// forums - main app styling
// ====================
body.discussion {

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

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

    .new-post-icon {
      margin-top: 8px;
      @include margin-right(7px);
      font-size: 16px;
      vertical-align: middle;
      color: $white;
    }
  }

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

    h1 {
      font-size: 20px;
    }

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

    .post-cancel {
      @include white-button;
      float: left;
      margin: ($baseline/2) 0 0 ($baseline*.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 {
      @include box-sizing(border-box);
      border: 1px solid #aaa;
      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: #333;
    font-weight: 700;
    font-size: 21px;
  }

  section.user-profile {
    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 {
    min-width: 500px;
    width: 100%;
  }

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

  .wmd-input {
    border: 1px solid #c8c8c8;
    border-radius: 3px 3px 0 0;
    width: 100%;
    height: 150px;
    background-color: #e9e9e9;
    font-style: normal;
    font-size: 0.8em;
    font-family: Monaco, 'Lucida Console', monospace;
    line-height: 1.6em;

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

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

  .wmd-spacer {

    position: absolute;
    display: inline-block;
    margin-left: 14px;
    width: 1px;
    height: 20px;
    background-color: Silver;
    list-style: none;
  }

  .wmd-button {
    position: absolute;
    display: inline-block;
    padding-right: 3px;
    padding-left: 2px;
    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/images/wmd-buttons-transparent.png');
    background-position: 0px 0px;
    background-repeat: no-repeat;
  }

  .wmd-spacer1 {
    left: 50px;
  }
  .wmd-spacer2 {
    left: 175px;
  }

  .wmd-spacer3 {
    left: 300px;
  }

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

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

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

    > div {
      font-size: 0.8em;
      font-family: arial, helvetica, sans-serif;
    }

    b {
      font-size: 16px;
    }

    > form > input[type="text"] {
      border-radius: 3px;
      color: #333;
    }

    > 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: #ccc;
    text-align: center;
  }

  .discussion-column {
    @include float(right);
    @include box-sizing(border-box);
    width: 68%;
    max-width: 800px;
    min-height: 500px;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: $white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  }

  .blank-slate {

    padding: 40px 40px 10px;

    section {
      border-bottom: 1px solid #ccc;
    }

    .label {
      display: block;
      font-size: 12px;
    }

    .label-settings {
      padding-top: $baseline;
      padding-bottom: $baseline/2;
    }

    .home-header {
      margin: 0;
    }

    .home-title {
      font-size: 18px;
      color: $black;
      margin-bottom: 5px;
    }
    .home-description {
      font-size: 12px;
      line-height: 1;
      margin-bottom: $baseline/2;
    }
    .home-stats {
      padding: $baseline 0;

      .label-area {
        display: inline-block;
        min-width: $baseline*5;
        width: 25%;
        vertical-align: middle;

        .profile-link {
          font-weight: 700;
        }
      }

      .stats-grouping {
        display: inline-block;
        width: 70%;
        padding-left: $baseline;

        .profile-stat {
          display: inline-block;
          width: 32.5%;
          vertical-align: middle;
          font-size: 12px;

          .count {
            display: inline-block;
            font-size: 28px;
            padding: 0 $baseline/2;
            vertical-align: middle;
          }

          .profile-stat-label{
            vertical-align: middle;
          }
        }
      }
    }

    .home-helpgrid {
      border-bottom: none;
      border-radius: 3px;
      border: 1px solid #b2b2b2;
      box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    }
  }

  .helpgrid-row {
      border-bottom: 1px solid #b2b2b2;

      .row-title {
        padding: 30px $baseline;
        background-color: #dedede;
        font-size: 12px;
      }

      .row-item-full, .row-item {
        font-size: 12px;
        padding: 0px $baseline/2;
        width: 26%;
        vertical-align: middle;

        .icon {
          padding: 0 $baseline/2;
          font-size: 24px;
          vertical-align: middle;
          display: table-cell;
        }

        .icon-stack i {
          padding: 0 $baseline/2;
        }

        .row-description {
          vertical-align: middle;
          display: table-cell;
        }
      }

      .row-item-full {

        .notification-checkbox {
          display: inline-block;
          padding: $baseline/4 0 $baseline/2 0;
          @include margin-right($baseline/2);
          border-radius: 5px;
          border: 1px solid gray;

          .email-setting {
            display: inline-block;
            text-align: center;
            vertical-align: middle;
            @include margin-left($baseline/2);
          }

          .icon {
            display: inline-block;
          }

          .email-setting:checked ~ .icon {
            color: $green;
          }
        }

        .row-description {
          display: inline-block;
          width:80%;
        }
      }
    }

  .helpgrid-row-navigation {
    .icon-reorder {color: $light-gray;}
    .icon-search {color: $light-gray;}
    .icon-sort {color: $light-gray;}
  }

  .helpgrid-row-participation {
    .icon-plus {color: $green;}
    .icon-flag {color: $pink;}
    .icon-star {color: $blue;}
  }

  .helpgrid-row-notification {
    .icon-sign-blank {color: $green;}
    .icon-envelope {color: $light-gray;}
  }

  .discussion-article {
    position: relative;
    min-height: 500px;
    background-image: url(../images/bg-texture.png);

    a {
      word-wrap: break-word;
    }

    h1 {
      margin-bottom: ($baseline/4);
      font-size: 28px;
      font-weight: 700;
      letter-spacing: 0;
      line-height: 1.2;
    }

    .posted-details {
      font-size: 12px;
      color: #888;

      .username {
        font-weight: 700;
      }

      .timeago, .top-post-status {
        color: inherit;
      }
    }

    .post-context{
      margin-top: $baseline;
      font-size: 12px;
      color: #888;
    }

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

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

  .responses {
    &:empty {
      display: none;
    }

    list-style: none;
    margin-top: $baseline;
    padding: 0px ($baseline*2);

    > li {
      @include animation(fadeIn .3s);
      position: relative;
      margin: 0 -10px 30px;
      border: 1px solid #b2b2b2;
      border-radius: 3px;
      box-shadow: 0 0 1px $shadow;

      &.staff {
        padding-top: 38px;
        border-color: #009fe2;
      }

      &.community-ta{
        padding-top: 38px;
        border-color: $forum-color-community-ta;
      }

      .staff-banner {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 14px;
        padding: 1px 5px;
        @include box-sizing(border-box);
        border-radius: 2px 2px 0 0;
        background: #009fe2;
        font-size: 9px;
        font-weight: 700;
        color: $white;
        text-transform: uppercase;
      }

      .community-ta-banner{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 14px;
        padding: 1px 5px;
        @include box-sizing(border-box);
        border-radius: 2px 2px 0 0;
        background: $forum-color-community-ta;
        font-size: 9px;
        font-weight: 700;
        color: $white;
        text-transform: uppercase;
      }

      &.loading {
        height: 0;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
      }
    }

    .discussion-response {
      @include box-sizing(border-box);
      border-radius: 3px 3px 0 0;
      padding: $baseline;
      background-color: $white;

      .response-body {
        ol, ul { // Fix up the RTL-only _reset.scss, but only in specific places
          @include padding-left(40px);
          @include padding-right(0);
        }
      }
    }
    .posted-by {
      font-weight: 700;
    }
  }

  .add-response {
    margin-top: $baseline;
    padding: 0 ($baseline*1.5);

    .add-response-btn {
      @include white-button;
      @include linear-gradient(top, $white 35%, #ebebeb);
      position: relative;
      border: 1px solid #b2b2b2;
      padding: 0 18px;
      width: 100%;
      box-shadow: 0 1px 1px $shadow-l1;
      @include text-align(left);
      font-size: 13px;

      .icon-reply:before { // flip the icon for RTL
        @include ltr {
          content: "\f112"; // FA icon arrow to the left
        }

        @include rtl {
          content: "\f064"; // FA icon arrow to the right
        }
      }

      span.add-response-btn-text {
        @include padding-left($baseline/5);
      }
    }
  }

  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(../images/wmd-buttons-transparent.png);
      }
    }
  }

  .comment-form-input {
    width: 100%;
    height: 31px;
    padding: 0 ($baseline/2);
    @include box-sizing(border-box);
    border: 1px solid #b2b2b2;
    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 {
    padding: $baseline ($baseline*1.5);
    @include clearfix;
    @include transition(opacity .2s linear 0s);

    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;
  border-radius: 3px;

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

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

    button.add-response-btn {
      @include white-button;
      @include linear-gradient(top, $white 35%, #ebebeb);
      position: relative;
      padding-left: ($baseline*1.5);
      width: 100%;
      box-shadow: 0 1px 1px $shadow-l1;
      @include text-align(left);

      .icon-reply:before {
        @include ltr {
          content: "\f112"; // FA icon arrow to the left
        }

        @include rtl {
          content: "\f064"; // FA icon arrow to the right
        }
      }

      &:hover, &:focus {
        @include linear-gradient(top, $white 35%, #ddd);
      }

      span.add-response-btn-text {
        padding-left: 4px;
      }
    }
  }

  .loading-animation {
    background-image: url(../images/spinner-on-grey.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(../images/show-hide-discussion-icon.png) no-repeat;
      background-position: -21px 0;
    }
  }

  .new-post-btn {
    display: inline-block;
    @include float(right);
  }

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

    .threads {
      margin-top: $baseline;
    }

    .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 #ddd;
        border-radius: 3px;
        min-height: 0;
        background: $white;
        padding: 0;
        box-shadow: 0 1px 0 $shadow;
        @include transition(all .2s linear 0s);

        .thread-wrapper {
          position: relative;
          overflow-x: hidden;
          overflow-y: auto;
          max-height: 600px;

          .group-visibility-label {
            font-weight: 400;
            margin-bottom: ($baseline*0.5);
          }

          .discussion-post {
            @include clearfix;

            .inline-comment-count {
              position: relative;
              z-index: 100;
              float: right;
              display: block;
              height: 27px;
              margin-top: 6px;
              margin-right: 8px;
              padding: 0 8px;
              border-radius: 5px;
              font-size: 12px;
              font-weight: 400;
              line-height: 25px;
              color: #888;
            }

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

              .posted-details {
                margin-top: ($baseline/5);

                .username {
                  display: inline;
                  font-size: 14px;
                  font-weight: 700;
                }
              }

              h1 {
                font-size: 19px;
                font-weight: 700;
                margin-bottom: 0px !important; // Override courseware CSS
              }

              h4 {
                font-size: 16px;
              }
            }

            .post-body {
              font-size: 14px;
              clear: both;
            }
          }

          .responses {
            header {
              padding-bottom: 0;
              margin-bottom: 15px;

              .posted-by {
                float: left;
                margin-right: 5px;
                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: #f6f6f6;

          &: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: #333;
      font-weight: 700;
    }
  }

  .new-post-btn {
    @include blue-button;
    display: inline-block;
    font-size: 13px;
    margin-right: 4px;
  }

  .new-post-icon {
    display: block;
    float: left;
    width: 16px;
    height: 17px;
    margin-top: 8px;
    @include margin-right(7px);
    font-size: 16px;
    @include padding-right($baseline/2);
    vertical-align: middle;
    color: $white;
  }

  section.pagination {
    margin-top: 30px;

    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 15px;
            border: 1px solid #ccc;
            border-radius: 3px;
            font-size: 13px;
            font-weight: 700;
            line-height: 32px;
            color: #333;
            text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
          }
        }
      }
    }
  }

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

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

    .post-cancel {
      @include white-button;
      float: left;
      margin: $baseline/2 0 0 15px;
    }

    .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;
      @include box-sizing(border-box);
      border-radius: 3px;
      border: 1px solid #aaa;
      font-size: 16px;
      font-family: $sans-serif;
      color: #333;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
    }
  }
}

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

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

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

// post pagination
.response-count {
  margin-top: $baseline;
  padding: 0 ($baseline*1.5);
  color: $gray;
  font-size: 14px;
}

.response-pagination {
  visibility: visible;
  padding: ($baseline/2) ($baseline*1.5);
  background-color: $gray-l6;
  box-shadow: 0 1px 1px $gray-l4 inset, 0 -1px 1px $gray-l4 inset;

  &: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%, #ebebeb);
    position: relative;
    margin: ($baseline/2) 0;
    border: 1px solid #b2b2b2;
    width: 100%;
    box-shadow: 0 1px 1px $shadow-l1;
    text-align: left;
    font-weight: normal;

    span.add-response-btn-text {
      padding-left: 4px;
    }
  }
}

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

// post metadata - cohorts
.group-visibility-label {
    font-size: 12px;
    color:#000;
    font-style: italic;
    background-color: $white;
  }
