@import "animations";

.commentable-container {
  transition: all .15s ease;
}

.side-comments-open {
  transform: translate(-280px, 0);
}

.commentable-section {
  position: relative;

  &:hover {

    .side-comment .marker {
      display: block;
    }

  }
}

.side-comment {
  * {
    box-sizing: border-box;
  }

  position: absolute;
  top: 0px;
  right: -80px;
  width: 80px;
  min-height: 100%;
  height: 100%;

  .hide {
    display: none;
  }
  
  .marker {
    display: none;
    position: absolute;
    top: 0;
    right: 30px;
    width: 20px;
    height: 18px;
    cursor: pointer;
    background: #DEDEDC;
    border-radius: 2px;
    text-decoration: none;
  }

  .marker:before, .marker span {
    content: "+";
    display: block;
    position: absolute;
    width: 20px;
    height: 18px;
    line-height: 16px;
    font-size: 14px;
    color: #FFF;
    text-align: center;
  }

  .marker span {
    display: none;
    line-height: 20px;
    font-size: 12px;
  }

  &.active .marker, &.has-comments .marker, &.has-comments ul.comments {
    display: block;
  }

  .marker:after {
    content: "";
    display: block;
    position: absolute;
    bottom: -7px;
    left: 5px;
    width: 0;
    border-width: 7px 8px 0 0;
    border-style: solid;
    border-color: #DEDEDC transparent;
  }

  .marker:hover, &.active .marker {
    background: #4FAF62;
  }

  .marker:hover:after, &.active .marker:after {
    border-color: #4FAF62 transparent;
  }

  .add-comment {
    display: none;
  }

  &.has-comments .add-comment, &.no-current-user .add-comment {
    display: block;
  }

  &.no-current-user .add-comment {
    margin-top: 20px;
  }

  &.has-comments {

    .marker:before {
      content: "";
    }

    .marker span {
      display: block;
    }

    .add-comment.hide {
      display: none;
    }

    .comment-form {
      display: none;
    }

  }
  
  .comments-wrapper {
    display: none;
    position: absolute;
    top: 0;
    left: 80px;
    width: 280px;
    padding-bottom: 120px;
  }

  .comments {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;

    li {
      overflow: hidden;
    }
  }

  .author-avatar {
    float: left;
    width: 32px;
    height: 32px;
    margin-right: 10px;

    img {
      width: 100%;
      height: 100%;
    }

  }

  .author-name {
    float: left;
    width: 238px;
  }

  .comment-box:empty:not(:focus):before {
    content: attr(data-placeholder-content);
    float: left;
  }

  .comment, .comment-box, .actions {
    margin: 0;
    width: 238px;
    float: left;
  }

  .actions, .delete {
    margin-left: 42px;
  }

  .comment-box {
    outline: none;
  }

  .add-comment.active {
    display: block;
  }

  .comment-form {
    overflow: hidden;
    
    &.active {
      display: block;
    }
  }

  &.active .comments-wrapper {
    display: block;
    animation: fadein 0.2s;
  }

}