/* Stripe "cabet" checkout layout — ported from the cabet shop's Buy Now modal
   (.buy-dialog / .buy-summary / .buy-payment) as a full page, on a neutral
   palette. The JS-injected summary classes (bf-sum-*, bf-promo, bf-totals,
   bf-grand, bf-qty) are styled here too — see lib/checkout-designs.ts. */
:root {
  --cb-ink: #111111;
  --cb-muted: #6b7280;
  --cb-line: #e5e7eb;
  --cb-soft: #faf9f5;
  --cb-soft-line: #e9e4d2;
  --cb-good: #0f7a3d;
  --cb-accent: #0d1f38;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.cb { font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: #f3f4f6; color: var(--cb-ink); -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* Header */
.cb-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(980px, 100% - 32px); margin: 22px auto 14px; }
.cb-store { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.cb-store img { max-height: 44px; max-width: 220px; object-fit: contain; display: inline-block; vertical-align: middle; }
.cb-secure { font-size: 13px; color: var(--cb-muted); }

/* Dialog */
.cb-dialog { position: relative; width: min(980px, 100% - 32px); margin: 0 auto 40px; background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(17, 17, 17, 0.08); display: grid; grid-template-columns: 0.85fr 1.15fr; overflow: hidden; }
.cb-summary { background: var(--cb-soft); padding: 30px 26px; border-right: 1px solid var(--cb-line); }
.cb-payment { padding: 26px 26px 30px; min-width: 0; }
.cb-eyebrow { margin: 0 0 14px; color: #7a6300; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.25em; }
.cb-ico { display: inline-block; width: 20px; text-align: center; flex: 0 0 auto; }

/* Injected order summary */
.bf-sum-item { display: flex; gap: 14px; align-items: center; margin: 0 0 18px; }
.bf-sum-thumb { width: 76px; height: 76px; flex: 0 0 76px; background: #fff; border: 1px solid var(--cb-line); border-radius: 10px; padding: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bf-sum-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bf-sum-info { flex: 1; min-width: 0; }
.bf-sum-name { display: block; font-weight: 800; font-size: 16px; line-height: 1.15; text-transform: uppercase; }
.bf-sum-qty { color: var(--cb-muted); font-size: 13px; margin-top: 3px; }
.bf-sum-price { font-weight: 700; font-size: 15px; white-space: nowrap; }
.bf-promo { display: flex; gap: 8px; margin: 4px 0 16px; }
.bf-promo input { flex: 1; min-width: 0; border: 1.5px solid var(--cb-line); border-radius: 9px; padding: 10px 13px; font-size: 13.5px; font-family: inherit; outline: none; background: #fff; }
.bf-promo input:focus { border-color: var(--cb-ink); }
.bf-promo button { background: var(--cb-ink); color: #fff; border: none; border-radius: 9px; padding: 10px 18px; font-size: 13.5px; font-weight: 700; font-family: inherit; cursor: pointer; }
.bf-promo-applied input { background: #f0fdf4; color: var(--cb-good); border-color: #bbf7d0; }
.bf-promo-applied .bf-promo-remove { background: transparent; color: var(--cb-muted); border: 1px solid var(--cb-line); }
.bf-totals { border-top: 1px solid var(--cb-soft-line); padding-top: 14px; display: grid; gap: 8px; }
.bf-total-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bf-total-row .lbl { color: var(--cb-muted); }
.bf-total-row .val { font-weight: 700; }
.bf-total-row .free, .bf-total-row .val.free { color: var(--cb-good); }
.bf-grand { display: flex; justify-content: space-between; margin: 16px 0 4px; padding-top: 14px; border-top: 2px solid var(--cb-ink); font-weight: 800; font-size: 22px; text-transform: uppercase; }
.cb-note { color: var(--cb-muted); font-size: 12px; margin: 0 0 18px; }
.cb-trust { list-style: none; margin: 0; padding: 16px; background: #fff; border: 1px solid var(--cb-line); border-radius: 12px; display: grid; gap: 11px; }
.cb-trust li { display: flex; align-items: center; gap: 10px; font-size: 13px; }

/* Quantity stepper (cart-qty.js) */
.bf-qty { display: inline-flex; align-items: center; margin-top: 8px; border: 1px solid var(--cb-line); border-radius: 8px; background: #fff; overflow: hidden; }
.bf-qty-btn { width: 30px; height: 28px; border: 0; padding: 0; background: #f4f4f2; color: var(--cb-ink); font-size: 16px; line-height: 1; cursor: pointer; font-family: inherit; }
.bf-qty-btn:hover:not(:disabled) { background: #e8e8e4; }
.bf-qty-btn:disabled { opacity: 0.4; cursor: default; }
.bf-qty-val { min-width: 32px; text-align: center; font-size: 13px; font-weight: 700; }
.bf-qty.busy { opacity: 0.6; }

/* Payment column */
.cb-banner { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; margin: 0 0 16px; padding: 10px 16px; border: 1px solid var(--cb-soft-line); border-radius: 12px; background: var(--cb-soft); font-size: 16px; text-align: center; }
.cb-urgency { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
.cb-urgency > div { display: flex; align-items: center; gap: 9px; min-height: 64px; padding: 11px 12px; border-radius: 12px; background: var(--cb-soft); }
.cb-urgency strong { font-size: 14px; line-height: 1.25; }
.cb-payment h2 { margin: 0; font-weight: 800; font-size: clamp(28px, 3vw, 38px); line-height: 1.05; letter-spacing: -0.02em; }
.cb-sub { color: var(--cb-muted); font-size: 15px; margin: 8px 0 18px; }
.cb-trust-row { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 20px; color: var(--cb-muted); font-size: 12px; }
.cb-trust-row span { display: inline-flex; align-items: center; gap: 6px; }
.cb-trust-row .cb-ico { width: 18px; }

/* Stripe Embedded Checkout mount + loading state */
.cb-stripe-shell { position: relative; min-height: 420px; }
.bf-loading { padding: 16px 0; text-align: center; font-size: 14px; color: var(--cb-muted); }
.bf-loading:empty { display: none; padding: 0; }
.cb-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 120px; }
.cb-loading:not(:empty)::before { content: ""; width: 20px; height: 20px; border: 2px solid var(--cb-line); border-top-color: var(--cb-good); border-radius: 50%; animation: cb-spin 0.8s linear infinite; }
.cb-loading:not(:empty) + .cb-stripe { min-height: 0; }
.cb-stripe { min-height: 420px; }
.cb-stripe:empty { min-height: 0; }
.cb-error { color: #b91c1c; font-size: 14px; margin-top: 10px; }
.cb-error:empty { display: none; }
.bf-pay-btn { margin-top: 16px; width: 100%; background: var(--cb-accent); color: #fff; border: none; border-radius: 10px; padding: 15px; font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer; }
@keyframes cb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cb-loading:not(:empty)::before { animation: none; } }

/* Mobile: summary first, then payment (cabet's stacking) */
@media (max-width: 800px) {
  .cb-header { width: min(980px, 100% - 24px); margin: 16px auto 12px; }
  .cb-dialog { width: min(980px, 100% - 24px); grid-template-columns: 1fr; }
  .cb-summary { border-right: 0; border-bottom: 1px solid var(--cb-line); padding: 24px 20px; }
  .cb-payment { padding: 24px 20px 30px; }
  .cb-banner { font-size: 15px; }
  .cb-urgency { grid-template-columns: 1fr; gap: 8px; margin-bottom: 24px; }
  .cb-urgency > div { min-height: 54px; border-radius: 10px; }
  .cb-trust-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .cb-trust-row span:last-child { grid-column: 1 / -1; }
  .cb-payment h2 { font-size: 30px; }
  .cb-sub { font-size: 14px; }
  .cb-stripe-shell, .cb-stripe { min-height: 360px; }
}
