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

// UI: form structure
.forum-new-post-form,
.edit-post-form {
  @include clearfix();
  box-sizing: border-box;
  margin: 0;
  border-radius: $forum-border-radius;
  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: $forum-small-font-size;
        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: $forum-small-font-size;

    }
  }

  .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: $forum-base-font-size;
    line-height: 36px;

    .drop-arrow {
      @include float(right);
      color: #999;
    }
  }

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

  .post-type-label {
    @extend %cont-truncated;
    @include white-button;
    font-size: $forum-base-font-size;
    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 {
      @include 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: $forum-border-radius;
    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: $forum-large-font-size;
    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: $forum-border-radius;
    padding: ($baseline/2);

    &:hover {
      border-color: $forum-color-border;
    }

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

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

    .icon {
      @include margin-right($baseline/2);
    }
  }
}

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

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

  .cancel {
    display: inline-block;
  }
}

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

// UI: errors - new post creation
.forum-new-post-form,
.edit-post-form {
  .post-errors {
    margin-bottom: $baseline;
    border-radius: $forum-border-radius;
    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;
    width: 100%;
    background: $forum-color-background;
    box-shadow: 0 2px 1px $shadow;
  }

  .topic-filter-label {
    border-bottom: 1px solid $forum-color-border;
  }

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

  .topic-menu {
    overflow-y: scroll;
    max-height: 400px;
    list-style: none;
    margin-left: ($baseline/2);
  }

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

  .topic-title {
    display: block;
    padding: ($baseline/4) ($baseline/2);
    font-size: $forum-base-font-size;
  }

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

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