/* Limitation des véhicules – thème commun (site public et espace admin).
   Sobre et arrondi : surfaces douces, un violet tiré du cristal Ultra, et cinq couleurs de statut
   qui disent tout de suite si un véhicule est autorisé. Deux éclairages : sombre et clair.
   Chaque statut a toujours une couleur, une icône et un mot : on le comprend même sans voir les couleurs. */

/* ---------- Éclairage clair ---------- */
:root {
  --bg: #f4f2f8;
  --bg-2: #ece9f3;
  --surface: #ffffff;
  --surface-2: #f3f0f8;
  --surface-3: #e8e3f1;
  --line: rgba(28, 18, 48, .09);
  --line-2: rgba(28, 18, 48, .17);
  --text: #17121f;
  --text-2: #4a4358;
  --text-3: #686179;
  --accent: #8a2be2;
  --accent-fort: #7e22ce;
  --accent-encre: #ffffff;
  --accent-doux: rgba(138, 43, 226, .1);
  --accent-ligne: rgba(138, 43, 226, .38);
  --or: #a16207;
  --or-doux: rgba(202, 138, 4, .13);
  --ombre: 0 1px 2px rgba(24, 12, 48, .05), 0 10px 28px -14px rgba(24, 12, 48, .2);
  --ombre-haute: 0 2px 6px rgba(24, 12, 48, .06), 0 28px 64px -26px rgba(24, 12, 48, .38);
  --verre: rgba(250, 249, 253, .8);
  --voile: rgba(16, 10, 28, .5);

  /* Statuts : --x (fond plein, texte blanc), --x-texte (sur une surface), --x-doux (fond teinté) */
  --ok: #15803d;   --ok-texte: #15803d;   --ok-doux: rgba(21, 128, 61, .11);
  --tol: #c2410c;  --tol-texte: #c2410c;  --tol-doux: rgba(194, 65, 12, .11);
  --lore: #0f766e; --lore-texte: #0f766e; --lore-doux: rgba(15, 118, 110, .11);
  --non: #dc2626;  --non-texte: #d01f1f;  --non-doux: rgba(220, 38, 38, .1);
  --inc: #64748b;  --inc-texte: #566070;  --inc-doux: rgba(100, 116, 139, .13);

  --r-xl: 28px;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --police: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --police-titre: Bahnschrift, "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --courbe: cubic-bezier(.2, .8, .2, 1);
  --courbe-sortie: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

/* ---------- Éclairage sombre ---------- */
:root[data-theme="dark"] {
  --bg: #0b0910;
  --bg-2: #100d16;
  --surface: #15121c;
  --surface-2: #1c1825;
  --surface-3: #262031;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .145);
  --text: #f3effa;
  --text-2: #c4bcd3;
  --text-3: #9a92ab;
  --accent: #c084fc;
  --accent-fort: #9333ea;
  --accent-doux: rgba(192, 132, 252, .13);
  --accent-ligne: rgba(192, 132, 252, .42);
  --or: #facc15;
  --or-doux: rgba(250, 204, 21, .12);
  --ombre: inset 0 1px 0 rgba(255, 255, 255, .03), 0 14px 34px -20px rgba(0, 0, 0, .95);
  --ombre-haute: inset 0 1px 0 rgba(255, 255, 255, .04), 0 34px 80px -30px rgba(0, 0, 0, .95);
  --verre: rgba(14, 11, 20, .76);
  --voile: rgba(4, 2, 8, .66);
  --ok-texte: #4ade80;   --ok-doux: rgba(74, 222, 128, .12);
  --tol-texte: #fb923c;  --tol-doux: rgba(251, 146, 60, .13);
  --lore-texte: #2dd4bf; --lore-doux: rgba(45, 212, 191, .12);
  --non-texte: #f87171;  --non-doux: rgba(248, 113, 113, .12);
  --inc-texte: #a8b1c0;  --inc-doux: rgba(148, 163, 184, .13);
  color-scheme: dark;
}

/* Chaque élément porteur d'un statut reçoit ses couleurs par data-s */
[data-s="autorise"] { --s: var(--ok);   --s-texte: var(--ok-texte);   --s-doux: var(--ok-doux); }
[data-s="tolere"]   { --s: var(--tol);  --s-texte: var(--tol-texte);  --s-doux: var(--tol-doux); }
[data-s="lore"]     { --s: var(--lore); --s-texte: var(--lore-texte); --s-doux: var(--lore-doux); }
[data-s="interdit"] { --s: var(--non);  --s-texte: var(--non-texte);  --s-doux: var(--non-doux); }
[data-s="inconnu"]  { --s: var(--inc);  --s-texte: var(--inc-texte);  --s-doux: var(--inc-doux); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--police); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--police-titre); font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-ligne); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.bloque { overflow: hidden; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); border: 3px solid transparent; background-clip: padding-box; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-plein { fill: currentColor; stroke: none; }

@keyframes monte { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }
@keyframes tourne { to { transform: rotate(360deg); } }
@keyframes rebond { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 18px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer;
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap; text-align: center;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.charge { opacity: .5; pointer-events: none; }
.btn-principal { background: var(--accent-fort); border-color: transparent; color: var(--accent-encre); box-shadow: 0 8px 22px -12px var(--accent-fort); }
.btn-principal:hover { background: var(--accent-fort); filter: brightness(1.1); border-color: transparent; }
.btn-fantome { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-fantome:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-danger { background: var(--non); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--non); filter: brightness(1.08); border-color: transparent; }
.btn-danger-doux { color: var(--non-texte); }
.btn-danger-doux:hover { background: var(--non-doux); border-color: transparent; color: var(--non-texte); }
.btn-petit { min-height: 34px; padding: 6px 13px; font-size: 13px; }
.btn-grand { min-height: 48px; padding: 12px 24px; font-size: 15px; }
.btn .i { width: 17px; height: 17px; }

.icone-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; padding: 0;
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.icone-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-3); }
.icone-btn:active { transform: scale(.94); }
.icone-btn.nu { border-color: transparent; background: transparent; }
.icone-btn.nu:hover { background: var(--surface-2); }
.icone-btn.petit { width: 32px; height: 32px; }
.icone-btn.petit .i { width: 16px; height: 16px; }
.charge-rond { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tourne .7s linear infinite; }

/* ---------- Pastilles de statut ---------- */
.pastille {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 7px; border-radius: 999px;
  background: var(--s); color: #fff; font: 700 12px/1.1 var(--police-titre); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.pastille .i { width: 16px; height: 16px; stroke-width: 2.4; }
.pastille.douce { background: var(--s-doux); color: var(--s-texte); }
.pastille.grande { padding: 8px 16px 8px 10px; font-size: 14px; gap: 8px; }
.pastille.grande .i { width: 20px; height: 20px; }

/* Petite étiquette neutre */
.etiquette {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.etiquette.accent { background: var(--accent-doux); border-color: transparent; color: var(--accent); }
.etiquette.or { background: var(--or-doux); border-color: transparent; color: var(--or); }

/* ---------- Champs ---------- */
.champ { display: block; margin-bottom: 16px; }
.champ > span, .champ > label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.champ small { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.saisie, .champ input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .champ select, .champ textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.champ textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.saisie:focus, .champ input:focus, .champ select:focus, .champ textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-doux); background: var(--surface); }
.saisie::placeholder, .champ input::placeholder, .champ textarea::placeholder { color: var(--text-3); }
select.saisie, .champ select { appearance: none; padding-right: 38px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.case { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.case input { width: 18px; height: 18px; accent-color: var(--accent-fort); }

/* Interrupteur */
.interrupteur { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14.5px; }
.interrupteur input { position: absolute; opacity: 0; pointer-events: none; }
.interrupteur i { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background-color .2s; flex: none; }
.interrupteur i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--courbe); }
.interrupteur input:checked + i { background: var(--accent-fort); border-color: transparent; }
.interrupteur input:checked + i::after { transform: translateX(18px); }
.interrupteur input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Surfaces ---------- */
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--ombre); }
.encart { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: 14px; border: 1px solid var(--line); }
.encart .i { margin-top: 1px; color: var(--accent); }
.encart strong { color: var(--text); }
.encart.alerte { background: var(--tol-doux); border-color: transparent; }
.encart.alerte .i { color: var(--tol-texte); }
.encart.erreur { background: var(--non-doux); border-color: transparent; }
.encart.erreur .i { color: var(--non-texte); }
.encart.ok { background: var(--ok-doux); border-color: transparent; }
.encart.ok .i { color: var(--ok-texte); }
.vide { padding: 48px 24px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface); }
.vide strong { display: block; margin-bottom: 6px; font-size: 16px; color: var(--text); }

/* ---------- Fenêtres ---------- */
.modale-fond {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px;
  background: var(--voile); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto; animation: fondu .18s ease both;
}
.modale { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--ombre-haute); animation: monte .26s var(--courbe-sortie) both; }
.modale.large { max-width: 860px; }
.modale-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modale-tete h2 { font-size: 20px; }
.modale-corps { padding: 18px 22px; }
.modale-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }
.modale-pied .gauche { margin-right: auto; }

/* ---------- Notification ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; z-index: 400; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  box-shadow: var(--ombre-haute); font-size: 14px; font-weight: 600; pointer-events: auto; animation: monte .25s var(--courbe-sortie) both;
}
.toast.seul { padding-right: 18px; }
.toast.erreur { background: var(--non); color: #fff; }
.toast button { border: 0; background: rgba(127, 127, 127, .25); color: inherit; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
.toast button:hover { background: rgba(127, 127, 127, .4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
