@import './../../../../sources/styles/include.scss';

$component: 'widget';
$template: 'products-5';

.widget.c-#{$component}.c-#{$component}-#{$template} {
  display: block;
  z-index: 0;

  .widget-content {
    position: relative;
  }

  .widget-tabs {
    margin-left: -15px;
    margin-right: -15px;
  }

  .widget-footer {
    &[data-type='tabs'] {
      position: absolute;
      top: 0;
      right: 0;
      padding: 12px 0;

      .widget-footer-button {
        display: block;
        font-size: 12px;
        font-weight: 500;
        line-height: 1;
        color: #808080;
        text-transform: uppercase;
        text-decoration: none;
        letter-spacing: 0.1em;
      }
    }
    &[data-type='default'] {
      .widget-footer-button {
        color: #2d2d2d !important;

        &:hover,
        &:active {
          color: #FFF !important;
        }
      }
    }
  }

  .widget-sections {
    margin: -15px 0;
  }

  .widget-section {
    padding: 15px 0;
  }

  .widget-section-name {
    margin-bottom: 20px;
    text-align: left;

    &[data-align="center"] {
      text-align: center;
    }

    &[data-align="right"] {
      text-align: right;
    }
  }

  .widget-fields {
    padding: 20px 30px;
    font-size: 10px;
    line-height: 14px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #B0B0B0;
    border: 1px solid #F7F7F7;
    border-bottom: none;
    word-break: break-word;
    @include border-radius(4px 4px 0 0);

    @media all and (max-width: 900px) {
      display: none;
    }
  }

  .widget-fields-properties, .widget-fields-quantity-wrap, .widget-fields-price-wrap {
    text-align: left;
  }

  .widget-fields-name-properties {
    margin-top: 4px;
  }

  .widget-fields-name-property {
    font-size: 10px;
    line-height: 14px;
    font-weight: 400;
  }

  .widget-items {
    z-index: 0;
  }

  .widget-item {
    &:hover {
      .widget-item-quick-view {
        display: block;
      }
    }

    &[data-available="false"] {
      .widget-item-additional {
        opacity: 0;
      }

      @media all and (max-width: 900px) {
        .widget-item-additional-wrap {
          display: none;
        }
      }
    }

    &:last-child .widget-item-background {
      border-bottom: 1px solid #F7F7F7;
    }
  }

  .widget-item-background {
    border: 1px solid #F7F7F7;
    border-bottom: none;
    @include transition(0.5s, box-shadow);

    &:hover {
      box-shadow: 0 0 20px rgba(0,0,0,0.15);
      -moz-box-shadow: 0 0 20px rgba(0,0,0,0.15);
      -o-box-shadow: 0 0 20px rgba(0,0,0,0.15);
      -webkit-box-shadow: 0 0 20px rgba(0,0,0,0.15);
    }
  }

  .widget-item-wrapper {
    padding: 20px 30px;
  }

  .widget-item-header {
    margin-bottom: 16px;
  }

  .widget-item-name, .widget-fields-name {
    flex-basis: 100%;
    max-width: 300px;

    @media all and (max-width: 900px) {
      margin-bottom: 22px;
      max-width: initial;
      order: 1;
    }
  }

  .widget-item-name-wrapper {
    font-weight: 500;
    font-size: 14px;
    line-height: 19px;
    color: #1B1E25;
    cursor: pointer;
    text-decoration: none;
    @include transition(0.4s, color);
  }

  .widget-item-name-properties {
    margin-top: 8px !important;
  }

  .widget-item-name-property {
    font-size: 12px;
    line-height: 16px;
  }

  .widget-item-name-property-name {
    display: none;
    color: #B0B0B0;
  }

  .widget-item-name-property-value {
    color: #404040;
    max-width: 300px;
  }

  .widget-item-quantity-wrap, .widget-fields-quantity-wrap {
    margin-left: auto;
    flex-basis: 100%;
    max-width: 140px;

    @media all and (max-width: 900px) {
      margin-bottom: 28px;
      max-width: initial;
      order: 2;
    }
  }

  .widget-item-quantity {
    font-size: 14px;
    line-height: 20px;
    font-weight: normal;
    color: #1B1E25;
    text-align: left;
    white-space: nowrap;
  }

  .widget-item-quantity-value {
    @media all and (max-width: 900px) {
      display: flex;
    }

    & div:first-child {
      @media all and (max-width: 900px) {
        padding-right: 8px;
      }
    }
  }

  .widget-item-quantity-icon {
    margin-right: 8px;
    top: -2px;
    height: 6px;
    width: 6px;
    @include border-radius(50%);
  }

  .widget-item-quantity-available {
    background: #24B779;
  }

  .widget-item-quantity-few {
    background: #F4BB28;
  }

  .widget-item-quantity-unavailable {
    background: #B0B0B0;
  }

  .widget-item-vote {
    margin-top: 8px;
    text-align: left;

    & .ns-bitrix.c-iblock-vote.c-iblock-vote-template-1 .iblock-vote-rating-item {
      font-size: 12px;
      padding: 0 3px;
    }
  }

  .widget-item-description {
    margin: 16px 0 24px 0;
    max-height: 105px;
    max-width: 800px;
    font-size: 14px;
    line-height: 1.5;
    color: #404040;
    overflow: hidden;
  }

  .widget-item-properties-wrap, .widget-fields-properties-wrap {
    flex-basis: 100%;

    @media all and (max-width: 900px) {
      margin-bottom: 28px;
      order: 3;
    }
  }

  .widget-item-property {
    @media all and (max-width: 900px) {
      width: auto;
      flex-basis: auto;

      &[data-empty="true"] {
        display: none;
      }
    }
  }

  .widget-item-property-name {
    display: none;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.1em;
    color: #B0B0B0;
    text-transform: uppercase;

    @media all and (max-width: 900px) {
      display: block
    }
  }

  .widget-item-property-value {
    font-size: 14px;
    line-height: 14px;
    text-align: left;
    color: #1B1E25;
    word-break: break-word;

    @media all and (max-width: 900px) {
      text-align: left;
    }
  }

  .widget-item-price {
    display: block;
    text-align: left;

    &[data-show="false"] {
      display: none;
    }

    &[data-discount="true"] {
      .widget-item-price-base {
        display: flex;
      }
    }

    &[data-discount='false'] {
      .widget-item-price-percent-container {
        display: none;
      }
    }

    @media all and (max-width: 900px) {
      text-align: left;
    }
  }

  .widget-item-price-wrap, .widget-fields-price-wrap {
    margin-left: auto;
    flex-basis: 100%;
    max-width: 150px;

    @media all and (max-width: 900px) {
      max-width: fit-content;
      order: 4;
      margin-bottom: 0;
      margin-left: initial;
      margin-top: 0;
    }
  }

  .widget-item-price-range-items {
    position: absolute;
    padding: 28px;
    z-index: 1;
    left: -140px;
    top: -20px;
    @include border-radius(4px);
    opacity: 0;
    background: #FFFFFF;

    -webkit-box-shadow: 0 16px 32px rgba(27, 30, 37, 0.1);
    -moz-box-shadow: 0 16px 32px rgba(27, 30, 37, 0.1);
    box-shadow: 0 16px 32px rgba(27, 30, 37, 0.1);

    pointer-events: none;
    @include user-select(none);
    @include transition (350ms, opacity);

    @media all and (max-width: 900px) {
      width: max-content;
      left: 80px;
    }
  }

  .widget-item-price-discount-wrapper:hover .widget-item-price-range-items {
    opacity: 1;
    pointer-events: initial;
    -webkit-user-select: initial;
    -moz-user-select: initial;
    -ms-user-select: initial;
    user-select: initial;
  }

  .widget-item-price-range-items-title {
    margin-bottom: 12px;
    font-size: 10px;
    line-height: 10px;
    font-weight: normal;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    color: #B0B0B0;
  }

  .widget-item-price-range-item {
    margin-top: 12px;
  }

  .widget-item-price-range-quantity {
    margin-right: 16px;
    font-size: 12px;
    line-height: 12px;
    font-weight: normal;
    color: #404040;
  }

  .widget-item-price-range-value {
    font-size: 12px;
    line-height: 12px;
    font-weight: 500;
    color: #404040;
  }

  .widget-item-price-discount {
    font-size: 16px;
    line-height: 16px;
    font-weight: bold;
    color: #1B1E25;

    @media all and (max-width: 900px) {
      font-size: 18px;
    }
  }

  .widget-item-price-discount-title {
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    color: #808080;
  }

  .widget-item-price-discount-wrapper {
    display: inline-block;
    padding-bottom: 4px;
    border-bottom: 1px dashed transparent;
    position: relative;
    top: 4px;
  }

  .widget-item-price[data-range="false"] .widget-item-price-discount-wrapper {
    border-color: transparent !important;
  }

  .widget-item-price[data-range="true"] .widget-item-price-discount-wrapper {
    padding-bottom: 4px;
    border-color: #B0B0B0;
    cursor: pointer;
    @include transition(350ms, border-color);
  }

  .widget-item-price-base {
    display: none;
    margin-top: 8px;
    font-size: 12px;
    line-height: 12px;
    color: #808080;
  }

  .widget-item-price-base-wrapper {
    margin-right: 8px;
    text-decoration: line-through;
  }

  .widget-item-price-percent-container {
    font-size: 0;
    line-height: 0;
    margin-top: 8px;
  }

  .widget-item-price-percent {
    display: inline-block;
    border: 1px solid #F4BB28;

    @include border-radius(2px);

    & > div {
      display: inline-block;
      vertical-align: middle;
    }
  }

  .widget-item-price-percent-part {
    display: inline-block;
    vertical-align: middle;
  }

  .widget-item-price-percent-value,
  .widget-item-price-percent-difference {
    font-size: 11px;
    font-weight: 600;
    line-height: 12px;
    color: #404040;
  }

  .widget-item-price-percent-value {
    padding: 3px 4px;
    background-color: #F4BB28;
  }

  .widget-item-price-percent-difference {
    padding-left: 4px;
    padding-right: 4px;
  }

  .widget-item-price-percent-decoration {
    padding-right: 6px;

    svg {
      display: inline-block;
      width: auto;
      height: auto;
      max-width: 10px;
      max-height: 10px;

      path {
        stroke: #404040;
      }
    }
  }

  .widget-item-price-total {
    @media all and (max-width: 768px) {
      display: none;
    }
  }

  .widget-item-price-total-caption {
    font-size: 12px;
    line-height: 16px;
    color: #808080;
  }

  .widget-item-price-total-value {
    margin-top: 4px;
    font-weight: bold;
    font-size: 20px;
    line-height: 27px;
    color: #1B1E25;
  }

  .widget-item-offers-wrap {
    margin-top: 12px;

    @media all and (max-width: 900px) {
      margin-top: 18px;
    }
  }

  .widget-item-offers-property {
    &[data-visible="false"] {
      display: none !important;
    }
  }

  .widget-item-offers-property-wrapper {
    @media all and (max-width: 900px) {
      display: block;
      margin: 0;
    }
  }

  .widget-item-offers-property-name {
    font-size: 10px;
    font-weight: 500;
    line-height: 10px;
    color: #B0B0B0;
    padding-top: 10px;
    padding-bottom: 10px;
    margin-right: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .widget-item-offers-property-values {
    font-size: 0;
    margin: -4px;

    @media all and (max-width: 900px) {
      margin: 0;
    }
  }

  .widget-item-offers-property-value {
    display: inline-block;
    margin: 4px;
    border: 2px solid #F7F7F7;
    vertical-align: middle;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    @include border-radius(6px);

    @include user-select(none);

    -webkit-transition: border-color 0.4s, opacity 0.4s;
    -moz-transition: border-color 0.4s, opacity 0.4s;
    -ms-transition: border-color 0.4s, opacity 0.4s;
    -o-transition: border-color 0.4s, opacity 0.4s;
    transition: border-color 0.4s, opacity 0.4s;

    &[data-state='selected'] {
      border-color: #B0B0B0;
    }

    &[data-state='disabled'] {
      border-color: transparent!important;
      opacity: 0.3;
      cursor: not-allowed;
    }

    &[data-state='hidden'] {
      display: none;
    }

    [data-type='text'] {
      font-size: 14px;
      line-height: 14px;
      color: #1B1E25;;
      padding: 6px 12px;
      background-color: #F7F7F7;
    }

    [data-type='picture'] {
      width: 26px;
      height: 26px;
      background-size: cover;
      background-repeat: no-repeat;
      background-position: center;
    }
  }

  .widget-item-purchase-wrapper {
    @media all and (max-width: 440px) {
      margin: 0 auto;
      margin-top: 20px;
      width: 160px;
      max-width: 160px;
    }
  }

  .widget-item-purchase-wrap {
  }

  .widget-item-ratio {
    margin-right: 24px;
    font-size: 12px;
    text-align: left;
    color: #808080;

    @media all and (max-width: 400px) {
      margin-right: 8px;
      white-space: nowrap;
    }
  }

  .widget-item-buttons-wrap, .widget-fields-buttons-wrap {
    flex-basis: 100%;
    max-width: 168px;

    @media all and (max-width: 900px) {
      max-width: fit-content;
      order: 5;
      margin-top: 18px;
      margin-bottom: 18px;
    }

  }

  .widget-item-action-buttons {
    display: block;
    font-size: 0;
    text-align: right;
    @include transition(350ms, opacity);
  }

  .widget-item-action-button {
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
    font-size: 18px;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    color: #808080;
    fill: #808080;
    background: transparent !important;
    padding: 11px;
    width: 20px;
    height: 20px;
    text-align: center;
    border: 1px solid #E8E8E8;
    @include border-radius(4px);
    cursor: pointer;

    @include transition(350ms, color);

    -webkit-box-sizing: content-box;
    -moz-box-sizing: content-box;
    box-sizing: content-box;

    svg {
      @include transition(350ms, fill);
    }

    &.inactive {
      opacity: 0.3;
      cursor: default;
    }

    &:first-child {
      margin-left: 0;
    }

    @media all and (max-width: 1000px) {
      opacity: 0.85;
    }

    @media all and (max-width: 425px) {
      padding: 8px;
      font-size: 16px;
      line-height: 24px;
      background: transparent;
    }

    &.widget-item-action-button-compare[data-compare-state="added"],
    &.widget-item-action-button-compared {
      display: none;
    }

    &.widget-item-action-button-compared[data-compare-state="added"] {
      display: inline-block;
      margin-left: 0;
    }

    &.widget-item-action-button-delay[data-basket-state="delayed"],
    &.widget-item-action-button-delayed {
      display: none;
    }

    &.widget-item-action-button-delayed[data-basket-state="delayed"] {
      display: inline-block;
    }
  }

  .widget-item-additional-wrap {
    display: none;
    padding: 20px;
    border-top: 1px solid #F7F7F7;

    @media all and (max-width: 900px) {
      display: block;
    }
  }

  .widget-item-counter {
    text-align: center;

    @media all and (max-width: 768px) {
      display: none;
    }
  }

  .widget-item-order-buttons {
    text-align: center;
  }

  .widget-item-order-button {
    width: 42px;
    padding: 11px 0;
    font-size: 20px;
    font-weight: normal;
    line-height: 1;
    color: #808080;
    fill: #808080;
    background: transparent !important;
    height: 20px;
    text-align: center;
    border: 1px solid #E8E8E8;
    @include border-radius(4px);
    cursor: pointer;
    @include transition(350ms, color);
    -webkit-box-sizing: content-box;
    -moz-box-sizing: content-box;
    box-sizing: content-box;

    svg {
      @include transition(350ms, fill);
    }

    @media all and (max-width: 425px) {
      padding: 8px 0;
      width: 84px;
      font-size: 18px;
    }

    &.widget-item-order-button-add[data-basket-state="added"],
    &.widget-item-order-button-added {
      display: none;
    }

    &.widget-item-order-button-added[data-basket-state="added"] {
      display: inline-block;
    }

    &.widget-item-order-button-toggle {
      display: none;

      &.active {
        display: block;
      }

      @media all and (max-width: 900px) {
        display: none !important;
      }
    }

    &.widget-item-order-button-toggle[data-toggle="open"][data-basket-state="added"],
    &.widget-item-order-button-toggle[data-toggle="open"].added {
      display: none;
    }

    &.widget-item-order-button-toggle[data-toggle="open"][data-basket-state="added"].added.active {
      display: block;
    }

    &.widget-item-order-button-subscribe.disabled {
      opacity: 0.3;
      color: #808080 !important;
      cursor: default;
    }
  }

  .widget-item-purchase-buttons {
    text-align: center;
  }

  .widget-item-purchase-button {
    padding: 16px 30px;
    font-size: 14px;
    line-height: 16px;
    cursor: pointer;

    &.widget-item-purchase-button-add[data-basket-state="added"],
    &.widget-item-purchase-button-add[data-basket-state="update"],
    &.widget-item-purchase-button-added,
    &.widget-item-purchase-button-update {
      display: none;
    }

    &.widget-item-purchase-button-added[data-basket-state="added"],
    &.widget-item-purchase-button-update[data-basket-state="update"] {
      display: block;
    }

    svg {
      margin-right: 4px;
      height: 16px;
      width: 16px;
      fill: #FFFFFF;
      vertical-align: middle;
    }
  }

  .widget-item-image {
    z-index: 0;

    .widget-item-image-look {
      position: relative;
      font-size: 0;
      text-align: center;
      width: 100px;
      height: 100px;

      &::after {
        content: '';
        display: inline-block;
        vertical-align: middle;
        width: 0;
        height: 100%;
        overflow: hidden;
      }

      img {
        display: inline-block;
        vertical-align: middle;
        max-width: 100%;
        max-height: 100%;
        @include border-radius(5px);
        cursor: pointer;
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
      }
    }
  }

  .widget-item-image-wrapper {
    position: relative;
  }

  .widget-item-quick-view {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    visibility: hidden;
    font-size: 0;
    text-align: center;

    @media all and (max-width: 1200px) {
      display: none !important;
    }
  }

  .widget-item-quick-view-button {
    display: inline-block;
    vertical-align: middle;
    visibility: visible;
    line-height: 1;
    padding: 10px;
    font-size: 14px;
    background: #fff;
    border: 1px solid #ccc;
    @include border-radius(50%);
    color: #848790;
    opacity: 0.9;
    cursor: pointer;
  }

  .widget-item-image-marks {
    display: block;
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  .widget-item-image + .widget-item-content {
    padding-left: 20px;

    @media all and (max-width: 768px) {
      padding: 0;
    }
  }

  .widget-item-content {
    @media all and (max-width: 768px) {
      margin-top: 16px;
    }
  }

  .widget-more {
    display: block;
    font-size: 0;
    font-style: normal;
    font-weight: normal;
    text-align: center;
    line-height: 1px;
    margin-top: 30px;

    + .widget-navigation {
      margin-top: 20px;
    }
  }

  .widget-more-button {
    display: inline-block;
    vertical-align: top;
    cursor: pointer;
  }

  .widget-more-icon,
  .widget-more-text {
    display: inline-block;
    vertical-align: middle;
  }

  .widget-more-icon {
    font-size: 16px;
    color: #fff;
    padding: 7px;
    @include border-radius(50%);
    text-align: center;
    height: 16px;
    width: 16px;

    -webkit-box-sizing: content-box;
    -moz-box-sizing: content-box;
    box-sizing: content-box;

    @include transition(350ms, transform);
  }

  .widget-more-text {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.5;
    margin-left: 10px;
  }

  .widget-more-button:hover {
    .widget-more-icon {
      -webkit-transform: rotate(180deg);
      -moz-transform: rotate(180deg);
      -ms-transform: rotate(180deg);
      -o-transform: rotate(180deg);
      transform: rotate(180deg);
    }
  }

  .widget-item {
    &:hover {
      z-index: 1;
    }
  }

  [data-offer] {
    display: none;
  }

  [data-offer="false"] {
    display: block;
  }

  @media all and (max-width: 900px) {
    .widget-item-name-property-value {
      max-width: 200px;
    }
  }
  .widget-header {
    overflow: hidden;
  }
  .widget-all-container {
    display: none;
  }
  .widget-all-button {
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #808080;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;

    i {
      display: none;
      font-size: 18px;
    }
  }

  @media all and (max-width: 768px) {
    .widget-footer {
      &[data-type='tabs'] {
        display: none;
      }
    }
    .widget-all-container {
      display: block;
    }
    .widget-title.align-center.widget-title-margin {
      margin-left: 25px;
    }
    .widget-all-container.mobile {
      text-align: right;
      width: 25px;
      max-height: 36px;
    }
    .widget-all-container i {
      display: inline-block;
    }
    .widget-footer.mobile,
    .widget-footer-button.mobile{
      display: none;
    }
    .widget-all-container {
      width: 25px;
    }
  }
  @media all and (max-width: 500px) {
    .widget-header + .widget-content {
      margin-top: 16px;
    }
  }
}