/* ==========================================================================
   TVB Cart Drawer — consumes the theme's own :root tokens (with runtime
   fallbacks) so it matches the site 1:1. Radius uses the theme's REAL tokens
   (--radius:2px / --radius-lg:4px) — TVB is intentionally sharp; the drawer
   follows the brand, not the reference mock's rounded corners.
   Accent gradient, subtle glow only on the unlocked shipping bar. No purple.
   ========================================================================== */

.tvb-cd,
.tvb-cd-scrim {
  --_bg:      var(--surface, #0d0d15);
  --_bg2:     var(--surface-2, #12121c);
  --_text:    var(--text, #f4f6f8);
  --_muted:   var(--text-3, rgba(255,255,255,.42));
  --_faint:   var(--text-4, rgba(255,255,255,.28));
  --_line:    var(--line, rgba(255,255,255,.07));
  --_line2:   var(--line-strong, rgba(255,255,255,.14));
  --_cyan:    var(--cyan, #00c9c8);
  --_ok:      var(--ok, #34d399);
  --_danger:  var(--danger, #ef4444);
  --_r:       var(--radius, 2px);
  --_rl:      var(--radius-lg, 4px);
  --_mono:    var(--font-mono, 'Roboto Mono', ui-monospace, monospace);
  --_body:    var(--font-body, 'Inter', system-ui, sans-serif);
  --_grad:    linear-gradient(90deg, #00C9C8 0%, #0693e3 100%);
  --_ease:    var(--tvb-ease-out, cubic-bezier(.22, 1, .36, 1));
}

.tvb-cd-scrim {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .3s var(--_ease);
}
.tvb-cd-scrim.is-open { opacity: 1; }

.tvb-cd {
  position: fixed; top: 0; right: 0; z-index: 1001;
  width: 420px; max-width: 100vw; height: 100%;
  display: flex; flex-direction: column;
  background: var(--_bg); color: var(--_text);
  font-family: var(--_body);
  border-left: 1px solid var(--_line2);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
  transform: translateX(100%);
  transition: transform .3s var(--_ease);
}
.tvb-cd.is-open { transform: translateX(0); }

/* ---- header ---- */
.tvb-cd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--_line); flex: none;
}
.tvb-cd-title { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.tvb-cd-count { color: var(--_muted); font-family: var(--_mono); font-variant-numeric: tabular-nums; }
.tvb-cd-close {
  width: 44px; height: 44px; margin: -10px -10px -10px 0;
  background: none; border: 0; color: var(--_muted); font-size: 28px; line-height: 1;
  cursor: pointer; transition: color .18s var(--_ease);
}
.tvb-cd-close:hover { color: var(--_text); }

/* ---- free-shipping bar ---- */
.tvb-cd-ship { padding: 14px 20px 4px; flex: none; }
.tvb-cd-ship-msg { margin: 0 0 8px; font-size: .82rem; color: var(--_muted); }
.tvb-cd-ship.is-unlocked .tvb-cd-ship-msg { color: var(--_ok); }
.tvb-cd-truck { color: var(--_cyan); }
.tvb-cd-ship-track {
  height: 5px; border-radius: 999px; background: var(--_line2); overflow: hidden;
}
.tvb-cd-ship-fill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--_grad); transition: width .4s var(--_ease);
}
.tvb-cd-ship.is-unlocked .tvb-cd-ship-fill {
  box-shadow: var(--glow-cyan, 0 0 12px rgba(0, 201, 200, .5));
}

/* ---- body / items ---- */
.tvb-cd-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 20px; -webkit-overflow-scrolling: touch; }
.tvb-cd-item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--_line);
}
.tvb-cd-thumb { width: 64px; height: 64px; background: var(--_bg2); border-radius: var(--_r); overflow: hidden; }
.tvb-cd-thumb img { width: 64px; height: 64px; object-fit: cover; display: block; }
.tvb-cd-item-name { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.tvb-cd-item-var {
  margin-top: 3px; font-family: var(--_mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--_muted);
}

.tvb-cd-qty { display: inline-flex; align-items: center; gap: 2px; margin-top: 10px; border: 1px solid var(--_line2); border-radius: var(--_r); }
.tvb-cd-qty-btn {
  width: 30px; height: 30px; background: none; border: 0; color: var(--_text);
  font-size: 16px; cursor: pointer; line-height: 1; transition: background .15s var(--_ease);
}
.tvb-cd-qty-btn:hover { background: rgba(255, 255, 255, .05); }
.tvb-cd-qty-n {
  min-width: 26px; text-align: center; font-family: var(--_mono); font-variant-numeric: tabular-nums; font-size: .85rem;
}

.tvb-cd-item-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.tvb-cd-item-price .woocommerce-Price-amount,
.tvb-cd-price .woocommerce-Price-amount,
.tvb-cd-reg .woocommerce-Price-amount,
.tvb-cd-total-val .woocommerce-Price-amount,
.tvb-cd-recon-price .woocommerce-Price-amount {
  font-family: var(--_mono); font-variant-numeric: tabular-nums;
}
.tvb-cd-price { font-weight: 700; font-size: .9rem; color: var(--_text); }
.tvb-cd-reg { color: var(--_muted); text-decoration: line-through; font-size: .78rem; }
.tvb-cd-save {
  font-family: var(--_mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--_cyan); border: 1px solid var(--cyan-line, rgba(0, 201, 200, .32)); border-radius: var(--_r); padding: 1px 5px;
}
.tvb-cd-remove {
  margin-top: 6px; background: none; border: 0; color: var(--_faint); font-size: 18px; line-height: 1; cursor: pointer;
  transition: color .15s var(--_ease);
}
.tvb-cd-remove:hover { color: var(--_danger); }

/* ---- empty / skeleton ---- */
.tvb-cd-empty { padding: 48px 8px; text-align: center; }
.tvb-cd-empty-msg { color: var(--_muted); margin: 0 0 18px; }
.tvb-cd-skeleton { padding: 20px 0; display: grid; gap: 14px; }
.tvb-cd-skeleton span { display: block; height: 64px; border-radius: var(--_r); background: linear-gradient(90deg, var(--_bg2), rgba(255, 255, 255, .04), var(--_bg2)); background-size: 200% 100%; animation: tvb-cd-sk 1.2s var(--_ease) infinite; }
@keyframes tvb-cd-sk { to { background-position: -200% 0; } }

/* ---- footer ---- */
.tvb-cd-foot { flex: none; padding: 16px 20px 20px; border-top: 1px solid var(--_line); background: var(--_bg); }

.tvb-cd-coupon { margin-bottom: 14px; }
.tvb-cd-coupon-toggle { background: none; border: 0; color: var(--_cyan); font-size: .85rem; cursor: pointer; padding: 0; }
.tvb-cd-coupon-panel { display: flex; gap: 8px; margin-top: 10px; }
.tvb-cd-coupon-input {
  flex: 1; min-width: 0; background: var(--_bg2); border: 1px solid var(--_line2); color: var(--_text);
  border-radius: var(--_r); padding: 10px 12px; font-family: var(--_body); font-size: .88rem;
}
.tvb-cd-coupon-input:focus { outline: none; border-color: var(--cyan-line, rgba(0, 201, 200, .32)); box-shadow: 0 0 0 3px var(--cyan-soft, rgba(0, 201, 200, .12)); }
.tvb-cd-coupon-apply {
  background: var(--_bg2); border: 1px solid var(--_line2); color: var(--_text); border-radius: var(--_r);
  padding: 0 16px; cursor: pointer; font-weight: 600; font-size: .85rem;
}
.tvb-cd-coupon-err { margin: 8px 0 0; color: var(--_danger); font-size: .8rem; }
.tvb-cd-chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 8px 0 0; padding: 4px 6px 4px 10px;
  background: var(--cyan-soft, rgba(0, 201, 200, .12)); border: 1px solid var(--cyan-line, rgba(0, 201, 200, .32));
  border-radius: 999px; font-family: var(--_mono); font-size: 11px; letter-spacing: .04em; color: var(--_cyan);
}
.tvb-cd-chip-x { background: none; border: 0; color: var(--_cyan); cursor: pointer; font-size: 15px; line-height: 1; }

/* ---- recon toggle ---- */
.tvb-cd-recon {
  display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--_line); border-bottom: 1px solid var(--_line);
}
.tvb-cd-recon-name { flex: 1; font-size: .88rem; font-weight: 600; }
.tvb-cd-recon-price { color: var(--_muted); font-weight: 700; font-size: .85rem; }
.tvb-cd-switch {
  width: 46px; height: 26px; flex: none; border: 0; border-radius: 999px; cursor: pointer; padding: 0;
  background: var(--_line2); position: relative; transition: background .2s var(--_ease);
}
.tvb-cd-switch.is-on { background: var(--_grad); }
.tvb-cd-switch-knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--_ease);
}
.tvb-cd-switch.is-on .tvb-cd-switch-knob { transform: translateX(20px); }

/* ---- totals ---- */
.tvb-cd-totals { padding: 14px 0 4px; }
.tvb-cd-total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: .9rem; }
.tvb-cd-total-label { color: var(--_muted); }
.tvb-cd-total-val { font-family: var(--_mono); font-variant-numeric: tabular-nums; font-weight: 700; }
.tvb-cd-total-row.is-discount .tvb-cd-total-val { color: var(--_ok); }
.tvb-cd-fineprint { margin: 8px 0 0; font-size: .74rem; color: var(--_faint); }

/* ---- CTAs ---- */
.tvb-cd-btn {
  display: block; width: 100%; text-align: center; padding: 15px; border: 0; border-radius: var(--_r);
  font-weight: 700; font-size: .95rem; letter-spacing: .02em; cursor: pointer; text-decoration: none;
  transition: transform .2s var(--_ease), box-shadow .3s var(--_ease);
}
.tvb-cd-btn-primary { margin-top: 14px; background: var(--_grad); color: #04121f; }
.tvb-cd-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px var(--cyan-glow, rgba(0, 201, 200, .5)); }
.tvb-cd-btn-ghost { background: transparent; border: 1px solid var(--cyan-line, rgba(0, 201, 200, .32)); color: var(--_cyan); }
.tvb-cd-continue { display: block; width: 100%; margin-top: 10px; background: none; border: 0; color: var(--_muted); font-size: .85rem; cursor: pointer; padding: 8px; }
.tvb-cd-continue:hover { color: var(--_text); }

.tvb-cd.is-busy { cursor: progress; }
.tvb-cd.is-busy .tvb-cd-body, .tvb-cd.is-busy .tvb-cd-foot { opacity: .6; }

/* ---- body scroll lock ---- */
body.tvb-cd-lock { overflow: hidden; }

/* logged-in admins only: keep the drawer clear of the fixed WP admin bar */
body.admin-bar .tvb-cd { top: 32px; height: calc(100% - 32px); }
@media (max-width: 782px) { body.admin-bar .tvb-cd { top: 46px; height: calc(100% - 46px); } }

/* ---- mobile ---- */
@media (max-width: 480px) {
  .tvb-cd { width: 100vw; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .tvb-cd, .tvb-cd-scrim, .tvb-cd-ship-fill, .tvb-cd-switch, .tvb-cd-switch-knob, .tvb-cd-btn { transition: none; }
  .tvb-cd-skeleton span { animation: none; }
}
