/* Charte L'AUTO AN NOU — miroir web de mobile/src/theme.ts.
   vert #1DBF73 = actions/nav/marqueurs · orange #FFA500 = énergie
   rouge #F74040 = SOS/erreurs · sable #FAF7F0 = fond. */
:root {
  --primary: #1dbf73;
  --primary-dark: #0e8a50;
  --energy: #ffa500;
  --danger: #f74040;
  --bg: #faf7f0;
  --card: #ffffff;
  --text: #14251c;
  --muted: #65756b;
  --border: #eae4d6;
  --brand-green: #1dbf73;
  --brand-red: #f74040;
  --display: "Bebas Neue", system-ui, sans-serif;
  --body: "Roboto Condensed", system-ui, sans-serif;
  --radius: 16px;
  --radius-s: 10px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--body);
  color: var(--text);
  background: #ece7db;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Cadre « téléphone » centré sur grand écran, plein écran sur mobile */
#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(20, 37, 28, 0.12);
}

/* ---------- Typo ---------- */
h1,
h2,
h3 {
  margin: 0;
}
.title {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1.05;
}
.subtitle {
  font-family: var(--body);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.body {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}
.muted {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.center {
  text-align: center;
}
a,
.link {
  color: var(--primary-dark);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Header de marque ---------- */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #fff3dd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-badge svg {
  width: 24px;
  height: 24px;
}
.brand-name {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.4px;
  color: var(--brand-green);
  line-height: 1;
}
.brand-slogan {
  font-size: 10.5px;
  font-style: italic;
  color: var(--brand-red);
  line-height: 1.2;
  margin-top: 1px;
}

/* Bascule langue FR / KZ */
.lang-toggle {
  display: inline-flex;
  background: #f1efe8;
  border-radius: 999px;
  padding: 3px;
}
.lang-toggle button {
  border: none;
  background: transparent;
  font-family: var(--body);
  font-weight: 700;
  font-size: 11px;
  color: #9a978c;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-toggle button.on {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.beta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #faeeda;
  color: #854f0b;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- Zone de contenu ---------- */
.content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 90px;
}
.content.no-nav {
  padding-bottom: 24px;
}

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.row-card {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

/* Véhicule */
.vehicle-thumb {
  width: 54px;
  height: 42px;
  border-radius: var(--radius-s);
  background: #fff3dd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vehicle-thumb svg {
  width: 30px;
  height: 30px;
}
.vehicle-meta {
  flex: 1;
  min-width: 0;
}
.batt {
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- Boutons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: filter 0.12s, transform 0.06s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.985);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn svg {
  width: 19px;
  height: 19px;
}

/* Chips (créneaux/durée) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 22px;
  padding: 9px 15px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Bannières ---------- */
.banner {
  border-radius: var(--radius-s);
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.4;
}
.banner-error {
  background: #fdecec;
  color: #9a2020;
  border: 1px solid #f4bcbc;
}
.banner-success {
  background: #e6f7ee;
  color: #0e6b3f;
  border: 1px solid #b6e6cd;
}
.banner-info {
  background: #eaf1fb;
  color: #1a4d8f;
  border: 1px solid #c3d8f2;
}
.banner-warning {
  background: #fff4e0;
  color: #8a5a00;
  border: 1px solid #f4d8a3;
}

/* ---------- Champs ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.field input {
  font-family: var(--body);
  font-size: 16px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: #fff;
  color: var(--text);
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 191, 115, 0.15);
}
.field .hint {
  font-size: 11.5px;
  color: var(--muted);
}

/* Tabs auth */
.seg {
  display: flex;
  background: #f1efe8;
  border-radius: var(--radius-s);
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

/* ---------- Carte Leaflet ---------- */
#map {
  height: 250px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  z-index: 1;
}
.pastille {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(20, 37, 28, 0.3);
}
.pastille.empty {
  background: #f1efe8;
}
.pastille svg {
  width: 26px;
  height: 26px;
}
.pastille .cnt {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Anneau de déverrouillage ---------- */
.ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}
.ring {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 10px solid var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.3s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.ring:active {
  transform: scale(0.97);
}
.ring.confirm {
  border-color: var(--energy);
}
.ring.sending {
  border-color: var(--energy);
  animation: spin 1.1s linear infinite;
}
.ring.success {
  border-color: var(--primary);
  animation: pulse 0.7s ease;
}
.ring.error {
  border-color: var(--danger);
  animation: shake 0.4s ease;
}
.ring.disabled {
  border-color: #d8d2c4;
  cursor: default;
  opacity: 0.7;
}
.ring .ring-icon {
  width: 44px;
  height: 44px;
}
.ring .ring-label {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--text);
}
.ring .ring-sub {
  font-size: 11px;
  color: var(--muted);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px);
  }
  75% {
    transform: translateX(7px);
  }
}

/* ---------- Photos ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
}
.photo-count {
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Reçu ---------- */
.ticket {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
}
.lisere {
  height: 7px;
  display: flex;
}
.ticket-inner {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ticket-title {
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: 0.5px;
}
.ticket-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
}
.ticket-row .k {
  font-size: 14.5px;
  color: var(--muted);
}
.ticket-row .v {
  font-size: 14.5px;
  font-weight: 700;
}

/* ---------- Barre de navigation basse ---------- */
.tabbar {
  position: sticky;
  bottom: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tabbar button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #9a978c;
  cursor: pointer;
  font-family: var(--body);
}
.tabbar button.on {
  color: var(--primary);
}
.tabbar button svg {
  width: 22px;
  height: 22px;
}
.tabbar button span {
  font-size: 10.5px;
  font-weight: 700;
}

/* ---------- Barre supérieure des sous-écrans ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 4px;
}
.back-btn {
  border: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.back-btn svg {
  width: 20px;
  height: 20px;
}

/* Greeting bilingue */
.greeting {
  font-family: var(--display);
  font-size: 27px;
  letter-spacing: 0.5px;
  color: var(--text);
  transition: opacity 0.32s, transform 0.32s;
}
.greeting.out {
  opacity: 0;
  transform: translateY(-10px);
}

/* Écran de chargement */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e3ddcd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.hero-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.hero-mark .car-big {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  background: #fff3dd;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-mark .car-big svg {
  width: 60px;
  height: 60px;
}
.hero-name {
  font-family: var(--display);
  font-size: 34px;
  letter-spacing: 0.6px;
  color: var(--brand-green);
  line-height: 1;
}
.hero-slogan {
  font-style: italic;
  font-weight: 700;
  color: var(--brand-red);
  font-size: 15px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* ================= PEAUFINAGE « présentable » ================= */

/* Cadre de présentation sur ordinateur : téléphone posé sur fond de marque */
@media (min-width: 620px) {
  body {
    background: radial-gradient(circle at 50% 0%, #12203a 0%, #0b1220 60%, #070c15 100%);
  }
  #app {
    margin: 26px auto 34px;
    min-height: 0;
    height: calc(100dvh - 60px);
    max-height: 900px;
    border-radius: 34px;
    border: 9px solid #05070d;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    overflow: hidden;
  }
  #app::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 22px;
    background: #05070d;
    border-radius: 0 0 14px 14px;
    z-index: 60;
  }
  .content {
    overscroll-behavior: contain;
  }
}

/* Splash vidéo (réutilise intro.mp4 du natif) */
#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
#splash.hide {
  opacity: 0;
  pointer-events: none;
}
#splash video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#splash .skip {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 15px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
}

/* Hero de marque (accueil / connexion) avec le vrai logo */
.hero-brand {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 26px 20px 20px;
  text-align: center;
  position: relative;
}
.hero-brand img.logo {
  width: 88%;
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.hero-brand .hero-tag {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}
.hero-brand .hero-site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: none;
}
.hero-brand .hero-site svg {
  width: 15px;
  height: 15px;
}

/* Section « Plus d'info » (Compte) */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 2px;
  margin-top: 2px;
}
.info-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid #f0ece2;
}
.info-row:last-child {
  border-bottom: none;
}
.info-row:active {
  background: #f7f4ec;
}
.info-row .ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.info-row .ico svg {
  width: 18px;
  height: 18px;
}
.info-row .info-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.info-row .info-txt b {
  font-weight: 700;
  font-size: 14px;
}
.info-row .info-txt small {
  font-size: 12px;
  color: var(--muted);
}
.info-row > svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.brand-strip {
  height: 5px;
  display: flex;
}
.brand-strip > i {
  display: block;
}
.brand-strip .s1 {
  flex: 3;
  background: var(--energy);
}
.brand-strip .s2 {
  flex: 3;
  background: var(--primary);
}
.brand-strip .s3 {
  flex: 1.4;
  background: var(--danger);
}

/* Logo dans le header (symbole voiture réel) */
.brand-badge img {
  width: 30px;
  height: auto;
}

/* Sélecteur de fond de carte (Leaflet layers control) — style charte */
.leaflet-control-layers {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 3px 10px rgba(20, 37, 28, 0.16) !important;
  font-family: var(--body) !important;
}
.leaflet-control-layers-toggle {
  border-radius: 10px !important;
}
.leaflet-bar a {
  border-radius: 8px !important;
}

/* Bouton itinéraire */
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--primary-dark);
  cursor: pointer;
}
.nav-btn svg {
  width: 17px;
  height: 17px;
}

/* Feuille d'actions (bottom sheet) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.sheet {
  background: #fff;
  width: 100%;
  max-width: 460px;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet .grip {
  width: 40px;
  height: 4px;
  background: #d8d2c4;
  border-radius: 999px;
  margin: 4px auto 12px;
}
.sheet h3 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 10px;
}
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 13px 14px;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 8px;
}
.sheet-item .ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sheet-item .badge-default {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary-dark);
  background: #e6f7ee;
  padding: 3px 8px;
  border-radius: 999px;
}
.sheet-cancel {
  width: 100%;
  border: none;
  background: #f1efe8;
  border-radius: 12px;
  padding: 13px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  margin-top: 4px;
}

/* Illustration état vide */
.empty-illu {
  width: 100%;
  max-width: 230px;
  border-radius: 14px;
  margin: 4px auto 6px;
  display: block;
}

/* Squelettes de chargement */
.skel {
  background: linear-gradient(90deg, #efe9dc 25%, #f6f2e8 50%, #efe9dc 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-s);
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* Animations d'entrée (une seule fois, pas dans les redraws fréquents) */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.animate-in > * {
  animation: fadeUp 0.34s ease both;
}
.animate-in > *:nth-child(2) {
  animation-delay: 0.04s;
}
.animate-in > *:nth-child(3) {
  animation-delay: 0.08s;
}
.animate-in > *:nth-child(4) {
  animation-delay: 0.12s;
}
.animate-in > *:nth-child(5) {
  animation-delay: 0.16s;
}
@media (prefers-reduced-motion: reduce) {
  .animate-in > *,
  #splash,
  .sheet,
  .sheet-backdrop {
    animation: none !important;
  }
}
