// discussion - views - new post
// ====================

// UI: form structure
.forum-new-post-form,
.edit-post-form {
  @include clearfix();
  box-sizing: border-box;
  margin: 0;
  border-radius: 3px;
  padding: $baseline;
  max-width: 1180px;

  .post-field {
    margin-bottom: $baseline;

    .field-label {
      display: inline-block;
      width: 50%;
      vertical-align: top;
      margin: 0;

      .field-input {
        display: inline-block;
        width: 100%;
        vertical-align: top;
        border-width: 0;
        padding: 0 ($baseline/2);
      }

      .field-label-text {
        display: inline-block;
        width: 25%;
        vertical-align: top;
        font-size: 12px;
        line-height: 40px;
      }

      .field-label-text + .field-input {
        width: 75%;
      }
    }

    // UI: support text for input fields
    .field-help {
      box-sizing: border-box;
      display: inline-block;
      @include padding-left($baseline);
      width: 50%;
      font-size: 12px;
    }
  }

  .post-options {
    margin-bottom: ($baseline/2);
  }
}

// CASE: inline styling
.discussion-module .forum-new-post-form {
  background: $forum-color-background;
}

// ====================

// UI: inputs
.forum-new-post-form,
.edit-post-form {
  .post-topic-button {
    @include white-button;
    @extend %cont-truncated;
    z-index: 1000;
    padding: 0 $baseline 0 ($baseline*0.75);
    width: 100%;
    height: 40px;
    font-size: 14px;
    line-height: 36px;

    .drop-arrow {
      float: right;
      color: #999;
    }
  }

  .post-type-input {
    @extend %text-sr;
  }

  .post-type-label {
    @extend %cont-truncated;
    @include white-button;
    @include font-size(14);
    box-sizing: border-box;
    display: inline-block;
    padding: 0 ($baseline/2);
    width: 48%;
    height: 40px;
    text-align: center;
    color: $gray-d3;
    font-weight: 600;
    line-height: 36px;

    .icon {
      margin-right: ($baseline/4);
    }
  }

  .post-type-input:checked + .post-type-label {
    background-color: $forum-color-active-thread;
    color: $forum-color-active-text;
    background-image: none;
    box-shadow: 0 1px 1px rgba(0, 0,  0, 0.4) inset;
  }

  .post-type-input:focus + .post-type-label {
    box-shadow: 0 1px 1px rgba(0, 0,  0, 0.4) inset, 0 0 2px 2px $blue;
  }

  input[type=text].field-input {
    box-sizing: border-box;
    border: 1px solid $forum-color-border;
    border-radius: 3px;
    padding: 0 $baseline/2;
    height: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
    color: #333;
    font-weight: 700;
    font-size: 16px;
    font-family: 'Open Sans', sans-serif;
  }

  .post-option {
    box-sizing: border-box;
    display: inline-block;
    @include margin-right($baseline);
    border: 1px solid transparent;
    border-radius: 3px;
    padding: ($baseline/2);

    &:hover {
      border-color: $gray-l3;
    }

    &.is-enabled {
      border-color: $blue;
      color: $blue;
    }

    .post-option-input {
      margin-right: ($baseline/2);
    }

    .icon {
      margin-right: 0.5em;
    }
  }
}

// ====================

// UI: actions
.forum-new-post-form {
  .submit {
    @include blue-button;
    display: inline-block;
    margin-right: ($baseline/2);
  }

  .cancel {
    @include white-button;
    display: inline-block;
  }
}

// ====================

// UI: errors - new post creation
.forum-new-post-form,
.edit-post-form {
  .post-errors {
    margin-bottom: $baseline;
    border-radius: 3px;
    padding: 0;
    background: $error-color;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, .2);
    color: $white;
    list-style: none;

    .post-error {
      padding: ($baseline/2) $baseline 12px 45px;
      border-bottom: 1px solid $forum-color-error;
      background: url('#{$static-path}/images/white-error-icon.png') no-repeat 15px 14px;

      &:last-child {
        border-bottom: none;
      }
    }
  }
}

// ====================

// UI: topic menu

// TO-DO: refactor to use _navigation.scss as general topic selector
.forum-new-post-form .post-topic ,
.edit-post-form .post-topic {
  position: relative;

  .topic-menu-wrapper {
    box-sizing: border-box;
    @extend %ui-depth4;
    position: absolute;
    top: 40px;
    left: 0;
    border: 1px solid $forum-color-border;
    width: 100%;
    background: $forum-color-background;
    box-shadow: 0 2px 1px $shadow;
  }

  .topic-filter-label {
    border-bottom: 1px solid $forum-color-border;
    padding: ($baseline/4);
  }

  .topic-filter-input {
    box-sizing: border-box;
    border: 1px solid $forum-color-border;
    padding: 0 15px;
    width: 100%;
    height: 30px;
    color: #333;
    font-size: 11px;
    line-height: 16px;
  }

  .topic-menu {
    overflow-y: scroll;
    max-height: 400px;
    list-style: none;
  }

  .topic-submenu {
    padding-left: $baseline;
    list-style: none;
  }

  .topic-title {
    display: block;
    border-bottom: 1px solid $forum-color-border;
    padding: ($baseline/2);
    font-size: 14px;
  }

  a.topic-title {
    @include transition(none);

    &:hover, &:focus {
      background-color: $gray-l4;
    }
  }
}
