/**
 * Notes
 */

@-webkit-keyframes targe3-note {
  from { background:#fffff0; }
  50% { background:#ffffd3; }
  to { background:#fffff0; }
}

ul.notes {
  display: block;
  list-style: none;
  margin: 0px;
  padding: 0px;

  .discussion-header,
  .note-header {
    @extend .cgray;
    padding-bottom: 15px;

    a:hover {
      text-decoration: none;
    }

    .avatar {
      float: left;
      margin-right: 10px;
    }

    .discussion-last-update,
    .note-last-update {
      &:before {
        content: "\00b7";
      }
      font-size: 13px;
    }
    .author {
      color: #333;
      font-weight: bold;
      font-size: 14px;
      &:hover {
        color: $link_color;
      }
    }
    .author-username {
      font-size: 14px;
    }
  }

  .discussion {
    overflow: hidden;
    display: block;
    position:relative;
  }

  .note {
    display: block;
    position:relative;
    .attachment {
      font-size: 14px;
    }
    .note-body {
      @include md-typography;
    }
    .note-header {
      padding-bottom: 3px;
    }

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

.diff-file .notes_holder {
  font-size: 13px;
  line-height: 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

  td {
    border: 1px solid #ddd;
    border-left: none;

    &.notes_line {
      text-align: center;
      padding: 10px 0;
      background: #FFF;
    }
    &.notes_line2 {
      text-align: center;
      padding: 10px 0;
      border-left: 1px solid #ddd !important;
    }
    &.notes_content {
      background-color: #fff;
      border-width: 1px 0;
      padding-top: 0;
      vertical-align: top;
      &.parallel{
        border-width: 1px;
      }
    }
  }
}

/**
 * Actions for Discussions/Notes
 */

.discussion,
.note {
  &.note:hover {
    .note-actions { display: block; }
  }
  .discussion-header:hover {
    .discussion-actions { display: block; }
  }

  .discussion-actions,
  .note-actions {
    display: none;
    float: right;

    [class~="fa"] {
      font-size: 16px;
      line-height: 16px;
      vertical-align: middle;
    }

    a {
      @extend .cgray;

      &:hover {
        color: $link_hover_color;
        &.danger { @extend .cred; }
      }
    }
  }
}
.diff-file .note .note-actions {
  right: 0;
  top: 0;
}


/**
 * Line note button on the side of diffs
 */

.diff-file tr.line_holder {
  @mixin show-add-diff-note {
    filter: alpha(opacity=100);
    opacity: 1.0;
  }

  .add-diff-note {
    background: image-url("diff_note_add.png") no-repeat left 0;
    border: none;
    height: 22px;
    margin-left: -65px;
    position: absolute;
    width: 22px;
    z-index: 10;

    // "hide" it by default
    opacity: 0.0;
    filter: alpha(opacity=0);

    &:hover {
      @include show-add-diff-note;
    }
  }

  // "show" the icon also if we just hover somewhere over the line
  &:hover > td {
    background: $hover !important;

    .add-diff-note {
      @include show-add-diff-note;
    }
  }
}

/**
 * Note Form
 */

.comment-btn {
  @extend .btn-create;
}
.reply-btn {
  @extend .btn-primary;
}
.diff-file .diff-content {
  tr.line_holder:hover {
    &> td.line_content {
      background: $hover !important;
      border-color: darken($hover, 10%) !important;
    }
    &> td.new_line,
    &> td.old_line {
      background: darken($hover, 4%) !important;
      border-color: darken($hover, 10%) !important;
    }
  }

  tr.line_holder:hover > td .line_note_link {
    opacity: 1.0;
    filter: alpha(opacity=100);
  }
}
.diff-file,
.discussion {
  .new_note {
    margin: 0;
    border: none;
  }
}
.new_note {
  display: none;
  .buttons {
    float: left;
    margin-top: 8px;
  }
  .clearfix {
    margin-bottom: 0;
  }

  .note-preview-holder,
  .note_text {
    background: #FFF;
    border: 1px solid #ddd;
    min-height: 100px;
    padding: 5px;
    font-size: 14px;
    box-shadow: none;
  }

  .note-preview-holder {
    > p {
      overflow-x: auto;
    }
  }

  .note_text {
    width: 100%;
  }
  .nav-tabs {
    margin-bottom: 0;
    border: none;

    li a,
    li.active a {
      border: 1px solid #DDD;
    }
  }
}

/* loading indicator */
.notes-busy {
  margin: 18px;
}

.note-image-attach {
  @extend .col-md-4;
  @extend .thumbnail;
  margin-left: 45px;
  float: none;
}

.common-note-form {
  margin: 0;
  background: #F9F9F9;
  padding: 5px;
  border: 1px solid #DDD;
}

.note-form-actions {
  background: #F9F9F9;
  height: 45px;

  .note-form-option {
    margin-top: 8px;
    margin-left: 30px;
    @extend .pull-left;
  }

  .js-notify-commit-author {
    float: left;
  }

  .write-preview-btn {
    // makes the "absolute" position for links relative to this
    position: relative;

    // preview/edit buttons
    > a {
      position: absolute;
      right: 5px;
      top: 8px;
    }
  }
}

.note-edit-form {
  display: none;

  .note_text {
    border: 1px solid #DDD;
    box-shadow: none;
    font-size: 14px;
    height: 80px;
    width: 100%;
  }

  .form-actions {
    padding-left: 20px;

    .btn-save {
      float: left;
    }

    .note-form-option {
      float: left;
      padding: 2px 0 0 25px;
    }
  }
}

.js-note-attachment-delete {
  display: none;
}

.parallel-comment {
  padding: 6px;
}

.error-alert > .alert {
  margin-top: 5px;
  margin-bottom: 5px;
}

.discussion-body,
.diff-file {
  .notes .note {
    border-color: #ddd;
    padding: 10px 15px;
  }

  .discussion-reply-holder {
    background: #f9f9f9;
    padding: 10px 15px;
    border-top: 1px solid #DDD;
  }
}

.discussion-notes-count {
  font-size: 16px;
}
