/* ============================================================
   CHECKOUT PAGE STYLES
   ============================================================ */

/* ---- Header ---- */
.checkout-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green-dark);
  padding-block: 0.875rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.checkout-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.checkout-header__logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

.checkout-header__steps {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  justify-content: center;
}

.checkout-header__steps svg {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.30);
}

.checkout-step {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.40);
}

.checkout-step--active {
  color: var(--white);
}

.checkout-step--done {
  color: rgba(255,255,255,0.55);
}

.checkout-header__back {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.60);
  transition: color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.checkout-header__back:hover { color: var(--white); }

/* ---- Page layout ---- */
.checkout-main {
  padding-block: 3rem 4rem;
  background: var(--cream);
  min-height: calc(100vh - 66px);
}

.checkout-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* ---- Order summary (left col) ---- */
.checkout-summary {
  background: var(--green-dark);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: sticky;
  top: calc(66px + 2rem);
}

.checkout-summary__heading {
  font-size: 1.125rem;
  color: var(--white);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.co-summary__product {
  margin-bottom: 1.25rem;
}

.co-summary__product-name {
  font-weight: 700;
  color: var(--white);
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.co-summary__product-sub {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 0.375rem;
}

.co-summary__product-price {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
}

.co-summary__addons {
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-top: 1rem;
  margin-bottom: 1rem;
}

.co-summary__addons-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.40);
  margin-bottom: 0.625rem;
}

.co-summary__addon {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.75);
  padding-block: 0.3rem;
}

.co-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 2px solid rgba(255,255,255,0.15);
  padding-top: 1rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.70);
}

.co-summary__total strong {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

.co-summary__freight {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.70);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.10);
}

.co-summary__freight strong {
  font-weight: 600;
  color: var(--white);
  text-align: right;
}

.co-summary__freight-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  line-height: 1.5;
  margin-top: 1rem;
}

.co-summary__freight-note svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.co-summary__edit-link {
  display: block;
  font-size: 0.8125rem;
  color: var(--amber);
  font-weight: 600;
  margin-top: 1.25rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.co-summary__edit-link:hover { color: #e8a04d; }

/* ---- Form wrap (right col) ---- */
.checkout-form-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}

/* ---- Fieldsets ---- */
.co-fieldset {
  border: none;
  padding: 0;
  margin-bottom: 2.25rem;
}

.co-fieldset__legend {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 0.25rem;
  display: block;
  width: 100%;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--cream-dark);
  margin-bottom: 1.25rem;
}

.co-fieldset__note {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: -0.75rem;
  margin-bottom: 1.25rem;
}

/* ---- Fields ---- */
.co-field {
  margin-bottom: 1rem;
}

.co-field--grow { flex: 1; }
.co-field--narrow { flex: 0 0 110px; }

.co-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.375rem;
}

.co-label span {
  color: var(--amber);
}

.co-input {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #D1D5DB;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.co-input:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,90,39,0.12);
}

.co-input.error {
  border-color: #DC2626;
}

.co-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%234A5568' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
  cursor: pointer;
}

.co-textarea {
  resize: vertical;
  min-height: 80px;
}

.co-row {
  display: flex;
  gap: 1rem;
}

.co-row--3 {
  gap: 0.875rem;
}

/* ---- Freight options ---- */
.co-freight-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.co-freight {
  display: block;
}

.co-freight__card {
  display: block;
  padding: 1rem 1.125rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.co-freight:has(.co-freight__radio:checked) .co-freight__card {
  border-color: var(--green-mid);
  background: rgba(45,90,39,0.04);
}

.co-freight__radio:focus-visible + .co-freight__name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.co-freight__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.co-freight__radio {
  width: 18px;
  height: 18px;
  accent-color: var(--green-mid);
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}

.co-freight__name {
  flex: 1;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-dark);
}

.co-freight__price {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--green-mid);
  white-space: nowrap;
}

.co-freight__note {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-mid);
  line-height: 1.5;
  margin-top: 0.45rem;
  padding-left: calc(18px + 0.75rem);
}

.co-freight__reveal {
  display: none;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  padding-left: calc(18px + 0.75rem);
  border-top: 1px solid var(--cream-dark);
}

.co-freight:has(.co-freight__radio:checked) .co-freight__reveal {
  display: block;
}

.co-freight__depot {
  display: block;
  margin-bottom: 0.875rem;
}

.co-freight__depot .co-label {
  margin-bottom: 0.375rem;
}

.co-freight__fee {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--green-mid);
}

.co-freight__fee:empty { display: none; }

.co-freight__ack {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  cursor: pointer;
}

.co-freight__ack-input {
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--green-mid);
  cursor: pointer;
}

.co-freight__ack span {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-mid);
}

.co-freight__tail {
  display: block;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* ---- Payment options ---- */
/* ---- Field errors ---- */
.co-field-error {
  display: block;
  font-size: 0.78rem;
  color: #DC2626;
  margin-top: 0.3rem;
  min-height: 1rem;
}

.co-input--error {
  border-color: #DC2626 !important;
  background: #FFF5F5;
}

.co-form-error {
  display: none;
  background: #FEF2F2;
  color: #991B1B;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border-left: 3px solid #DC2626;
  margin-bottom: 1rem;
}

.co-form-error:not(:empty) {
  display: block;
}

.co-paypal-retry {
  display: block;
  margin: 0 auto 1rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: var(--green-dark);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.co-paypal-note a {
  color: inherit;
  font-weight: 700;
}

/* ---- Payment options ---- */
.co-payment-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.co-payment-option {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  cursor: pointer;
}

.co-payment-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green-mid);
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 1px;
}

.co-payment-option__card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 1;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.co-payment-option:has(input:checked) .co-payment-option__card {
  border-color: var(--green-mid);
  background: rgba(45,90,39,0.04);
}

.co-payment-option__left {
  flex-shrink: 0;
}

.co-payment-option__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 800;
  padding: 0.3rem 0.625rem;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.co-payment-option__badge--card {
  background: var(--green-dark);
  color: var(--white);
}

.co-payment-option__badge--afterpay {
  background: #B2FCE4;
  color: #0B2B25;
}

.co-payment-option__badge--paypal {
  background: #FFC43A;
  color: #003087;
}

.co-payment-option__badge--bpay {
  background: #1A4099;
  color: var(--white);
}

.co-payment-option__desc {
  font-size: 0.8125rem;
  color: var(--text-mid);
  line-height: 1.4;
}

/* ---- Stripe card element ---- */
.co-stripe-section {
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}

.co-stripe-wrap {
  border: 1.5px solid #D1D5DB;
  border-radius: var(--radius);
  padding: 0.75rem 0.875rem;
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.co-stripe-wrap:focus-within {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,90,39,0.12);
}

.co-stripe-element {
  /* Stripe mounts an iframe here — min-height prevents collapse */
  min-height: 22px;
}

.co-stripe-errors {
  display: none;
  font-size: 0.8125rem;
  color: #DC2626;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #FEF2F2;
  border-radius: var(--radius);
  border-left: 2px solid #DC2626;
}

.co-stripe-secure {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.625rem;
  line-height: 1.5;
}

.co-stripe-unavailable {
  font-size: 0.875rem;
  color: #991B1B;
  background: #FEF2F2;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

/* ---- Payment info (non-card methods) ---- */
.co-payment-info {
  display: none;
  font-size: 0.875rem;
  color: var(--green-mid);
  font-weight: 500;
  background: rgba(45,90,39,0.06);
  border-left: 3px solid var(--green-mid);
  padding: 0.625rem 0.875rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 0.75rem;
}

/* ---- Submit ---- */
.co-submit-btn {
  width: 100%;
  justify-content: center;
  font-size: 1.0625rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.co-disclaimer {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.65;
}

.co-disclaimer a {
  color: var(--green-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Success state ---- */
.checkout-success {
  text-align: center;
  padding: 3rem 2rem;
}

.checkout-success__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem;
  color: var(--green-mid);
}

.checkout-success__icon svg {
  width: 100%;
  height: 100%;
}

.checkout-success__heading {
  font-size: 2rem;
  color: var(--green-dark);
  margin-bottom: 1rem;
}

.checkout-success__body {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.7;
  max-width: 44ch;
  margin: 0 auto 1rem;
}

.checkout-success__payment {
  font-size: 0.9375rem;
  color: var(--green-mid);
  font-weight: 500;
  margin-bottom: 2rem;
  min-height: 1rem;
}

.checkout-success__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- Footer ---- */
.checkout-footer {
  background: #111e17;
  padding-block: 1.25rem;
  text-align: center;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.35);
}

.checkout-footer a {
  color: rgba(255,255,255,0.55);
  transition: color 0.2s;
}

.checkout-footer a:hover { color: var(--white); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .checkout-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .checkout-summary {
    position: static;
    order: -1;
  }

  .checkout-form-wrap {
    padding: 1.75rem;
  }

  .co-row { flex-direction: column; }
  .co-row--3 { flex-direction: row; }
  .co-field--narrow { flex: 0 0 90px; }
}

@media (max-width: 480px) {
  .checkout-header__steps { display: none; }
  .checkout-form-wrap { padding: 1.25rem; }
  .co-row--3 { flex-direction: column; }
  .co-field--narrow { flex: 1; }
  .checkout-success__actions { flex-direction: column; }
  .checkout-success__actions .btn { width: 100%; justify-content: center; }

  /* Freight cards: let the price drop under the (often-wrapping) title */
  .co-freight__head { flex-wrap: wrap; align-items: flex-start; }
  .co-freight__price {
    flex-basis: 100%;
    margin-left: calc(18px + 0.75rem);
    margin-top: 0.15rem;
  }
}

/* ---- PayPal payment panel ---- */
.co-payment-paypal { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--cream-dark); border-radius: var(--radius); }
.co-payment-paypal__desc { font-size: 0.875rem; color: var(--text-mid); margin: 0; }

/* ---- Disclaimer checkbox ---- */
.co-disclaimer-field { margin-bottom: 1.25rem; }
.co-disclaimer-label { display: flex; align-items: flex-start; gap: 0.75rem; cursor: pointer; }
.co-disclaimer-label input[type="checkbox"] { flex-shrink: 0; width: 1.125rem; height: 1.125rem; margin-top: 0.2rem; accent-color: var(--green-mid); cursor: pointer; }
.co-disclaimer-text { font-size: 0.8rem; line-height: 1.55; color: var(--text-mid); }
.co-disclaimer-text a { color: var(--green-mid); text-decoration: underline; }
.co-disclaimer-text a:hover { color: var(--green-dark); }

/* ---- Deposit callout in order summary ---- */
.co-summary__deposit { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.6rem 0.75rem; background: var(--amber); border-radius: var(--radius); margin-top: 0.5rem; font-size: 0.9rem; }
.co-summary__deposit span, .co-summary__deposit strong { color: var(--green-dark); }

/* ---- Field hint text (e.g. invoice number) ---- */
.co-field-hint { font-size: 0.8rem; color: var(--text-mid); margin: 0.25rem 0 0; }

/* ---- PayPal payment section ---- */
.co-paypal-section { margin-top: 1.25rem; padding: 1.25rem; background: var(--cream-dark); border-radius: var(--radius); }
.co-paypal-note { font-size: 0.875rem; font-weight: 600; color: var(--green-dark); margin: 0 0 1rem; text-align: center; }
#paypal-button-container { max-width: 480px; margin: 0 auto; }

/* ---- Pay Invoice page ---- */
.checkout-form-wrap--narrow { max-width: 640px; margin: 0 auto; }
.pay-invoice__title { font-family: 'Playfair Display', serif; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; color: var(--green-dark); margin-bottom: 0.5rem; }
.pay-invoice__sub { font-size: 0.9375rem; color: var(--text-mid); line-height: 1.65; margin-bottom: 1.75rem; }
.co-disclaimer-error { font-size: 0.78rem; color: #c0392b; margin-top: 0.35rem; margin-left: 1.875rem; }
