/* Autonomie Solaire — base de la page et de la carte (recherche, assistant) : « verre dépoli », typographie système Apple. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --bg: #f5f5f7;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: rgba(0, 0, 0, .08);
  --accent: #0071e3;
  --accent-press: #0062c4;
  --accent-soft: rgba(0, 113, 227, .1);
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .6);
  --shadow: 0 1px 1px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .12);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .04), 0 24px 60px rgba(0, 0, 0, .18);
  --radius: 22px;
  --spring: cubic-bezier(.2, .8, .2, 1);
  --pro: #248a3d;
  font-family: var(--font);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000; --fg: #f5f5f7; --muted: #a1a1a6; --faint: #8e8e93; --line: rgba(255, 255, 255, .12);
    --accent: #2997ff; --accent-press: #0a84ff; --accent-soft: rgba(41, 151, 255, .16);
    --glass: rgba(28, 28, 30, .72); --glass-strong: rgba(28, 28, 30, .88); --glass-border: rgba(255, 255, 255, .08);
    --pro: #30d158;
  }
}

/* thème choisi à la main (bouton ☾ / ☀) : mêmes valeurs que le mode sombre du système */
:root[data-theme="dark"] {
  --bg: #000; --fg: #f5f5f7; --muted: #a1a1a6; --faint: #8e8e93; --line: rgba(255, 255, 255, .12);
  --accent: #2997ff; --accent-press: #0a84ff; --accent-soft: rgba(41, 151, 255, .16);
  --glass: rgba(28, 28, 30, .72); --glass-strong: rgba(28, 28, 30, .88); --glass-border: rgba(255, 255, 255, .08);
  --pro: #30d158; color-scheme: dark;
}

:root[data-theme="dark"] #suggest { background: #1c1c1e; }
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
.theme-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: var(--fs-xl); flex: none; }
* { box-sizing: border-box; }
/* l'attribut hidden doit toujours l'emporter sur les display: flex / grid des composants */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
#map { position: absolute; inset: 0; }

button { font: inherit; cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500; }
.link:hover { text-decoration: underline; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.close {
  border: 0; width: 30px; height: 30px; border-radius: 50%; background: rgba(120, 120, 128, .14); color: var(--muted);
  font-size: var(--fs-h); line-height: 30px; padding: 0; display: grid; place-items: center; transition: background .2s;
}
.close:hover { background: rgba(120, 120, 128, .24); }

/* ---------- barre supérieure ---------- */
#top {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 5;
  display: flex; gap: 10px; align-items: center; pointer-events: none;
}
#top > * { pointer-events: auto; }
/* les suggestions de recherche passent au-dessus des panneaux (la barre laisse passer les clics hors de ses éléments) */
#top { z-index: 9; }

.logo { width: 26px; height: 26px; border-radius: var(--r-s); display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #34c759, #0a84ff); }
.logo svg { width: 17px; height: 17px; }

#search { position: relative; flex: 1; max-width: 400px; }
.search-ic { position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; z-index: 1; }
#q { width: 100%; height: 44px; border-radius: var(--r-pill); padding: 0 16px 0 40px; font-size: var(--fs-l); color: var(--fg); outline: none; font-family: inherit; }
#q::placeholder { color: var(--faint); }
#q:focus { box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
#suggest { position: absolute; top: 52px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; border-radius: var(--r-l); max-height: 50vh; overflow: auto; background: var(--glass-strong); }
#suggest li { padding: 9px 12px; cursor: pointer; font-size: var(--fs-body); border-radius: var(--r-m); }
#suggest li:hover { background: var(--accent-soft); }
#suggest small { color: var(--muted); display: block; font-size: var(--fs-s); }

/* ---------- panneaux ---------- */

.hint { font-size: var(--fs-s); color: var(--muted); margin: 0 0 4px; line-height: 1.45; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: var(--r-xs); background: rgba(120,120,128,.24); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.04), 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); cursor: grab; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 3px 8px rgba(0,0,0,.2); }

/* ---------- animations ---------- */
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ---------- fiche ---------- */
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- contrôles de la carte (MapLibre) ---------- */
.maplibregl-ctrl-group { border-radius: var(--r-m) !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib { font-size: var(--fs-xs); border-radius: var(--r-s); }

/* ---------- boutons ---------- */

.primary { border: 0; background: var(--accent); color: #fff; font-size: var(--fs-xl); font-weight: 500; padding: 14px 30px; border-radius: var(--r-pill); min-width: 180px;
  transition: transform .2s var(--spring), background .2s, opacity .2s; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.primary:hover { background: var(--accent-press); }
.primary:active { transform: scale(.96); }
.primary:disabled { opacity: .35; box-shadow: none; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ================================================================= téléphone */
@media (max-width: 760px) {
  #top { top: 10px; left: 10px; right: 10px; gap: 6px; flex-wrap: wrap; }
  #search { order: 3; flex-basis: 100%; max-width: none; }
  #q { height: 42px; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 52px; }
  .maplibregl-ctrl-scale { display: none; }
  .primary { width: 100%; }
}

/* ---------- boutons ---------- */
.primary.small { font-size: var(--fs-body); padding: 9px 18px; min-width: 0; }
.primary.alt { background: rgba(120,120,128,.16); color: var(--fg); box-shadow: none; }

/* ---------- suggestions de recherche ---------- */
#suggest { background: color-mix(in srgb, var(--bg) 97%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #suggest { background: #1c1c1e; } }

/* ---------- fiche d'un point (calcul détaillé, zoom fort) ---------- */

/* ---------- boutons et champs ---------- */
.primary[aria-pressed="true"] { background: var(--accent-press); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- fiche d'un point ---------- */

/* ---------- compteurs, liens, avertissements ---------- */
.sp-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: var(--fs-m); }
.sp-warn { padding: 10px 12px; border-radius: var(--r-m); background: rgba(255, 159, 10, .14); font-size: var(--fs-m); }
/* ---------- recherche ---------- */
#top #search { max-width: 360px; }

/* ---------- assistant et page d'accueil ---------- */
.wiz { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
.wz-frame { width: min(980px, 100% - 32px); height: min(820px, 100% - 32px); border-radius: var(--r-l); background: var(--glass-strong); box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border); display: flex; flex-direction: column; overflow: hidden; }
.wz-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.wz-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--fs-l); white-space: nowrap; }
.wz-brand b { color: #e0a100; font-weight: 600; }
.wz-steps { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.wz-steps button { border: 0; background: none; display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: var(--r-pill); font-size: var(--fs-s); color: var(--muted); white-space: nowrap; }
.wz-steps button span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); background: rgba(120,120,128,.16); }
.wz-steps button.now { color: var(--fg); background: var(--accent-soft); font-weight: 600; }
.wz-steps button.now span { background: var(--accent); color: #fff; }
.wz-steps button.done span { background: var(--pro); color: #fff; }
.wz-body { flex: 1; overflow: auto; padding: 22px 28px; }
.wz-body h2 { font-size: var(--fs-hh); margin: 0 0 6px; letter-spacing: -.02em; }
.wz-body h3 { font-size: var(--fs-s); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
.wz-lead { color: var(--muted); margin: 0 0 14px; font-size: var(--fs-body); line-height: 1.45; max-width: 70ch; }
.wz-nav { display: flex; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line); }
.pe-side input, .pe-side select { width: 100%; height: 36px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--glass); color: var(--fg); font: inherit; font-size: var(--fs-body); padding: 0 10px; }
.wz-search { position: relative; max-width: 560px; }
.wz-search input { width: 100%; height: 44px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--glass); color: var(--fg); font: inherit; font-size: var(--fs-l); padding: 0 14px; }
.wz-sugg { position: absolute; left: 0; right: 0; top: 48px; z-index: 3; list-style: none; margin: 0; padding: 6px; border-radius: var(--r-m); background: var(--glass-strong); box-shadow: var(--shadow); }
.wz-sugg li { padding: 8px 10px; border-radius: var(--r-s); cursor: pointer; font-size: var(--fs-body); }
.wz-sugg li:hover { background: var(--accent-soft); }
.wz-sugg small { display: block; color: var(--muted); font-size: var(--fs-s); }
.wz-rot { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; margin: 10px 0; }
.wz-rot output { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 42px; }
.wz-launch { width: 100%; margin-top: 12px; }
/* implantation : l'assistant devient un panneau latéral, la carte est visible */
.wiz.side { inset: auto; top: 72px; left: 14px; bottom: 14px; width: 380px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; place-items: stretch; }
.wiz.side .wz-frame { width: 100%; height: 100%; }
.wiz.side .wz-steps { display: none; }
.wiz.side .wz-body { padding: 16px 18px; }
.wiz.side .wz-body h2 { font-size: var(--fs-h); }
body.wizard-full #top { visibility: hidden; }
/* éditeur de plan */
.pe-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pe-tpl { font-size: var(--fs-m); color: var(--muted); display: flex; gap: 10px; }
.pe-cv { width: 100%; height: 360px; border-radius: var(--r-l); background: var(--glass); border: 1px solid var(--line); touch-action: none; cursor: crosshair; }
.pe-hint { margin-top: 6px; }
.pe-sum { font-size: var(--fs-m); font-weight: 500; margin: 4px 0 10px; }
.pe-side { display: grid; gap: 6px; max-width: 420px; margin-top: 10px; }
@media (max-width: 760px) {
  .wz-frame { width: 100%; height: 100%; border-radius: 0; }
  .wz-body { padding: 16px; }
  .pe-cv { height: 300px; }
  .wiz.side { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 46vh; }
  .wiz.side .wz-frame { border-radius: var(--r-l) var(--r-l) 0 0; }
}

.pe-zoom { display: flex; gap: 4px; margin-left: auto; }
.pe-zoom button { border: 1px solid var(--line); background: var(--glass); color: var(--fg); border-radius: var(--r-s); min-width: 32px; height: 30px; font-size: var(--fs-l); padding: 0 8px; }

/* maison restée à l'ancienne adresse */
.sp-relocate { margin: 6px 0 10px; display: grid; gap: 6px; }
.sp-relocate p { margin: 0; font-size: var(--fs-m); line-height: 1.4; }
.sp-relocate .sp-links { margin-top: 2px; align-items: center; }

