/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --primary:       #0F1B2D;
  --primary-light: #1A2F4E;
  --accent:        #C41230;
  --accent-hover:  #A10E27;
  --success:       #059669;
  --success-hover: #047857;
  --info:          #0284C7;
  --info-hover:    #0369A1;
  --bg:            #F0F3F8;
  --card:          #FFFFFF;
  --border:        #E2E8F0;
  --text:          #111827;
  --text-muted:    #6B7280;
  --diff-bg:       #FEF9C3;
  --same-bg:       #DCFCE7;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -2px rgba(0,0,0,.05);
  --font:          'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--primary);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
  flex-shrink: 0;
}
.logo-icon { font-size: 22px; }
.logo-brand { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; display: block; }
.logo-accent { color: var(--accent); }
.logo-tagline { display: block; font-size: 11px; color: rgba(255,255,255,.5); letter-spacing: .5px; text-transform: uppercase; }

.mode-nav { display: flex; gap: 4px; }
.mode-btn {
  padding: 7px 16px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.2);
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.mode-btn:hover { background: rgba(255,255,255,.1); color: white; border-color: rgba(255,255,255,.4); }
.mode-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Main ───────────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px;
}

/* ── Search card ────────────────────────────────────────────────────────── */
.search-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.search-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.search-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── VIN input ──────────────────────────────────────────────────────────── */
.input-wrap {
  position: relative;
  margin-bottom: 16px;
}
.vin-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.vin-input {
  width: 100%;
  padding: 12px 64px 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.vin-input:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(2,132,199,.15);
}
.vin-input.valid { border-color: var(--success); }
.vin-counter {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Compare layout ─────────────────────────────────────────────────────── */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: end;
}
.vs-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 30px;
  text-align: center;
}

/* ── Action row ─────────────────────────────────────────────────────────── */
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }
.btn-info { background: var(--info); color: white; }
.btn-info:hover:not(:disabled) { background: var(--info-hover); }
.btn-secondary { background: #4B5563; color: white; }
.btn-secondary:hover:not(:disabled) { background: #374151; }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-ghost.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Loading ────────────────────────────────────────────────────────────── */
.loading-wrap {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ──────────────────────────────────────────────────────────────── */
.error-msg {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid #EF4444;
  border-radius: var(--radius);
  padding: 14px 18px;
  color: #991B1B;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Vehicle info cards ──────────────────────────────────────────────────── */
.results-vehicles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.results-vehicles.single { grid-template-columns: 1fr; max-width: 420px; }

.vehicle-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  padding: 20px;
  box-shadow: var(--shadow);
}
.vehicle-card .card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.vehicle-card .card-model {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  line-height: 1.3;
}
.vehicle-meta { display: grid; gap: 3px; }
.meta-row { display: flex; gap: 10px; font-size: 13px; }
.meta-row .meta-key { color: var(--text-muted); min-width: 75px; }
.meta-row .meta-val { font-weight: 500; }

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }

/* ── Section cards ──────────────────────────────────────────────────────── */
.section-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.section-hd {
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-hd:hover { background: var(--primary-light); }
.section-hd-meta { font-size: 12px; font-weight: 400; opacity: .65; }
.chevron { font-size: 11px; transition: transform .2s; flex-shrink: 0; }
.section-card.collapsed .chevron { transform: rotate(-90deg); }
.section-card.collapsed .section-body { display: none; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  white-space: nowrap;
}
tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFC; }

/* Category header rows */
tr.cat-hd td {
  background: #F1F5F9;
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: .2px;
}
tr.cat-hd:hover td { background: #E8EDF4; }

/* Diff / same rows */
tr.row-diff td { background: var(--diff-bg); }
tr.row-diff td:first-child { border-left: 3px solid #F59E0B; }
tr.row-same td { background: var(--same-bg); }
tr.row-same td:first-child { border-left: 3px solid #10B981; }

/* Equipment code pill */
.eq-code {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: #FEF2F2;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-diff { background: #FEF3C7; color: #92400E; }
.badge-same { background: #D1FAE5; color: #065F46; }
.icon-present { color: #059669; font-weight: 700; }
.icon-absent  { color: #CBD5E1; }

/* ── Recall notice (shown on build sheet if open recalls exist) ──────────── */
.recall-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-left: 4px solid #F59E0B;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.recall-notice-stop {
  background: #FEF2F2;
  border-color: #FECACA;
  border-left-color: var(--accent);
}
.recall-notice-icon { font-size: 18px; flex-shrink: 0; }
.recall-notice-text { flex: 1; font-size: 14px; color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── Market select ───────────────────────────────────────────────────────── */
.market-select {
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s;
}
.market-select:focus { outline: none; border-color: var(--info); }

/* ── Recall cards ────────────────────────────────────────────────────────── */
.recalls-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.no-recalls {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--success);
}
.recall-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  padding: 20px 24px;
}
.recall-safety   { border-left-color: var(--accent); }
.recall-customer { border-left-color: #F59E0B; }
.recall-other    { border-left-color: var(--info); }
.recall-card-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.recall-card-title { font-size: 15px; font-weight: 600; color: var(--primary); line-height: 1.4; }
.recall-card-badges { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.recall-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.recall-meta-row { display: flex; gap: 8px; font-size: 13px; }
.recall-meta-key { color: var(--text-muted); min-width: 120px; }
.recall-meta-val { font-weight: 500; }
.recall-details { font-size: 13px; color: var(--text); margin-bottom: 14px; }
.recall-detail-block { margin-bottom: 8px; line-height: 1.5; }
.recall-detail-block:last-child { margin-bottom: 0; }
.recall-card-footer { padding-top: 12px; border-top: 1px solid var(--border); }
.recall-letter-link { font-size: 13px; color: var(--info); text-decoration: none; font-weight: 500; }
.recall-letter-link:hover { text-decoration: underline; }

/* Recall badge variants */
.badge-recall-safety     { background: #FEE2E2; color: #991B1B; }
.badge-recall-customer   { background: #FEF3C7; color: #92400E; }
.badge-recall-emissions  { background: #EDE9FE; color: #5B21B6; }
.badge-recall-warranty   { background: #ECFDF5; color: #065F46; }
.badge-recall-other      { background: #F1F5F9; color: #475569; }
.badge-stop-drive        { background: var(--accent); color: white; }

/* ── Ads ─────────────────────────────────────────────────────────────────── */
.ad-slot {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  margin-bottom: 24px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  background: var(--primary);
  color: rgba(255,255,255,.65);
  border-top: 3px solid var(--accent);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.disclaimer { font-size: 13px; line-height: 1.6; max-width: 700px; }
.disclaimer strong { color: rgba(255,255,255,.9); }
.coffee-link img { height: 38px; border-radius: 6px; transition: transform .2s; display: block; }
.coffee-link img:hover { transform: scale(1.05); }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; height: 56px; }
  .logo-tagline { display: none; }
  .main-content { padding: 16px; }
  .search-card { padding: 20px; }
  .compare-grid { grid-template-columns: 1fr; }
  .vs-badge { display: none; }
  .results-vehicles { grid-template-columns: 1fr; }
  thead th { top: 56px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .recall-card-hd { flex-direction: column; }
  .recall-meta { grid-template-columns: 1fr; }
}
