.anycomment-app {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  padding: $global-padding;
  margin: $global-margin;
  position: relative;
  background-color: $global-background-color;
  border-radius: $global-background-border-radius;

  // Footer
  .anycomment-copy-footer {
    margin-top: $big-space;
    padding-top: $medium-space;
    text-align: right;
    font-size: $font-size - 3;
    border-top: 2px solid #e4e2e7;
    display: flex;
    justify-content: flex-end;
    align-items: center;

    &, a {
      color: $semi-hidden-color
    }

    a:hover,
    a:focus,
    a:active {
      color: $text-color;
    }

    & > span {
      display: inline-block;
      margin-right: 6px;
      vertical-align: middle;
    }
  }

  // Comments list
  .anycomment-list {
    margin: 0;
    padding: 0;

    &,
    .comment-single {
      list-style: none;
    }

    // Preparation for side line
    .comment-single {
      //&::before {
      //  content: '';
      //  position: absolute;
      //  top: $parent-avatar-size + 20;
      //  left: $parent-avatar-size / 2;
      //  border-left: 1px solid $primary-color;
      //  height: calc(100% - 61px);
      //}
    }

    .comment-single-highlight {
      position: relative;

      &::before {
        content: '';
        position: absolute;
        left: -8px;
        top: 0;
        height: 100%;
        width: 5px;
        background-color: $btn-background-color;
      }
    }

    .comment-single {
      margin-bottom: $medium-space;

      &-replies {
        margin-top: $medium-space;
      }

      &:last-of-type {
        padding-bottom: 0 !important;
      }

      &-avatar {
        position: absolute;
        left: 0;
        top: 0;

        &,
        &__img {
          @include avatar-parent();
        }

        &__img {
          position: relative;
          @include avatar();

          &-auth-type {
            $size: 15px;
            position: absolute;
            bottom: -($size / 4);
            right: -($size / 4);

            &, & > img {
              width: $size;
              height: $size;
            }
          }
        }
      }

      &-body {
        &-header {

          &__author {
            display: flex;
            justify-content: start;
            flex-direction: row;
            align-items: center;
            margin-bottom: 3px;

            &--actions {
              display: flex;
              align-items: center;
              flex-direction: row;
              margin-left: auto;

              .anycomment-icon {
                &, svg {
                  font-size: 12px;
                }
              }

              & > * {
                margin-right: 15px;

                &:last-child {
                  margin-right: 0;
                }
              }
            }

            &-name {
              color: $link-color;
              font-size: $font-size;
            }

            &-owner {
              background-color: $btn-background-color;
              color: $btn-color;
              font-size: $font-size - 2;
              padding: 0 8px;
              margin-left: 10px;
              user-select: none;
              height: 18px;
              line-height: 18px;
              @include border-radius($global-radius);
            }

            &-reply {
              margin-left: 5px;
              display: inline-block;

              &, a {
                color: $semi-hidden-color;
                font-size: $font-size - 2;
              }
            }

            &-replied,
            &-parent-author {
              color: $link-color;
            }

            &-answered {
              color: $semi-hidden-color;
            }
          }

          &__date {
            color: $semi-hidden-color;
            font-size: $font-size - 2;
            line-height: $small-space;
            display: block;
          }
        }

        &__shortened {
          .comment-single-body__text {
            &-content {
              position: relative;
              cursor: pointer;
              overflow: hidden;
            }
          }
        }

        &__text {
          width: 100%;
          margin: 5px 0;
          transition: height 1s ease-out;

          &-content {
            color: $text-color;
            font-size: $font-size;
            font-weight: normal;
            line-height: 19px;
            padding: 0;
            margin: 0;
            word-break: break-word;
            word-wrap: break-word;
            overflow: hidden;

            // In case when <p> tag is not wrapping text
            &, p {
              line-height: 1.6;
              margin: 0 0 5px 0;
            }

            a {
              color: $link-color;

              &,
              &:hover,
              &:active,
              &:focus,
              &:visited {
                background-color: transparent;
              }
            }

            // blockTypes
            ul, ol {
              padding-left: 21px;
              margin-left: 0;
            }

            // quotes
            blockquote {
              position: relative;
              margin: 0 0 10px 0;
              padding: 5px 8px 8px 41px;
              font-size: $font-size + 5;
              font-weight: 400;
              font-family: Georgia, Cambria, "Times New Roman", Times, serif;
              background-color: #efefef;
              line-height: 1.48;
              letter-spacing: -.012em;
              @include border-radius($global-radius);

              &::after {
                // Clean-up possible styles from the theme
                content: '';
              }

              &::before {
                position: absolute;
                top: 5px;
                left: 10px;
                content: "\201C";
                font-family: Georgia, Cambria, "Times New Roman", Times, serif;
                font-size: $font-size + 25;
                font-weight: bold;
                line-height: $font-size +25;
              }
            }

            // images
            img {
              max-width: 100%;
              width: auto;
            }

            & > *:last-child {
              margin-bottom: 0;
            }

            & > p:last-child {
              padding-bottom: 0;
            }
          }

          &-readmore {
            color: $link-color;
            font-size: $font-size - 2;
            text-decoration: none;
            text-align: left;
            padding: 5px 0 0;
            margin: 0;
            cursor: pointer;

            &:hover,
            &:active,
            &:focus {
              color: $link-color-active;
            }
          }
        }

        .comment-attachments {
          width: 100%;
          display: block;
          margin: 3px 0;
          padding: 0;

          li {
            display: inline-block;
            margin-right: 5px;
            margin-bottom: 2px;
            float: left;

            .comment-attachment {
              display: block;
              width: $attachment-size;
              height: $attachment-size;
              line-height: $attachment-size;
              background-color: $attachment-background-color;
              text-align: center;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
              padding: 0 2px;
              font-size: $font-size - 7;
              font-weight: bold;
              user-select: none;
              color: darken($attachment-color, 15%);
              @include border-radius(3px);

              &:hover {
                background-color: darken($attachment-background-color, 3%);
                color: darken($attachment-color, 20%);
              }

              .anycomment-icon {
                color: darken($attachment-background-color, 20%);
              }
            }

            .comment-attachment__link {
              outline: 0;
            }

            .comment-attachment__image {
              background-size: cover;
              background-repeat: no-repeat;
              background-position: center center;
            }
          }
        }

        &__actions {
          display: flex;
          margin-top: 10px;

          &-like-static {
            svg {
              -webkit-animation: iconToStatic 0.4s ease-out;
              animation: iconToStatic 0.4s ease-out;
            }
          }

          &-like-active {
            svg {
              -webkit-animation: iconToActive 0.4s ease-out;
              animation: iconToActive 0.4s ease-out;
            }
          }

          @keyframes iconToStatic {
            50% {
              -webkit-transform: scale(0.77);
              transform: scale(0.77);
            }
            100% {
              -webkit-transform: scale(1);
              transform: scale(1);
            }
          }

          @keyframes iconToActive {
            25% {
              -webkit-transform: scale(0.77);
              transform: scale(0.77);
            }
            75% {
              -webkit-transform: scale(1.55);
              transform: scale(1.55);
            }
            100% {
              -webkit-transform: scale(1);
              transform: scale(1);
            }
          }

          ul {
            list-style: none;
            margin: 0;
            padding: 0;
            user-select: none;

            li {
              display: inline-block;
              margin-right: 15px;

              .svg-inline--fa {
                font-size: $font-size + 1;
                margin-right: 7px;
                vertical-align: middle;
              }

              &:last-of-type {
                margin-right: 0;
              }

              a, span {
                font-size: $font-size;
                color: $semi-hidden-color;
                text-decoration: none;

                &:hover,
                &:active,
                &:focus {
                  text-decoration: none;
                  color: darken($semi-hidden-color, 5%);
                }
              }
            }
          }
        }
      }

      &-form-wrapper {
        margin: 10px 0;
      }
    }

    // Child comments
    &-child {
      .comment-single {
        &-avatar {
          &,
          &__img {
            @include avatar-child();

            &-auth-type {
              width: 12px;
              height: 12px;
              font-size: 8px;
              line-height: 12px;
            }
          }
        }

        &-body {
          .comment-attachments {
            li {
              .comment-attachment {
                width: $attachment-child-size;
                height: $attachment-child-size;
                line-height: $attachment-child-size;
                font-size: $font-size - 9;
              }
            }
          }
        }
      }
    }

    // Load more
    .comment-single-load-more {
      text-align: center;
    }
  }

  & > .anycomment-list {

    ul.anycomment-list-child {
      .comment-single-body {
        padding-left: $comment-child-space;
      }
    }

    & > .comment-single {

      & > .comment-single-body {
        padding-left: $comment-parent-space;
      }

      & > .comment-single-replies {
        // Second level
        & > ul.anycomment-list-child {
          margin-left: $comment-parent-space;

          // Third level
          & > li {
            & > .comment-single-replies {
              & > ul.anycomment-list-child {
                margin-left: $comment-parent-space;
              }
            }
          }
        }
      }
    }
  }
}
