/* stylelint-disable selector-max-compound-selectors */

div.ccm-conversation-avatar {
  left: 0;
  margin-right: 10px;
  position: absolute;
  top: 0;
  width: 40px;

  img {
    border-radius: 4px;
    max-height: 40px !important;
    max-width: 40px !important;
  }
}

div.ccm-conversation-message-form {
  ul.redactor-toolbar {
    border: 1px solid #ddd;
    box-shadow: none;
  }

  .redactor-editor {
    border: 1px solid #eee;
    padding: 10px;
  }
}

.cnv-admin-pane {
  position: absolute;
  right: 0;
  top: -10px;

  a.dropdown-toggle {
    font-size: $font-size-sm;
  }

  .dropdown-menu {
    left: auto;
    right: 0;

    a.admin-edit {
      color: #0c6;

      &:hover {
        color: white;
      }
    }

    a.admin-delete {
      color: #ff7070;

      &:hover {
        color: white;
      }
    }

  }
}

div.ccm-conversation-message-count {
  float: left;
  font-weight: bold;
  margin-top: 20px;
}

div.ccm-conversation-messages-header {
  @include clearfix();
  margin-bottom: 15px;

  select.ccm-sort-conversations {
    float: right;
    font-size: $font-size-sm;
    margin-top: 10px;
    width: auto;
  }
}

div.ccm-conversation-add-reply,
div.ccm-conversation-add-new-message,
div.ccm-conversation-edit-message {
  @include clearfix();
  clear: both;
  position: relative;

  form {
    margin-bottom: 0;
  }

  div.ccm-conversation-avatar + div.ccm-conversation-message-form {
    padding-left: 50px;
  }

  div.ccm-conversation-message-form {
    @include clearfix();

    textarea {
      box-sizing: border-box;
      font-size: $font-size-sm;
      height: 80px;
      width: 100%;
    }

    .ccm-conversation-attachment-toggle {
      float: right;
      opacity: 0.7;

      &.btn-success {
        border-bottom: 0;
        border-top: 0;
      }
    }

    button,
    a.btn {
      margin: 16px 0 0 16px;
    }
  }
}

div.ccm-conversation-add-new-message {
  margin-bottom: 20px;
}

div.ccm-conversation-add-reply {
  display: none;
  margin-top: 20px;
}

div.ccm-conversation-attachment-container {
  margin-top: 20px;

  .dropzone {
    border: 1px dashed $gray-300;
  }
}

div.ccm-conversation-errors {
  display: none;
}

div.ccm-conversation-message-list {
  div.ccm-conversation-delete-message {
    display: none;
  }

  div.ccm-conversation-delete-attachment {
    display: none;
  }

}

div.ccm-conversation-dialog {
  textarea {
    width: 100%;
  }

  div.ui-dialog-buttonset {
    float: none !important;
  }
}

div.ccm-conversation-message.ccm-conversation-message-topic {
  padding-left: 0;
}

div.ccm-conversation-message {
  @include clearfix();
  padding-bottom: 20px;
  padding-left: 50px;
  padding-right: 0;
  padding-top: 0;
  position: relative;

  div.ccm-conversation-message-byline {
    color: #9f9f9f;
    margin-bottom: 0;
    padding: 0 8px 8px;

    span.ccm-conversation-message-date {
      color: #9f9f9f;
    }

    span.ccm-conversation-message-username {
      color: #09f;
      font-weight: bold;
    }

    span.ccm-conversation-message-divider {
      padding: 0 10px;
    }

  }

  .message-attachments {
    @include clearfix();

    .attachment-container {
      @include clearfix();
      background: #f9f9f9;
      border: 1px solid #ccc;
      border-radius: 4px;
      display: block;
      margin-bottom: 20px;
      position: relative;

      .attachment-preview-container {
        float: left;
        min-height: 90px;
        width: 90px;
      }

      .image-popover-hover {
        background: transparent;
        border-bottom-left-radius: 4px;
        border-top-left-radius: 4px;
        cursor: pointer;
        height: 90px;
        left: 0;
        position: absolute;
        top: 0;
        width: 90px;

        .glyph-container {
          background-color: black;
          border-radius: 4px;
          color: #fff;
          display: none;
          height: 36px;
          margin: 29px 0 0 27px;
          padding: 8px 0 0 10px;
          width: 36px;

          i {
            margin-left: 1px;
          }
        }

        &:hover {
          background: #0a5d99;
          opacity: 0.8;

          .glyph-container {
            display: block;
          }
        }
      }

      img {
        border-bottom-left-radius: 4px;
        border-top-left-radius: 4px;
        float: left;
      }

      p.image-preview {
        display: block;
        float: left;
        padding: 20px 0 10px 20px;
      }
    }
  }

  .ccm-conversation-message-body {
    padding: 0 8px;
  }

  div.ccm-conversation-message-controls {

    @include clearfix();
    color: #999;
    padding: 0 0 0 8px;

    a.ccm-conversation-message-control-icon {
      color: #999;
    }

    a.ccm-conversation-message-control-icon:hover {
      color: #333;
    }

    .ccm-conversation-social-share {
      display: none;
    }

    span.control-divider {
      display: block;
      float: left;
      margin-left: 15px;
      padding: 8px;
    }

    li:first-child {
      margin-left: 0;
    }

    ul {
      float: left;
      list-style-type: none;
      margin: 0;
      padding: 0;

      li {
        display: inline-block;
        margin-left: 20px;

        &.dropdown {
          margin-left: 0;
        }
      }

      a {
        display: block;
        padding-bottom: 8px;
        // make them stack nicely next to the bootstrap dropdown toggle
        padding-top: 8px;
      }

    }

  }

}

div.ccm-conversation-message-deleted,
div.ccm-conversation-message-flagged {
  opacity: 0.3;
}

div.ccm-conversation-message:hover {
  .ccm-conversation-message-admin-control {
    display: inline-block;
  }
}

.ccm-conversation-message-admin-control {
  display: none;
}

div.ccm-conversation-message {
  &:hover {
    div.ccm-conversation-message-controls {
      .ccm-conversation-social-share {
        display: inline-block;
      }
    }
  }

}

div.ccm-conversation-messages-threaded {
  div.ccm-conversation-message-level0 {
    margin-left: 0;
  }

  div.ccm-conversation-message-level1 {
    margin-left: 50px;
  }

  div.ccm-conversation-message-level2 {
    margin-left: 100px;
  }

  div.ccm-conversation-message-level3 {
    margin-left: 150px;
  }

  div.ccm-conversation-message-level4 {
    margin-left: 200px;
  }

}

div.ccm-conversation-form-submitted {
  opacity: 0.4;
}

div.ccm-conversation-load-more-messages {
  padding: 0 0 20px;
  text-align: center;
}

/**
 * Basic editor styles
 */

.conversation-editor {
  height: 200px;
}

/**
 * Discussions
 */
ul.ccm-discussion-topics {
  list-style-type: none;
  margin: 0 0 20px;
  padding: 0;

  li {
    border-bottom: 1px inset #ccc;
    display: block;
    min-height: 60px;
    padding: 4px 4px 10px 80px;
    position: relative;

    div.ccm-discussion-topic-replies {

      color: #999;
      height: 62px;
      left: 0;
      position: absolute;
      text-align: center;
      top: 18px;
      width: 62px;

      em {
        color: #999;
        display: block;
        font-style: normal;
        line-height: 1em;
        margin: 5px auto 0;
      }

    }

    div.ccm-discussion-topic-details {
      color: #444;
    }
  }

  h3 {
    margin-bottom: 2px;
  }
}

div.ccm-discussion {
  select.ccm-discussion-order-by {
    float: right;
    margin-right: 10px;
  }
}

