// styles that apply to the reply pane that slides up to compose replies

// hack, this needs to be done cleaner
.private-message input.span8 {
  width: 47%;
}

.composer-popup-container {
display: none !important; // can be removed if inline JS CSS is removed from composer-popup
}

.composer-popup {
display: none !important; // can be removed if inline JS CSS is removed from composer-popup
}

input {
  background: $secondary;
  color: $primary;
  padding: 4px;
  border-radius: 3px;
  box-shadow: inset 0 1px 1px rgba(0,0,0, .3);
  border: 1px solid $primary-low; 
}
input[type=radio], input[type=checkbox] {
  box-shadow: none;
}

#reply-control {
  // used for upload link
  .composer-bottom-right {
    float: right;
    line-height: 3em;
  }
  #mobile-uploader { display: none; }
  .mobile-file-upload.hidden { display: none; }
  #draft-status, #file-uploading, .mobile-file-upload { display: inline-block; }
  transition: height .4s ease;
  width: 100%;
  z-index: 1039;
  height: 0;
  background-color: $primary-low; 
  bottom: 0;
  font-size: 1em;
  position: fixed;
  .toggle-toolbar, .toggler {
    right: 1px;
    position: absolute;
    font-size: 1.071em;
    color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
  }

  .toggle-toolbar {
    right: 30px;
  }

  a.cancel {
    padding-left: 7px;
    line-height: 30px;
  }
  .control-row {
    margin: 0 0 0 5px;
    .reply-to {
      overflow: hidden;
      max-width: 80%;
      white-space: nowrap;
      i {
        color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
      }
    }
  }
  .saving-text {
    display: none;
  }
  .draft-text {
    display: none;
  }
  .grippie {
    display: none;
  }
  // The various states
  &.open {
    max-height: 100%; // ensure no overflow e.g. on small Android
    height: 270px;
  }
  &.closed {
    height: 0 !important;
  }
  &.draft {
    height: 35px !important;
    cursor: pointer;
    border-top: 1px solid $primary-low; 
    .draft-text {
      display: block;
      position: absolute;
      margin-right: 40px;
      max-width: 80%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      i {
        color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
      }
    }
  }
  &.saving {
    height: 40px !important;
    border-top: 1px solid $primary-low;
    .saving-text {
      display: block;
    }
  }

  // if this is a new topic, make room for the category field in the editor on
  // a small screen mobile device
  &.edit-title {
    &.open {
      max-height: 100%; // ensure no overflow e.g. on small Android
      height: 250px;
    }
    .contents {
      input#reply-title {
        padding: 5px;
        margin-top: 6px;
        width: 99%;
        box-sizing: border-box;
        border: 1px solid $secondary;
      }
      .wmd-controls {
        transition: top 0.3s ease;
        top: 110px;
      }
    }
  }
  .contents {
    padding: 8px 5px 0 5px;
    .form-element {
      .select2-container {
        width: 99%;
        margin-top: 6px;
        a {
          padding-top: 4px;
          height: 28px;
        }
        b {
          margin-top: 4px;
        }
      }

    }
    .edit-reason-input, .display-edit-reason {
      display: none;
    }
    .edit-reason-input {
      display: inline-block;
      margin-left: 2px;
      #edit-reason {
        margin: 0;
        padding: 2px;
      }
    }
    #reply-title {
      margin-right: 10px;
      &:disabled {
        background-color: dark-light-choose(scale-color($primary, $lightness: 75%), scale-color($secondary, $lightness: 25%));
      }
    }
    .d-editor-input:disabled {
      background-color: dark-light-choose(scale-color($primary, $lightness: 75%), scale-color($secondary, $lightness: 25%));
    }
    .d-editor-input {
      color: dark-light-choose(darken($primary, 40%), blend-primary-secondary(90%));
      bottom: 35px;
      width: 100%;
      height: 100%;
      padding: 7px;
      margin: 0;
      background-color: $secondary;
      word-wrap: break-word;
      box-sizing: border-box;
      border: 1px solid $secondary;
    }
    .submit-panel {
      // need minimum width that fits, or this'll wrap cancel under submit/create which is super bad
      width: 180px;
      position: absolute;
      display: block;
      bottom: 0;
      white-space: nowrap;
      .btn {
        max-width: 120px;
        overflow: hidden;
        white-space: nowrap;
      }
    }
  }
  .category-input {
    // hack, select2 is using inline styles
    .select2-container {
      width: 99% !important;
    }
  }
  .popup-tip .close {
    padding: 0 2px 2px 8px; // so my fingers can touch the little x
  }
  .title-input .popup-tip {
    width: 240px;
    right: 5px;
  }
  .category-input .popup-tip {
    width: 240px;
    right: 5px;
  }
  .d-editor-textarea-wrapper .popup-tip {
    top: 28px;
  }
  button.btn.no-text {
    margin: 7px 0 0 5px;
    position: absolute;
  }
  .btn-primary {
    margin-bottom: 8px;
  }
}

#reply-control.edit-title.private-message {
  .wmd-controls {
    transition: top 0.3s ease;
    top: 120px;
  }
}

#reply-control {

  .d-editor {
    height: 100%;
  }

  .d-editor-container {
    height: 100%;
  }

  .wmd-controls {
    left: 10px;
    right: 10px;
    position: absolute;
    top: 40px;
    bottom: 50px;
    display: block;
    .d-editor-container {
      padding: 0;
    }
    .d-editor-preview-wrapper {
      display: none;
    }

    .btn.hide-preview {
      position: fixed;
      right: 5px;
      bottom: 5px;
      z-index: 1000001;
    }

    .d-editor-preview-wrapper.force-preview {
      display: block;
      position: fixed;
      z-index: 1000000;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background-color: $secondary;

      .d-editor-preview {
        height: 90%;
        height: calc(100% - 60px);
        border: 0;
        overflow: auto;
      }
    }
    .d-editor-textarea-wrapper {
      position: relative;
      box-sizing: border-box;
      height: 100%;
      min-height: 100%;
      margin: 0;
      padding: 0;
      .popup-tip {
        margin-top: 3px;
        right: 4px;
      }
    }
  }
  .d-editor-button-bar {
    display: none;
  }


  .wmd-controls.toolbar-visible .d-editor-input {
    padding-top: 40px;
  }

  .wmd-controls.toolbar-visible .d-editor-button-bar {

    .btn.link, .btn.upload, .btn.rule, .btn.bullet, .btn.list, .btn.heading {
      display: none;
    }

    display: block;
    margin: 1px 4px;
    position: absolute;
    color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
    background-color: $secondary;
    z-index: 100;
    overflow: hidden;
    width: 100%;
    width: calc(100% - 10px);

    -moz-box-sizing: border-box;
    box-sizing: border-box;

    button {
      color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
    }
    button.btn.no-text {
      margin: 0 2px;
      padding: 2px 5px;
      position: static;
    }
  }
}

// make sure the category selector *NEVER* gets focus by default on mobile anywhere
.select2-hidden,
.select2-search,
.select2-focusser {
  display:none !important;
}