@import '../helpers/helpers';
@import '../components/barcode';

$voucher-gap: 16px;
$voucher-gap-desktop: 24px;
$voucher-cell-height-lg: 246px;
$voucher-cell-height-xl: 296px;

.text-start {
  text-align: left !important;
}

.page_tradePro-rewards {
  .voucher {
    &__grid {
      display: grid;
      grid-template-columns: repeat(1, 1fr);
      grid-template-rows: auto;
      grid-auto-flow: dense;
      gap: $voucher-gap;

      @include media-breakpoint-up(lg) {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: $voucher-cell-height-lg;
        gap: $voucher-gap-desktop;
      }

      @include media-breakpoint-up(xl) {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: $voucher-cell-height-xl;
        gap: $voucher-gap-desktop;
      }
    }

    &__cell {
      border-radius: $border-radius;

      &:not(.voucher__description) {
        min-height: 240px;

        @include media-breakpoint-up(lg) {
          min-height: $voucher-cell-height-lg;
        }

        @include media-breakpoint-up(xl) {
          min-height: $voucher-cell-height-xl;
        }
      }
    }

    &__column {
      grid-area: auto;
      text-align: center;

      @include media-breakpoint-up(lg) {
        grid-area: 1 / 2 / 3 / 3;
      }

      .voucher__cell {
        border: 1px solid $gray;
        overflow: hidden;

        &:first-child {
          margin-bottom: $voucher-gap;

          @include media-breakpoint-up(lg) {
            margin-bottom: $voucher-gap-desktop;
          }
        }
      }
    }

    &__image-wrap {
      height: 100%;

      img {
        width: 100%;
        height: auto;

        @include media-breakpoint-up(lg) {
          width: auto;
          height: 100%;
        }
      }
    }

    &__barcode-img {
      width: 311px;
      height: 78px;
      margin: auto;

      & > * {
        width: 100%;
        height: 100%;
      }

      @include media-breakpoint-up(lg) {
        width: 261px;
        height: 66px;
      }

      @include media-breakpoint-up(xl) {
        width: 450px;
        height: 114px;
      }
    }

    &__qr-img {
      width: 183px;
      height: 183px;
      margin: auto;

      & > * {
        width: 100%;
        height: 100%;
      }

      @include media-breakpoint-up(md) {
        width: 166px;
        height: 166px;
      }
    }

    &__barcode-number {
      margin-top: 8px;
      word-break: break-word;
    }

    &__label {
      background: $blue-dark;
      color: $white;
      display: block;
      padding: 4px;
      font-size: 0.75rem;
      font-weight: 500;
    }

    &__code-field {
      display: inline-block;
      padding: 8px 16px;
      background: $ma-white;
      border-radius: $border-radius;
      cursor: pointer;
      word-break: break-word;

      input {
        background: none;
        border: 0;
        width: 90px;
        pointer-events: none;
      }

      .icon {
        color: $blue;
      }
    }

    &__code-title {
      margin-right: 8px;
      font-weight: 700;
    }

    &__description {
      &-title {
        font-weight: 700;
        font-size: 1rem;
      }

      &-text {
        font-weight: 400;
        font-size: 0.875rem;
      }

      &-button {
        margin-top: 16px;
      }
    }

    &__content {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      flex: 1;
      padding: 24px 16px;
    }

    &--terms {
      padding: 24px 0 16px;
    }
  }
}

@include media-breakpoint-up(md) {
  .page_tradePro-rewards {
    .voucher {
      &__content {
        padding: 24px;
      }
    }
  }
}
