@import '../helpers/helpers';

.page_checkout-payment-details {
  .lines-group {
    margin-top: 20px;
  }
}

.checkout-payment-details {
  .rbn_align {
    line-height: 1.375em;
  }

  &__payment-method,
  &__card-details {
    &_hidden {
      display: none;
    }
  }

  &__card-details {
    margin-bottom: 20px;
  }

  &__payment-method {
    .checkout-payment-details__row:first-child {
      .checkout-payment-details__descr:first-child {
        margin-bottom: 30px;

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

  &__holder {
    margin: 0 0 30px;
  }

  &__link {
    margin-left: 20px;
    vertical-align: bottom;
  }

  &__paypal-email {
    margin: 10px 0 0 34px;
    font-size: .9rem;

    a {
      margin-left: 10px;
    }
  }

  &__row {
    @include make-row;
  }

  &__title {
    margin-bottom: 20px;
  }

  &__info {
    @include make-col(12);
    flex: 1 0 auto;
    margin-bottom: 0;
  }

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

    &_large {
      @include make-col-ready;
    }

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

  &__card-title {
    @include make-col(12);
    margin-bottom: 30px;
  }

  &__card-heading {
    margin-bottom: 10px;
  }

  &__card-holder {
    margin-bottom: 20px;

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

    @include make-col(12);
  }

  &__card {
    padding: 20px 30px 20px 20px;
    background: $white;
    border: 1px solid $gray;

    .card-warning {
      flex-basis: 100%;
    }
  }

  &__card-content {
    margin-bottom: 20px;

    .row {
      .card__links {
        position: relative;

        .link-secondary {
          display: block;
          text-decoration: none;
          font-weight: 500;

          &:first-child {
            margin-bottom: 15px;
          }
        }
      }
    }
  }

  &__action {
    .btn-secondary,
    .btn-primary {
      display: block;

      & + .btn-secondary {
        margin-top: 20px;
      }

      & + .rbn {
        margin-top: 35px;
      }
    }
  }

  &__card-info {
    margin: 0;
    padding: 0;
    line-height: 1.375rem;
    color: $warm-grey;

    dt {
      color: $gray-dark;
      font-weight: 500;
    }
  }

  &__delete {

    .delete-heading {
      margin: 20px 0 10px;
      font-size: 1.2rem;
    }

    .btn {
      margin-right: 20px;
      padding: 8px 40px;
    }

    .delete-warning {
      display: inline-block;
    }
  }

  .form-row__col-field {
    @include make-col-ready;
  }

  .form-row__action {
    margin-top: 20px;

    .form-row__col-terms {
      @include make-col-ready;
    }

    .btn_full {
      min-width: 145px;
    }
  }

  .link-secondary {
    display: inline-block;
  }

  .form-row__action_normal {
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 40px;

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

    .form-row__col-btn {
      @include make-col-ready;
    }
  }

  &__back-btn {
    @include heading-5;
    @include make-col-ready;
    margin-bottom: 20px;
  }

  &__place-order {
    &_visible {
      // sass-lint:disable no-important
      display: flex !important;
    }
  }

  &__icon {
    pointer-events: none;
  }
}

.checkout-payment-card-ineligible {
  &__excuse {
    font-weight: 700;
  }
}

.confirm-delete {

  .rbn {
    visibility: hidden;
  }
}

.address-data {
  margin: 0;
  padding: 0;
  line-height: 1.375rem;

  &__name,
  &__address1,
  &__address2,
  &__city,
  &__country,
  &__postal-code {
    display: block;
  }
}

.default-mark {
  margin-top: 20px;
  text-align: center;
}

// sass-lint:disable no-qualifying-elements

a.pay-pal_wrap {
  text-decoration: none;

  .paypal-logo {
    padding: 0;
    display: inline-block;
    background: none;
    border: 0;
  }

  .paypal-button > .paypal-logo {
    vertical-align: top;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    text-align: left;
    height: 17px;
    max-height: 21px;
    min-height: 14px;

    &_icon {
      width: 16px;
    }

    &_icon-text {
      width: 60px;
    }
  }

  .paypal-button .paypal-button-text {
    vertical-align: top;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    text-align: left;
    display: inline-block;
    white-space: pre-wrap;
    margin-right: 5px;
  }

  .paypal-button {
    border: 1px solid transparent;
    border-radius: 4px;
    position: relative;
    width: 100%;
    padding: 4px;
    box-sizing: border-box;
    vertical-align: top;
    cursor: pointer;
    overflow: hidden;
    text-align: center;
    background: $orange;
    color: $black-lite;
    height: 40px;

    &:hover {
      filter: brightness(.95);
    }

    & iframe {
      z-index: 1 !important;

      & .paypal-button-row {
        height: 50px;
        min-height: 50px;
        max-height: 50px;
      }
    }
  }

  .paypal-button-container {
    min-width: 200px;
    max-width: 300px;
    font-size: 11px;
  }

  @media (max-width: 767px) and (min-width: 321px) {
    .paypal-button-container {
      min-width: 300px;
      max-width: 500px;
      font-size: 14px;
    }

    .paypal-button > .paypal-logo {
      height: 21px;
      max-height: 27px;
      min-height: 18px;
    }
  }
}

@include media-breakpoint-up(md) {
  .checkout-payment-details {
    .checkout-payment-details__info-holder {
      display: flex;
      width: 100%;
    }

    &__descr {
      @include make-col(7, 9);
      @include make-col-offset(1, 9);
    }

    &__card-content {
      .row {
        .payment-card,
        .billing-address {
          @include make-col(4.5);
        }
      }

      .card__links {
        @include make-col(3);

        .default-mark-full {
          position: absolute;
          bottom: 0;
          left: 45px;
        }
      }
    }

    &__action {
      .btn-secondary,
      .btn-primary {
        min-width: 130px;
      }
    }

    .form-row__col-field {
      @include make-col(2, 5);
    }

    .form-row__action_normal {
      .form-row__col-btn {
        @include make-col(2, 5);
      }
    }

    &__back-btn {
      @include make-col-offset(1, 9);
    }
  }
}

@include media-breakpoint-up(lg) {
  .checkout-payment-details {

    &__info {
      line-height: 2.5rem;
    }

    .checkout-payment-details__col-btn_info {
      min-width: 160px;
    }

    &__descr {
      @include make-col(5, 9);
      @include make-col-offset(2, 9);

      &_large {
        margin-left: 8.33333%;
        margin-right: 8.33333%;
      }
    }

    .form-row__save {
      .form-row__field {
        @include make-col-offset(2, 9);
      }
    }

    &__card {
      flex-wrap: wrap;
      margin-left: 8.33333%;
      margin-right: 8.33333%;
    }

    &__card-content {
      flex: 1 0 auto;
    }

    &__action {
      border-left: 1px solid $gray;
      padding: 0 0 0 30px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .form-row__col-img {
      @include make-col(3, 9);
      margin-left: 15px;
    }

    .form-row__action {
      .form-row__col-btn {
        @include make-col(2, 9);

        &:first-child {
          @include make-col-offset(2, 9);
        }
      }

      .form-row__col-terms {
        @include make-col(3, 9);
        padding-left: 0;
        padding-right: 0;
        margin-left: 30px;
      }

      &.paypal__row {
        .form-row__col-btn {
          @include make-col(3, 9);
        }
      }
    }

    .form-row__action_custom {
      &::before {
        left: 8.33333%;
        right: 8.33333%;
      }
    }

    &__back-btn {
      @include make-col-offset(2, 9);
    }
  }
}

@include media-breakpoint-only(md) {
  .checkout-payment-details {
    &__payment-method {
      .checkout-payment-details__row:first-child {
        .checkout-payment-details__descr:first-child {
          &::after {
            left: 0;
            right: 0;
          }
        }
      }
    }

    &__info {
      @include make-col(4, 9);
      @include make-col-offset(1, 9);
    }

    .checkout-payment-details__col-btn_info {
      @include make-col(3, 9);
    }

    .form-row__save {
      .form-row__field {
        @include make-col-offset(1, 9);
      }
    }

    &__card-title {
      @include make-col-offset(1, 9);
    }

    &__card {
      @include make-col(10);
      @include make-col-offset(1);
    }

    .form-row__action {
      .form-row__col-btn {
        @include make-col(4, 9);
        @include make-col-offset(1, 9);
      }

      .form-row__col-terms {
        @include make-col(4, 9);
        padding-right: 40px;
      }

      &.paypal__row {
        .form-row__col-btn {
          @include make-col(12);
          margin-bottom: 20px;
        }

        .form-row__col-terms {
          @include make-col(12);
          text-align: center;
        }
      }
    }

    .form-row__action_custom {
      &::before {
        left: 50px;
        right: 50px;
      }
    }
  }
}

@include media-breakpoint-down(lg) {
  .checkout-payment-details {
    &__delete {
      .btn {
        width: 100%;
        margin: 0 0 15px;
      }
    }
  }
}

@include media-breakpoint-down(md) {
  .checkout-payment-details {
    &__card-holder {
      @include make-col-ready;
    }

    &__card-content {
      .row {
        .payment-card,
        .billing-address {
          @include make-col(12);
        }

        .card__links {
          @include make-col(12);
          padding-top: 15px;

          .default-mark-full {
            position: absolute;
            right: 0;
            bottom: -2px;
            left: inherit;
          }
        }
      }
    }

    &__action {
      @include make-col(12);
      border-top: 1px solid $gray;
      padding: 30px 0;
      text-align: center;
    }

    .form-row__col-img {
      @include make-col(6, 9);
    }
  }

  .confirm-delete {
    display: none;
  }
}

@include media-breakpoint-down(sm) {
  .checkout-payment-details {
    &__info {
      @include make-col-ready;
      margin-bottom: 20px;
    }

    .checkout-payment-details__info-holder {
      @include make-col(12);
    }

    .checkout-payment-details__col-btn_info {
      @include make-col-ready;
      @include make-col(12);
    }

    &__card-title {
      @include make-col-ready;
    }

    &__card {
      @include make-col(12);
      padding: 20px;
    }

    &__card-content {
      .row {
        .card__links {
          .default-mark-full {
            position: absolute;
            right: 15px;
          }
        }
      }
    }

    .form-row__col-field {
      @include make-col(1, 2);
    }

    .form-row__action {
      .form-row__col-btn {
        @include make-col(12);
        margin-bottom: 20px;
      }

      .form-row__col-terms {
        @include make-col(12);
        text-align: center;
      }
    }

    .form-row__action_custom {
      &::before {
        left: 15px;
        right: 15px;
      }
    }
  }
}

@include media-breakpoint-down(xs) {
  .checkout-payment-details {
    margin-right: -15px;
    margin-left: -15px;
  }
}
