/* ============================================================
   CHECKOUT — Universal checkout/cart styles
   Tokens: --chk-* (overrideable per template)
   Defaults: light neutral
   ============================================================ */

:root {
  /* background layers */
  --chk-bg:           #f8fafc;
  --chk-surface:      #ffffff;
  --chk-surface-2:    #f1f5f9;

  /* text */
  --chk-text:         #0f172a;
  --chk-text-2:       #475569;
  --chk-text-3:       #64748b;
  --chk-text-muted:   #94a3b8;

  /* accent */
  --chk-accent:       #8b5cf6;
  --chk-accent-dark:  #7c3aed;
  --chk-accent-text:  #ffffff;
  --chk-accent-soft:  rgba(139, 92, 246, 0.08);

  /* lines */
  --chk-line:         #e2e8f0;
  --chk-line-2:       #cbd5e1;

  /* states */
  --chk-success-bg:   #d1fae5;
  --chk-success-text: #065f46;
  --chk-free-text:    #16a34a;
  --chk-error-bg:     #fef2f2;
  --chk-error-text:   #991b1b;
  --chk-error-border: #fecaca;
  --chk-error-icon:   #ef4444;
  --chk-warn-bg:      #fffbeb;
  --chk-warn-text:    #92400e;
  --chk-warn-border:  #fde68a;

  /* typography */
  --chk-font:         system-ui, -apple-system, sans-serif;
  --chk-font-display: system-ui, -apple-system, sans-serif;

  /* shape */
  --chk-radius:    8px;
  --chk-radius-sm: 6px;
  --chk-radius-lg: 12px;

  /* button */
  --chk-btn-bg:       var(--chk-accent);
  --chk-btn-text:     var(--chk-accent-text);
  --chk-btn-hover-bg: var(--chk-accent-dark);
}

.chk-wrap { background: var(--chk-bg); min-height: 100vh; padding: 32px 0 80px; }
.chk-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.chk-back { display: inline-block; font-size: 14px; color: var(--chk-text-3); text-decoration: none; margin-bottom: 24px; }
.chk-back:hover { color: var(--chk-accent); }
.chk-alert { padding: 12px 16px; border-radius: var(--chk-radius); margin-bottom: 20px; font-size: 14px; }
.chk-alert-error { background: var(--chk-error-bg); color: var(--chk-error-text); border: 1px solid var(--chk-error-border); }
.chk-alert-warn  { background: var(--chk-warn-bg);  color: var(--chk-warn-text);  border: 1px solid var(--chk-warn-border); }

.chk-progress { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto 32px; max-width: 600px; }
.chk-step-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; background: transparent; border: 0; cursor: pointer; padding: 0; font-family: var(--chk-font); color: var(--chk-text-muted); }
.chk-step-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.chk-step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--chk-line); color: var(--chk-text-muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; transition: all 0.2s; }
.chk-step-label { font-size: 12px; font-weight: 500; }
.chk-step-btn.active .chk-step-num { background: var(--chk-accent); color: var(--chk-accent-text); }
.chk-step-btn.active .chk-step-label { color: var(--chk-accent); font-weight: 600; }
.chk-step-btn.done .chk-step-num { background: var(--chk-success-bg); color: var(--chk-success-text); }
.chk-step-btn.done .chk-step-label { color: var(--chk-success-text); }
.chk-step-line { flex: 1; height: 2px; background: var(--chk-line); max-width: 80px; }

.chk-empty { text-align: center; padding: 80px 20px; background: var(--chk-surface); border-radius: var(--chk-radius-lg); border: 1px solid var(--chk-line); }
.chk-empty svg { margin-bottom: 16px; }
.chk-empty h2 { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--chk-text); font-family: var(--chk-font-display); }
.chk-empty p { color: var(--chk-text-3); margin: 0 0 24px; }

.chk-grid { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .chk-grid { grid-template-columns: 1fr; } }

.chk-h2 { font-size: 16px; font-weight: 700; color: var(--chk-text); margin: 0 0 12px; padding-top: 8px; font-family: var(--chk-font-display); }
.chk-card { background: var(--chk-surface); border: 1px solid var(--chk-line); border-radius: var(--chk-radius); padding: 20px; margin-bottom: 20px; }
.chk-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chk-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .chk-row-2, .chk-row-3 { grid-template-columns: 1fr; } }
.chk-field { margin-bottom: 14px; }
.chk-field:last-child { margin-bottom: 0; }
.chk-field label { display: block; font-size: 13px; color: var(--chk-text-2); margin-bottom: 6px; font-weight: 500; }
.chk-field .req { color: var(--chk-error-icon); }
.chk-field input, .chk-field textarea, .chk-field select { width: 100%; padding: 10px 12px; border: 1px solid var(--chk-line-2); border-radius: var(--chk-radius); font-size: 14px; font-family: var(--chk-font); background: var(--chk-surface); color: var(--chk-text); transition: border-color 0.15s, box-shadow 0.15s; }
.chk-field input:focus, .chk-field textarea:focus, .chk-field select:focus { outline: none; border-color: var(--chk-accent); box-shadow: 0 0 0 3px var(--chk-accent-soft); }
.chk-field .chk-err { border-color: var(--chk-error-icon); }
.chk-field textarea { resize: vertical; min-height: 80px; }

.chk-toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--chk-text-2); cursor: pointer; }
.chk-toggle input { width: 18px; height: 18px; accent-color: var(--chk-accent); cursor: pointer; flex-shrink: 0; }
.chk-billing-fields { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--chk-line); }
.chk-gdpr { align-items: flex-start; }
.chk-gdpr a { color: var(--chk-accent); }

.chk-radio { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--chk-line); border-radius: var(--chk-radius); margin-bottom: 8px; cursor: pointer; transition: all 0.15s; }
.chk-radio:last-child { margin-bottom: 0; }
.chk-radio:has(input:checked) { border-color: var(--chk-accent); background: var(--chk-accent-soft); }
.chk-radio input[type="radio"] { width: 18px; height: 18px; accent-color: var(--chk-accent); cursor: pointer; flex-shrink: 0; }
.chk-radio-content { flex: 1; }
.chk-radio-content strong { display: block; font-size: 14px; font-weight: 600; color: var(--chk-text); }
.chk-radio-content small { display: block; font-size: 12px; color: var(--chk-text-3); margin-top: 2px; }
.chk-radio-price { font-size: 14px; font-weight: 700; color: var(--chk-text); white-space: nowrap; }
.chk-radio-price.chk-free { color: var(--chk-free-text); }

.chk-btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 22px; border-radius: var(--chk-radius); font-size: 14px; font-weight: 600; font-family: var(--chk-font); border: 0; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.chk-btn-primary { background: var(--chk-btn-bg); color: var(--chk-btn-text); }
.chk-btn-primary:hover { background: var(--chk-btn-hover-bg); }
.chk-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.chk-btn-ghost { background: transparent; color: var(--chk-text-3); }
.chk-btn-ghost:hover { color: var(--chk-text); background: var(--chk-surface-2); }
.chk-btn-outline { background: transparent; color: var(--chk-accent); border: 1px solid var(--chk-accent); }
.chk-btn-outline:hover { background: var(--chk-accent); color: var(--chk-accent-text); }
.chk-btn-lg { padding: 14px 28px; font-size: 15px; }
.chk-step-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; flex-wrap: wrap; gap: 12px; }

.chk-cart-list { display: flex; flex-direction: column; gap: 12px; }
.chk-cart-item { display: grid; grid-template-columns: 72px 1fr 32px; grid-template-areas: "img info remove" "img controls controls"; gap: 10px 14px; align-items: center; padding: 14px; background: var(--chk-surface); border: 1px solid var(--chk-line); border-radius: var(--chk-radius, 12px); margin-bottom: 0; }
.chk-cart-img { grid-area: img; }
.chk-cart-img img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--chk-radius-sm); display: block; }
.chk-img-ph { width: 72px; height: 72px; background: var(--chk-surface-2); border-radius: var(--chk-radius-sm); }
.chk-cart-info { grid-area: info; min-width: 0; }
.chk-cart-name { font-weight: 600; color: var(--chk-text); font-size: 14px; }
.chk-cart-price { font-size: 12px; color: var(--chk-text-3); margin-top: 2px; }
.chk-cart-remove { grid-area: remove; align-self: start; width: 32px; height: 32px; background: transparent; border: 0; color: var(--chk-text-muted); cursor: pointer; border-radius: var(--chk-radius-sm); display: flex; align-items: center; justify-content: center; }
.chk-cart-remove:hover { background: var(--chk-error-bg); color: var(--chk-error-icon); }
.chk-cart-controls { grid-area: controls; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chk-qty { display: flex; align-items: center; border: 1px solid var(--chk-line-2); border-radius: var(--chk-radius); overflow: hidden; }
.chk-qty-btn { width: 32px; height: 32px; background: var(--chk-bg); border: 0; font-size: 16px; font-weight: 700; color: var(--chk-text-2); cursor: pointer; }
.chk-qty-btn:hover { background: var(--chk-line); }
.chk-qty-input { width: 40px; height: 32px; border: 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--chk-text); background: var(--chk-surface); -moz-appearance: textfield; }
.chk-qty-input::-webkit-outer-spin-button, .chk-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.chk-cart-total { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--chk-text); white-space: nowrap; margin-left: auto; }
@media (max-width: 600px) {
  .chk-cart-item { grid-template-columns: 60px 1fr 28px; gap: 8px 10px; padding: 10px; }
  .chk-cart-name { font-size: 14px; }
  .chk-cart-total { font-size: 15px; }
}

.chk-review-block { padding: 12px 0; border-bottom: 1px solid var(--chk-surface-2); }
.chk-review-block:last-child { border-bottom: 0; }
.chk-review-title { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--chk-text-3); margin-bottom: 8px; }
.chk-review-body { font-size: 14px; color: var(--chk-text-2); line-height: 1.6; }
.chk-edit { background: transparent; border: 0; color: var(--chk-accent); font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--chk-font); text-transform: none; letter-spacing: 0; }
.chk-edit:hover { text-decoration: underline; }

.chk-coupon { display: flex; gap: 8px; }
.chk-coupon input { flex: 1; padding: 10px 12px; border: 1px solid var(--chk-line-2); border-radius: var(--chk-radius); font-size: 14px; font-family: var(--chk-font); text-transform: uppercase; }
.chk-coupon input:focus { outline: none; border-color: var(--chk-accent); box-shadow: 0 0 0 3px var(--chk-accent-soft); }
.chk-coupon-msg { margin-top: 10px; font-size: 13px; padding: 8px 12px; border-radius: var(--chk-radius-sm); }
.chk-coupon-msg.chk-ok    { background: var(--chk-success-bg); color: var(--chk-success-text); }
.chk-coupon-msg.chk-err-msg { background: var(--chk-error-bg); color: var(--chk-error-text); }

.chk-summary { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto; }
.chk-summary-inner { background: var(--chk-surface); border: 1px solid var(--chk-line); border-radius: var(--chk-radius-lg); padding: 20px; }
.chk-summary-title { font-size: 16px; font-weight: 700; color: var(--chk-text); margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--chk-surface-2); font-family: var(--chk-font-display); }
.chk-summary-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--chk-surface-2); }
.chk-sum-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.chk-sum-thumb { position: relative; width: 48px; height: 48px; border-radius: var(--chk-radius-sm); overflow: hidden; background: var(--chk-surface-2); }
.chk-sum-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chk-sum-qty { position: absolute; top: -6px; right: -6px; background: var(--chk-accent); color: var(--chk-accent-text); font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.chk-sum-name { color: var(--chk-text-2); line-height: 1.4; }
.chk-sum-price { font-weight: 600; color: var(--chk-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chk-summary-totals { display: flex; flex-direction: column; gap: 8px; }
.chk-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--chk-text-3); font-variant-numeric: tabular-nums; }
.chk-row em { font-style: normal; color: var(--chk-text-muted); }
.chk-neg { color: var(--chk-free-text); }
.chk-row-total { padding-top: 10px; border-top: 1px solid var(--chk-surface-2); font-size: 17px; font-weight: 700; color: var(--chk-text); }
@media (max-width: 900px) { .chk-summary { position: static; } }
