@import '../helpers/helpers';

.top-rated-page {
  &.container {
    padding-top: 0;
  }

  .card-block {
    position: relative;
    padding-bottom: 68px;

    &:not(:last-child) {
      &::after {
        content: '';
        position: absolute;
        left: calc(50% - 200px/2);
        bottom: 30px;
        width: 200px;
        height: 8px;
        background-color: $blue-dark;
      }
    }

    .heading2 {
      font-weight: bold;
      line-height: 2rem;
    }

    .heading3 {
      font-weight: bold;
      text-align: center;
    }

    .link-holder {
      font-size: 1rem;
      font-weight: bold;
    }

    .color-header {
      color: $blue-dark;
      margin-bottom: 20px;
    }
  }

  .top-rated-by-you {
    margin: 0 0 -100px;

    &__header {
      margin-bottom: 20px;
    }

    &__content {
      margin: 0 -15px;
      padding: 30px 20px 115px;
      text-align: center;
      color: $white;
      background-color: $blue-darker;
    }

    &__info {
      font-size: 1.25rem;
    }

    .stars img {
      width: 270px;
      height: 50px;
    }
  }

  .great-quality {
    &-block {
      position: relative;
      top: -90px;
    }

    &-item {
      @include make-col-ready;
      text-align: center;
      padding: 0;
    }

    &-product {
      position: relative;
      display: inline-block;
      width: 215px;
      height: 215px;
      background-color: $gray-bg;
      border-radius: 50%;
      z-index: 1;

      &__img {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 215px;
        height: 215px;
        line-height: 199px;
        border: 8px solid $white;
        border-radius: 50%;
        overflow: hidden;

        img {
          height: 70%;
        }
      }
    }

    &-heading {
      color: $gray-dark;
      font-size: 1.15rem;
      font-weight: 500;
    }

    &-rate {
      max-width: 100px;
      margin: 0 auto;

      img {
        width: 100%;
      }
    }
  }

  .product-rated-block {
    margin-top: 30px;

    &__info {
      margin: 10px 0 15px;
      font-size: 1rem;
    }

    &__wrap {
      position: relative;
    }

    &__review {
      display: block;
      margin: 0 auto;
      height: 310px;
      width: 310px;
      border-radius: 50%;
      background-color: $gray-light;
      position: absolute;
      top: -330px;
      left: calc(50% - 310px/2);
      z-index: 5;

      &-number {
        color: $gray-dark;
        font-size: 1.85rem;
        font-weight: bold;
        text-align: center;
        position: relative;
        top: 30px;
      }

      &-text {
        text-align: center;
        font-size: 1.15rem;
        line-height: 1.5rem;
        width: 235px;
        height: 115px;
        position: absolute;
        top: calc(50% - 115px/2);
        left: calc(50% - 235px/2);

        .review-name {
          margin-top: 20px;
          font-size: 1rem;
        }
      }

      &-wrap {
        opacity: 0;
        visibility: hidden;
        transition: .55s opacity, .55s visibility;

        &.show {
          opacity: 1;
          visibility: visible;
        }
      }

      &.index-show {
        z-index: 6;
      }

      .icon-left,
      .icon-right {
        position: absolute;
        opacity: .15;
        font-size: 2rem;
        color: $gray-dark;
      }

      .icon-left {
        top: 50px;
        left: 45px;
      }

      .icon-right {
        bottom: 50px;
        right: 45px;
      }
    }

    &__products {
      @include make-row;
      margin-top: 350px;

      &-item {
        @include make-col-ready;
        @include make-col(12);
        padding: 0;
        margin-bottom: 10px;
        cursor: pointer;

        .product {
          &-img {
            display: block;
            max-height: 300px;
            line-height: 230px;
            overflow: hidden;
            margin: 0 5px;
            text-align: center;

            &::after {
              content: '';
              position: absolute;
              top: 0;
              left: 0;
              bottom: 0;
              right: 0;
              margin: 0 5px;
              background: linear-gradient(180deg, $black-transparent35 0% , $white-transparent20 100%);
              z-index: 2;
            }

            .full-width-img {
              width: 100%;
            }

            .full-height-img {
              max-height: 160px;
            }
          }

          &-star-rate {
            position: absolute;
            width: 105px;
            top: 10px;
            left: calc(50% - 105px/2);
            text-align: center;
            z-index: 4;

            &__img {
              width: 100%;
            }
          }

          &-number {
            position: absolute;
            top: 0;
            font-size: 1.85rem;
            font-weight: bold;
            color: $white;
            z-index: 5;
          }
        }

        &:nth-of-type(4n+3) .product-number {
          right: 15px;
        }

        &:nth-of-type(4n+1) .product-number {
          left: 15px;
        }
      }
    }

    &__links {
      @include make-row;
      margin: 20px 0;
      list-style-type: decimal;
      text-align: left;
      font-weight: 500;
      padding-inline-start: 20px;

      &-item {
        @include make-col(12);
        font-size: 1rem;
        padding-left: 0;
        margin-bottom: 15px;
      }
    }
  }

  .all-products-btn {
    display: block;
    margin: 0 auto;
    padding: 10px 40px;

    .icon {
      display: none;
    }
  }

  .customer-favourites {
    &-block {
      @include make-row;
      margin-top: 20px;

      &__item {
        @include make-col-ready;
        @include make-col(12);
        margin-bottom: 10px;

        &-wrap {
          position: relative;
          width: 100%;
          height: 100%;
        }

        .product {
          &-img {
            overflow: hidden;
            text-align: center;
            position: relative;
            height: 100%;
            width: 100%;

            &::after {
              content: '';
              position: absolute;
              top: 0;
              left: 0;
              bottom: 0;
              right: 0;
              background: linear-gradient(180deg, $black-transparent35 0% , $white-transparent20 100%);
              z-index: 2;
            }

            .full-width-img {
              width: 100%;
              height: auto;
            }

            .full-height-img {
              width: 100%;
            }
          }

          &-star-rate {
            position: absolute;
            width: 105px;
            top: 10px;
            left: calc(50% - 105px/2);
            z-index: 4;
            text-align: center;

            &__img {
              width: 100%;
            }
          }
        }

        &:hover {
          .customer-favourites__shadow {
            opacity: 1;
            visibility: visible;
          }
        }
      }
    }

    &__shadow {
      display: flex;
      flex-direction: column;
      justify-content: center;
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      bottom: 0;
      right: 0;
      left: 0;
      background-color: $blue;
      color: $white;
      font-size: 1.25rem;
      font-weight: 500;
      text-align: center;
      padding: 0 30px;
      z-index: 10;
      opacity: 0;
      visibility: hidden;
      transition: .55s opacity, .55s visibility;
      text-decoration: none;

      &-link {
        margin-top: 20px;
        color: $white;
        font-size: 1rem;
        text-decoration: none;
      }
    }
  }

  .gift-card-block {
    text-align: center;

    .gift-card {
      position: relative;
      margin-bottom: 40px;

      &-img {
        width: 70%;
        margin-left: 90px;
      }
    }

    &__info {
      @include primary-text;

      &-footnote {
        font-size: .75rem;
      }
    }
  }

  .review-block {
    @include make-row;
    text-align: center;
    margin-top: 15px;

    &__item {
      @include make-col(12);

      &-icon {
        background-color: $gray-bg;
        border-radius: 50%;
        width: 125px;
        height: 125px;
        margin: 0 auto 10px;

        img {
          position: relative;
          height: 53px;
          width: 53px;
          top: calc(50% - 53px/2);
        }
      }
    }
  }

  .perfect-products {
    .view-link {
      display: none;
    }

    .btn {
      border: 1px solid $blue;
      color: $blue;
      background: $white;
      text-align: left;
      position: relative;
      width: 100%;
      font-size: 1.125rem;
      padding: 5px 15px;

      &__text {
        text-align: left;
        position: static;

        .icon {
          position: absolute;
          right: 10px;
          top: 5px;
        }
      }
    }

    .ranges {
      width: 100%;
      background-color: $white;
      z-index: 10;
      padding: 0 10px;
      border: 1px solid $blue;
      border-top: 0;
      display: none;

      &-el {
        color: $blue;
        text-decoration: none;
        display: block;
        padding: 7px 0;
        border-bottom: 1px solid $gray-light;
        font-weight: 500;
        font-size: 1rem;
        position: relative;

        .icon {
          position: absolute;
          right: 0;
          top: 5px;

          svg {
            font-size: .75rem;
          }
        }
      }
    }
  }

  .border-bottom-rounded {
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;

    &_false {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }
  }

  .icon-rotated {
    transform: rotate(180deg);
  }
}

@include media-breakpoint-up(md) {
  .top-rated-page {
    .card-block {
      padding-bottom: 80px;

      &:not(:last-child) {
        &::after {
          left: calc(50% - 555px/2);
          bottom: 36px;
          width: 555px;
        }
      }
    }

    .top-rated-by-you {
      margin-left: 0;
      margin-right: 0;

      &__content {
        margin: 0;
      }

      &__info {
        font-size: 1.25rem;
      }
    }

    .product-rated-block {
      margin-top: 40px;
      text-align: center;

      &__info {
        margin: 10px 0 20px;
        padding: 0 40px;
        font-size: 1.15rem;
      }

      &__review {
        height: 350px;
        width: 350px;
        border: 10px solid $white;
        left: calc(50% - 350px/2);
        top: calc(50% - 350px/2);

        &-text {
          font-size: 1.25rem;

          .review-name {
            font-size: 1.125rem;
          }
        }

        .icon-left,
        .icon-right {
          font-size: 2.5rem;
        }

        .icon-left {
          top: 60px;
          left: 45px;
        }

        .icon-right {
          bottom: 60px;
          right: 45px;
        }
      }

      &__products {
        margin-top: 0;

        &-item {
          @include make-col(6);

          .product {
            &-star-rate {
              width: 200px;
              top: 20px;
              left: calc(50% - 200px/2);

              &__img {
                width: 70%;
              }
            }

            &-number {
              top: 20px;
            }
          }

          &:nth-of-type(4n+3) .product-number {
            right: 30px;
          }

          &:nth-of-type(4n+1) .product-number {
            left: 30px;
          }

          &:nth-of-type(n+4) {
            & .product-star-rate,
            & .product-number {
              top: auto;
              bottom: 20px;
            }

            & .product-img::after {
              background: linear-gradient(180deg, $white-transparent20 0, $black-transparent35 100%);
            }
          }
        }
      }

      &__links {
        flex-flow: row;
        margin: 20px 0 10px;

        &-item {
          max-width: initial;
          flex: auto;
          margin-right: 5px;
          padding: 0 5px;
        }
      }
    }

    .customer-favourites {
      &-block {
        margin-top: 30px;

        &__item {
          @include make-col(4);
          margin-bottom: 14px;

          .product {
            &-star-rate {
              width: 200px;
              top: 20px;
              left: calc(50% - 200px/2);

              &__img {
                width: 70%;
              }
            }
          }
        }
      }
    }

    .gift-card-block {
      .gift-card {
        &-img {
          width: 30%;
        }
      }
    }

    .all-products-btn {
      display: inline-block;
      padding: 10px 150px;

      .icon {
        display: inline-block;
        margin-left: 30px;
        vertical-align: middle;
      }
    }

    .review-block {
      flex-flow: row;

      &__item {
        @include make-col-ready;
        max-width: initial;
        flex: auto;
      }
    }

    .perfect-products {
      position: relative;

      .view-link {
        display: block;
        position: absolute;
        right: 0;
        top: 5px;
        font-weight: 500;
        font-size: 1.125rem;
      }

      .btn {
        display: none;
      }

      .ranges {
        @include make-row;
        position: relative;
        border: 0;
        padding: 0;
        margin: 0 -10px;
        flex-wrap: nowrap;

        &-el {
          border: 1px solid;
          border-radius: 3px;
          font-size: 1rem;
          padding: 5px;

          &-wrap {
            @include make-col-ready;
            border-bottom: 0;
            padding: 10px;
          }
        }
      }
    }
  }
}

@include media-breakpoint-only(md) {
  .top-rated-page {

    .great-quality {
      &-block {
        .card-slider {
          padding: 0;
        }
      }
    }

    .perfect-products {
      .ranges {
        position: relative;
        width: auto;
        justify-content: center;
        flex-wrap: wrap;

        &-el {
          font-size: 1.125rem;

          &-wrap {
            @include make-col(4);
          }
        }
      }
    }

    .product-rated-block {
      &__products {
        &-item {
          .product {
            &-img {
              display: block;
              max-height: 300px;
              line-height: 260px;
              overflow: hidden;
              margin: 0 5px;
              text-align: center;

              .full-height-img {
                max-height: 160px;
              }
            }
          }
        }
      }
    }

    .customer-favourites {
      &-block {
        &__item {
          @include make-col(6);
        }
      }
    }
  }
}

@include media-breakpoint-up(lg) {
  .top-rated-page {
    .product-rated-block {
      &__products {
        &-item {
          .product {
            &-img {
              max-height: 300px;
              line-height: 300px;

              .full-height-img {
                max-height: 200px;
              }
            }
          }
        }
      }
    }

    .great-quality {
      &-block {
        .card-slider__btn-prev,
        .card-slider__btn-next {
          display: none;
        }
      }

      // sass-lint:disable no-important
      &-item {
        width: calc(20% - 6px) !important;
        margin-right: 8px !important;
      }

      &-product {
        width: 100%;
        height: auto;
        padding-top: 100%;

        &__img {
          width: 100%;
          height: 100%;
          line-height: 170px;
        }
      }
    }

    .perfect-products {
      .ranges {
        &-el {
          &-wrap {
            padding: 0 5px;
          }
        }
      }
    }
  }
}

@include media-breakpoint-up(xl) {
  .top-rated-page {
    .great-quality {
      &-product {
        &__img {
          width: 100%;
          height: 100%;
          line-height: 200px;
        }
      }
    }
  }
}
