@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 {
    &__image {
      margin-bottom: 20px;

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

    &__content {
      font-size: 16px;
      font-weight: 500;
      line-height: 1.5;
      padding: 1em 1.25em;
      border: 2px solid $blue;
      margin-bottom: 20px;
      text-align: center;

      p {
        margin: 0;
      }
    }
  }

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

.sort-products-list {
  @include make-row;
  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;
  }
}

.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;
      }
    }
  }
}

//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: .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;
    }

    &: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;

        @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;
      }
    }
  }

  .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 {
        margin-top: 5px;
        font-size: .875rem;
        font-weight: 700;
        line-height: 18px;

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

    &__title {
      margin-bottom: 0;
    }

    &__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: .875rem;

      & .fa-star {
        margin-right: 2px;
      }

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

    &__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: .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);
    }

    &__pagination {
      .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;
    }
  }
}

@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: .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 {
    &__pagination {
      .pagination_tablet {
        display: none;
      }
    }

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

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

  .srp-injected {
    &__content {
      padding: 1.25em .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: .875rem;
    color: $warm-grey;
    cursor: pointer;

    &_white {
      color: $white;
    }
  }

  &__hide {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: .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: .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 {
  color: $warm-grey;
  font-size: .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;
    }

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

    }

    .star-overlay {
      display: inline-block;
      margin-right: 2px;
      overflow: hidden;
    }
  }

}

@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: .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
