:root {
  --primary: #c2b6a2;  /* taupe : ombre du panneau, liseré du pied de page */
  --accent: #077b8a;   /* bleu canard : en-tête, panneau, champs, techniques */
  --red: #d72631;      /* marqueurs sur la carte */
  --mint: #a2d5c6;     /* survols, focus, séparateurs */
  --purple: #5c3c92;   /* logo, liens */
  --ink: var(--accent); /* texte sur blanc (contraste 5:1) */
  --white: #ffffff;
  --header-h: 80px;
  --footer-h: 30px;
  --radius: 14px;
  --font: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  background: var(--accent);
  color: var(--white);
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: inherit;
  text-decoration: none;
  line-height: 1;
}
.logo-main {
  font-family: "Bebas Neue", var(--font);
  font-size: 42px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.logo-sub { font-size: 20px; font-weight: 700; text-transform: uppercase; margin-top: 0; letter-spacing: 0.08em; }

/* Accroche, à gauche du logo */
.tagline {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--mint);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
}



/* ---------- Footer ---------- */
.site-footer {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--footer-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--purple);
  background: var(--white);
  border-top: 1px solid var(--primary);
}
.site-footer a { color: var(--purple); font-weight: 500; }
.site-footer a:hover { color: var(--accent); }
.site-footer .sep { opacity: .5; }
.site-footer > * { white-space: nowrap; }

/* ---------- Map ---------- */
.map-wrap {
  position: fixed;
  inset: var(--header-h) 0 var(--footer-h) 0;
}
#map { width: 100%; height: 100%; background: var(--white); }

/* « x résultats trouvés », centré sur la partie de la carte non couverte par le cadre de filtres */
.results-banner {
  position: absolute;
  left: 0;
  right: 380px; /* largeur du cadre de filtres + marges */
  bottom: 16px;
  z-index: 850;
  width: max-content;
  max-width: calc(100% - 400px);
  margin: 0 auto;
  padding: 6px 16px;
  border: 2px solid var(--red);
  border-radius: 999px;
  background: var(--white);
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}
.results-banner[hidden] { display: none; }


.leaflet-control-zoom a {
  color: var(--ink) !important;
  border-color: var(--accent) !important;
}
.leaflet-bar { border: 2px solid var(--accent) !important; border-radius: 10px !important; overflow: hidden; }

/* Marqueurs */
.pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--red);
  transition: transform .15s, background .2s, box-shadow .2s;
}
.pin:hover, .pin.active { transform: scale(1.4); }

/* Filtre actif : points hors critères grisés, résultats qui pulsent doucement */
.pin.is-dim {
  background: #b9b2a8;
  box-shadow: 0 0 0 2px #b9b2a8;
  opacity: .7;
}
.pin.is-match { animation: pin-pulse 1.6s ease-in-out infinite; }
@keyframes pin-pulse {
  0%   { box-shadow: 0 0 0 2px var(--red), 0 0 0 2px rgba(215, 38, 49, .6); }
  100% { box-shadow: 0 0 0 2px var(--red), 0 0 0 11px rgba(215, 38, 49, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .pin.is-match { animation: none; box-shadow: 0 0 0 2px var(--red), 0 0 0 5px rgba(215, 38, 49, .3); }
}

/* Popups */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  box-shadow: 6px 6px 0 var(--primary);
  font-family: var(--font);
  color: var(--ink);
}
.leaflet-popup-tip { background: var(--accent); }
.leaflet-popup-content { margin: 18px 20px; line-height: 1.45; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink); top: 6px; right: 6px; }
.popup h3 { margin: 0 24px 8px 0; font-size: 20px; line-height: 1.2; color: var(--purple); }
.popup p { margin: 0; font-size: 13px; }
.popup a { color: var(--ink); font-weight: 700; text-decoration: none; }
.popup a:hover { text-decoration: underline; }
.popup .desc {
  margin: 12px 0;
  font-size: 13px;
  color: #3b3530;
  white-space: pre-line;   /* respecte les retours à la ligne saisis dans l'admin */
  max-height: 180px;
  overflow-y: auto;
}
.popup .addr { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--mint); }
.popup .contacts { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.popup .contacts li { margin: 2px 0; overflow-wrap: anywhere; }
.popup .more { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--mint); font-size: 13px; }
.popup .more a { color: var(--purple); }
.popup .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.popup .tag {
  font-size: 11px;
  background: var(--mint);
  color: var(--purple);
  font-weight: 500;
  border-radius: 999px;
  padding: 2px 8px;
}
.popup .tag-express { background: var(--purple); color: var(--white); }

/* ---------- Panneau flottant ---------- */
.panel {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 340px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--primary);
  overflow: hidden;
}

.panel-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--white);
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.count {
  background: var(--white);
  color: var(--ink);
  border-radius: 999px;
  min-width: 28px;
  padding: 2px 10px;
  text-align: center;
  font-size: 12px;
}

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

form { padding: 14px 16px 6px; border-bottom: 2px solid var(--accent); }

.field { display: block; margin: 0 0 12px; padding: 0; border: 0; }
.label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 6px;
  padding: 0;
}

input, select {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 6px 10px;
  outline: none;
}
input::placeholder { color: var(--ink); opacity: .5; }
input:focus, select:focus { box-shadow: 0 0 0 3px var(--mint); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--mint); }

.actions { display: flex; justify-content: flex-end; }
.btn-link {
  all: unset;
  color: var(--purple);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-decoration: underline;
}

/* Liste de résultats */
.results { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.results li {
  padding: 10px 16px;
  border-bottom: 1px solid var(--mint);
  cursor: pointer;
}
.results li:hover, .results li.active { background: var(--mint); color: var(--purple); }
.results .name { font-weight: 700; font-size: 14px; }
.results .addr { font-size: 12px; }
.results .empty { cursor: default; font-size: 13px; }
.results .empty:hover { background: none; color: var(--ink); }

/* Interrupteur « Ouvert maintenant » */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--white);
  transition: background .15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform .15s, background .15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--white); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--mint); }
.switch-label { font-size: 13px; font-weight: 700; }
.switch + .switch { margin-top: -4px; }

/* Statut ouvert / fermé */
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: 2px;
}
.badge.is-open { background: var(--accent); color: var(--white); }
.badge.is-closed { background: var(--white); color: var(--red); border: 1px solid var(--red); }

.popup .status { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.popup .status.is-open .state::before,
.popup .status.is-closed .state::before { content: "●"; margin-right: 6px; }
.popup .status.is-open .state { color: var(--accent); }
.popup .status.is-closed .state { color: var(--red); }
.popup .status .sep { margin: 0 6px; color: var(--ink); opacity: .5; }
.popup .status .rdv { color: var(--red); }

.popup .hours { width: 100%; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--mint); border-collapse: collapse; font-size: 12px; }
.popup .hours th { text-align: left; font-weight: 500; padding: 1px 12px 1px 0; white-space: nowrap; }
.popup .hours td { padding: 1px 0; }
.popup .hours tr.today { font-weight: 700; color: var(--purple); }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  :root {
    --header-h: 56px;
    --panel-h: 45dvh; /* hauteur du cadre de filtres, sous la carte */
  }
  @supports not (height: 1dvh) {
    :root { --panel-h: 45vh; }
  }

  /* En-tête compact : logo à gauche, accroche à droite */
  .site-header {
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    padding: 0 16px;
  }
  .logo { grid-column: 1; grid-row: 1; }
  .logo-main { font-size: 24px; }
  .logo-sub { font-size: 11px; }
  .tagline {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    text-align: right;
    padding: 0 10px 0 0;
    border-left: 0;
    border-right: 3px solid var(--mint);
    font-size: 11px;
  }

  /* Carte en haut, cadre de filtres en dessous (plus de superposition) */
  .map-wrap { bottom: calc(var(--footer-h) + var(--panel-h)); }
  .panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: var(--footer-h);
    width: auto;
    height: var(--panel-h);
    border: 0;
    border-top: 2px solid var(--accent);
    border-radius: 0;
    box-shadow: none;
  }
  .panel-head { padding: 8px 16px; }
  .results-banner { right: 0; bottom: 22px; max-width: calc(100% - 32px); font-size: 13px; padding: 4px 14px; }
  /* Tout le cadre défile : formulaire puis liste des résultats */
  .panel-body { overflow-y: auto; }
  .results { flex: none; overflow: visible; }

  /* Zoom au doigt sur mobile : pas de boutons, crédits plus discrets */
  .leaflet-control-zoom { display: none; }
  .leaflet-control-attribution { font-size: 9px; }

  .site-footer { gap: 6px; font-size: 11px; }
  .footer-domain, .footer-copy { display: none; }
  input, select { font-size: 16px; } /* évite le zoom auto d'iOS sur les champs */
}
