/*
  Checkout card (delivery → payment) as a modal (?ext=1) or a section on the page, payment options and the
  Mollie card fields.
  Field primitives (.field, .field__input, .field-grid) come from checkout.css; colours and the
  font from the tokens glp.css restates, which loads after this file.
*/

html.is-modal-open {
  overflow: hidden;
}

.cc-modal {
  width: min(100% - 1.5rem, 34rem);
  max-width: none;
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: var(--navy);
  overflow: visible;
}

.cc-modal::backdrop {
  background: rgba(23, 33, 64, 0.55);
}

.cc-modal__card {
  position: relative;
  max-height: calc(100dvh - 1.5rem);
  padding: 1.25rem 1.25rem 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--white);
  box-shadow: 0 24px 60px rgba(23, 33, 64, 0.25);
}

@media (min-width: 640px) {
  .cc-modal__card {
    padding: 1.75rem 2rem 2rem;
  }
}

.cc-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--navy);
}

.cc-modal__close .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.cc-modal__close:hover {
  background: var(--line);
}

/* Steps ------------------------------------------------------------------- */

.cc-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.25rem 2.5rem 1.25rem 0;
}

.cc-steps__item {
  position: relative;
}

.cc-steps__item + .cc-steps__item::before {
  content: "";
  position: absolute;
  top: 1.125rem;
  right: calc(50% + 1.375rem);
  left: calc(-50% + 1.375rem);
  height: 2px;
  background: var(--line);
}

.cc-steps__item.is-done + .cc-steps__item::before,
.cc-steps__item.is-current:not(:first-child)::before {
  background: var(--buy);
}

.cc-steps__button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.cc-steps__button:disabled {
  cursor: default;
}

.cc-steps__icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--white);
}

.cc-steps__icon .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.cc-steps__item.is-current .cc-steps__button,
.cc-steps__item.is-done .cc-steps__button {
  color: var(--navy);
}

.cc-steps__item.is-current .cc-steps__icon {
  border-color: var(--buy);
  color: var(--buy-border);
}

.cc-steps__item.is-done .cc-steps__icon {
  border-color: var(--buy);
  background: var(--buy);
  color: var(--white);
}

/* Panels: one step at a time -------------------------------------------- */

.cc-modal__panel {
  display: none;
}

.cc-checkout[data-step="delivery"] [data-panel="delivery"],
.cc-checkout[data-step="payment"] [data-panel="payment"] {
  display: block;
}

.cc-checkout .checkout__form {
  display: block;
}

.cc-modal__title {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.cc-checkout .field-grid {
  gap: 0.75rem;
}

.cc-checkout .field__input {
  min-height: 3rem;
  font-size: 1rem;
}

.cc-modal__ship {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 1rem;
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  background: var(--mint);
  font-size: 0.875rem;
}

.cc-modal__ship .icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--buy-border);
}

.cc-modal__error {
  margin-top: 0.75rem;
  color: var(--coral);
  font-size: 0.875rem;
  font-weight: 600;
}

.cc-modal__next {
  margin-top: 1.25rem;
}

/* Toast: payment errors ---------------------------------------------------- */

.cc-modal__toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  background: rgba(184, 60, 60, 0.08);
  outline: 1px solid rgba(184, 60, 60, 0.3);
  color: var(--coral);
  font-size: 0.875rem;
  font-weight: 600;
}

.cc-modal__toast-text {
  flex: 1;
}

.cc-modal__toast-close {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

.cc-modal__toast-close .icon {
  width: 1rem;
  height: 1rem;
}

/* Order line on the payment step ------------------------------------------ */

.cc-modal__order {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.cc-modal__order-image {
  flex: none;
  width: 3rem;
  height: 3.75rem;
  object-fit: contain;
}

.cc-modal__order-text {
  flex: 1;
  min-width: 0;
}

.cc-modal__order-pack {
  font-weight: 600;
  line-height: 1.3;
}

.cc-modal__order-shipping {
  color: var(--muted);
  font-size: 0.8125rem;
}

.cc-modal__order-total {
  flex: none;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Payment options ------------------------------------------------------------ */

.cc-checkout .pay-options,
.retry .pay-options {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pay-options-status {
  padding: 0.75rem 0.875rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.payment-option--card {
  border-radius: 0.75rem;
}

.pay-option {
  min-height: 3.25rem;
}

.pay-option__marks img {
  width: auto;
  height: 26px;
}

.pay-option__marks .pay-mark--visa {
  height: 30px;
}

.pay-option__marks .pay-mark--mastercard {
  height: 26px;
}

.pay-option__badge {
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 700;
}

.paybtn--apple-pay {
  background: #000;
}

/* Mollie card fields */

.card-pay {
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--mist, #f3f8fa);
}

.card-pay__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.card-pay__grid .field--wide {
  grid-column: span 2;
}

.card-pay__mount {
  min-height: 3rem;
  padding-block: 0.8rem;
}

.card-pay__mount.is-focused,
.card-pay__mount:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(37, 143, 140, 0.2);
}

.card-pay__mount.is-invalid {
  border-color: var(--coral);
}

.card-pay__error {
  min-height: 1rem;
  margin-top: 0.25rem;
  color: var(--coral);
  font-size: 0.75rem;
  font-weight: 600;
}

.card-pay__error:empty {
  min-height: 0;
  margin: 0;
}

.card-pay__secure {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.card-pay__secure svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--buy-border);
}

/* Pay button and fine print ------------------------------------------------- */

.cc-checkout .checkout__submit,
.retry .checkout__submit {
  width: 100%;
  margin-top: 1.25rem;
}

.retry .checkout__submit {
  min-height: 3.5rem;
  border-radius: 999px;
  background: var(--go);
}

.retry .checkout__submit:hover,
.retry .checkout__submit:focus {
  background: var(--go-deep);
}

.checkout__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.checkout__submit[aria-busy="true"] {
  cursor: progress;
}

.cc-modal__terms {
  margin-top: 0.875rem;
  text-align: center;
}

.cc-modal__terms a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Reassurance under the form -------------------------------------------------- */

.cc-support {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 640px) {
  .cc-support {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cc-support__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.cc-support__item .icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--buy-border);
}

/* On the page (without ?ext=1) ------------------------------------------------ */

.g-checkout {
  background: var(--white);
  scroll-margin-top: 1rem;
}

.g-checkout .cc-modal__card {
  max-width: 60rem;
  max-height: none;
  margin: 2rem auto 0;
  overflow: visible;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

/* Both steps show at once, so the step bar, the close button and "Continue" are modal-only. "Continue" is a
   .btn--buy, which glp.css (loaded later) displays at the same specificity: the extra class outweighs it. */
.g-checkout .cc-steps,
.g-checkout .cc-modal__close,
.g-checkout .cc-checkout .cc-modal__next {
  display: none;
}

.g-checkout .cc-modal__panel {
  display: block;
}

@media (min-width: 960px) {
  .g-checkout .checkout__form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
    align-items: start;
  }
}

/* The sticky bar would cover the form it points to. */
.is-checkout-visible .sticky-cta {
  display: none;
}
