/* =========================================================
   ROBOTIMEDZ — Checkout page styles
   Loaded after main.css (tokens, .btn, .logo, focus ring, WhatsApp button).
   Mobile-first:
     base     one column: compact summary on top → form → payment → Place Order
     600px    two-column field rows, delivery cards side by side
     1024px   desktop: form on the left, sticky summary/payment panel on the right
   The only max-width query mirrors 1024px exactly (1023.98px), so no width is uncovered.
   ========================================================= */

.checkout-page { background: #fff; }

/* ---------- Simplified header ---------- */
.co-header { border-bottom: 1px solid var(--line); background: #fff; }
.co-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1160px; height: 62px; margin-inline: auto; padding-inline: var(--gutter); }
.co-header .logo__word { font-size: 21px; }
/* Same language dropdown as the site header (shared .lang component in main.css) */
.co-header .lang { margin-inline-end: -6px; }

/* ---------- Page shell ---------- */
.co-main { max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); padding-block: 0 24px; }
.co-layout { display: flex; flex-direction: column; }

/* ---------- Mobile compact summary ---------- */
.co-mini { margin-inline: calc(var(--gutter) * -1); background: var(--soft); border-bottom: 1px solid var(--line); }
.co-mini__toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding-inline: var(--gutter); font-size: 15px; font-weight: 600; color: var(--ink); text-align: start; }
.co-mini__label { display: inline-flex; align-items: center; gap: 6px; color: var(--red); }
.co-mini__label .icon { width: 18px; height: 18px; transition: transform .3s var(--ease); }
.co-mini__toggle[aria-expanded="true"] .co-mini__label .icon { transform: rotate(180deg); }
.co-mini__total { font-size: 17px; font-weight: 700; }
.co-mini__panel { padding: 4px var(--gutter) 18px; }

/* ---------- Form ---------- */
.co-form { padding-block: 22px 8px; min-width: 0; }
.co-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.co-required-note { margin-top: 4px; font-size: 13px; color: var(--muted); }
.co-req { color: var(--red); font-weight: 700; }
.co-section { margin-top: 26px; }
.co-section__title { margin-bottom: 14px; font-size: 18px; font-weight: 700; color: var(--ink); }
.co-country { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; font-size: 13.5px; color: var(--muted); }
.co-country .icon { width: 17px; height: 17px; color: var(--red); }
.co-grid { display: grid; gap: 16px; }

.co-field { min-width: 0; margin: 0; }
.co-field + .co-field, .co-grid + .co-field { margin-top: 16px; }
.co-grid > .co-field { margin-top: 0; }           /* fields in the same row stay aligned */
.co-field > label, .co-field > legend { display: block; margin-bottom: 7px; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.co-field input, .co-field select, .co-field textarea { display: block; width: 100%; min-width: 0; height: 50px; padding-inline: 14px; border: 1px solid #D0D0D0; border-radius: 8px; background: #fff; font: inherit; font-size: 16px; color: var(--ink); transition: border-color .2s, box-shadow .2s, background-color .2s; }
.co-field textarea { height: auto; min-height: 96px; padding-block: 12px; line-height: 1.45; resize: vertical; }
.co-field input::placeholder, .co-field textarea::placeholder { color: #A5A5A5; }
.co-field input:focus, .co-field select:focus, .co-field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, .08); }
.co-field input[dir="ltr"] { text-align: start; }
[dir="rtl"] .co-field input[dir="ltr"] { text-align: end; }
.co-select { position: relative; }
.co-select select { appearance: none; -webkit-appearance: none; padding-inline-end: 40px; cursor: pointer; }
.co-select .icon { position: absolute; top: 50%; inset-inline-end: 14px; width: 18px; height: 18px; margin-top: -9px; pointer-events: none; color: var(--ink); }
.co-hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); }

/* Errors: red text under the field + red field border */
.co-error { font-size: 13px; line-height: 1.35; color: #C62828; }
.co-error:not(:empty) { display: flex; gap: 6px; margin-top: 6px; }
.co-error:not(:empty)::before { content: "!"; flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: #C62828; color: #fff; font-size: 11px; font-weight: 800; }
.co-field.is-invalid input, .co-field.is-invalid select, .co-field.is-invalid textarea { border-color: #C62828; background: #FFFAFA; }
.co-field.is-invalid .co-hint { display: none; }

/* ---------- Delivery method cards ---------- */
.co-methods { border: 0; padding: 0; margin-top: 18px; }
.co-methods__grid { display: grid; gap: 12px; }
.co-unavailable { margin-bottom: 12px; padding: 12px 14px; border-radius: 8px; background: #FFF4F2; color: #9E2A24; font-size: 14px; font-weight: 600; }
.co-method { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; padding: 14px 16px; border: 1px solid #D0D0D0; border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .2s; }
.co-method input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.co-method__radio { grid-row: 1 / span 2; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid #9A9A9A; border-radius: 50%; }
.co-method__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); transform: scale(0); transition: transform .2s var(--ease); }
.co-method__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.co-method__title { font-size: 15px; font-weight: 700; color: var(--ink); }
.co-method__desc { font-size: 13px; line-height: 1.4; color: var(--muted); }
.co-method__price { grid-column: 2; font-size: 16px; font-weight: 700; color: var(--ink); }
.co-method__wait { font-size: 13px; font-weight: 500; color: var(--muted); }
.co-method__na { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #EDEDED; font-size: 12.5px; font-weight: 600; color: #6B6B6B; }
.co-method:hover:not(.is-disabled):not(.is-waiting) { border-color: #9A9A9A; }
.co-method:has(input:checked) { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: #FFF8F7; }
.co-method:has(input:checked) .co-method__radio { border-color: var(--red); }
.co-method:has(input:checked) .co-method__radio::after { transform: scale(1); }
.co-method:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.co-method.is-disabled, .co-method.is-waiting { cursor: not-allowed; background: #FAFAFA; }
.co-method.is-disabled .co-method__title, .co-method.is-disabled .co-method__desc { color: #A0A0A0; }
.co-method.is-disabled .co-method__radio, .co-method.is-waiting .co-method__radio { border-color: #D0D0D0; }
.co-methods.is-invalid .co-method:not(.is-disabled) { border-color: #C62828; }
.co-methods .co-error:not(:empty) { margin-top: 10px; }

/* ---------- Summary pieces (used in the panel and the mobile summary) ---------- */
.co-money { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.co-items { display: grid; gap: 14px; }
.co-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.co-item__img { position: relative; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.co-item__img img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.co-item__qty { position: absolute; top: -7px; inset-inline-end: -7px; display: grid; place-items: center; min-width: 22px; height: 22px; padding-inline: 6px; border-radius: 11px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; }
.co-item__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.co-item__name { font-size: 14px; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.co-item__meta { font-size: 12.5px; color: var(--muted); }
.co-item__out { color: #C62828; font-weight: 700; }
.co-item.is-sold-out .co-item__img img { opacity: .5; }
.co-item__price { font-size: 14px; font-weight: 600; color: var(--ink); }

.co-totals { display: grid; gap: 10px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.co-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.co-row dt { font-size: 14px; color: #444; }
.co-row dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); text-align: end; }
.co-row__sub { color: var(--muted); font-weight: 400; }
.co-pending { display: block; max-width: 19ch; font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--muted); }
.co-row--total { align-items: flex-start; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.co-row--total dt { font-size: 17px; font-weight: 700; color: var(--ink); }
.co-row--total dd { font-size: 20px; font-weight: 800; }
.co-total-note { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }

/* ---------- Panel: summary + payment + Place Order ---------- */
.co-panel { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.co-panel__summary { display: none; }            /* products are in the top summary on mobile */
.co-panel .co-totals { margin-top: 0; padding-top: 0; border-top: 0; }
.co-panel__title { margin-bottom: 16px; font-size: 18px; font-weight: 700; color: var(--ink); }
.co-pay { margin-top: 22px; }
.co-pay__title { margin-bottom: 10px; font-size: 16px; font-weight: 700; color: var(--ink); }
.co-cod { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--red); border-radius: 10px; background: #fff; }
.co-cod__check { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; }
.co-cod__check .icon { width: 15px; height: 15px; }
.co-cod b { display: block; font-size: 15px; color: var(--ink); }
.co-cod span:not(.co-cod__check) { display: block; font-size: 13px; color: var(--muted); }
.co-notice { display: flex; gap: 10px; margin-top: 12px; font-size: 13px; line-height: 1.45; color: #555; }
.co-notice .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--red); }
/* Anti-robot check (Cloudflare Turnstile, shown only when enabled). Height reserved: no jump when the widget appears. */
.co-verify { margin-top: 18px; max-width: 100%; }
.co-verify__label { margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.co-verify__widget { min-height: 65px; max-width: 100%; }
.co-verify__msg { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.co-verify__msg.is-error { color: #B71C1C; font-weight: 600; }
.co-verify__retry { margin-top: 4px; font-size: 14px; }
.co-form-error { margin-top: 16px; padding: 11px 14px; border-radius: 8px; background: #FFF4F4; color: #B71C1C; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.co-submit { width: 100%; min-height: 56px; margin-top: 16px; font-size: 16.5px; font-weight: 700; }
.co-submit:disabled { background: #D6D6D6; color: #7A7A7A; cursor: not-allowed; transform: none; }

/* ---------- Empty cart / success ---------- */
.co-empty, .co-success { max-width: 520px; margin-inline: auto; padding-block: 72px 48px; text-align: center; }
.co-empty__icon { width: 56px; height: 56px; margin-inline: auto; color: #B5B5B5; }
.co-empty__title, .co-success__title { margin: 16px 0 22px; font-size: 24px; font-weight: 800; color: var(--ink); }
.co-success:focus { outline: none; }
.co-success__icon { display: grid; place-items: center; width: 64px; height: 64px; margin-inline: auto; border-radius: 50%; background: #E8F5E9; color: #2E7D32; }
.co-success__icon .icon { width: 32px; height: 32px; }
.co-success__title { margin-bottom: 10px; }
.co-success__text { margin-bottom: 14px; font-size: 15px; line-height: 1.55; color: #444; }
.co-success__ref { margin-bottom: 24px; padding: 8px 12px; border: 1px dashed #D0D0D0; border-radius: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- Copyright ---------- */
.co-footer { margin-top: 32px; border-top: 1px solid var(--line); }
.co-footer p { padding-block: 18px calc(88px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- WhatsApp: never over Place Order or the field being typed in (mobile/tablet) ---------- */
.checkout-page .wa-fab { transition: transform .25s var(--ease), background-color .2s, opacity .2s, visibility .2s; }
@media (max-width: 1023.98px) {
  .co-cta-visible .wa-fab, .co-typing .wa-fab { opacity: 0; visibility: hidden; transform: scale(.85); }
}

/* ---------- 600px: two fields per row, cards side by side ---------- */
@media (min-width: 600px) {
  .co-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .co-methods__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .co-main { padding-block-end: 32px; }
  .co-form, .co-panel { max-width: 640px; width: 100%; margin-inline: auto; }
  .co-mini__panel { max-width: 640px; margin-inline: auto; }
}

/* ---------- 1024px: desktop two columns, sticky right panel ---------- */
@media (min-width: 1024px) {
  .co-header__inner { height: 68px; }
  .co-header .logo__word { font-size: 24px; }
  .co-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; column-gap: 56px; align-items: start; }
  .co-mini { display: none; }
  .co-form, .co-panel { max-width: none; margin-inline: 0; }
  .co-form { padding-block: 36px 16px; }
  .co-title { font-size: 30px; }
  /* The complete panel stays visible while the form scrolls; it stops at the end of
     .co-layout (before the copyright). The page keeps one scrollbar; a very long cart
     scrolls inside the product list only, so Total and Place Order stay in view. */
  .co-panel { position: sticky; top: 24px; margin-top: 36px; padding: 24px 24px 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft);
    /* Short windows only: the panel scrolls inside itself (thin bar) so Place Order is always reachable */
    max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #D0D0D0 transparent; }
  .co-panel__summary { display: block; }
  .co-panel .co-items { max-height: min(34vh, 320px); overflow-y: auto; padding: 8px 8px 4px 2px; margin: -8px -8px 0 -2px; scrollbar-width: thin; scrollbar-color: #D0D0D0 transparent; }
  .co-panel .co-totals { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
  .co-footer p { padding-block-end: 18px; }
}
@media (min-width: 1200px) {
  .co-layout { grid-template-columns: minmax(0, 1fr) 440px; column-gap: 72px; }
}

/* ---------- Promo code (checked by the server) ---------- */
.co-promo { display: grid; gap: 8px; min-width: 0; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.co-promo__label { font-size: 14px; font-weight: 600; color: var(--ink); }
.co-promo__row { display: flex; gap: 8px; align-items: stretch; }
.co-promo__input { flex: 1 1 auto; width: 0; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid #CFCFCF; border-radius: 10px; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; background: #fff; }
.co-promo__input:focus { outline: none; border-color: var(--ink); }
.co-promo__input:read-only { background: var(--soft); }
.co-promo__input[aria-invalid="true"] { border-color: var(--red); }
.co-promo__btn { min-height: 44px; padding: 0 18px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; }
.co-promo__btn:disabled { opacity: .6; }
.co-promo__remove { min-height: 44px; padding: 0 12px; color: var(--red); font-weight: 600; text-decoration: underline; }
.co-promo__msg { font-size: 13px; color: var(--red); }
.co-promo__msg.is-ok { color: #047857; }
.co-row--discount dd { color: #047857; font-weight: 600; }
.co-panel { min-width: 0; }
