@import '../helpers/helpers';

.order-item {
  margin-bottom: 20px;
  padding: 15px;
  background: $gray-bg;

  &__image {
    max-width: 105px;
    float: left;
    margin-right: 15px;
    margin-bottom: 15px;

    & img {
      width: 105px;
      height: 105px;
    }
  }

  &__title {
    text-decoration: none;
    font-weight: 500;
    color: $gray-dark;
  }

  &__product {
    min-height: 105px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  &__code {
    white-space: nowrap;

    & .product-code {
      display: inline-block;
      background-color: $white;
      font-size: .75rem;
      line-height: 1.25rem;
      border-left: 2px solid $gray;

      &-number {
        font-weight: 500;
      }
    }
  }

  &__offers {
    margin-top: 15px;
  }

  &__promo {
    font-size: .75rem;
    line-height: 1rem;
    color: $red;
    font-weight: 500;
  }

  &__cost {
    position: relative;
  }

  &__quantity {
    margin-top: 15px;
    display: flex;
    align-items: center;

    &-title {
      width: 105px;
      margin-right: 15px;
    }

    &-control {
      display: inline-flex;
      align-items: flex-end;
      flex-direction: row;
      justify-content: flex-end;
    }

    &-btn {
      width: 32px;
      height: 32px;
      padding: 0;
      background-color: $white;
      color: $blue;
      border: 0;

      & .btn__text {
        font-size: 1.125rem;
      }

      &:first-of-type {
        border-radius: 3px 0 0 3px;
      }

      &:last-of-type {
        border-radius: 0 3px 3px 0;
      }

      &:disabled {
        border: 0;
        opacity: 1;
      }
    }

    &-label {
      position: relative;
      margin: 0;
      width: 32px;
    }

    &-value {
      text-align: center;
      width: 32px;
      height: 32px;
      border-radius: 0;
      border: 0;
      padding: 5px 0;
      font-weight: 500;

      //rules for hiding arrows for input type number
      -moz-appearance: textfield;

      &::-webkit-outer-spin-button,
      &::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
      }

      &.tbx {
        font-size: 1rem;

        &:disabled {
          background: $white;
        }
      }
    }
  }

  &__quant,
  &__price,
  &__price-m,
  &__total {
    display: flex;
    align-items: center;
    margin-top: 15px;

    &-title {
      width: 105px;
      margin-right: 15px;
    }

    &-value {
      font-weight: 500;
      line-height: 1;
    }
  }

  &__total {
    &-value {
      font-size: 1.25rem;
    }
  }

  &__remove {
    bottom: 0;
    right: 0;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    background: $white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: $blue;
    padding: 0;

    & .btn__text {
      font-size: 1rem;
    }
  }

  &__actions {
    margin-top: 20px;
  }

  &__action {
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid $gray;
    border-radius: 3px;
    background: $white;

    &.disabled {
      pointer-events: none;
    }

    label {
      display: block;
    }

    &-selected:not(.disabled) {
      border-color: $blue;

      & label {
        font-weight: 500;
      }
    }

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

  &__offers {
    margin-top: 20px;
  }

  &__delivery {
    display: flex;
    margin-top: 15px;
    padding: 10px 5px;
    background: $gray-bg;

    &-type {
      font-weight: 500;
    }

    &-icon {
      font-size: 1.25rem;
      color: $blue;
      margin-right: 5px;
    }
  }

  &__wisdom {
    background: $white;
    padding: 20px;
    margin-top: 15px;

    &-close {
      margin-bottom: 8px;
      text-align: right;
      font-size: 1rem;
    }

    &-hide {
      display: none;
    }
  }

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

  .price-vat {
    margin-left: .4em;
  }
}

.basket {
  &__section {
    &[data-type='Delivery'] {
      .cc-order {
        display: none;
      }
    }
  }

  .order-item {
    &__value {
      color: $blue-dark;
    }
  }
}

@include media-breakpoint-up(md) {
  .order-item {
    &__main {
      display: grid;
      grid-template-columns: 190px 1fr 1fr;
      grid-template-rows: 1fr 40px;
    }

    &__image {
      grid-column: 1/span 1;
      grid-row: 1/span 2;
      max-width: none;
      float: none;
      margin-bottom: 0;

      & img {
        width: 175px;
        height: 175px;
      }
    }

    &__info {
      grid-column: 2/span 1;
      grid-row: 1/span 1;
      padding-right: 15px;
      padding-bottom: 15px;
    }

    &__cost {
      grid-column: 3/span 1;
      grid-row: 1/span 1;
      padding-left: 10px;
      padding-bottom: 15px;
    }

    &__actions {
      grid-column: 2/span 2;
      grid-row: 2/span 1;
      margin: 0;
      display: grid;
      grid-template-columns: 1fr 1fr;
      grid-gap: 15px;
    }

    &__title {
      margin-bottom: 20px;
      font-size: 1rem;
    }

    &__action {
      margin: 0;
    }

    &__product {
      min-height: auto;
    }

    &__quantity {
      margin-top: 0;
    }

    &__quant,
    &__quantity,
    &__price,
    &__price-m,
    &__total {

      &-title {
        width: 90px;
        margin-right: 0;
      }
    }

    &__remove {
      top: 0;
      right: 0;
      bottom: auto;
    }

    &__delivery {
      align-items: center;
      padding: 10px;

      &-message {
        font-size: 1rem;
      }
    }
  }
}

@include media-breakpoint-only(lg) {
  .order-item {
    &__main {
      grid-template-columns: 160px 1fr 1fr;
    }

    &__image {
      img {
        width: 145px;
        height: 145px;
      }
    }

    &__title {
      margin-bottom: 15px;
    }

    &__info {
      padding-right: 10px;
      padding-bottom: 5px;
    }

    &__remove {
      right: -5px;
    }

    &__cost {
      padding-left: 5px;
      padding-bottom: 0;
    }

    &__actions {
      grid-gap: 10px;
    }

    &__quant,
    &__price,
    &__price-m,
    &__total {
      margin-top: 10px;
    }

    &__quant,
    &__quantity,
    &__price,
    &__price-m,
    &__total {
      &-title {
        width: 80px;
      }
    }
  }
}

@include media-breakpoint-up(lg) {
  .order-item {
    &__delivery {
      border-top: 2px dotted $border-grey;
      padding: 10px 0;
      margin-bottom: -20px;
      background: transparent;
    }
  }
}

@include media-breakpoint-up(xl) {
  .order-item {
    &__quant,
    &__quantity,
    &__price,
    &__price-m,
    &__total {
      &-title {
        width: 105px;
      }
    }
  }
}
