/* ═══════════ Auto Go — Material Design (style Android) ═══════════ */
:root {
  --primary: #1b6ef3;
  --on-primary: #ffffff;
  --primary-container: #d9e2ff;
  --on-primary-container: #001947;
  --surface: #faf9fd;
  --surface-container: #ffffff;
  --surface-variant: #e1e2ec;
  --on-surface: #1a1b20;
  --on-surface-variant: #45464f;
  --outline: #c5c6d0;
  --elev-1: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --elev-2: 0 3px 8px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.10);
  --nav-h: 80px;
  --appbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #b0c6ff;
    --on-primary: #002d6e;
    --primary-container: #1b438f;
    --on-primary-container: #d9e2ff;
    --surface: #121318;
    --surface-container: #1e1f25;
    --surface-variant: #2b2c33;
    --on-surface: #e3e2e9;
    --on-surface-variant: #c5c6d0;
    --outline: #45464f;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: Roboto, "Segoe UI", system-ui, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100%;
  padding-top: var(--appbar-h);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
svg { fill: currentColor; }

/* ═══ App bar ═══ */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px;
  background: var(--surface-container);
  box-shadow: var(--elev-1);
}
.appbar-titles { flex: 1; min-width: 0; padding-left: 8px; }
.appbar h1 { font-size: 20px; font-weight: 500; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar span { font-size: 12px; color: var(--on-surface-variant); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 48px; height: 48px; border: none; border-radius: 50%;
  background: transparent; color: var(--on-surface); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { background: var(--surface-variant); }

/* ═══ Vues ═══ */
#main { max-width: 640px; margin: 0 auto; padding: 12px 12px 24px; }
.view[hidden] { display: none; }

/* ═══ Carte véhicule ═══ */
.card {
  background: var(--surface-container);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--elev-2);
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.card-img {
  width: 100%; aspect-ratio: 16/10; object-fit: cover;
  background: var(--surface-variant); display: block;
}
.card-img.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: var(--on-surface-variant);
}
.card-body { padding: 18px 20px 8px; }
.card-body h2 { font-size: 24px; font-weight: 500; line-height: 1.2; }
.card-kicker { font-size: 13px; color: var(--primary); font-weight: 500; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.card-desc { font-size: 14px; color: var(--on-surface-variant); margin-top: 4px; font-style: italic; }
.card-extract { font-size: 15px; line-height: 1.55; margin-top: 12px; color: var(--on-surface); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 4px; }
.chip {
  font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 10px;
  background: var(--primary-container); color: var(--on-primary-container);
  border: none; cursor: pointer;
}
.card-actions { display: flex; gap: 10px; padding: 16px 20px 20px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 24px; cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit;
  padding: 12px 22px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: filter .15s, transform .1s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--outline); }

/* ═══ Fiche technique ═══ */
.spec { margin-top: 18px; }
.spec h3 {
  font-size: 17px; font-weight: 500; letter-spacing: .2px;
  padding-bottom: 8px; border-bottom: 2px solid var(--primary);
  display: inline-block; margin-bottom: 4px;
}
.spec-section { margin-top: 12px; }
.spec-section h4 {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  color: var(--primary); margin-bottom: 6px;
}
.spec-section table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-section tr { border-bottom: 1px solid var(--surface-variant); }
.spec-section tr:last-child { border-bottom: none; }
.spec-section th {
  text-align: left; font-weight: 500; color: var(--on-surface-variant);
  padding: 8px 12px 8px 0; width: 42%; vertical-align: top; white-space: normal;
}
.spec-section td { padding: 8px 0; color: var(--on-surface); vertical-align: top; }

/* ═══ Article complet ═══ */
.article { margin-top: 20px; }
.article h4 {
  font-size: 17px; font-weight: 500; letter-spacing: .2px;
  padding-bottom: 6px; border-bottom: 2px solid var(--primary);
  display: inline-block; margin: 18px 0 6px;
}
.article h5 {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  color: var(--primary); margin: 14px 0 4px;
}
.article p { font-size: 15px; line-height: 1.6; margin: 8px 0; color: var(--on-surface); }
.ilink {
  display: inline; border: none; background: none; padding: 0; margin: 0;
  font: inherit; cursor: pointer;
  color: var(--primary); font-weight: 500;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
}
.ilink:active { opacity: .7; }

/* ═══ Listes ═══ */
.searchbox {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-variant);
  border-radius: 28px; padding: 0 18px; height: 52px;
  margin-bottom: 12px;
}
.searchbox svg { width: 20px; height: 20px; color: var(--on-surface-variant); flex-shrink: 0; }
.searchbox input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 16px; font-family: inherit; color: var(--on-surface); height: 100%;
}
.mlist { background: var(--surface-container); border-radius: 20px; overflow: hidden; box-shadow: var(--elev-1); }
.mlist-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 14px 18px; border: none; cursor: pointer;
  background: transparent; color: var(--on-surface);
  font-size: 16px; font-family: inherit;
  border-bottom: 1px solid var(--surface-variant);
  transition: background .12s;
}
.mlist-item:last-child { border-bottom: none; }
.mlist-item:active { background: var(--surface-variant); }
.mlist-item .leading {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-container); color: var(--on-primary-container);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 500;
}
.mlist-item .txt { flex: 1; min-width: 0; }
.mlist-item .txt small { display: block; color: var(--on-surface-variant); font-size: 13px; }
.mlist-item .chev { width: 22px; height: 22px; color: var(--on-surface-variant); flex-shrink: 0; }
.list-count { font-size: 13px; color: var(--on-surface-variant); margin: 4px 6px 10px; }

/* ═══ Bottom nav ═══ */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface-container);
  box-shadow: 0 -1px 6px rgba(0,0,0,.15);
  display: flex;
}
.nav-item {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--on-surface-variant); font-family: inherit;
}
.nav-pill {
  width: 56px; height: 32px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.nav-pill svg { width: 24px; height: 24px; }
.nav-label { font-size: 12px; font-weight: 500; letter-spacing: .3px; }
.nav-item.active { color: var(--on-surface); }
.nav-item.active .nav-pill { background: var(--primary-container); color: var(--on-primary-container); }

/* ═══ Loader / snackbar ═══ */
.loader { display: flex; justify-content: center; padding: 60px 0; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--surface-variant); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#snackbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px);
  background: #313033; color: #f4eff4;
  padding: 12px 20px; border-radius: 8px; font-size: 14px;
  box-shadow: var(--elev-2); z-index: 30; max-width: 90vw;
}
