/*
 * Storefront checkout — Phase 2 native (Tabler) re-skin.  (Twisti, 2026-09-04)
 *
 * Linked by the two PAGE templates in catalog/view/template/checkout/
 * (cart.twig, checkout.twig). The FRAGMENTS (cart_list, register,
 * payment_address, shipping_address, shipping_method, payment_method, confirm)
 * are AJAX-loaded into those pages and rely on this file being present there.
 *
 * Scope rule: this file only adds what the shell (store.css / app.css /
 * uix.min.css) does NOT provide. It is screen-scoped: every class starts with
 * `chk-`, and the few selectors that reach into stock ids (#checkout-payment,
 * #output-cart) do so only to style markup the payment/total extensions inject
 * and that this theme cannot rewrite. No `!important`; nothing here outranks
 * a Tabler `.btn-*` variant (those are (0,1,0) and set their own colour).
 *
 * Tokens come from app.css (--app-*) and store.css (--store-*). Layout is
 * logical-property / grid based so it survives RTL.
 *
 * JS contract (frozen — see the templates): every container id, form id,
 * input name and data-oc-* attribute is stock; this file never depends on a
 * class the fragment scripts do not already emit.
 */

/* ── Page heading (fragments render <h1> inside #shopping-cart, so the
      store.css `#content > h1` rule does not reach it) ── */
.chk-title {
  font-size: 22px; font-weight: 800; letter-spacing: -0.3px;
  color: var(--app-text); margin: 4px 0 14px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.chk-title small { font-size: 13px; font-weight: 600; color: var(--app-muted); }

/* ── Two-column frame: steps / lines on the left, sticky summary on the right.
      Collapses to one column below the desktop breakpoint (store.css §5.2). ── */
.chk-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px; align-items: start;
}
.chk-summary { position: sticky; top: calc(var(--store-bar-h) + 12px); }
@media (max-width: 991.98px) {
  .chk-layout { grid-template-columns: minmax(0, 1fr); }
  .chk-summary { position: static; }
}

/* ── Card ── */
.chk-card {
  background: var(--app-card); border: 1px solid var(--app-border);
  border-radius: var(--app-radius); box-shadow: var(--app-shadow);
  padding: 18px; margin-bottom: 14px; min-width: 0;
}
.chk-card-title, .chk-card legend {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 800; color: var(--app-text);
  margin: 0 0 12px; padding: 0; float: none; width: auto; line-height: 1.3;
}
.chk-card-title i, .chk-card legend i { font-size: 20px; color: var(--app-primary); line-height: 1; }
.chk-card fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
.chk-card fieldset + fieldset { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--app-border); }
.chk-card .form-label { font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 5px; }
/* Stock stylesheet.css (not loaded by the native shell) marked required
   fields with a red asterisk before the label — restore that cue. */
.chk-card .required .form-label::after { content: ' *'; color: #dc2626; font-weight: 800; }
.chk-card .invalid-feedback { font-size: 11.5px; }
.chk-card .form-check-label { font-size: 13.5px; }
.chk-card .form-switch .form-check-label { font-weight: 600; }
.chk-hint { font-size: 12.5px; color: var(--app-muted); margin: 0 0 12px; }
/* switch rows (newsletter / agree): knob and text on one baseline */
.chk-switch { display: flex; align-items: center; gap: 10px; padding-inline-start: 0; margin: 10px 0; min-height: 28px; }
.chk-switch .form-check-input { float: none; margin: 0; flex-shrink: 0; }
.chk-switch .form-check-label { margin: 0; }

/* ── Cart lines (cart_list) and summary lines (confirm) ── */
.chk-lines { display: flex; flex-direction: column; }
.chk-line {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px; padding: 14px 0; border-top: 1px solid var(--app-border); align-items: start;
}
/* confirm summary lines carry no thumbnail */
.chk-line-nothumb { grid-template-columns: minmax(0, 1fr) auto; }
.chk-line:first-child { border-top: 0; padding-top: 0; }
.chk-line:last-child { padding-bottom: 4px; }
.chk-thumb { width: 72px; }
.chk-thumb img {
  width: 72px; height: 72px; object-fit: cover; display: block;
  border-radius: 12px; border: 1px solid var(--app-border); background: #f8fafc;
}
.chk-body { min-width: 0; }
.chk-name { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
/* product name is a text link but reads as a title: (0,1,1) outranks the
   store.css :where() link rule (0,0,1) */
.chk-name a { color: var(--app-text); }
.chk-name a:hover { color: var(--app-primary); }
.chk-qty-badge {
  display: inline-block; min-width: 26px; padding: 1px 6px; margin-inline-end: 4px;
  border-radius: 7px; background: #f1f5f9; color: #475569;
  font-size: 11.5px; font-weight: 800; text-align: center; vertical-align: 1px;
}
.chk-meta { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12.5px; color: var(--app-muted); line-height: 1.5; }
.chk-meta li { overflow-wrap: anywhere; }

/* Recurring-billing terms — the one thing a subscription buyer must be able
   to read before committing. Rendered from the controller's formatted string
   (text_subscription_* in the language file); this block only frames it. */
.chk-terms {
  display: flex; gap: 9px; align-items: flex-start;
  margin-top: 9px; padding: 9px 11px;
  border-radius: 10px; background: #eff6ff; border: 1px solid #bfdbfe;
  color: #1e3a8a; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere;
}
.chk-terms i { font-size: 18px; line-height: 1; flex-shrink: 0; color: #1d4ed8; margin-top: 1px; }
.chk-terms-label {
  display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: #1d4ed8; margin-bottom: 1px;
}

/* quantity form (stock markup: .input-group > input[name=quantity] + 2 buttons) */
.chk-qty { margin-top: 10px; }
.chk-qty .input-group { flex-wrap: nowrap; width: auto; display: inline-flex; }
.chk-qty .form-control { width: 60px; flex: 0 0 60px; text-align: center; font-weight: 700; }
.chk-qty .btn { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; }
.chk-qty .btn i { font-size: 16px; }

.chk-line-right {
  text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  min-width: 96px; white-space: nowrap;
}
.chk-amount { font-size: 15px; font-weight: 800; color: var(--app-text); font-variant-numeric: tabular-nums; }
.chk-unit { font-size: 12px; color: var(--app-muted); }

/* ── Totals (stock `totals` list) ── */
.chk-totals { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--app-border); }
.chk-totals li {
  display: flex; justify-content: space-between; gap: 12px; padding: 4px 0;
  font-size: 13.5px; color: #475569; font-variant-numeric: tabular-nums;
}
.chk-totals li span:last-child { font-weight: 700; color: var(--app-text); }
.chk-totals li:last-child {
  margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--app-border);
  font-size: 16px; font-weight: 800; color: var(--app-text);
}

/* ── Actions ── */
.chk-cta { min-height: 46px; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.chk-cta i { font-size: 20px; }
.chk-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.chk-actions .btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.chk-actions .btn i { font-size: 18px; }

/* ── "What next" total-extension accordion (coupon / voucher / reward /
      shipping estimate). The extension fragments emit Tabler's own
      .accordion-item markup; only the frame is adjusted. ── */
.chk-next .accordion-item { border-color: var(--app-border); }
.chk-next .accordion-item:first-of-type { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.chk-next .accordion-item:last-of-type { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
.chk-next .accordion-button { font-weight: 700; font-size: 13.5px; padding: 12px 14px; }
.chk-next .accordion-body { padding: 4px 14px 14px; }

/* ── Method pickers (shipping_method / payment_method): read-only input +
      Choose button. Stock ids/names untouched. ── */
.chk-pick .input-group-text { background: #f8fafc; color: var(--app-primary); }
.chk-pick .input-group-text i { font-size: 18px; line-height: 1; }
.chk-pick .form-control[readonly] { background: #fff; }
.chk-pick .btn { white-space: nowrap; }

/* ── Confirm step: the payment extension's fragment lands in #checkout-payment.
      Stock extensions emit <div class="text-end"><button id="button-confirm"
      class="btn btn-primary">; Razorpay emits Bootstrap-3 `.buttons .pull-right`
      (no BS5 equivalent — the button would sit flush left). Both get one
      full-width CTA here. `.btn-primary` keeps its own colour. ── */
#checkout-payment { margin-top: 14px; }
#checkout-payment .pull-right, #checkout-payment .text-end { text-align: start; }
#checkout-payment .btn-primary, #checkout-payment input[type="submit"].btn {
  width: 100%; min-height: 46px; font-weight: 800; font-size: 15px;
}
#checkout-payment .btn-primary:disabled { opacity: .55; }

/* ── Phone ── */
@media (max-width: 575.98px) {
  .chk-card { padding: 14px; border-radius: 12px; }
  .chk-line { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
  .chk-thumb, .chk-thumb img { width: 56px; height: 56px; }
  /* price block drops under the body and becomes a row (total right-aligned) */
  .chk-line-right {
    grid-column: 2; flex-direction: row-reverse; justify-content: space-between;
    align-items: baseline; min-width: 0; margin-top: 4px;
  }
  .chk-line-nothumb { grid-template-columns: minmax(0, 1fr); }
  .chk-line-nothumb .chk-line-right { grid-column: 1; }
  .chk-actions .btn { flex-basis: 100%; }
}

/* ── Payment picker (payment_method.twig chkRenderPaymentPicker) ──────────
      < 992px: #modal-payment is an app.css .bottom-sheet over #sheetOverlay —
      the chrome (.sheet-handle/.sheet-hdr/.sheet-scroll) and slide/backdrop
      come from app.css; these rules only dress the choices list.
      >= 992px: the stock Tabler .modal; the same list rules apply inside it. */
.chk-sheet .sheet-hdr > .ti { font-size: 22px; color: var(--app-primary); line-height: 1; }
.chk-sheet .sheet-hdr-title { color: var(--app-text); }
.chk-sheet .chk-sheet-close { margin-inline-end: -8px; }
.chk-sheet-body { padding: 6px 18px calc(14px + env(safe-area-inset-bottom, 0px)); }
.chk-picker-group { margin: 10px 0 2px; font-size: 13px; color: var(--app-muted); }
.chk-picker-group strong { color: var(--app-text); font-weight: 800; }
/* each choice is a full-width tap row (44px+) with the radio on the start side */
.chk-picker-option {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 2px;
  min-height: 48px; border-bottom: 1px solid #f1f5f9;
}
.chk-picker-option .form-check-input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; float: none; }
.chk-picker-option .form-check-label { font-size: 14.5px; font-weight: 600; color: var(--app-text); flex: 1; cursor: pointer; }
.chk-picker-option .form-check-input:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.chk-picker-actions { margin-top: 14px; }
.chk-sheet .chk-picker-actions .btn { width: 100%; min-height: 46px; font-weight: 800; font-size: 15px; }
#modal-payment.modal .modal-content { border-radius: var(--app-radius); }
#modal-payment.modal .modal-title { display: flex; align-items: center; gap: 8px; font-weight: 800; }
#modal-payment.modal .modal-title .ti { font-size: 20px; color: var(--app-primary); }
