/* ==========================================================================
   Parkflow — socle commun
   Tokens repris du design system Paperless ("DA / COLOR"), accent or remplacé par un bleu.
   ========================================================================== */

:root {
  --white: #FFFFFF;
  --white-a90: rgba(255, 255, 255, .9);
  --blue500: #2563EB;
  --blue600: #1D4ED8;
  --blue700: #1E40AF;
  --blue100: #DBEAFE;
  --blue50: #EFF6FF;
  --blue500-a20: rgba(37, 99, 235, .2);
  --blue500-a15: rgba(37, 99, 235, .15);
  --green500: #22C55E;
  --green100: #DCFCE7;
  --green700: #15803D;
  --red500: #EF4444;
  --red100: #FEE2E2;
  --red700: #B91C1C;
  --gray900: #111827;
  --gray900-a55: rgba(17, 24, 39, .55);
  --gray700: #374151;
  --gray500: #6B7280;
  --gray450: #878D96; /* bordure des champs, contraste ≥ 3:1 sur blanc */
  --gray400: #9CA3AF;
  --gray300: #D1D5DB; /* hors Paperless : marquage au sol du plan */
  --gray200: #E5E7EB;
  --gray100: #F3F4F6;
  --gray50: #F8F8F6;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;

  --shadow-card: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px rgba(17, 24, 39, .06);
  --shadow-blue: 0 4px 20px var(--blue500-a15);
  --shadow-modal: 0 24px 64px rgba(17, 24, 39, .24);

  /* Animations : départ franc puis freinage. Aucune animation décorative. */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --duration-fast: .15s;
  --duration-base: .2s;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1120px;
  --gutter: 24px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray900);
  background: var(--gray50);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--blue700); outline-offset: 2px; border-radius: 4px; }

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--white-a90);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--gray200);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand svg { width: 32px; height: 32px; flex: none; }

.nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.nav a {
  text-decoration: none; font-size: 15px; font-weight: 500; color: var(--gray500);
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
}
.nav a[aria-current="page"] { color: var(--gray900); background: var(--gray100); }
@media (hover: hover) { .nav a:hover { color: var(--gray900); } }
.header-end { display: flex; align-items: center; gap: 16px; margin-left: auto; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: var(--radius-md);
  font: 600 16px/1 var(--font); text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition-property: background-color, border-color, color, transform;
  transition-duration: var(--duration-fast); transition-timing-function: var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { background: var(--gray200); color: var(--gray400); box-shadow: none; cursor: not-allowed; }
.btn-primary { background: var(--blue500); color: var(--white); box-shadow: var(--shadow-blue); }
.btn-secondary { background: var(--white); color: var(--gray700); border-color: var(--gray200); font-weight: 500; }
.btn-danger { background: var(--white); color: var(--red700); border-color: var(--gray200); font-weight: 500; }
/* Survol réservé aux souris : sur écran tactile, l'effet resterait affiché après un appui. */
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: var(--blue600); }
  .btn-secondary:hover { border-color: var(--gray400); color: var(--gray900); }
  .btn-danger:hover { border-color: var(--red500); background: var(--red100); }
}
@media (prefers-reduced-motion: reduce) { .btn:active:not(:disabled) { transform: none; } }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Cartes, badges ---------- */
.card { background: var(--white); border: 1px solid var(--gray200); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--blue50); color: var(--blue700);
}

/* Indicateur de connexion temps réel. */
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--gray500); white-space: nowrap; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gray400); }
.live.is-on { color: var(--green700); }
.live.is-on::before { background: var(--green500); }

/* ---------- Champs ---------- */
.field { display: block; }
.field-label { display: block; font-size: 16px; font-weight: 500; color: var(--gray700); margin-bottom: 8px; }
.input {
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray450); background: var(--white);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.input::placeholder { color: var(--gray400); }
.input:focus { outline: none; border-color: var(--blue500); box-shadow: 0 0 0 4px var(--blue500-a20); }

/* ---------- Fenêtre modale ---------- */
.modal {
  width: min(420px, calc(100vw - 2 * var(--gutter))); padding: 32px; border: 0;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); color: var(--gray900);
}
.modal::backdrop { background: var(--gray900-a55); }
.modal h2 { font-size: 22px; font-weight: 600; margin-bottom: 12px; }
.modal .helper { font-size: 15px; color: var(--gray500); margin-bottom: 24px; }
.modal .btn { margin-top: 24px; }

/* ---------- Message éphémère ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; max-width: calc(100vw - 2 * var(--gutter));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--gray900); color: var(--white); font-size: 15px; font-weight: 500;
  padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-modal);
  transition: transform var(--duration-base) var(--ease-out), opacity var(--duration-base) var(--ease-out);
}
.toast.is-shown { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: var(--red700); }

/* ---------- Plan du parking (SVG, partagé par les trois pages) ---------- */
.plan { display: block; width: 100%; height: auto; }
.plan-floor { fill: var(--gray100); stroke: var(--gray200); stroke-width: 1.5; }
.plan-entrance { fill: var(--gray100); }
.plan-edge { stroke: var(--gray200); stroke-width: 1.5; }
.plan-line, .plan-arrow { fill: none; stroke: var(--gray300); stroke-linecap: round; stroke-linejoin: round; }
.plan-line { stroke-width: 2; }
.plan-arrow { stroke-width: 3; }
.plan-caption { fill: var(--gray500); font-size: 12px; font-weight: 600; letter-spacing: .08em; }

.spot { outline: none; }
.spot-card { fill: var(--white); stroke: var(--gray200); stroke-width: 1.5; transition: fill var(--duration-fast) var(--ease-out), stroke var(--duration-fast) var(--ease-out); }
.spot-halo { fill: none; stroke: var(--blue500-a20); stroke-width: 6; }
.spot-id { fill: var(--gray900); font-size: 17px; font-weight: 600; text-anchor: middle; pointer-events: none; }
.spot-id.is-small { font-size: 12px; font-weight: 500; fill: var(--gray500); }
.spot-name { fill: var(--gray700); font-size: 14px; font-weight: 500; text-anchor: middle; pointer-events: none; }
.spot-pmr { fill: none; stroke: var(--blue500); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

.spot.is-clickable { cursor: pointer; }
@media (hover: hover) { .spot.is-free.is-clickable:hover .spot-card { stroke: var(--blue500); fill: var(--blue50); } }
.spot:focus-visible .spot-card { stroke: var(--blue700); stroke-width: 3; }

.spot.is-selected .spot-card { fill: var(--blue50); stroke: var(--blue500); stroke-width: 2.5; }
.spot.is-taken .spot-card { fill: var(--gray200); stroke: var(--gray200); }
.spot.is-taken .spot-id:not(.is-small) { fill: var(--gray400); }
.spot.is-taken .spot-pmr { stroke: var(--gray500); }
.spot.is-mine .spot-card { fill: var(--blue500); stroke: var(--blue500); }
.spot.is-mine .spot-id { fill: var(--blue100); }
.spot.is-mine .spot-name { fill: var(--white); font-weight: 600; }
.spot.is-mine .spot-pmr { stroke: var(--white); }

/* Légende du plan : pastilles reprenant exactement les états des places. */
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--gray500); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 16px; height: 12px; border-radius: 4px; border: 1.5px solid var(--gray200); background: var(--white); }
.legend .is-taken { background: var(--gray200); }
.legend .is-mine { background: var(--blue500); border-color: var(--blue500); }
