/* InfoClim — feuille de style */

/* thème sombre par défaut ; clair uniquement via le bouton */
:root {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9b9992;
  --offline-ink: #fab219;
  --hairline: #2c2c2a;
  --ring: rgba(255, 255, 255, .10);
  --ok: #0ca30c;
  --warn: #fab219;
  --off: #6f6d66;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --map-g1: #21252c;
  --map-g2: #191d23;
  --map-stroke: #353d47;
  --map-shadow: rgba(0, 0, 0, .5);
  /* barre de défilement : toujours sombre, y compris en thème clair */
  --scroll-track: #1a1a19;
  --scroll-thumb: #4a4843;
  --scroll-thumb-hover: #605e58;
}
:root[data-theme="light"] {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a64;
  --offline-ink: #8a5d00;
  --hairline: #e1e0d9;
  --ring: rgba(11, 11, 11, .10);
  --off: #4a4843;
  --accent: #2a78d6;
  --map-g1: #eef3f7;
  --map-g2: #dfe8f0;
  --map-stroke: #c9d6e2;
  --map-shadow: rgba(43, 73, 102, .14);
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
/* barre de défilement toujours sombre (Chrome/Edge/Safari) */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid var(--scroll-track); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
body.no-scroll { overflow: hidden; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------- header (titre centré) ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  background: var(--page);
  background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.bar {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end;
  min-height: 60px;
  padding: 8px 16px; max-width: 760px; margin: 0 auto;
}
.brand {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em;
  pointer-events: none;
}
.btn-alert {
  background: var(--accent); color: var(--accent-ink);
  border: 0; font: inherit; cursor: pointer;
  padding: 10px 17px; border-radius: 999px;
  font-weight: 600; font-size: .85rem;
  transition: opacity .15s;
}
.btn-alert:hover { opacity: .88; }
.h-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--surface);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s;
}
.btn-icon:hover { border-color: var(--muted); }
.btn-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) {
  .bar .btn-alert { padding: 8px 12px; font-size: .78rem; }
  .brand { font-size: 1.15rem; }
}
@media (max-width: 380px) {
  .bar .btn-alert { padding: 7px 10px; font-size: .72rem; }
  .brand { font-size: 1rem; }
}

.updated { margin: 0; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.live-dot.fresh { background: var(--ok); }
.updated .offline { color: var(--offline-ink); font-weight: 600; }

/* ---------- modèle (nom + image, un seul modèle actuellement) ---------- */
.pdisplay { margin: 0; }
.pd-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }
.pd-image { display: block; width: 100%; max-width: 260px; height: auto; border-radius: 16px; margin: 0 auto; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 18px;
  padding: 16px;
  margin: 12px 0;
}
.side { display: flex; flex-direction: column; }

/* ---------- carte ---------- */
.map-wrap { position: relative; }
#map {
  position: relative;
  isolation: isolate;             /* confine les z-index internes de Leaflet sous le header */
  width: 100%;
  aspect-ratio: 560 / 540;
  border-radius: 14px; overflow: hidden;
  background: var(--map-g2);
  opacity: 0; transition: opacity .6s ease;
}
#map.ready { opacity: 1; }
.leaflet-container { font: inherit; background: var(--map-g2); }
/* points magasins : la couleur suit le thème via les variables CSS
   (une propriété CSS l'emporte sur l'attribut de présentation posé par Leaflet) */
.map-dot { stroke: var(--surface); stroke-width: 2; cursor: pointer; }
.map-dot.ds-ok   { fill: var(--ok);   fill-opacity: 1; }
.map-dot.ds-warn { fill: var(--warn); fill-opacity: 1; }
.map-dot.ds-off  { fill: var(--off);  fill-opacity: .55; stroke: none; }
/* attribution discrète, adaptée au thème */
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface) 82%, transparent) !important;
  color: var(--muted) !important; font-size: .62rem;
}
.leaflet-control-attribution a { color: var(--muted); }
.map-zoom {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px;
}
.zoom-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--hairline); background: var(--surface);
  color: var(--ink); font-size: 1.15rem; font-weight: 600; line-height: 1;
  cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s;
}
.zoom-btn:hover { border-color: var(--muted); }
.zoom-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.meta-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--ink-2); }
.lg-item { display: inline-flex; align-items: center; gap: 7px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lg-count { color: var(--muted); }

/* infobulle survol d'un point (Leaflet) */
.leaflet-tooltip.store-tip-wrap {
  background: var(--ink); color: var(--page);
  border: 0; border-radius: 12px; padding: 9px 12px;
  font: inherit; font-size: .8rem; line-height: 1.4;
  white-space: normal; max-width: 230px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}
.leaflet-tooltip-top.store-tip-wrap::before { border-top-color: var(--ink); }
.leaflet-tooltip-bottom.store-tip-wrap::before { border-bottom-color: var(--ink); }
.store-tip .st-price { font-weight: 700; font-size: .95rem; }
.store-tip .st-name { opacity: .85; }
.store-tip .st-sub { opacity: .72; }

/* ---------- liste des magasins ---------- */
.list-card { max-height: 65vh; overflow-y: auto; }
#storeList { list-style: none; margin: 0; padding: 0; }
#storeList > .store:first-child, #storeList > .empty:first-child { border-top: none; padding-top: 2px; }
.store { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-top: 1px solid var(--hairline); border-radius: 8px; }
.store:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.store.s-clickable { cursor: pointer; }
.store.s-clickable:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.store.s-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.s-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.s-txt { flex: 1; min-width: 0; }
.s-name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-sub { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.s-price { font-weight: 600; font-variant-numeric: tabular-nums; font-size: .9rem; }
.s-price.none { color: var(--muted); font-weight: 400; }
.s-price.est { color: var(--ink-2); }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .7rem; color: var(--ink-2);
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 2px 8px; white-space: nowrap;
}
.b-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.empty { padding: 22px 0; color: var(--muted); text-align: center; border-top: 1px solid var(--hairline); }
.expand-row { padding: 10px 0 4px; }
.expander {
  display: block; width: 100%;
  font: inherit; font-size: .83rem; font-weight: 600;
  color: var(--ink-2); background: none;
  border: 1px solid var(--hairline); border-radius: 12px;
  padding: 12px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.expander:hover { border-color: var(--muted); color: var(--ink); }
.expander:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- alternatives & guide ---------- */
.sec-title { margin: 0 0 10px; font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.alt-ad-note { margin: -4px 0 12px; font-size: .68rem; color: var(--muted); }
#altList { list-style: none; margin: 0; padding: 0; }
.alt-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.alt-item:first-child { border-top: none; padding-top: 2px; }
.alt-img-wrap {
  position: relative; flex: none;
  width: 58px; height: 58px; border-radius: 10px;
  overflow: hidden; cursor: zoom-in;
  background: var(--page); border: 1px solid var(--hairline);
}
.alt-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.alt-zoom {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .15s;
  border: 0; padding: 0; margin: 0; cursor: zoom-in; color: #ffffff;
}
.alt-img-wrap:hover .alt-zoom, .alt-zoom:focus-visible { opacity: 1; }
.alt-zoom svg { width: 22px; height: 22px; }
.alt-txt { flex: 1; min-width: 0; }
.alt-name { font-weight: 600; font-size: .88rem; }
.alt-note { font-size: .76rem; color: var(--muted); }
.alt-buy {
  flex: none; display: inline-flex; flex-direction: column; align-items: center;
  background: #232f3e; color: #ffffff;
  border-radius: 10px; padding: 7px 13px 6px;
  font-size: .64rem; font-weight: 600; line-height: 1.2;
  transition: opacity .15s;
}
.alt-buy:hover { opacity: .9; }
.alt-buy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.am-word { font-size: .88rem; font-weight: 700; letter-spacing: -.02em; color: #ffffff; line-height: 1; }
.am-smile { width: 40px; height: 9px; display: block; margin: 0 auto; }
.guide-card { line-height: 1.55; font-size: .86rem; }
.guide-card p { margin: 0 0 10px; color: var(--ink-2); }
.guide-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.guide-list li {
  position: relative; padding-left: 16px; color: var(--ink-2);
}
.guide-list li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.guide-list strong { color: var(--ink); }
.guide-note { margin: 0; color: var(--muted); font-size: .82rem; font-style: italic; }

/* ---------- états ---------- */
main { transition: opacity .25s; }
body.is-loading main { opacity: .55; }
.panel-error { text-align: center; padding: 26px 18px; }
.panel-error strong { display: block; margin-bottom: 6px; }
.panel-error span { color: var(--muted); font-size: .84rem; }
[hidden] { display: none !important; }
main { padding-bottom: 24px; }

/* ---------- bandeau alerte (fin) ---------- */
.alert-band { border-top: 1px solid var(--hairline); background: var(--surface); }
.ab-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px 14px;
  padding-top: 10px; padding-bottom: 10px;
  text-align: center;
}
.ab-inner p { margin: 0; color: var(--ink-2); font-size: .85rem; }
.ab-btn { text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; padding: 9px 16px; }

/* ---------- modal alerte ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .68); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.modal-box {
  position: relative; width: 100%; max-width: 440px;
  max-height: calc(100vh - 28px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--ring);
  border-radius: 20px; padding: 20px;
}
.modal-x {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
  font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0;
}
.modal-x:hover { color: var(--ink); border-color: var(--muted); }
.modal-box h2 { margin: 2px 0 14px; font-size: 1.15rem; letter-spacing: -.01em; }
.plans { display: flex; flex-direction: column; gap: 8px; }
.plan {
  position: relative;
  font: inherit; text-align: left;
  background: var(--page);
  border: 1.5px solid var(--hairline); border-radius: 14px;
  padding: 12px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.plan:hover { border-color: var(--muted); }
.plan[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--page));
}
.plan-reco { border-color: var(--accent); }
/* une fois une formule choisie, le liseré bleu « Recommandé » redevient neutre
   s'il n'est pas celui sélectionné : le bleu suit le choix de l'utilisateur */
.plans.has-chosen .plan-reco:not([aria-pressed="true"]) { border-color: var(--hairline); }
.plan-badge {
  position: absolute; top: -10px; left: 14px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .64rem; font-weight: 700; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 999px;
}
.plan:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-main { font-size: .95rem; }
.plan-main strong { font-size: 1.05rem; }
.plan-old { color: var(--muted); font-weight: 400; margin-left: 7px; font-size: .85em; }
.geo { margin-top: 14px; position: relative; }
.geo input[type="text"] {
  width: 100%; font: inherit; font-size: .9rem;
  padding: 11px 13px; border-radius: 12px;
  border: 1.5px solid var(--hairline);
  background: var(--page); color: var(--ink);
}
.geo input[type="text"]:focus { outline: none; border-color: var(--accent); }
.cp-list {
  position: absolute; left: 0; right: 0; top: 48px; z-index: 5;
  list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.cp-item { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: .88rem; }
.cp-item:hover { background: var(--page); }
#radiusBox { margin-top: 12px; }
.radius-row { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; color: var(--ink-2); margin-bottom: 4px; }
.radius-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
#radiusRange { width: 100%; accent-color: var(--accent); }
/* mini-carte du rayon (Leaflet) : recadrée sur le cercle, qui garde donc une
   taille écran constante pendant que la carte dézoome */
#miniMap {
  height: 190px; margin-top: 10px;
  border-radius: 12px; overflow: hidden;
  isolation: isolate; background: var(--map-g2);
}
.radius-ring { stroke: var(--accent); fill: var(--accent); fill-opacity: .15; stroke-width: 2; }
.radius-dot { fill: var(--accent); }
.geo-privacy-link { display: inline-block; margin-top: 8px; font-size: .72rem; color: var(--muted); text-decoration: underline; }
.geo-privacy-link:hover { color: var(--ink-2); }
.legal { display: flex; gap: 9px; margin-top: 12px; font-size: .7rem; color: var(--muted); line-height: 1.5; cursor: pointer; }
.legal input { margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.go { width: 100%; margin-top: 14px; padding: 13px; font-size: .9rem; }
.go:disabled { opacity: .45; cursor: not-allowed; }
.pay-note { margin: 8px 0 0; text-align: center; font-size: .72rem; color: var(--muted); }
@media (max-width: 560px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { max-width: none; border-radius: 20px 20px 0 0; max-height: 94vh; }
}

/* ---------- agrandissement image (lightbox alternatives) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox-img {
  position: relative; z-index: 1;
  max-width: min(90vw, 640px); max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.lightbox-x {
  position: fixed; top: 16px; right: 16px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0;
}
.lightbox-x:hover { color: var(--ink); border-color: var(--muted); }
.lightbox-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- mentions légales (dépliables sous le bandeau) ---------- */
.legal-foot { padding: 14px 16px 28px; }
/* l'en-tête est un bouton : les conditions se déplient au clic dessus */
.legal-heading {
  display: block; width: 100%; max-width: 720px; margin: 0 auto;
  background: none; border: none; padding: 4px 0;
  font: inherit; font-size: .72rem; color: var(--muted);
  text-align: center; cursor: pointer;
}
.legal-heading-link { text-decoration: underline; text-underline-offset: 2px; }
.legal-heading:hover .legal-heading-link { color: var(--ink-2); }
.legal-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.legal-caret {
  display: inline-block; margin-left: 7px; vertical-align: middle;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform .18s ease;
}
.legal-heading[aria-expanded="true"] .legal-caret { transform: rotate(180deg); }
.legal-body {
  max-width: 720px; margin: 10px auto 0;
  color: var(--muted); font-size: .72rem; line-height: 1.6;
}
.legal-body p { margin: 0 0 8px; }
.legal-body strong { color: var(--ink-2); font-weight: 600; }

/* ---------- bannière cookies ---------- */
.cookie {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 70;
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  font-size: .8rem;
}
.cookie > p { margin: 0 0 8px; color: var(--ink-2); }
.cookie-more { margin: 0 0 8px; color: var(--muted); font-size: .74rem; line-height: 1.55; }
.cookie-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ck-btn {
  font: inherit; font-size: .78rem; font-weight: 600;
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
}
.ck-btn:hover { border-color: var(--muted); color: var(--ink); }
#ckYes { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- desktop : l'écran s'arrête au bandeau, les mentions
   légales se découvrent en scrollant ---------- */
@media (min-width: 1080px) {
  .shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
  header, .alert-band { flex: none; }
  .bar, .wrap { max-width: 1400px; }
  main.wrap {
    flex: 1 1 auto; min-height: 0; width: 100%;
    display: grid;
    /* colonnes latérales égales : la carte est centrée sur l'axe du titre */
    grid-template-columns: 320px minmax(0, 1fr) 320px;
    grid-template-areas: "aside map side";
    column-gap: 18px;
    padding-top: 12px; padding-bottom: 12px; margin: 0 auto;
  }
  .aside { grid-area: aside; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
  .aside > * { margin: 0; flex: none; }
  .map-card { grid-area: map; margin: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .map-wrap { flex: 1 1 auto; min-height: 0; }
  #map { width: 100%; height: 100%; }
  .meta-row { flex: none; }
  /* modèle + liste combinés : jamais plus hauts que la carte */
  .side { grid-area: side; min-height: 0; overflow: hidden; gap: 12px; }
  .side > * { margin: 0; flex: none; }
  .list-card { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
  main { padding-bottom: 12px; }
}
