@mixin textOverflow($maxWidth) {
  max-width: $maxWidth;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@mixin comment($background, $borderColor, $borderRadius) {
  position: relative;
  // padding: 1em;
  padding: 0.5em;
  width: 100%;
  margin-bottom: 0.5em;
  // max-width: 30em;
  max-width: 22em;
  max-width: 30em;
  background: $background;
  border: 1px solid $borderColor;
  border-radius: $borderRadius;
  margin-right: 3.5em;

  &::after {
    content: "";
    position: absolute;
    right: -16px;
    top: 0.7em;
    border-left: 0.5em solid $background;
    border-bottom: 0.5em solid transparent;
    border-right: 0.5em solid transparent;
    border-top: 0.5em solid transparent;
    z-index: 0;
  }
  &::before {
    content: "";
    position: absolute;
    right: -17px;
    top: 0.7em;
    border-left: 0.5em solid $borderColor;
    border-bottom: 0.5em solid transparent;
    border-right: 0.5em solid transparent;
    border-top: 0.5em solid transparent;
    z-index: 0;
  }
}

@mixin footer-reply_comment() {
  .footer-reply_comment {
    display: flex;
    align-items: center;
    justify-content: space-between;

    background-color: #fff;
    border-bottom: 1px solid #eee;
    margin-bottom: 0.5em;
    width: 100%;

    // position: absolute;
    // bottom: 100%;
    // left: 0;
    // right: 0;

    .commentor-name {
      max-width: 21em;
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      // line-height: 1.8;

      font-size: 0.8rem;
      color: rgb(33, 37, 41);
      font-family: "sahel-semi-bold";
      margin: 0;
    }

    .commentor-text {
      max-width: 21em;
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: 0;
      // font-size: 0.9rem;
      // line-height: 1.5;

      font-size: 0.8rem;
      font-weight: 400;
      color: #333;
      text-align: justify;

      img.max-height {
        width: 100%;
        object-fit: cover;
        height: 8em;
      }
    }
  }
}

@mixin commentor-avatar($position: absolute) {
  position: $position;
  top: 0;
  right: -3em;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  overflow: hidden;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
}

@mixin comment-actions($flex-direction: row, $background-color: #92a2b2) {
  position: absolute;
  bottom: 0;
  left: -3.2em;
  // top: 0;

  display: flex;
  flex-wrap: wrap;
  flex-direction: $flex-direction;
  align-items: center;
  justify-content: flex-end;

  visibility: hidden;
  // transition: all 0.1s;

  .btn {
    margin-bottom: 0.5em;
    border-radius: 50%;
    background-color: $background-color;
    color: #fff;

    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;

    .tavasi {
      font-size: 1rem;
    }

    * {
      color: #fff;
    }
  }
}

%commentor-name {
  // font-size: 1.1rem;
  font-size: 0.8rem;
  color: rgb(33, 37, 41);
  font-family: "sahel-semi-bold";
  margin-bottom: 0.5em;
}

%comment-labels {
  margin-bottom: 0.5em;

  .btn {
    color: #fff;
    // font-size: 14px;
    font-size: 0.8rem;
    border-radius: 4px;
    padding: 0 0.3em 0.2em 0.3em;
    line-height: 1.2;
    background-color: #3877be;

    &.label-1 {
      background-color: #ffc31f;
    }

    &.label-2 {
      background-color: #ea4c89;
    }

    &.label-3 {
      background-color: #00b6e3;
    }
    &.label-4 {
      background-color: #df6d89;
    }
    &.label-5 {
      background-color: #7279d8;
    }
    &.label-6 {
      background-color: #cad84f;
    }
    &.label-7 {
      background-color: #e7a253;
    }
    &.label-8 {
      background-color: #e30031;
    }
    &.label-9 {
      background-color: #d000e3;
    }
    &.label-10 {
      background-color: #002ae3;
    }
    &.label-11 {
      background-color: #00e3e3;
    }
    &.label-12 {
      background-color: #40e300;
    }
    &.label-13 {
      background-color: #cce300;
    }
    &.label-14 {
      background-color: #e3b900;
    }
    &.label-15 {
      background-color: #e35300;
    }

    &.label-16 {
      background-color: #37aec4;
    }
    &.label-17 {
      background-color: #bd5232;
    }
    &.label-18 {
      background-color: #c72e2e;
    }
    &.label-19 {
      background-color: #47c03c;
    }
    &.label-20 {
      background-color: #bb9630;
    }
    &.label-21 {
      background-color: #67c02b;
    }
    &.label-22 {
      background-color: #bfc937;
    }
    &.label-23 {
      background-color: #a59b08;
    }
  }
}

%comment-tags {
  margin-bottom: 0.5em;

  .btn {
    color: #00b6e3;
    font-size: 0.8rem;
    background-color: transparent;
    padding: 0.12em;
    line-height: 1.2;
    text-decoration: underline !important;
  }
}

%replayers {
  display: flex;
  align-items: center;
  position: relative;
  flex: 1;
  margin-left: 1em;
  cursor: pointer;
  // padding: 2px 0 5px;
  // border-radius: 6px;
  // border-radius: 0 1.25rem 01.25rem 0;
  padding: 0.2em 0.3em;
  border-radius: $border-radius;

  &::after {
    content: "\e9b1";

    font-family: "tavasi" !important;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    font-size: 1.3rem;
    color: #bac4ce;
    color: #21bf84;

    position: absolute;
    left: 0;
    opacity: 0;
  }

  &:hover {
    background-color: #f4f4f4;
    background-color: #fff;

    &::after {
      opacity: 1;
    }
  }

  .btn {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;

    color: #00b6e3;
    border-color: #00b6e3;
    font-size: 0.8rem;
    margin-left: 1em;
  }

  // .replayer-avatar {
  //   flex-shrink: 0;
  //   margin-left: 12px;
  // }

  .replayer-avatar {
    padding: 0;
    width: 1.8em;
    height: 1.8em;
    border: 2px solid #b3e0eb;
    border: 2px solid #fff;
    border-radius: 50%;
    overflow: hidden;

    &:not(:first-child) {
      margin-right: -0.5em !important;
    }

    &.all-replays-number {
      color: #00b6e3;
      font-size: 0.9rem;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: #fff;
    }

    img {
      // margin-top: -2px;
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center;
    }
  }
}

%comment-footer {
  margin-top: 0.8em;
  display: flex;
  align-items: center;

  .comment-date {
    // font-size: 12px;
    font-size: 0.7rem;
    color: #666;
    text-align: left;
  }
}

%comment-form-container {
  margin-top: 1em;
  // padding-right: 3em;
  // padding-left: 3em;
  // max-width: 60em;
  max-width: 40em;
  margin-right: auto;
  margin-left: auto;

  .comment-form {
    .textform {
      border: 0;
      visibility: visible;
      height: 4.5em;
      overflow: auto;
      padding: 0.4em 1em;
      font-size: 0.9rem;
      // max-height: 8em;
      resize: none;
      background: rgba(0, 0, 0, 0);
      background-color: #fff;
      color: #121212 !important;
      line-height: 1.6rem;
      // min-height: 2.6em;
      overflow-x: hidden;
      white-space: pre-wrap;
      word-wrap: break-word;
    }

    .input-group {
      border: 1px solid #ddd;
      border-radius: 1.4em;
      overflow: hidden;

      .input-group-prepend {
        background-color: #fff;

        .btn {
          padding: 0.175rem 0.4rem;
          display: flex;
          align-items: center;

          .tavasi {
            font-size: 1.2rem;
            color: #8f8f8f;

          }
          &:hover {
            .tavasi {
              color: #333;
            }
          }
        }
      }

      .input-group-append {
        .btn {
          padding: 0.175rem 1em;
          background-color: #f5f8fc;
          display: flex;
          align-items: center;

          .tavasi {
            color: #00b6e3;
            // font-size: 2rem;
            // font-size: 1.5rem;
            font-size: 1.3rem;
            font-size: 2rem;
          }
        }
      }
    }
  }
}

.chat-list-group-info {
  display: flex;
  box-shadow: 0px 3px 5px 0px #eee;
  // margin-bottom: 1em;

  .group-row {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0.3em;
    border-radius: $border-radius;

    .group-picture-container {
      display: flex;
      align-items: center;
      margin-left: 0.5em;
      overflow: hidden;
      border-radius: 50%;
      border: 1px solid #ccc;

      .group-picture {
        width: 3em;
        height: 3em;
        object-fit: cover;
        object-position: center;
      }
    }

    .group-content {
      flex: 1;

      // display: flex;
      // align-items: center;
      // flex-direction: column;
      // align-items: flex-start;
      .group-title-container {
        display: flex;
        align-items: center;
        justify-content: space-between;

        .group-title {
          display: flex;
          align-items: center;
          font-size: 0.8rem;
          // font-size: 1.1rem;
          margin-bottom: 0.3em;
          // font-family: "sahel-bold";
          font-family: "sahel-semi-bold";
          text-align: right;

          color: #444;
          @include textOverflow(30em);

          .tavasi {
            // font-size: 1rem;
            font-size: 0.7rem;
            margin-left: 0.3em;
          }
        }

        .group-time {
          font-size: 0.5rem;
          font-family: "sahel-light";
        }
      }

      .group-description-container {
        display: flex;
        align-items: center;
        justify-content: space-between;

        .group-unread-indicator {
          font-size: 0.85rem;
          font-size: 0.55rem;
          background-color: #929292;
          font-family: "sahel-light";
        }

        .group-description {
          // font-size: 1rem;
          font-size: 0.8rem;
          margin: 0;
          text-align: right;

          // font-family: "yekan-regular";
          color: #6f6f6f;
          color: #333;
          @include textOverflow(30em);
        }
      }
    }
  }
}

.comment-list {
  flex: 1;
  display: flex;
  flex-direction: column;

  .comments {
    // height: 70vh;
    // height: calc(100dvh - 70px - 63px - 3.7em);
    // height: calc(100dvh - 8.5em);
    // height: calc(100dvh - 10em);
    .drop {
      .stream {
        height: calc(100dvh - 12em);
        // height: calc(100dvh - 16.5em);

        &.filter-is-active {
          // height: calc(100dvh - 21em) !important;
          // height: calc(100dvh - 24.5em) !important;
          height: calc(100dvh - 16.5em);
        }
      }
    }

    // flex: 1;
    // height: 100%;
    // max-height: 100%;
    // overflow: auto;
    background-color: #f5f8fc;
    padding: 1em;

    .comment-container {
      display: flex;
      justify-content: flex-start;

      &:hover {
        .comment {
          background-color: #c8f8ff;

          .comment-actions {
            visibility: visible;
            // transition: visibility 0.1s;
          }
        }
      }

      &:active,
      &.active {
        .comment {
          background-color: #9ff3ff;
        }
      }

      .comment {
        @include comment(#e8fcff, #b8ecff, 0.5em);

        .comment-header {
          .commentor-avatar {
            @include commentor-avatar();
          }

          .commentor-name {
            @extend %commentor-name;
          }
        }

        .comment-body {
          position: relative;

          .commentor-name {
            @extend %commentor-name;
          }

          .comment-labels {
            @extend %comment-labels;
          }

          .comment-tags {
            @extend %comment-tags;
          }

          .commentor-text {
            font-size: 0.8rem;
            font-weight: 400;
            color: #333;
            white-space: pre-wrap; /* CSS3 */
            white-space: -moz-pre-wrap; /* Firefox */
            white-space: -pre-wrap; /* Opera <7 */
            white-space: -o-pre-wrap; /* Opera 7 */
            word-wrap: break-word; /* IE */

            img.max-height {
              width: 100%;
              object-fit: cover;
              height: 8em;
            }
          }
        }

        .comment-footer {
          @extend %comment-footer;

          .replayers {
            @extend %replayers;

            // .shared-user__no-pic {
            //   font-size: 10px;
            //   padding-bottom: 2px;
            // }

            // .all-replays {
            //     margin-right: -0.3em !important;
            // }
          }
        }

        .comment-actions {
          @include comment-actions(column);
        }
      }

      &.replayer {
        justify-content: flex-end;
        margin-right: 0;
        margin-left: 3.3em;

        &:hover {
          .comment {
            background-color: #f5f5f5;
          }
        }

        &:active,
        &.active {
          .comment {
            background-color: #dfdfdf;
          }
        }

        .comment {
          @include comment(#fff, #ccc, 0.5em);

          &::after {
            right: unset;
            left: -0.9em;
            border-right: 0.5em solid #fff;
            border-left: 0.5em solid transparent;
          }
          &::before {
            left: -1em;
            right: unset;
            border-right: 0.5em solid #ccc;
            border-left: 0.5em solid transparent;
          }
          .comment-header {
            .custom-checkbox-container {
              right: -2em;
              top: 0em;
            }

            .commentor-avatar {
              left: -3em;
              right: unset;
            }
          }

          .comment-actions {
            left: unset;
            right: -2.5em;
          }

          .comment-body {
            .replayers {
              .replayer-avatar {
                border: 4px solid #b3e0eb;
              }

              &:hover {
                background-color: #f0f0f0;

                &::after {
                  opacity: 1;
                }
              }
            }
          }
        }
      }
    }
  }

  .comment-form-container {
    @extend %comment-form-container;
    min-width: 35em;
    @include footer-reply_comment();
  }

  &.replays-is-open {
    // background-color: #f5f8fc;

    .comments {
      .drop {
        .stream {
          height: calc(100dvh - 15.5em);
        }
      }
    }

    .comment-form-container {
      .comment-form {
        .textform {
        }

        .input-group {
          .input-group-prepend {
            .btn {
            }
          }

          .input-group-append {
            .btn {
              background-color: #eee;
            }
          }
        }
      }
    }
  }
}

#replays {
  // transform: translateX(-100%);
  // width: 0;
  // height: 0;
  transition: all 0.3s;
  // visibility: hidden;
  // opacity: 0;
  // overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #fff;
  z-index: 10;
  background-color: #fff;

  // show Issue Properties
  &.show {
    // transform: translateX(0);
    transition: all 0.3s;
    // width: 30em;
    width: 25em;
    // visibility: visible;
    // opacity: 1;
    // overflow: auto;
    // height: auto;
    // height: calc(100dvh - 18em)

    .drop {
      // .stream {
      // overflow: auto;
      // height: calc(100dvh - 17.8em);
      // height: calc(100dvh - 16.5em);
      // height: calc(100dvh - 20.5em);
      // }

      .stream {
        overflow: auto;
        height: calc(100dvh - 20.5em);

        &.filter-is-active {
          height: calc(100dvh - 24em);
        }
      }
    }
  }

  .replay-head {
    display: flex;
    justify-content: space-between;
    padding: 0.5em 1em;
    background: #fafafa;
    height: 4em;

    .group-title {
      display: flex;
      align-items: center;
      // font-size: 1rem;
      font-size: 0.9rem;
      margin-bottom: 0.3em;
      // font-family: "sahel-bold";
      // font-family: "sahel-semi-bold";
      color: #444;
      @include textOverflow(18em);

      .tavasi {
        // font-size: 1rem;
        font-size: 0.8rem;
        margin-left: 0.3em;
      }
    }

    .group-description {
      color: #6f6f6f;
      font-size: 0.8rem;
      margin: 0;
    }
  }

  .replay-list {
    // height: 100%; // if replay list is empty
    
    // padding: 1em;
    // height: 70vh;
    // height: calc(100dvh - 14.5em);
    // height: 70vh;
    // height: calc(100dvh - 70px - 63px - 3.7em);
    // height: calc(100dvh - 8.5em);
    // height: calc(100dvh - 10em);

    // max-height: 100%;
    // overflow: auto;
    // background-color: #f5f8fc;
    // background-color: #eaebed;
    padding: 1em;
    .drop {
      // height: calc(100dvh - 16.5em);

      .stream {
        // height: calc(100dvh - 12em);
        height: calc(100dvh - 17em);

        &.filter-is-active {
          height: calc(100dvh - 20.5em);

          & + .empty .wrapper {
            bottom: 5em;
          }
        }
      }
    }

    &.replay-comment-is-open {
      // height: calc(100dvh - 13em - 5em);
      .drop {
        .stream {
          height: calc(100dvh - 19em);

          &.filter-is-active {
            height: calc(100dvh - 23.5em);

            & + .empty .wrapper {
              bottom: 8.5em;
            }
          }
        }
      }
    }

    .comment-container {
      display: flex;
      justify-content: flex-start;

      &:hover {
        .comment {
          background-color: #c8f8ff;

          .comment-actions {
            visibility: visible;
            // transition: visibility 0.1s;
          }
        }
      }

      .comment {
        @include comment(#fff, #b8ecff, 0.5em);
        margin-right: 3em;
        // position: relative;
        // padding: 1em;

        // width: 100%;
        // // display: flex;
        // margin-bottom: 0.5em;
        // max-width: 30em;
        // // background: #e8fcff;
        // border: 1px solid #b8ecff;
        // border-radius: 10px 0 10px 10px;
        // // margin-right: 3em;

        .comment-header {
          display: flex;
          align-items: center;

          .commentor-avatar {
            // @include commentor-avatar(static);
            @include commentor-avatar();
          }

          .commentor-name {
            @extend %commentor-name;
            // margin-right: 0.3em;
          }
        }

        .commentor-text {
          font-size: 0.8rem;
          font-weight: 400;
          color: #333;
          white-space: pre-wrap; /* CSS3 */
          white-space: -moz-pre-wrap; /* Firefox */
          white-space: -pre-wrap; /* Opera <7 */
          white-space: -o-pre-wrap; /* Opera 7 */
          word-wrap: break-word; /* IE */
        }

        .comment-body {
          position: relative;

          .comment-labels {
            @extend %comment-labels;
          }

          .comment-tags {
            @extend %comment-tags;
          }

          .commentor-text {
            font-size: 0.8rem;
            color: rgb(33, 37, 41);

            img.max-height {
              width: 100%;
              object-fit: cover;
              height: 8em;
            }
          }
        }

        .comment-footer {
          @extend %comment-footer;
        }

        .comment-actions {
          @include comment-actions(row, #fff);
          top: 1em;
          left: 1em;
          bottom: unset;

          .btn {
            margin-bottom: 0;
            margin-left: 0.5em;

            * {
              color: #6f6f6f;
            }
          }
        }
      }
    }

   
  }

  .comment-form-container {
    @extend %comment-form-container;
    padding: 0 1em;
    position: relative;

    @include footer-reply_comment();
  }
}

.custom-checkbox-container {
  position: absolute;
  right: -2.2em;
  top: 2em;

  .custom-control {
    padding-left: 0;
    padding-right: 1.2rem;
    .custom-control-input {
      left: unset;
      right: 0;
      width: 1.2rem;
      height: 1.45rem;

      &:checked ~ .custom-control-label::before {
        // border-color: #3DEF90;
        border-color: transparent;
        background-color: transparent;
      }

      &:checked ~ .custom-control-label::after {
        background: url("../../common/img/checked.svg");

        background-size: cover;
      }
    }

    .custom-control-label::before {
      border-radius: 0.45rem;
      left: unset;
      right: -1.2rem;
      width: 1.2rem;
      height: 1.2rem;
      border-color: #bac4ce;
    }

    .custom-control-label::after {
      left: unset;
      right: -1.2rem;
      width: 1.2rem;
      height: 1.2rem;
    }
  }
}
