@import '../helpers/variables';
@import '../helpers/CTAs';
@import '../helpers/mixins';
@import '../../../node_modules/bootstrap/scss/mixins';

$color-bar-radius: 3px;

.products-list-page {
  .page-header {
    &__title {
      text-transform: none;
    }
  }

  .searched-item {
    display: block;
    font-weight: 700;
  }

  .left-aside {
    position: static;
  }

  .srp-injected {
    margin-bottom: 20px;
    margin-top: 10px;

    &__image {
      margin-bottom: 20px;

      img {
        display: block;
        max-width: 100%;
      }
    }

    &__content {
      font-size: 16px;
      font-weight: 500;
      line-height: 1.5;
      padding: 0;
      text-align: left;

      p {
        margin: 0;
      }
    }
  }

  .sponsor-top-banner {
    margin-bottom: 20px;
    margin-top: 10px;

    &__image {
      display: block;
      max-width: 100%;
      margin-bottom: 20px;
    }
  }

  .color-pick {
    &__wrap {
      display: none;
    }
  }
}

.sort-products-list {
  display: flex;
  justify-content: flex-end;
  align-items: center;

  .open-filters-btn {
    @include button-full;
    margin-bottom: 30px;

    .icon {
      margin-right: 6px;
    }
  }

  &__section {
    @include make-col-ready;
    @include make-col(12);
  }

  &__sort-by {
    text-align: right;
    flex: 1;

    .form-row {
      margin-bottom: 0;
    }
  }

  &__total {
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 22px;
  }
}

.products-list {
  display: flex;
  flex-wrap: wrap;
  margin-top: 30px;

  .card__inner {
    .card__descr {
      margin-bottom: 10px;
    }
  }

  .product-card__price {
    position: relative;

    .product-card__price-value {
      bottom: 0;
    }

    &.product-card__price_sale {
      .product-card__price-value {
        bottom: 1px;
      }
    }
  }
}

.load-more-wrap {
  width: 100%;

  @media (hover: none) {
    .btn-primary {
      &:hover {
        color: $white;
        background-color: $blue;
        border-color: $blue;
      }

      &:focus {
        color: $blue;
        background-color: $white;
        border-color: $blue;
      }
    }
  }
}

//sass-lint:disable no-mergeable-selectors
.products-list {
  .product-card {
    .product-card__title {
      font-size: 1rem;
    }

    .card__inner {
      padding-top: 0;
      padding-bottom: 10px;
      border: 1px solid $gray;

      .card__img {
        border-bottom: 1px solid $gray;
      }
    }

    .product-card__extra-info {
      margin: 0;
      width: 100%;
    }

    .out-of-stock-container {
      padding: 10px 0;
      padding-left: 30px;
    }

    .notify-container {
      padding: 10px 0;
      padding-right: 30px;
    }

    .card__offers {
      top: 0;
    }

    .click-collect-container {
      padding: 10px 30px 0;
    }

    &__price {
      display: flex;
      align-items: center;
      text-align: center;
      width: 100%;
      margin: 0;
      flex-direction: column;
      min-height: auto;

      .product-card__price__old-price {
        text-align: left;
        width: 100%;
        margin-right: 0;
        padding-left: 15px;
        padding-bottom: 5px;
      }

      .product-card__price-value {
        width: 100%;
        text-align: left;
        padding-left: 15px;
        padding-bottom: 5px;
      }

      .uom-price {
        margin: 0;
      }

      .product-card__price__out-of-stock {
        margin-right: 0;
        width: 100%;
        text-align: left;
        padding-left: 15px;
      }
    }
  }

  .product-card__description {
    float: left;
    padding: 15px 0 0 15px;
    width: 100%;
    font-weight: 500;
  }

  .card__inner {
    .card__descr {
      line-height: 1.5;
    }
  }
}

.product-card__price {
  .product-card__price_sale {
    padding: 0 10px;
  }
}

.product-list {
  .card__descr {
    .card_offer_text:empty {
      display: none;
    }
  }
}

.products-list-v2 {
  @include media-breakpoint-down(sm) {
    margin-right: -5px;
    margin-left: -5px;
    margin-top: 0;
    padding-top: 40px;
    overflow-x: hidden;
  }

  &__badges {
    @include badges;
    @include price-block-badge;
    font-size: 1rem;

    @include media-breakpoint-down(sm) {
      font-size: 0.875rem;
    }
  }

  &__badges.products-list-v2__badges.products-list-v2__badges {
    width: auto;
    min-width: 120px;
  }

  &__badge {
    padding: 3px 5px;
  }

  .card {
    &:nth-of-type(1)::before,
    &:nth-of-type(2)::before {
      @include media-breakpoint-down(sm) {
        content: '';
        position: absolute;
        top: -20px;
        left: 5px;
        width: calc(100% - 10px);
        border-bottom: 1px solid $gray;
      }
    }
  }

  .card {
    @include media-breakpoint-down(sm) {
      margin-bottom: 20px;
      position: relative;
      display: inline-block;
      vertical-align: top;
      max-width: 50%;
      margin-right: -4px;
      padding-left: 5px;
      padding-right: 5px;
      width: 50%;
    }

    &:nth-of-type(1)::before,
    &:nth-of-type(2)::before {
      @include media-breakpoint-down(sm) {
        content: '';
        position: absolute;
        top: -20px;
        left: 5px;
        width: calc(100% - 10px);
        border-bottom: 1px solid $gray;
      }
    }

    &__inner-v2.card__inner-v2.card__inner-v2 {
      padding-bottom: 0;

      @include media-breakpoint-down(sm) {
        border: 0;
        border-bottom: 1px solid $gray;
      }
    }

    &__img {
      &-v2 {
        max-width: 100%;
        max-height: 100%;
      }

      &-wrap {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: 1px solid $gray;
        width: 100%;

        @supports (aspect-ratio: 1 / 1) {
          aspect-ratio: 1 / 1;
        }

        @supports not (aspect-ratio: 1 / 1) {
          &:before {
            content: '';
            display: block;
            padding-top: 100%;
          }
        }

        .card__img-v2 {
          position: absolute;
          inset: 0;
          width: 100%;
          height: 100%;
          object-fit: contain;
        }

        @include media-breakpoint-down(sm) {
          border: 1px solid $gray;
        }
      }
    }

    &__offers {
      &-item-v2 {
        font-size: 1.25rem;
      }

      &-red {
        padding-left: 35px;
        padding-right: 35px;

        @include media-breakpoint-down(sm) {
          padding-left: 0;
          padding-right: 0;
        }
      }

      &-green {
        padding-left: 15px;
        padding-right: 15px;
      }
    }
  }

  .card-sponsor-product {
    @include media-breakpoint-down(sm) {
      width: 50%;

      .card {
        width: 100%;
      }
    }
  }

  .product-card {
    & .card__inner-v2:hover {
      border: 1px solid $gray-dark;

      @include media-breakpoint-down(sm) {
        border: 0;
        border-bottom: 1px solid $gray;
      }
    }

    &__header {
      margin-bottom: 15px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      //height: 100%;

      &-r1 {
        max-height: 50px;
        min-height: 50px;
      }

      &-r2 {
        max-height: 70px;
        min-height: 70px;
      }

      &-r3 {
        max-height: 90px;
        min-height: 90px;
      }

      & .product-card__title.product-card__title-v2 {
        @include clamp-text(3);
        margin-top: 5px;
        font-size: 0.875rem;
        font-weight: 700;
        line-height: 18px;

        @include media-breakpoint-down(sm) {
          text-align: center;
        }
      }
    }

    &__title {
      margin-bottom: 0;
    }

    &__delivery {
      @include font-size(12);
      @include line-height(16);
      font-weight: 400;
      color: $squant;
      margin-bottom: 5px;
    }

    &__content {
      height: 100%;
      margin-bottom: 5px;

      @include media-breakpoint-down(sm) {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 10px;
      }
    }

    &__price-value.product-card__price-value.product-card__price-value {
      font-size: 1.5rem;

      @media screen and (max-width: 321px) {
        font-size: 1.125rem;
      }
    }

    &__price-value {
      &-text {
        font-size: 1rem;
        line-height: 1;
      }
    }

    .product-rating.product-rating-v2 {
      font-size: 0.875rem;

      .fa-star {
        margin-right: 0;

        & + .fa-star {
          margin-left: 6px;
        }
      }
    }

    &__price {
      justify-content: flex-end;
      //max-height: 65px;
      //height: 100%;

      &_empty {
        opacity: 0;
        cursor: default;
      }

      &_sale {
        .product-card__price {
          &-value {
            color: $red;
          }

          &-sqm {
            color: $red;
          }
        }
      }

      &.product-card__price {
        margin-bottom: 5px;
      }

      &.product-card__min-height {
        min-height: 40px;
      }

      &.product-card__max-height {
        max-height: 20px;
      }

      &-sqm {
        text-align: left;
        width: 100%;
        margin-right: 0;
        font-size: 0.875rem;
        font-weight: 500;
        line-height: 14px;
        color: $blue-dark;
        padding: 5px 0 1px;

        @include media-breakpoint-down(sm) {
          text-align: center;
        }
      }

      &__old-price.product-card__price__old-price.product-card__price__old-price {
        padding-bottom: 5px;
        padding-left: 0;

        @include media-breakpoint-down(sm) {
          text-align: center;
        }
      }

      &-value.product-card__price-value.product-card__price-value.product-card__price-value {
        padding: 0;
        line-height: 24px;

        @include media-breakpoint-down(sm) {
          text-align: center;
        }
      }
    }

    &__reviews-v2 {
      @include media-breakpoint-down(sm) {
        display: flex;
        justify-content: center;
      }
    }
  }
}

@include media-breakpoint-up(lg) {
  .sort-products-list {
    &__section {
      @include make-col(4);
    }

    &__pagination {
      .pagination_tablet {
        display: none;
      }
    }

    .form-row {
      margin-bottom: 0;
    }

    .ddn {
      display: inline-block;
      width: 200px;
    }
  }

  .products-list {
    .card {
      @include make-col(4);
    }
  }
}

@include media-breakpoint-only(md) {
  .products-list-page {
    .left-aside {
      @include make-col(4);
    }

    .content {
      @include make-col(8);
    }

    .banner {
      min-height: 310px;
    }
  }

  .sort-products-list {
    &__section {
      @include make-col(6);
      color: $black;
      border: 0;

      > .form-row {
        margin-bottom: 0;
      }
    }

    &__pagination {
      margin-top: 20px;

      .pagination {
        &:not(.pagination_tablet) {
          display: none;
        }
      }
    }
  }

  .products-list {
    .card {
      @include make-col(6);
    }
  }
}

@include media-breakpoint-up(md) {
  .sort-products-list {
    .open-filters-btn {
      display: none;
    }
  }

  .products-list {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;

    .product-card__price {
      .product-card__price-value {
        .product-card__price-from {
          float: left;
        }
      }
    }

    .card {
      @include make-col-ready;
    }

    &-page {
      .srp-injected {
        &__content {
          text-align: center;
        }
      }
    }
  }

  .load-more-wrap {
    max-width: 147px;
    margin: 0 auto;
  }
}

@include media-breakpoint-down(md) {
  .sort-products-list {
    &__pagination {
      @include make-col(12);
      order: 2;
    }
  }

  .is-hidden {
    display: none;
  }
}

@include media-breakpoint-down(sm) {
  .products-list-page {
    .page-header {
      border: 0;
      padding: 0;
    }

    .color-pick {
      &__header,
      &__wrap {
        margin-bottom: 1rem;
        display: block;
      }

      &__header {
        text-align: center;
      }

      &__line {
        &-top,
        &-bottom {
          display: flex;
        }
      }

      &__color {
        height: 35px;
        width: 50px;
        display: inline-block;

        &s {
          flex-direction: column;
        }

        &-active {
          transform: rotateX(180deg) scale(1.25);
          transition: 0.4s;
          transform-style: preserve-3d;
          box-shadow: -1px 0 5px -1px $black;
        }
      }

      &__line {
        &-top {
          width: 100%;

          .color-pick {
            &__color {
              width: inherit;

              &:first-child {
                border-top-left-radius: $color-bar-radius;
                border-bottom-left-radius: $color-bar-radius;
              }

              &:last-child {
                border-top-right-radius: $color-bar-radius;
                border-bottom-right-radius: $color-bar-radius;
              }
            }
          }
        }

        &-bottom {
          margin: 0 auto;
          width: 85%;

          .color-pick {
            &__color {
              width: 100%;

              &:first-child {
                border-bottom-left-radius: $color-bar-radius;
              }

              &:last-child {
                border-bottom-right-radius: $color-bar-radius;
              }
            }
          }
        }
      }
    }
  }

  .sort-products-list {
    margin: 0;

    &__pagination {
      .pagination_tablet {
        display: none;
      }
    }

    &__items-per-page {
      .form-row {
        display: none;
      }
    }

    .form-row {
      padding: 0;
    }
  }

  .filter-results {
    &__actions.filter-results__actions {
      padding: 5px 0;
    }
  }

  .srp-injected {
    &__content {
      padding: 1.25em 0.75em;
    }
  }
}

//minified notification component styles start
.notification {
  padding: 8px 40px;
  border: 1px solid;
  position: relative;
  line-height: 1.57143;

  &__icon {
    position: absolute;
    left: 8px;
    top: 7px;
    font-size: 1rem;
  }

  &__close {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 0.875rem;
    color: $warm-grey;
    cursor: pointer;

    &_white {
      color: $white;
    }
  }

  &__hide {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 0.875rem;
    color: $warm-grey;
    cursor: pointer;
  }

  &_success {
    color: $green;
    border-color: $green;
    background: $green-transparent5;
    font-weight: 500;
  }

  &_warning {
    border-color: $yellow;
    background: $yellow-transparent5;
    font-weight: 500;

    .notification__icon {
      color: $yellow;
    }
  }

  &_reminder {
    color: $white;
    background: $warm-grey;
    width: 100%;
  }

  &_error {
    color: $red;
    border-color: $red;
    background: $red-transparent5;
    font-weight: 500;

    .notification__icon {
      color: $red;
      display: flex;
      justify-content: center;
      align-items: center;
      align-content: center;
    }
  }

  &_general {
    margin-bottom: 40px;

    @include media-breakpoint-down(sm) {
      margin-bottom: 30px;
    }
  }

  &_app {
    position: relative;
    padding: 5px 15px;
    color: $white;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 0;
    text-align: left;

    &-error {
      background-color: $app-error;
    }

    &-success {
      background-color: $green;
    }

    &:nth-child(2) {
      border-top: 2px solid $white;
    }

    .notification__close {
      top: 4px;
      right: 4px;
      color: $white;
    }
  }
}

//minified notification component styles end

//minified autocomplete component styles start
.autocomplete {
  .twitter-typeahead {
    width: 100%;
  }

  &__menu {
    width: 100%;
    background: $white;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 1px 2px 0 $black-transparent30;
  }

  &__dataset {
    padding: 0 15px;
  }

  &__dataset-suggestions {
    .autocomplete__suggestion {
      display: block;
      line-height: 2rem;
      color: $gray-dark;
      text-decoration: none;

      &:hover,
      &.autocomplete__cursor {
        color: $blue;
      }

      &:first-child {
        margin-top: 10px;
      }

      &:last-child {
        margin-bottom: 10px;
      }
    }
  }

  &__dataset-products {
    .autocomplete__suggestion {
      padding: 10px 0;
      border-bottom: 1px solid $gray-light;

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

      &:hover,
      &.autocomplete__cursor {
        .autocomplete__suggestion-title {
          color: $blue;
        }
      }
    }
  }

  &__dataset-header {
    @include primary-text;
    position: relative;
    padding-top: 10px;

    &::before {
      content: '';
      background: $gray-light;
      position: absolute;
      height: 1px;
      top: 0;
      left: -15px;
      right: -15px;
    }
  }
}

@include media-breakpoint-down(sm) {
  .autocomplete {
    &__menu {
      max-height: 50vh;
      overflow-y: auto;
    }
  }
}

//minified autocomplete component styles end

//minified card component styles start
.card {
  flex-direction: row;
  margin-bottom: 30px;

  &.descr--normal {
    .product-card__description .card_offer_text {
      color: $gray-dark;
    }
  }
}

.card__inner {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  background-color: $white;
  border: 1px solid $gray;

  .card_filled &,
  .card_horizontal &,
  .component_filled {
    border: 0;
  }

  .card_filled &,
  .card_horizontal & {
    background: $gray-light;
  }

  .card_filled & {
    text-align: center;
  }

  .card_horizontal & {
    @include media-breakpoint-up(md) {
      //@include make-row;
      flex-direction: row;
      padding: 30px 15px;
    }
  }

  .card__img {
    border-bottom: 1px solid $gray;
  }

  .is-secondary & {
    flex-direction: row;
    border-left: 0;
    border-right: 0;

    @include media-breakpoint-up(sm) {
      flex-direction: column;
      border-left: 1px solid $gray;
      border-right: 1px solid $gray;
    }

    .product-card__wrap,
    .card__img-wrap {
      width: 50%;

      @include media-breakpoint-up(sm) {
        width: auto;
      }
    }

    .card__img {
      @include media-breakpoint-down(sm) {
        padding-top: 15px;
        padding-bottom: 10px;
        display: block;
        border-bottom: 0;
      }
    }
  }

  &.background-image {
    // sass-lint:disable no-url-domains
    // sass-lint:disable no-url-protocols
    background-image: url('https://media.wickes.co.uk/is/image/wickes/2018-Black-friday-BG-TEXTURE');
    background-position: center;

    @include media-breakpoint-down(sm) {
      padding-top: 20px;
    }
  }
}

.card__offers {
  @include badges;

  .full-width-offers & {
    width: 100%;
  }

  &-item {
    @include badge;

    &_new {
      background-color: $green-light;
    }

    &_clearance {
      background-color: $yellow;
      color: $gray-dark;
    }

    &_ends {
      background-color: $gray-dark-transparent75;
      font-size: 0.75rem;
      font-weight: 500;
      line-height: 14px;
    }

    &_discount-old-price {
      text-decoration: line-through;
      display: inline-block;
    }
  }
}

.card__img-wrap {
  flex-shrink: 0;
  position: relative;

  .card_horizontal & {
    @include media-breakpoint-up(md) {
      @include make-col-ready;
    }
    @include media-breakpoint-only(md) {
      @include make-col-ready;
      @include make-col(6);
    }
    @include media-breakpoint-up(lg) {
      @include make-col(3);
    }
  }

  .card_horizontal.large & {
    @include media-breakpoint-up(md) {
      @include make-col-ready;
    }
    @include media-breakpoint-only(md) {
      @include make-col-ready;
      @include make-col(6);
    }
    @include media-breakpoint-up(lg) {
      @include make-col(4);
    }
  }
}

.card__img {
  max-width: 100%;
  width: 100%;
}

//minified card component styles end

//minified product-card component styles start
.product-card {
  .card__inner {
    &:hover {
      border-color: $blue;
    }
  }

  .card__actions {
    margin-top: 0;
  }

  .card__action-link {
    font-weight: 500;
  }

  .color-slider-container {
    width: 160px;
  }
}

.product-card__content {
  padding: 10px 15px 0;
}

.product-card__description {
  padding: 10px 15px 0;

  .card_offer_text {
    color: $red;
  }
}

.product-card__description.no-flex {
  flex: 0;
}

.product-card__title {
  margin-bottom: 10px;
  color: $blue;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.25rem;

  &:hover {
    color: $blue;
  }
}

.product-card__reviews,
.filter__reviews {
  color: $warm-grey;
  font-size: 0.75rem;
  line-height: 16px;
  margin-top: 10px;

  + .card__descr {
    margin-top: 10px;
  }

  .product-rating {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 1em;

    .rating-bg {
      color: $gray;
      position: relative;
      padding-right: 5px;
      display: flex;
      line-height: 0;
    }

    .rating-overlay {
      color: $yellow;
      position: absolute;
      left: 0;
      top: 0;
      display: flex;
    }

    .star-overlay {
      display: inline-block;
      overflow: hidden;

      & + .star-overlay {
        margin-left: 6px;
      }
    }
  }
}

.filter__reviews {
  font-size: 0.875rem;
  margin: 0;
  transform: translateY(3px);

  .rating-bg {
    display: flex;

    .fa-star {
      display: block;
      margin-right: 4px;
    }

    .rating-overlay {
      display: flex;

      .star-overlay {
        display: block;
        margin: 0;
      }
    }
  }
}

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .product-card__reviews {
    .product-rating {
      .rating-bg {
        display: block;
      }

      .rating-overlay {
        height: 14px;
        display: block;
      }
    }
  }

  .product-card__description {
    &.no-flex {
      flex: none;
    }
  }
}

.product-card__price {
  margin: 10px 15px;
}

.product-card__lower-quantity {
  color: $red;
  font-weight: bold;
}

.product-card__bad-quantity {
  color: $red;
}

.product-card__price-value {
  color: $blue-dark;
  font-size: 1.625rem;
  font-weight: bold;
  line-height: 36px;

  .product-card__price-from {
    font-size: 0.7em;
    margin-right: 4px;
  }

  .product-card__price_sale & {
    color: $red;
  }

  .product-card__price_out-of-stock & {
    color: $warm-grey;
  }
}

.product-card__price__old-price,
.product-card__price__out-of-stock {
  color: $warm-grey;
  font-weight: 500;
  line-height: 14px;
}

.product-card__price__old-price {
  text-decoration: line-through;
  text-decoration-color: $line-through;

  s {
    text-decoration: line-through;
    text-decoration-color: $line-through;
  }
}

//minified product-card component styles end

@include media-breakpoint-down(sm) {
  .products-list-v2 .product-card {
    &__delivery {
      text-align: center;
    }
  }
}
