.checkout-widget {
  padding: 20px;
  background-color: $gray-bg;
  margin-bottom: 20px;

  &:last-child {
    margin-bottom: 0;
  }

  .heading-3 {
    margin-bottom: 15px;
  }

  .heading-3_checkout-widget-supply {
    .checkout-widget__edit-link {
      margin-top: 2px;
    }
  }

  .accordion {
    padding: 0;
    border-bottom: 0;

    .accordion__content {
      padding: 0;
      margin-top: 20px;

      &-inner > :last-child {
        border-bottom: 0;
        padding-bottom: 0;
      }

    }

    .accordion__header {
      padding-left: 0;
    }

    .accordion__header-icon {
      left: -30px;
    }
  }

  &__accordion-wrap {
    position: relative;

    .collapsed .accordion__header-icon-small {
      transform: rotate(180deg);
    }

    .accordion__header-icon-small {
      display: block;
      position: absolute;
      left: 80px;
      top: -2px;
      color: $blue;
      font-size: 1.25rem;
    }
  }

  &__detail-name_accordion {
    display: block;
    cursor: pointer;
  }

  &__detail-name_accordion + .checkout-widget__details-hidden + span {
    position: absolute;
    top: 0;
    right: 0;
  }

  .accordion + .checkout-widget__detail-value {
    position: absolute;
    right: 0;
    top: 0;
  }

  &__details {
    font-size: $font-size-base;
    font-weight: 500;
    line-height: 1.375rem;
    padding-left: 0;
    margin-bottom: 0;
    list-style-type: none;

    & > li:last-child {
      margin: 0;
    }

    & >li:not(:first-of-type) {
      margin-top: 5px;
    }

    & > .checkout-widget__accordion-wrap {
      &.checkout-widget__details-discount {
        margin-top: 8px;
      }
    }

    .checkout-widget__details-hidden {
      padding-left: 15px;
      list-style: disc;
      margin-top: 5px;

      li {
        font-size: .75rem;
        line-height: 1rem;
        position: relative;
        font-weight: normal;
        padding-right: 20px;

        &.checkout-widget__voucher-removed {
          color: $red;
          list-style: none;
        }

        & .icon {
          width: 16px;
          height: 16px;
          line-height: 16px;
          position: absolute;
          right: 0;
          top: 0;
          cursor: pointer;
          color: $warm-grey;
          font-size: $font-size-base;
        }
      }
    }

    & > .checkout-widget__details__item {
      overflow: hidden;

      .checkout-widget__detail-name {
        white-space: nowrap;
      }
    }
  }

  &__detail-name {
    font-weight: 700;
  }

  &__detail-block {
    &:first-child {
      font-weight: 700;
    }
  }

  &__detail-value:not(.checkout-widget__details-hidden),
  &__detail-value_payment:not(.checkout-widget__details-hidden),
  &__detail-value_no-float {
    display: block;
    color: $warm-grey;
  }

  &__detail-value:not(.checkout-widget__details-hidden) {
    float: right;
  }

  .checkout-widget__detail-text_accented {
    color: $red;
  }

  &__total {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid $gray;
  }

  &__total-legend {
    font-weight: 700;
  }

  &__price {
    color: $blue-dark;
    font-size: 2.125rem;
    font-weight: 700;
    line-height: 2.25rem;
  }

  &__actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid $gray;
  }

  &__basket-block {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid $gray;

    &_cards {
      text-align: center;
      border-top: 0;
      margin-top: 0;
    }

    &_small {
      border-top: 0;
      background: $gray-bg;
      margin: 0 -15px 15px;
      padding: 30px 15px;

      .form-row__col-btn.pay-pal_container {
        padding-top: 20px;
        border-bottom: 0;
        margin-bottom: -10px;
      }
    }

    .pay-pal_container {
      padding: 0;
      padding-top: 20px;
      border-bottom: 1px solid $gray;

      .paypal-button-container {
        min-width: inherit;
      }

      .paypal-button-text {
        line-height: 35px;
        font-size: $font-size-base;
        font-weight: 500;
        padding-left: 5px;
      }

      .checkout-payment-details__link {
        margin: 0;
      }

      &-link {
        margin-top: 20px;
        width: 100%;
        text-align: center;
        font-size: .75rem;
        display: inline-block;
      }

      &-email {
        position: relative;
        bottom: 5px;
        margin: 20px auto 0;
        text-align: center;
        font-size: .75rem;
        line-height: 1.25rem;

        .pay-pal_email {
          &-heading {
            color: $warm-grey;
            font-weight: 500;
          }
        }
      }
    }
  }

  &__payment-wrapper {
    position: relative;
    margin-top: 10px;
    margin-left: -5px;
    margin-right: -5px;
    border: 1px solid $gray;
  }

  &__secure {
    &-header {
      position: absolute;
      top: -10px;
      left: calc(50% - 100px);
      text-align: center;
      width: 200px;
      font-weight: bold;
      font-size: $font-size-13;
      background: $gray-bg;
    }

    &-icon {
      display: inline-block;
      margin-right: 5px;
    }

    &-ssl,
    &-message {
      font-size: .625rem;
      margin-bottom: 0;
    }

    &-ssl {
      padding-top: 9px;
      line-height: 1rem;
    }

    &-message {
      position: absolute;
      bottom: -7px;
      left: calc(50% - 80px);
      text-align: center;
      width: 160px;
      background: $gray-bg;
    }

    &-link {
      display: block;
      text-align: center;
      margin-top: 10px;
      padding-bottom: 20px;
      border-bottom: 1px solid $gray;
    }
  }

  &__payment-list {
    margin: 13px 20px 20px;
  }

  &__payment-item {
    display: inline-block;
    margin: 0 1px 6px;
  }

  &__payment-img {
    height: 24px;

    &_large {
      height: 30px;
      display: block;

      &.verified-by-visa {
        background: url('../../img/visa-secure-border.png') no-repeat;
        width: 38px;
        background-size: contain;
      }

      &.mastercard-secure-code {
        background: url('../../img/payments-small-2.png') no-repeat;
        width: 48px;
        background-size: contain;
      }

      &.mastercard {
        background: url('../../img/basket-mastercard.png') no-repeat;
        width: 36px;
        background-size: contain;
      }

      &.visa {
        background: url('../../img/visa.png') no-repeat;
        width: 39px;
        background-size: contain;
      }

      &.paypal {
        background: url('../../img/basket-paypal.png') no-repeat;
        width: 39px;
        background-size: contain;
      }
    }
  }

  &__card-save {

    .success {
      text-align: center;
      width: 100%;
      color: $green;
      font-size: 4rem;
      margin: 10px 0 20px;
    }

    .error {
      // sass-lint:disable placeholder-in-extend
      @extend .success;
      color: $red;
    }
  }

  &__action-description {
    @include additional-text;
    margin-top: 16px;

    &_accented {
      @include additional-text;
      font-weight: 500;
      color: $warm-grey;
    }
  }

  &__edit-link {
    font-size: $font-size-base;
    font-weight: 500;
    margin-top: 4px;
    text-align: right;
    float: right;
  }

  &__delivery-option {
    margin: 0 -15px;
  }

  &__subscribe-message {
    font-size: .75rem;
  }

  &__detail-name.checkout-widget__detail-block,
  &__detail-value.checkout-widget__detail-block {
    width: 100%;
    text-align: left;
  }

  &_order-summary {

    .content & {
      margin-bottom: 40px;
    }

    &_paypal-add {
      .checkout-widget {
        &_order-summary {
          padding: 0;
        }

        &__header {
          text-align: center;
        }
      }

      .voucher-applied {
        display: none;
      }
    }
  }

  &.voucher-applied {

    .fa-check-circle {
      text-align: center;
      width: 100%;
      color: $green;
      font-size: 1rem;
      margin-bottom: 10px;
    }
  }

  // sass-lint:disable no-ids
  #voucher-code {
    text-transform: uppercase;
  }

  &__tooltip-bb {
    position: relative;
    display: inline-block;
  }
}

.tooltip-bb {
  &__element {
    display: inline-block;
    text-align: center;
    background: $blue-dark;
    color: $white;
    font-weight: 400;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;

    &:hover {
      & + .tooltip-bb__info,
      & + .tooltip-bb__info::after {
        visibility: visible;
      }
    }
  }

  &__info {
    position: absolute;
    display: block;
    width: 154px;
    height: 50px;
    padding: 5px 5px 5px 10px;
    background: $blue-dark;
    color: $white;
    font-weight: 400;
    bottom: 130%;
    left: 80%;
    visibility: hidden;

    &::after {
      display: block;
      content: '';
      width: 0;
      height: 0;
      border-top: 15px solid $blue-dark;
      border-right: 15px solid transparent;
      position: absolute;
      left: 0;
      bottom: -20%;
      visibility: hidden;
    }
  }
}

// sass-lint:disable no-ids
#checkout-widget-information {
  line-height: 1.375rem;
}

.checkout-widget__outer-button {
  margin-top: 20px;
  margin-bottom: 20px;

  .simplebar-content & {
    // IE issue with custom scroll calculations
    width: calc(100% - 1px);
  }
}

.checkout-voucher {
  &-hide {
    display: none;
  }

  & .form-row__field {
    padding-left: 0;
    padding-right: 0;
  }

  input {
    text-transform: uppercase;

    &::placeholder {
      color: transparent;
    }
  }
}

.voucher {
  padding-bottom: 10px;

  .checkout-widget.checkout-voucher.checkout-voucher_fixed {
    padding: 0;
  }

  .checkout-widget.checkout-voucher {
    margin-bottom: 0;

    &-hide {
      display: none;
    }

    &.voucher-applied {
      background: $white;
      height: 40px;
      padding: 8px 0;
      margin: 0;

      .voucher-applied__inner {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;

        & .icon {
          display: inline-block;

          &__check {
            width: 24px;
            height: 24px;
            display: flex;
            justify-content: center;
            align-items: center;

            i {
              font-size: 24px;
              line-height: 24px;
            }
          }
        }

        & .fa-check-circle {
          font-size: 1rem;
          margin: 0;
        }

        & h5 {
          font-size: .875rem;
          margin: 0;
        }
      }
    }

    form {
      display: flex;
      justify-content: space-between;
      width: 100%;

      .form-row {
        max-width: 100%;
        flex: 1;
        margin-right: 16px;
        margin-bottom: 0;
        padding: 0;

        &__field {
          margin-left: 30px;
        }

        &__error {
          margin-left: 30px;
          font-weight: 400;
        }
      }

      .voucher__btn {
        margin-top: 0;
        margin-right: 15px;
        height: 40px;
      }
    }
  }
}

.voucher {
  .checkout-widget {
    margin-left: -15px;
    margin-right: -15px;
  }
}

@include media-breakpoint-up(sm) {
  .voucher {
    .checkout-widget.checkout-voucher {
      form {
        .form-row {
          &__field {
            margin-right: 0;
            margin-left: 15px;
          }

          &__error {
            margin-left: 15px;
          }
        }
      }
    }
  }
}

@include media-breakpoint-up(md) {
  .checkout-widget {
    .accordion {
      .accordion__content {
        // sass-lint:disable no-important
        display: block !important;
        margin-top: 0;
      }
    }

    .accordion .accordion__header,
    &__basket-block_small,
    .content &_order-summary {
      display: none;
    }
  }

  .basket-checkout-widget {
    position: sticky;
    top: 35px;
  }

  .checkout-voucher {
    & form {
      .form-row {
        &__error {
          margin-left: 15px;
        }
      }

      & .voucher__btn {
        max-width: 115px;
        height: 40px;
      }

      .form-row {
        @include make-col(12);
      }
    }

    & .form-row__field {
      margin-left: 15px;
      margin-right: -15px;
    }
  }
}

@include media-breakpoint-up(md) {
  .voucher {
    .checkout-widget.checkout-voucher {
      form {
        .form-row {
          &__field {
            margin-right: 0;
            margin-left: 30px;
          }
        }
      }
    }
  }
}


@include media-breakpoint-up(xl) {
  .checkout-widget {
    &__detail-value_payment:not(.checkout-widget__details-hidden) {
      float: right;
    }
  }

  .tooltip-bb {
    &__element {
      margin-left: 5px;
    }

    &__info {
      width: 160px;
    }
  }
}

@include media-breakpoint-down(lg) {
  .checkout-widget {
    &__secure {
      &-header {
        font-size: .6875rem;
        left: calc(50% - 85px);
        width: 170px;
        top: -9px;
      }
    }
  }
}

@include media-breakpoint-up(lg) {
  .checkout-voucher {
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

@include media-breakpoint-down(md) {
  .checkout-widget {
    &__secure {
      &-ssl {
        padding-top: 10px;
      }
    }
  }
}

@include media-breakpoint-down(sm) {
  .checkout-widget {
    .heading-3 {
      font-size: 1.5rem;
    }

    &__header,
    &__actions {
      display: none;
    }

    &__detail-value_payment:not(.checkout-widget__details-hidden) {
      float: right;
    }

    &__total {
      padding-top: 10px;
    }

    &__price {
      margin-top: 5px;
    }

    &__basket-block {
      .pay-pal_container {
        &-link {
          font-size: $font-size-base;
        }

        &-email {
          font-size: $font-size-base;
          line-height: 1.5rem;
        }
      }
    }

    &__secure {
      &-header {
        top: -12px;
        left: calc(50% - 110px);
        text-align: center;
        width: 220px;
        font-size: $font-size-base;
      }

      &-ssl {
        padding-top: 14px;
      }

      &-ssl,
      &-message {
        font-size: .75rem;
      }

      &-message {
        left: calc(50% - 100px);
        width: 200px;
        bottom: -9px;
      }
    }

    &_order-summary {

      .accordion__header-text {
        margin-left: 4px;
      }

      .accordion__content-inner {
        padding-left: 4px;
      }
    }

    &_email {
      .checkout-widget__header {
        display: block;
      }
    }
  }

  .tooltip-bb {
    &__element {
      margin-left: 5px;
    }

    &__info {
      width: 160px;
    }
  }

  .checkout-widget__click-collect {
    display: none;
  }
}

@include media-breakpoint-down(xs) {
  .checkout-widget {
    &__payment-wrapper {
      margin-left: -30px;
      margin-right: -25px;
    }
  }
}

@include media-breakpoint-only(lg) {
  .checkout-widget {
    .heading-3_checkout-widget-supply {
      font-size: 1.125rem;
    }

    &__detail-name,
    &__detail-value:not(.checkout-widget__details-hidden) {
      display: block;
    }

    &__detail-value:not(.checkout-widget__details-hidden) {
      float: none;
    }
  }
}

@include media-breakpoint-only(md) {
  .checkout-widget {
    .heading-3_checkout-widget-supply {
      font-size: 1.125rem;
    }

    &__detail-name_accordion {
      padding-bottom: 20px;
    }

    &__detail-name,
    &__detail-value:not(.checkout-widget__details-hidden) {
      display: block;
    }

    &__detail-value:not(.checkout-widget__details-hidden) {
      float: none;
    }

    &__action-description {
      &_accented {
        font-size: .625rem;
      }
    }
  }
}

@include media-breakpoint-only(xs) {
  .checkout-widget {
    &__detail-value_payment:not(.checkout-widget__details-hidden) {
      float: none;
      display: block;
    }
  }
}

@include media-breakpoint-up(lg) {
  .checkout-voucher {
    margin-bottom: 30px;

    form {
      align-items: flex-start;
    }
  }
}
