/* ==========================================================================
   CHECKOUT PAGE (woocommerce/checkout/form-checkout.php override)
   Ported exactly from bashi-jewelry html/checkout.html's inline <style> block.
   ========================================================================== */

/* Guard against horizontal overflow on mobile. We've found two real causes
   of the page silently gaining extra scrollable width on phones (an
   off-screen element positioned without a clipping ancestor, and a CSS
   grid track forced wider than the viewport by unshrinkable content) —
   this doesn't fix a cause, it just stops any such bug from pushing the
   whole page sideways. Scoped to the checkout body class only. */
body.woocommerce-checkout { overflow-x: hidden; }

.checkout-header { background: var(--color-charcoal); padding: 16px 0; }
.checkout-header__inner { display: flex; align-items: center; justify-content: space-between; }
.checkout-header__logo { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #fff; text-decoration: none; display: flex; align-items: center; }
.checkout-header__logo span { color: var(--color-gold); }
.checkout-header__logo img { height: 32px; width: auto; display: block; }

.checkout-steps { display: flex; align-items: center; gap: 0; }
.checkout-step { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.45); }
.checkout-step--active { color: #fff; }
.checkout-step--done { color: var(--color-gold); }
.checkout-step__num { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.checkout-step__sep { width: 32px; height: 1px; background: rgba(255,255,255,0.2); margin: 0 6px; }

.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; padding: 32px 0 56px; align-items: start; }

/* Stock/validation notices (wc_print_notices(), moved inside .container in
   form-checkout.php so they're no longer full-bleed edge-to-edge) still
   need their own top spacing — they sit directly against the dark header
   otherwise, with no breathing room before the first card below them.
   WooCommerce wraps them in .woocommerce-notices-wrapper (a child of
   .container, not the notice elements themselves), present even with zero
   notices — :not(:empty) keeps that case from adding blank space.
   Scoped to checkout only. */
.woocommerce-checkout .container > .woocommerce-notices-wrapper:not(:empty) {
  margin-top: 24px;
}
.woocommerce-checkout .container > .woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-checkout .container > .woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-checkout .container > .woocommerce-notices-wrapper .woocommerce-info {
  margin-bottom: 0;
}

.checkout-form-card { background: #fff; border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.checkout-form-card__header { padding: 16px 22px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: 10px; }
.checkout-form-card__num { width: 26px; height: 26px; background: var(--color-charcoal); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.checkout-form-card__title { font-size: 15px; font-weight: 700; color: var(--color-charcoal); }
.checkout-form-card__body { padding: 22px; }

/* Scoped to the checkout form cards -- .form-row is a common class name
   (also used bare, single-column, by the login/register forms in
   myaccount.css) and must not turn every field wrapper site-wide into a
   2-column grid.
   Also scoped to div.form-row specifically, not just .form-row: WooCommerce
   wraps EVERY individual field (not just our intentional side-by-side
   pairs) in its own <p class="form-row ..."> containing just a <label> and
   the input -- matching that too split each field's own label into column
   1 and its input into column 2 instead of stacking them normally. Our
   deliberate two-up wrapper is always a <div>; WooCommerce's per-field one
   is always a <p>, so qualifying by tag excludes it cleanly. */
.checkout-form-card div.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--color-charcoal); margin-bottom: 6px; letter-spacing: 0.02em; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--color-border); border-radius: 6px; font-size: 14px; font-family: var(--font-primary); transition: border-color 0.2s; background: #fff; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--color-gold); }

.delivery-options { display: flex; flex-direction: column; gap: 10px; }
.delivery-option { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--color-border); border-radius: 8px; cursor: pointer; transition: border-color 0.2s; }
.delivery-option:has(input:checked) { border-color: var(--color-gold); background: var(--color-gold-bg); }
.delivery-option input { accent-color: var(--color-gold); width: 17px; height: 17px; flex-shrink: 0; }
.delivery-option__info { flex: 1; }
.delivery-option__name { font-size: 14px; font-weight: 600; color: var(--color-charcoal); }
.delivery-option__desc { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.delivery-option__price { font-size: 14px; font-weight: 700; color: var(--color-charcoal); }

.payment-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; list-style: none; margin: 0; padding: 0; }
.payment-option { padding: 14px; border: 1.5px solid var(--color-border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.payment-option:has(input:checked) { border-color: var(--color-gold); background: var(--color-gold-bg); }
.payment-option__label { display: flex; align-items: center; gap: 10px; cursor: pointer; width: 100%; }
.payment-option__label input[type="radio"] { accent-color: var(--color-gold); width: 16px; height: 16px; flex-shrink: 0; }
.payment-option__name { font-size: 13px; font-weight: 600; color: var(--color-charcoal); margin: 0; }
.payment-option__desc { font-size: 11px; color: var(--color-text-muted); }
.payment-option .payment_box { margin-top: 12px; }

/* Order summary sidebar */
.co-summary { background: #fff; border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; position: sticky; top: 20px; }
.co-summary__header { padding: 16px 20px; border-bottom: 1px solid var(--color-border); font-size: 14px; font-weight: 700; color: var(--color-charcoal); }
.co-summary__items { max-height: 260px; overflow-y: auto; }
.co-summary__item { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--color-border); align-items: center; }
.co-summary__item img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--color-border); flex-shrink: 0; }
.co-summary__item__info { flex: 1; min-width: 0; }
.co-summary__item__name { font-size: 12px; font-weight: 600; color: var(--color-charcoal); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-summary__item__meta { font-size: 11px; color: var(--color-text-muted); }
.co-summary__item__price { font-size: 13px; font-weight: 700; flex-shrink: 0; }
.co-summary__totals { padding: 16px 20px; }
.co-summary__row { display: flex; justify-content: space-between; font-size: 13px; color: var(--color-text); margin-bottom: 10px; }
.co-summary__row--total { font-size: 16px; font-weight: 700; color: var(--color-charcoal); border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 4px; }
.co-summary__free-delivery { margin: 0 0 14px; }
.co-summary__free-delivery-note { font-size: 12px; color: var(--color-text-muted); margin: 0 0 6px; }
.co-summary__free-delivery-note strong { color: var(--color-gold); }
.co-summary__free-delivery-note--unlocked { color: var(--color-success); font-weight: 600; }
.co-summary__free-delivery-bar { height: 5px; border-radius: 3px; background: var(--color-border); overflow: hidden; }
.co-summary__free-delivery-bar-fill { height: 100%; background: var(--color-gold); border-radius: 3px; transition: width 0.3s ease; }
.co-summary__promo { margin: 4px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.co-summary__promo-row { display: flex; gap: 8px; }
.co-summary__promo-input { flex: 1; min-width: 0; padding: 9px 12px; border: 1.5px solid var(--color-border); border-radius: 6px; font-size: 13px; font-family: inherit; }
.co-summary__promo-input:focus { outline: none; border-color: var(--color-gold); }
.co-summary__promo-btn { padding: 9px 16px; border: 1.5px solid var(--color-gold); border-radius: 6px; background: none; color: var(--color-gold); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.co-summary__promo-btn:hover { background: var(--color-gold-bg); }
.co-summary__promo-btn:disabled { opacity: 0.6; cursor: default; }
.co-summary__promo-message { font-size: 12px; margin: 6px 0 0; }

.place-order-btn { width: 100%; padding: 15px; font-size: 16px; font-weight: 700; border-radius: 8px; margin-top: 8px; }
.co-summary__secure { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--color-text-muted); margin-top: 10px; }

/* Order-received (thank you) — same success-modal visuals as checkout.html's JS modal */
.order-success { background: #fff; border-radius: 16px; padding: 48px 40px; text-align: center; max-width: 440px; width: 90%; margin: 40px auto; }
.order-success__icon { width: 64px; height: 64px; background: var(--color-success-bg); color: var(--color-success); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 28px; }
.order-success__title { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--color-charcoal); margin-bottom: 10px; }
.order-success p { font-size: 14px; color: var(--color-text-muted); margin-bottom: 6px; }
.order-success__id { color: var(--color-text); margin-bottom: 28px !important; }
.order-success__note { font-size: 13px !important; color: var(--color-text) !important; margin-bottom: 28px !important; }
.order-success .btn { width: 100%; display: block; }
.order-success-details { padding-bottom: 56px; color: var(--color-text); }
.order-success-details h2 { font-size: 18px; font-weight: 700; color: var(--color-charcoal); margin: 24px 0 12px; }

@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .co-summary { position: static; }
  .payment-options { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
  .checkout-form-card div.form-row { grid-template-columns: 1fr; }
  .checkout-steps { display: none; }
  .checkout-header__logo img { height: 26px; }
}
