@import "elements.less";

/* Theme Variables
 ------------------------------------------*/
@border-color: #a9a9a9;
@background-color: #f5f5f5;

/* Layout
 ------------------------------------------*/
.note-editor {
  border: 1px solid @border-color;

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

  &.codeview {
    .note-editable {
      display: none;
    }
    .note-codeable {
      display: block;
    }
  }
  
  /* toolbar */
  .note-toolbar {
    padding-left: 5px;
    padding-bottom: 5px;
    margin: 0;
    background-color: @background-color;
    border-bottom: 1px solid @border-color;

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

    .note-table {
      .dropdown-menu {
        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: 290px;
        .btn-group {
          margin: 0;
          &:first-child {
            margin: 0 5px;
          }

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

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

          .note-color-reset:hover {
            background: #eee;
          }
        }
      }
    }
    
    .note-para {
      .dropdown-menu {
        min-width: 153px;
        padding: 5px;
      }
      
      li:first-child {
        margin-bottom: 5px;
      }
    }
  }

  .note-statusbar {
    background-color: @background-color;
    .note-resizebar {
      height: 8px;
      width: 100%;
      border-top: 1px solid @border-color;
      cursor: s-resize;
      .note-icon-bar {
        width: 20px;
        margin: 1px auto;
        border-top: 1px solid @border-color;
      }
    }
  }
  
  // popover
  .note-popover .popover {
    max-width: none;
    .popover-content {
      padding: 5px;

      a {
        display: inline-block;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;    /* for FF */ 
        vertical-align: middle; /* for FF */
      }
      .btn-group+.btn-group {
        margin-left: 5px;
      }
    }
    & .arrow {
      left: 20px;
    }
  }

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

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

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

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

      .note-control-sizing {
        .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-selection-info {
        right: 0;
        bottom: 0;
        padding: 5px;
        margin: 5px;
        color: white;
        background-color: black;
        font-size: 12px;
        .rounded(5px);
        .opacity(0.7);
      }
    }
  }

  /* dialog */
  .note-dialog {
    &>div {
      display: none; /* BS2's hide pacth. */
    }
    .note-image-dialog {
      .note-dropzone {
        min-height: 200px;
        font-size: 30px;
        line-height: 6; /* vertical-align */
        color: lightgray;
        text-align: center;
        border: 4px dashed lightgray;
      }
    }
    .note-help-dialog {
      @note-shortcut-hl: #dd0;
      font-size: 12px;
      color: #ccc;
      background-color: #222 !important;
      .opacity(0.9);
      .modal-content {
        background: transparent;
        border: 1px solid white;
        .box-shadow(none);
        .rounded(5px);
      }

      /* BS2's background pacth. */
      background: transparent;
      border: none;

      a {
        font-size: 12px;
        color: white;
      }

      .title {
        color: white;
        font-size: 14px;
        font-weight: bold;
        padding-bottom: 5px;
        border-bottom: white 1px solid;
      }
      .modal-close {
        font-size: 14px;
        color: @note-shortcut-hl;
        cursor: pointer;
      }
      .note-shortcut-layout {
        width: 100%;
        td {
          vertical-align: top;
        }
      }
      .note-shortcut {
        margin-top: 8px;
        th {
          text-align: left;
          font-size: 13px;
          color: @note-shortcut-hl;
        }
        td:first-child {
          min-width: 110px;
          font-family: "Courier New";
          color: @note-shortcut-hl;
          text-align: right;
          padding-right: 10px
        }
      }
    }
  }
  
  /* editable */
  .note-editable {
    padding: 10px;
    overflow: scroll;
    outline: none;
  }

  /* codeable */
  .note-codeable {
    display: none;
    width: 100%;
    padding: 10px;
    border: none;
    box-shadow: none;
    font-family: Menlo, Monaco, monospace, sans-serif;
    font-size: 14px;
    color: #ccc;
    background-color: #222;
    resize: none;

    /* override BS2 default style */
    .box-sizing(border-box);
    .rounded(0);
    margin-bottom: 0;
  }
  
  /* dropdown-menu for toolbar and popover */
  .dropdown-menu {
    min-width: 90px;

    /* 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 */
    li a i {
      color: deepskyblue;
      visibility: hidden;
    }
    li a.checked i {
      visibility: visible;
    }
  }
  
  /* color palette for toolbar and popover */
  .note-color-palette {
    line-height: 1;
    div {
      .note-color-btn {
        width: 17px;
        height: 17px;
        padding: 0;
        margin: 0;
        border: 1px solid #fff;
      }
      .note-color-btn:hover {
        border: 1px solid #000;
      }
    }
  }
}
