@import 'vars'; // z-index
$summernote-fullscreen-z-index: $zindex-fullscreen;
$summernote-dropzone-z-index: $zindex-overlay;

/* Theme Variables
 ------------------------------------------*/
@import "scss/elements";
@import "scss/icon";

/* Theme Variables
 ------------------------------------------*/
$border-color: $border-color-base;
$background-color: #f5f5f5;

/* Layout
 ------------------------------------------*/
.note-editor {
  /* dropzone */
  $dropzone-color: lightskyblue;
  $dropzone-active-color: darken($dropzone-color, 30);
  position: relative;

  .note-dropzone {
    position: absolute;
    z-index: $summernote-dropzone-z-index;
    display: none;
    color: $dropzone-color;
    background-color: white;
    opacity: .95;

    .note-dropzone-message {
      display: table-cell;
      font-size: 28px;
      font-weight: 700;
      text-align: center;
      vertical-align: middle;
    }

    &.hover {
      color: $dropzone-active-color;
    }
  }

  &.dragover .note-dropzone {
    display: table;
  }

  .note-editing-area {
    position: relative;

    .note-editable {
      outline: none;

      sup {
        vertical-align: super;
      }

      sub {
        vertical-align: sub;
      }
    }
  }
}

/* Frame mode layout
------------------------------------------*/
.note-editor.note-frame {
  border: 1px solid $border-color;

  /* codeview mode */
  &.codeview {
    .note-editing-area {
      .note-editable {
        display: none;
      }

      .note-codable {
        display: block;
      }
    }
  }

  .note-editing-area {
    overflow: hidden;

    /* editable */
    .note-editable {
      padding: 10px;
      overflow: auto;
      color: #000;
      background-color: #fff;

      &[contenteditable="false"] {
        background-color: #e5e5e5;
      }
    }

    /* codeable */
    .note-codable {
      /* override BS2 default style */
      @include box-sizing(border-box);
      @include rounded(0);
      display: none;
      width: 100%;
      padding: 10px;
      margin-bottom: 0;
      font-family: Menlo, Monaco, monospace, sans-serif;
      font-size: 14px;
      color: #ccc;
      resize: none;
      background-color: #222;
      border: none;
      box-shadow: none;
    }
  }

  /* fullscreen mode */
  &.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    z-index: $summernote-fullscreen-z-index; /* bs3 modal-backdrop: 1030, bs2: 1040 */
    width: 100% !important;
    .note-editable {
      background-color: white;
    }

    .note-resizebar {
      display: none;
    }
  }

  /* statusbar */
  .note-statusbar {
    background-color: $background-color;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 4px;

    .note-resizebar {
      width: 100%;
      height: 8px;
      padding-top: 1px;
      cursor: ns-resize;

      .note-icon-bar {
        width: 20px;
        margin: 1px auto;
        border-top: 1px solid $border-color;
      }
    }

  &.locked {
    .note-resizebar {
      cursor: default;
      .note-icon-bar {
        display: none;
      }
    }
  }
}

  .note-placeholder {
    padding: 10px;
  }
}

/* Popover
------------------------------------------*/
.note-popover.popover {
  max-width: none;

  .popover-content {
    a {
      display: inline-block;
      max-width: 200px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;    /* for FF */
      vertical-align: middle; /* for FF */
    }
  }

  .arrow {
    left: 20px !important;
  }
}

/* Popover and Toolbar (Button container)
------------------------------------------*/
.note-popover .popover-content, .panel-heading.note-toolbar {
  padding: 0 0 5px 5px;
  margin: 0;

  & > .btn-group {
    margin-top: 5px;
    margin-right: 5px;
    margin-left: 0;
  }

  .btn-group {
    .note-table {
      min-width: 0;
      padding: 5px;

      .note-dimension-picker {
        font-size: 18px;

        .note-dimension-picker-mousecatcher {
          position: absolute !important;
          z-index: 3;
          width: 10em;
          height: 10em;
          cursor: pointer;
        }

        .note-dimension-picker-unhighlighted {
          position: relative !important;
          z-index: 1;
          width: 5em;
          height: 5em;
          background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat;
        }

        .note-dimension-picker-highlighted {
          position: absolute !important;
          z-index: 2;
          width: 1em;
          height: 1em;
          background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat;
        }
      }
    }
  }

  .note-style {
    h1, h2, h3, h4, h5, h6, blockquote {
      margin: 0;
    }
  }

  .note-color {
    .dropdown-toggle {
      width: 20px;
      padding-left: 5px;
    }

    .dropdown-menu {
      min-width: 340px;

      .btn-group {
        margin: 0;

        &:first-child {
          margin: 0 5px;
        }

        .note-palette-title {
          margin: 2px 7px;
          font-size: 12px;
          text-align: center;
          border-bottom: 1px solid #eee;
        }

        .note-color-reset {
          @include rounded(5px);
          padding: 0 3px;
          margin: 3px;
          font-size: 11px;
          cursor: pointer;
        }

        .note-color-row {
          height: 20px;
        }

        .note-color-reset:hover {
          background: #eee;
        }
      }
    }
  }

  .note-para {
    .dropdown-menu {
      //min-width: 216px;
      min-width: 242px;
      padding: 5px;

      & > div:first-child {
        margin-right: 5px;
      }
    }
  }

  /* dropdown-menu for toolbar and popover */
  .dropdown-menu {
    //min-width: 90px;
    width: auto;

    .note-palette {
      display: inline-block;
      &:first-child {
        margin: 0 5px;
      }
    }

    /* dropdown-menu right position */

    /* http://forrst.com/posts/Bootstrap_right_positioned_dropdown-2KB */
    &.right {
      right: 0;
      left: auto;

      &::before {
        right: 9px;
        left: auto !important;
      }

      &::after {
        right: 10px;
        left: auto !important;
      }
    }

    /* dropdown-menu for selectbox */
    &.note-check {
      li a i {
        color: deepskyblue;
        visibility: hidden;
      }

      li a.checked i {
        visibility: visible;
      }
    }
  }

  .note-fontsize-10 {
    font-size: 10px;
  }

  /* color palette for toolbar and popover */
  .note-color-palette {
    line-height: 1;

    div {
      .note-color-btn {
        width: 20px;
        height: 20px;
        padding: 0;
        margin: 0;
        border: 1px solid #fff;
      }

      .note-color-btn:hover {
        border: 1px solid #000;
      }
    }
  }
}

/* Dialog
------------------------------------------*/
.note-dialog {
  & > div {
    display: none; /* BS2's hide pacth. */
  }

  .form-group { /* overwrite BS's form-horizontal minus margins */
    margin-right: 0;
    margin-left: 0;
  }

  .note-modal-form {
    margin: 0; /* overwrite BS2's form margin bottom */
  }

  .note-image-dialog {
    .note-dropzone {
      min-height: 100px;
      margin-bottom: 10px;
      font-size: 30px;
      line-height: 4; /* vertical-align */
      color: lightgray;
      text-align: center;
      border: 4px dashed lightgray;
    }
  }
}

/* Placeholder
------------------------------------------*/
.note-placeholder {
  position: absolute;
  display: none;
  color: gray;
}

/* Handle
------------------------------------------*/
.note-handle {
  /* control selection */
  .note-control-selection {
    position: absolute;
    display: none;
    border: 1px solid black;

    & > div {
      position: absolute;
    }

    .note-control-selection-bg {
      @include opacity(0.3);
      width: 100%;
      height: 100%;
      background-color: black;
    }

    .note-control-handle {
      width: 7px;
      height: 7px;
      border: 1px solid black;
    }

    .note-control-holder {
      @extend .note-control-handle;
    }

    .note-control-sizing {
      @extend .note-control-handle;
      background-color: white;
    }

    .note-control-nw {
      top: -5px;
      left: -5px;
      border-right: none;
      border-bottom: none;
    }

    .note-control-ne {
      top: -5px;
      right: -5px;
      border-bottom: none;
      border-left: none;
    }

    .note-control-sw {
      bottom: -5px;
      left: -5px;
      border-top: none;
      border-right: none;
    }

    .note-control-se {
      right: -5px;
      bottom: -5px;
      cursor: se-resize;
    }

    .note-control-se.note-control-holder {
      cursor: default;
      border-top: none;
      border-left: none;
    }

    .note-control-selection-info {
      @include rounded(5px);
      @include opacity(0.7);
      right: 0;
      bottom: 0;
      padding: 5px;
      margin: 5px;
      font-size: 12px;
      color: white;
      background-color: black;
    }
  }
}

.note-hint-popover {
  min-width: 100px;
  padding: 2px;

  .popover-content {
    max-height: 150px;
    padding: 3px;
    overflow: auto;

    .note-hint-group {
      .note-hint-item {
        display: block !important;
        padding: 3px;

        &.active, &:hover {
          display: block;
          clear: both;
          font-weight: 400;
          line-height: 1.4;
          color: white;
          text-decoration: none;
          white-space: nowrap;
          cursor: pointer;
          background-color: #428bca;
          outline: 0;
        }
      }
    }
  }
}

// for fix note-popover first load is visible
.note-popover.popover {
  display: none;
}

// dropdown is diffrent in v4 and v3
// for bootstrapV3.x dropdown-menu style
.note-popover.note-air-popover, .note-editor .note-toolbar {
  .note-btn.dropdown-toggle:after {
    display: none;
    margin: 0;
    border: none;
  }

  .dropdown-menu > li {
    padding: 0 5px;
    margin: 2px 0;
  }

  .note-color .dropdown-menu > li {
    padding: 0;
    margin: 0;
  }

  .dropdown-menu > li.divider {
    height: 1px;
    margin: 10px 0;
    overflow: hidden;
    background-color: $gray-200;
  }

  .dropdown-menu > li > a {
    display: block;
    padding: $dropdown-item-padding-y $dropdown-item-padding-x;
    font-weight: normal;
    line-height: $line-height-base;
    color: $dropdown-link-color;
    white-space: nowrap; // prevent links from randomly breaking onto new lines
    border-radius: $dropdown-item-border-radius;
    transition: background-color .25s;

    &:hover, &:focus {
      color: $dropdown-link-hover-color;
      text-decoration: none;
      background-color: $dropdown-link-hover-bg;
    }
  }

  // Active state
  .dropdown-menu > .active > a {
    &, &:hover, &:focus {
      color: $dropdown-link-active-color;
      text-decoration: none;
      background-color: $dropdown-link-active-bg;
      outline: 0;
    }
  }
  // disabled state
  .dropdown-menu > .disabled > a {
    &, &:hover, &:focus {
      color: $dropdown-link-disabled-color;
    }

    // Nuke hover/focus effects
    &:hover, &:focus {
      text-decoration: none;
      // @include reset-filter;
      cursor: $cursor-disabled;
      background-color: transparent;
      background-image: none; // Remove CSS gradient
    }
  }
}

