// forums - main app styling
// ====================
// NOTE: this file is deprecated, and we should not continue to add to this file. Use other partials as appropriate.

body.discussion {

  .course-tabs .right {
    @include float(right);
  }

  .edit-post-form {
    @include clearfix();
    box-sizing: border-box;
    width: 100%;

    h1 {
      font-size: 20px;
    }

    .form-row {
      margin-top: $baseline;
    }

    .post-cancel {
      @include white-button;
      float: left;
      margin: ($baseline/2) 0 0 ($baseline*0.75);
    }

    .post-update {
      @include blue-button;
      float: left;
      margin-top: ($baseline/2);
      padding-bottom: ($baseline/10);
      height: 37px;

      &:hover, &:focus {
        border-color: #222;
      }
    }

    .edit-post-title {
      box-sizing: border-box;
      border: 1px solid $forum-color-border;
      border-radius: 3px;
      padding: 0 ($baseline/2);
      width: 100%;
      height: 40px;
      box-shadow: 0 1px 3px $shadow-l1 inset;
      color: $dark-gray;
      font-size: 16px;
      font-family: $sans-serif;
    }
  }

  .comments .edit-post-form h1 {
    @extend %t-title6;
  }

  .thread-title {
    display: block;
    margin-bottom: $baseline;
    color: $gray-d3;
    font-weight: 700;
    font-size: 21px;
  }

  section.user-profile {
    // TODO: don't use table-cell for layout purposes as it switches the screenreader mode
    display: table-cell;
    border-right: 1px solid #ddd;
    border-radius: 3px 0 0 3px;
    background-color: $sidebar-color;
    box-shadow: none;

    .user-profile {
      padding: 32px 36px;
    }

    .sidebar-username {
      font-weight: 700;
      font-size: 18px;
    }

    .sidebar-user-roles {
      margin-top: 6px;
      font-style: italic;
      font-size: 13px;
    }

    .sidebar-threads-count {
      margin-top: 14px;
    }

    .sidebar-threads-count span,
    .sidebar-comments-count span {
      font-weight: 700;
    }
  }

  .wmd-panel {
    width: 100%;
  }

  .wmd-button-bar  {
    width: 100%;
    background-color: Silver;
  }

  .wmd-input {
    @include border-radius(3px, 3px, 0, 0);
    border: 1px solid $forum-color-border;
    width: 100%;
    height: 150px;
    background-color: $gray-l4;
    font-style: normal;
    font-size: 0.8em;
    font-family: $f-sans-serif;
    line-height: 1.6em;

    &::-webkit-input-placeholder {
      color: #888;
    }
  }

  .wmd-button-row {
    @include transition(all .2s ease-out 0s);
    @include margin(($baseline/2), ($baseline/4), ($baseline/4), ($baseline/4));
    position: relative;
    overflow: hidden;
    padding: 0;
    height: 20px;
  }

  .wmd-spacer {
    @include margin-left(14px);
    position: absolute;
    display: inline-block;
    width: 1px;
    height: 20px;
    background-color: Silver;
    list-style: none;
  }

  .wmd-button {
    @include padding-right(3px);
    @include padding-left(3px);
    position: absolute;
    display: inline-block;
    width: 20px;
    height: 20px;
    background: none;
    list-style: none;
    cursor: pointer;
  }

  .wmd-button > span {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('#{$static-path}/images/wmd-buttons-transparent.png');
    background-repeat: no-repeat;
  }

  .wmd-spacer1 {
    @include left(50px);
  }
  .wmd-spacer2 {
    @include left(175px);
  }

  .wmd-spacer3 {
    @include left(300px);
  }

  .wmd-prompt-background {
    background-color: Black;
  }

  .wmd-prompt-dialog {
    @extend .modal;
    background: $forum-color-background;
  }

  .wmd-prompt-dialog {
    padding: $baseline;

    > div {
      font-size: 0.8em;
      font-family: $sans-serif;
    }

    b {
      font-size: 16px;
    }

    > form > input[type="text"] {
      border-radius: 3px;
      color: $gray-d3;
    }

    > form > input[type="button"] {
      border: 1px solid #888;
      font-size: 14px;
      font-family: $sans-serif;
    }

    > form > input[type="file"] {
      margin-bottom: 18px;
    }
  }
}

.container .discussion-body {
  @include clearfix();
  display: block;
  border: none;
  background: transparent;
  box-shadow: none;
  line-height: 1.4;

  .bottom-post-status {
    padding: 30px;
    font-size: 20px;
    font-weight: 700;
    color: $gray-l3;
    text-align: center;
  }

  .discussion-column {
    @include float(right);
    box-sizing: border-box;
    padding-left: ($baseline/2);
    width: 68%;
    max-width: 800px;
    min-height: 500px;
    border-radius: 3px;
  }

  .discussion-article {
    position: relative;
    min-height: 500px;

    a {
      word-wrap: break-word;
    }

    p + p {
      margin-top: $baseline;
    }
  }

  .discussion-post header,
  .responses li header {
    margin-bottom: $baseline;
  }

  blockquote {
    background: $gray-l5;
    border-radius: 3px;
    padding: ($baseline/4) ($baseline/2);
    font-size: 14px;
  }

  .comment-form {
    padding: ($baseline/2) 0;

    .wmd-input {
      @include transition(all .2s linear 0s);
    }

    .wmd-button {
      background: transparent;

      span {
        background-image: url('#{$static-path}/images/wmd-buttons-transparent.png');
      }
    }
  }

  .comment-form-input {
    width: 100%;
    height: 31px;
    padding: 0 ($baseline/2);
    box-sizing: border-box;
    border: 1px solid $forum-color-border;
    border-radius: 3px;
    box-shadow: 0 1px 3px $shadow-l1 inset;
    @include transition(border-color .1s linear 0s);

    &:focus {
      border-color: #4697c1;
    }
  }

  .main-article.new {
    display: none;
    padding: ($baseline*2.5);
  }

  .discussion-reply-new {
    @include clearfix();
    @include transition(opacity .2s linear 0s);
    padding: 0 ($baseline/2);

    h4 {
      font-size: 16px;
      font-weight: 700;
    }
  }

  .wmd-button-bar {
    border: none;
  }

  .wmd-input {
    @include discussion-wmd-input;
  }

  .wmd-preview-container {
    @include discussion-wmd-preview-container;
  }

  .wmd-preview-label {
    @include discussion-wmd-preview-label;
  }

  .wmd-preview {
    @include discussion-wmd-preview;
  }

  .reply-post-control {
    margin-top: $baseline;
  }

  .discussion-submit-post {
    @include blue-button;
    @include float(left);
  }

  .wmd-button {
    width: 15px;
  }
}

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

// inline discussion module and profile thread styling
.discussion-module {
  @extend .discussion-body;

  position: relative;
  margin: $baseline 0;
  padding: $baseline;
  background: #f6f6f6 !important;
  border-radius: 3px;

  header {
    .anonymous{
      font-size: 15px;
    }
  }

  .new-post-btn {
    @include float(right);
    @include margin-right(4px);
    @include blue-button;
  }

  div.add-response.post-extended-content {
    margin-top: $baseline;
    margin-bottom: $baseline;
  }

  .loading-animation {
    background-image: url('#{$static-path}/images/spinner.gif');
  }

  .discussion-show {
    position: relative;
    top: 3px;
    font-size: 14px;
    text-align: center;

    &.shown {
      .show-hide-discussion-icon {
        background-position: 0 0;
      }
    }

    .show-hide-discussion-icon {
      display: inline-block;
      position: relative;
      top: 5px;
      @include margin-right(6px);
      width: 21px;
      height: 19px;
      background: url('#{$static-path}/images/show-hide-discussion-icon.png') no-repeat;
      background-position: -21px 0;
    }
  }

  section.discussion {
    clear: both;
    padding-top: $baseline;

    .threads {
    }

    .discussion-thread {
      padding: 0;
      margin-bottom: $baseline;
      @include transition(all .25s linear 0s);

      p {
        margin-bottom: 0;
      }

      .discussion-article {
        @include transition(all .2s linear 0s);
        border: 1px solid $forum-color-border;
        border-radius: 3px;
        min-height: 0;
        background: $forum-color-background;
        box-shadow: 0 1px 0 $shadow;
        @include transition(all .2s linear 0s);

        .thread-wrapper {
          @include border-radius(3px, 3px, 0, 0);
          position: relative;
          overflow-x: hidden;
          overflow-y: auto;
          max-height: 600px;
          background-color: $forum-color-background;

          .discussion-post {

            .inline-comment-count {
              @extend %ui-depth2;
              position: relative;
              float: right;
              display: block;
              height: 27px;
              margin-top: 6px;
              margin-right: 8px;
              padding: 0 8px;
              border-radius: ($baseline/4);
              font-size: 12px;
              font-weight: 400;
              line-height: 25px;
              color: #888;
            }
          }

          .responses {
            header {
              padding-bottom: 0;
              margin-bottom: ($baseline*0.75);

              .posted-by {
                float: left;
                margin-right: ($baseline/4);
                font-size: 16px;
              }
            }

            .response-body {
              margin-bottom: 0.2em;
              font-size: 14px;
            }
          }

          .discussion-reply-new {
            .wmd-input {
              height: 120px;
            }
          }

          // Content that is hidden by default in the inline view
          .post-extended-content{
            display: none;
          }
        }

        .post-tools {
          box-shadow: 0 1px 1px $shadow inset;
          background: $gray-l6;

          &:hover {
            background: #fcfcfc;

            .icon {
              color: $link-hover;
            }
          }

          a {
            display: block;
            padding: ($baseline*0.25) $baseline;
            font-size: 12px;
            line-height: 30px;

            .icon {
              color: $link-color;
              margin-right: ($baseline*0.25);
            }
          }
        }
      }
    }
  }

  .new-post-article {
    display: none;
    margin-top: $baseline;

    .inner-wrapper {
      max-width: 1180px;
      min-width: 760px;
      margin: auto;
    }

    .thread-title {
      display: block;
      margin-bottom: $baseline;
      font-size: 21px;
      color: $gray-d3;
      font-weight: 700;
    }
  }

  section.discussion-pagination {
    margin-top: ($baseline*1.5);

    nav.discussion-paginator {
      float: right;

      ol {
        li {
          list-style: none;
          display: inline-block;
          padding-right: 0.5em;
          a {
            @include white-button;
          }
          &.current-page span {
            display: inline-block;
            height: 35px;
            padding: 0 ($baseline*0.75);
            border: 1px solid $forum-color-border;
            border-radius: 3px;
            font-size: 13px;
            font-weight: 700;
            line-height: 32px;
            color: $gray-d3;
            text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
          }
        }
      }
    }
  }

  .edit-post-form {
    width: 100%;
    margin-bottom: $baseline;
    @include clearfix();
    box-sizing: border-box;

    .form-row {
      margin-top: $baseline;
    }

    .post-cancel {
      @include white-button;
      float: left;
      margin: ($baseline/2) 0 0 ($baseline*0.75);
    }

    .post-update {
      @include blue-button;
      float: left;
      height: 37px;
      margin-top: ($baseline/2);
      padding-bottom: 2px;

      &:hover, &:focus {
        border-color: #222;
      }
    }

    .edit-post-title {
      width: 100%;
      height: 40px;
      padding: 0 ($baseline/2);
      box-sizing: border-box;
      border-radius: 3px;
      border: 1px solid $forum-color-border;
      font-size: 16px;
      font-family: $sans-serif;
      color: $gray-d3;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
    }
  }
}

.discussion-user-threads {
  @extend .discussion-module;

  .discussion-post {
    padding-bottom: $baseline !important;
  }
}

.xblock-student_view-discussion {
  @extend %ui-print-excluded;
}

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

// post pagination
.response-count {
  @include float(right);
}

.response-pagination {
  visibility: visible;
  padding: 0 ($baseline/2);

  &:empty {
    visibility: hidden;
  }

  .response-display-count {
    display: block;
    padding: ($baseline/2) 0;
    color: $gray;
    font-size: 14px;
  }

  .load-response-button {
    @include white-button;
    @include linear-gradient(top, $white 35%, $gray-l4);
    position: relative;
    margin: ($baseline/2) 0;
    border: 1px solid $forum-color-border;
    width: 100%;
    box-shadow: 0 1px 1px $shadow-l1;
    text-align: left;
    font-weight: normal;
  }
}
