/* Card detail page — eBay vs TCGplayer side-by-side price comparison.
   Extends design-system.css. Additional tokens and component styles below. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Additional tokens specific to the card detail page palette (extends design-system vars).
   These are intentionally distinct from landing (darker surface) for contrast UX. */
:root {
  /* Surfaces */
  --surface-2: #1c2230;
  /* Extended text tokens not in design-system */
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  /* Semantic — mirrors hot-movers.css palette */
  --success-dim2: rgba(34,197,94,0.02);
  --green-border: rgba(34,197,94,0.25);
  --green: #22c55e;
  --winner-glow: 0 0 0 2px rgba(34,197,94,0.3), 0 4px 24px rgba(34,197,94,0.08);
  /* Radii */
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body.card-detail-page {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
.cd-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.cd-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cd-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
}
.cd-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cd-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.cd-nav a:hover { color: var(--text); background: var(--surface); }
.cd-nav-cta {
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 600;
}
.cd-nav-cta:hover { background: var(--primary-h) !important; }

/* ── Main layout ── */
.cd-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── Breadcrumb ── */
.cd-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 20px 0 12px;
  font-size: 0.8125rem;
  color: var(--text-dim);
}
.cd-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.cd-breadcrumb a:hover { color: var(--primary); }
.cd-breadcrumb-current { color: var(--text-muted); }

/* ── Card Hero ── */
.cd-hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
  padding: 24px 0 40px;
}
.cd-hero-image-wrap { position: relative; }
.cd-hero-image {
  width: 200px;
  height: 280px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: block;
}
.cd-true-deal-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(249,115,22,0.4);
}
.cd-game-tag {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.cd-card-name {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--text);
}
.cd-card-set {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.cd-market-ref {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cd-market-label {
  font-size: 0.8125rem;
  color: var(--text-dim);
}
.cd-market-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: line-through;
  opacity: 0.6;
}
.cd-savings-pill {
  background: var(--success-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.cd-hero-hook {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.7;
}
.cd-best-inline {
  color: var(--green);
  font-weight: 600;
}

/* ── Comparison Section ── */
.cd-comparison {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 36px 28px;
  margin-bottom: 32px;
}
.cd-comparison-heading {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.cd-comparison-subhead {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.cd-comparison-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}

/* ── Marketplace Column ── */
.cd-mp-col {
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  transition: box-shadow 0.2s;
}
.cd-mp-col--winner {
  background: linear-gradient(160deg, var(--success-dim), var(--success-dim2));
  border: 1.5px solid var(--green-border);
  box-shadow: var(--winner-glow);
}
.cd-mp-col--other {
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* Best badge */
.cd-best-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

/* Marketplace header */
.cd-mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.cd-mp-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.cd-mp-shipping-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Price breakdown */
.cd-price-breakdown { display: flex; flex-direction: column; gap: 8px; }
.cd-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}
.cd-price-label { color: var(--text-muted); }
.cd-price-value { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.cd-price-shipping { color: var(--text-dim); }
.cd-price-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.cd-price-total-row { margin-top: 2px; }
.cd-price-total-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.cd-price-total-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}
.cd-mp-col--winner .cd-price-total-value { color: var(--green); }
.cd-savings-vs-market {
  font-size: 0.8rem;
  color: var(--green);
  margin-top: 4px;
  font-weight: 600;
}

/* Buy buttons */
.cd-buy-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 13px 20px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  margin-top: 20px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.cd-buy-btn--primary {
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 12px rgba(249,115,22,0.25);
}
.cd-buy-btn--primary:hover {
  background: var(--primary-h);
  border-color: var(--primary-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(249,115,22,0.35);
}
.cd-buy-btn--secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.cd-buy-btn--secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* FTC micro-disclosure under each button */
.cd-mp-disclosure {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 8px;
}

/* VS divider */
.cd-vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-dim);
  padding-top: 80px; /* align with price rows */
  min-width: 32px;
}

/* Verdict bar */
.cd-verdict {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.cd-verdict strong { color: var(--text); }

/* FTC full disclosure */
.cd-ftc-disclosure {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.cd-ftc-disclosure--inline {
  text-align: center;
  margin-top: 16px;
}
.ftc-icon {
  margin-right: 4px;
  font-style: normal;
}

/* ── Alert CTA ── */
.cd-alert-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.cd-alert-cta-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.cd-alert-icon { font-size: 2rem; }
.cd-alert-text { flex: 1; min-width: 200px; }
.cd-alert-text h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.cd-alert-text p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Shared primary button */
.cd-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 22px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.cd-btn-primary:hover {
  background: var(--primary-h);
  transform: translateY(-1px);
}

/* ── Back link ── */
.cd-back-wrap { padding: 8px 0 16px; }
.cd-back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}
.cd-back-link:hover { color: var(--primary); }

/* ── Not Found ── */
.cd-not-found {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 60px 24px;
}
.cd-not-found-icon {
  font-size: 64px;
  opacity: 0.2;
}
.cd-not-found h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}
.cd-not-found p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 380px;
}

/* ── Footer ── */
.cd-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: 40px;
}
.cd-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.cd-footer-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}
.cd-footer-nav {
  display: flex;
  gap: 16px;
  flex: 1;
}
.cd-footer-nav a {
  color: var(--text-dim);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: color 0.15s;
}
.cd-footer-nav a:hover { color: var(--text-muted); }
.cd-footer-copy {
  font-size: 0.75rem;
  color: var(--text-dim);
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — stack comparison vertically, winner on top
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .cd-hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0 28px;
  }
  .cd-hero-image-wrap {
    display: flex;
    justify-content: center;
  }
  .cd-hero-image { width: 160px; height: 224px; }

  .cd-card-name { font-size: 1.5rem; }

  .cd-comparison { padding: 24px 20px 20px; }
  .cd-comparison-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cd-vs-divider {
    padding: 0;
    order: 1; /* between the two columns */
  }

  /* Winner column always renders first on mobile */
  .cd-mp-col--winner { order: 0; }
  .cd-mp-col--other  { order: 2; }
  .cd-vs-divider     { order: 1; }

  .cd-alert-cta-inner { flex-direction: column; align-items: flex-start; }
  .cd-btn-primary { width: 100%; justify-content: center; }

  .cd-footer-nav { display: none; }
}

@media (max-width: 480px) {
  .cd-main { padding: 0 16px 60px; }
  .cd-comparison { padding: 20px 16px 16px; }
  .cd-mp-col { padding: 18px 16px; }
  .cd-price-total-value { font-size: 1.25rem; }
}

/* ── Skeleton Loading ── */
.cd-skeleton {
  pointer-events: none;
}
.cd-skeleton-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 36px 28px;
  margin-bottom: 32px;
}
.cd-skeleton-hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  padding: 24px 0 40px;
}
.cd-skel-img {
  width: 200px;
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.cd-skel-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}
.cd-skel-line {
  border-radius: var(--radius-sm);
  height: 16px;
}
.cd-skel-line--lg { height: 28px; width: 70%; }
.cd-skel-line--md { height: 16px; width: 50%; }
.cd-skel-line--sm { height: 12px; width: 35%; }
.cd-skel-line--xl { height: 44px; width: 45%; border-radius: var(--radius-sm); }

/* No-data placeholder when one marketplace is missing */
.cd-no-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  text-align: center;
}
.cd-no-data-icon {
  font-size: 1.8rem;
  color: var(--text-muted);
  line-height: 1;
}
.cd-no-data-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  margin: 0;
}
.cd-no-data-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0;
}

/* Note when only one marketplace has data */
.cd-partial-note {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-2);
  text-align: center;
}

@media (max-width: 768px) {
  .cd-skeleton-hero { grid-template-columns: 1fr; gap: 20px; padding: 20px 0 28px; }
  .cd-skel-img { width: 160px; height: 224px; margin: 0 auto; }
  .cd-skel-block { padding-top: 0; }
  .cd-skeleton-wrap { padding: 24px 20px 20px; }
}

@media (max-width: 480px) {
  .cd-skeleton-wrap { padding: 20px 16px 16px; }
  .cd-skel-line--lg { width: 85%; }
  .cd-skel-line--xl { width: 60%; }
}

/* ─────────────────────────────────────────────────────────────────
   Set Price Alert widget  — .sa-* namespace
   ───────────────────────────────────────────────────────────────── */
.sa-widget {
  max-width: 780px;
  margin: 32px auto;
  background: #131824;
  border: 1px solid #2a3248;
  border-radius: 16px;
  padding: 28px 32px;
  scroll-margin-top: 80px; /* account for sticky header */
}
.sa-inner { max-width: 680px; margin: 0 auto; }

/* Header row */
.sa-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}
.sa-bell { font-size: 28px; line-height: 1; flex-shrink: 0; }
.sa-title { font-size: 1.25rem; font-weight: 800; color: #e6edf3; margin-bottom: 4px; }
.sa-subtitle { font-size: 0.9rem; color: #8b949e; }

/* Field grid */
.sa-row { display: grid; gap: 16px; margin-bottom: 16px; }
.sa-row--2 { grid-template-columns: 1fr 1fr; }

.sa-field { display: flex; flex-direction: column; gap: 6px; }
.sa-label { font-size: 0.8rem; font-weight: 600; color: #8b949e; text-transform: uppercase; letter-spacing: 0.4px; }

.sa-input {
  background: #0d1117;
  border: 1px solid #2a3248;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: #e6edf3;
  width: 100%;
  transition: border-color 0.15s;
}
.sa-input:focus { outline: none; border-color: #3b6fef; }
.sa-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
.sa-select option { background: #0d1117; }

.sa-input-prefix-wrap { position: relative; }
.sa-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8b949e; font-size: 0.95rem; pointer-events: none; }
.sa-input--prefixed { padding-left: 24px; }

.sa-err { font-size: 0.78rem; color: #f87171; min-height: 16px; }

/* Submit row */
.sa-submit-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.sa-btn {
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.sa-btn:hover { background: #16a34a; }
.sa-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.sa-privacy-note { font-size: 0.78rem; color: #6868a0; }

/* Error banner */
.sa-banner { border-radius: 8px; padding: 10px 14px; font-size: 0.88rem; margin-top: 12px; }
.sa-banner--err { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: #f87171; }

/* Success state */
.sa-success { text-align: center; padding: 16px 0; }
.sa-success-icon { font-size: 40px; color: #22c55e; margin-bottom: 12px; }
.sa-success-title { font-size: 1.2rem; font-weight: 800; color: #22c55e; margin-bottom: 8px; }
.sa-success-body { font-size: 0.92rem; color: #9898b8; line-height: 1.6; margin-bottom: 16px; }
.sa-manage-link { display: inline-block; color: #3b6fef; font-size: 0.88rem; font-weight: 600; text-decoration: underline; margin-bottom: 12px; }
.sa-another-btn { display: block; margin: 8px auto 0; background: none; border: 1px solid #2a3248; color: #9898b8; border-radius: 8px; padding: 8px 20px; font-size: 0.85rem; cursor: pointer; }
.sa-another-btn:hover { border-color: #3b6fef; color: #e6edf3; }

/* Duplicate state */
.sa-duplicate { text-align: center; padding: 20px 0; }
.sa-dup-icon { font-size: 32px; margin-bottom: 10px; color: #f59e0b; }
.sa-dup-text { color: #9898b8; font-size: 0.92rem; margin-bottom: 12px; }

/* Responsive */
@media (max-width: 560px) {
  .sa-widget { padding: 20px 16px; border-radius: 12px; }
  .sa-row--2 { grid-template-columns: 1fr; }
  .sa-submit-row { flex-direction: column; align-items: stretch; }
  .sa-btn { text-align: center; }
}


/* Card detail hero fallback — styled placeholder when no image available */
.cd-hero-fallback {
  width: 200px;
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #1c2230 0%, #131824 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  gap: 10px;
  text-align: center;
}
.cd-hero-fallback__badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(249,115,22,0.12);
  border: 1px solid rgba(249,115,22,0.25);
  border-radius: 8px;
  padding: 3px 8px;
}
.cd-hero-fallback__name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #c8d0e0;
  line-height: 1.4;
}
.cd-hero-fallback__set {
  font-size: 0.7rem;
  color: #4d6382;
}

@media (max-width: 768px) {
  .cd-hero-fallback { width: 160px; height: 224px; }
  .cd-hero-fallback__name { font-size: 0.75rem; }
}
