/* ============================================================================
   shell.css — bandeau de navigation COMMUN des maquettes 2028 (Atlas /
   Observatoire / Export). Extrait une fois : fini la redéfinition par page.
   Dépend de tokens.css. JS associé : shell.js (auto-masquage + bascule thème).

   Dessous concave (type macOS) sur les pages carte/graphes : plein sur les
   côtés (contenu), creusé au milieu pour libérer la vue. Le clip-path référence
   un <clipPath id="shellClip"> présent dans le HTML de la page.
   ============================================================================ */

/* Bandeau auto-masquant (Atlas, Observatoire) : se range pour libérer la vue,
   revient quand la souris remonte. offsetHeight reste 56px (le clip-path ne
   change pas la boîte) donc la réactivité souris est stable. */
.shell {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 56px;
  padding: 0 26px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  clip-path: url(#shellClip);
  /* 1er drop-shadow = liseré 1px épousant le bord concave ; 2e = ombre douce. */
  filter: drop-shadow(0 1.2px 0 var(--hairline-strong)) drop-shadow(0 7px 16px rgba(10, 16, 24, 0.24));
  transform: translateY(-100%);
  transition: transform 0.28s var(--ease);
}
.shell.show, .shell:focus-within { transform: translateY(0); }
/* Sombre : liseré teal (signature néon) + ombre plus creusée sur carte sombre. */
:root[data-theme="dark"] .shell {
  filter: drop-shadow(0 1px 1px var(--accent-glow)) drop-shadow(0 9px 24px rgba(0, 0, 0, 0.55));
}

/* Onglet indicateur quand le shell est masqué. */
.shell-peek {
  position: fixed; top: 0; left: 56%; transform: translateX(-50%);
  width: 56px; height: 5px; border-radius: 0 0 7px 7px;
  background: var(--hairline-strong); z-index: 18; opacity: 0.7;
  transition: opacity 0.2s;
}
.shell.show ~ .shell-peek { opacity: 0; }

/* Panneaux flottants décalés en douceur sous le shell (--shell-h posé en JS),
   sans déborder de l'écran. Inopérant sur les pages sans panneau (Export). */
:root { --shell-h: 0px; }
.panel {
  top: calc(14px + var(--shell-h));
  max-height: calc(100vh - 28px - var(--shell-h));
  /* top/max-height : décalage sous le shell ; transform/opacity : rétraction fluide (double-clic /
     languette), même ressort que la frise temporelle. */
  transition: top 0.28s var(--ease), max-height 0.28s var(--ease),
    transform 0.5s cubic-bezier(0.34, 1.2, 0.4, 1), opacity 0.4s ease;
}
.table-wrap {
  top: calc(14px + var(--shell-h));
  transition: top 0.28s var(--ease);
}

/* Sous-composants (marque, nav, actions) — partagés par les trois pages. */
.shell-brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); text-decoration: none;
}
.shell-nav { display: flex; gap: 6px; }
.shell-nav a {
  padding: 7px 12px; border-radius: var(--r-sm); font-size: 13px;
  color: var(--text-muted); text-decoration: none; transition: color .2s, background .2s;
}
.shell-nav a:hover { color: var(--text); background: var(--surface-2); }
.shell-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.shell-spacer { flex: 1; }
.shell-actions { display: flex; align-items: center; gap: 12px; }

/* Entrée Exporter : unique CTA teal dans le bandeau (se range avec lui). */
.shell-actions .shell-export {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-sm);
  color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 16px var(--accent-glow); font: inherit; font-size: 13px; font-weight: 600; text-decoration: none;
  /* Reset des defauts d'un <button> pour qu'il soit IDENTIQUE au lien <a> (bordure, curseur, apparence native). */
  border: 0; cursor: pointer; -webkit-appearance: none; appearance: none; line-height: 1.2; transition: filter 0.18s;
}
.shell-actions .shell-export:hover { filter: brightness(1.07); }

/* Panneau « À proximité » — PARTAGÉ Atlas + Observatoire. Le bloc ENTIER est un panneau rétractable
   `.ctx-section` (comme Loyer/Géorisques) ; à l'intérieur, les 4 familles sont dépliables vers leurs
   sous-catégories au clic. Rendu piloté par poi.js. */
.poi-section { margin-top: 8px; }
/* Atlas : « À proximité » vit dans .result-stats, juste après Loyer/Géorisques -> même rythme (4 px de gouttière
   + 2 px = 6 px, comme l'espacement entre les ctx-sections). La grille marketStats vide ne doit pas créer de trou. */
.result-stats .poi-section { margin-top: 2px; }
.market-stats:empty { display: none; }
.poi-total { font-size: 11px; color: var(--text-faint); margin: 1px 0 6px; }

/* « Reçu » d'estimation — CASCADE en euros (result-view.js renderFacteurs) : médiane du quartier (base) ->
   chaque correction A1..A5 signée + barre proportionnelle -> prix estimé. Par construction le reçu s'additionne. */
.facteur-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1px 8px; }
.facteur-line-name { font-weight: 600; }
.facteur-line-val { font-variant-numeric: tabular-nums; font-size: 15px; }
.facteur-line-sub { flex: 1 1 100%; font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.facteur-base { padding-bottom: 6px; }
.facteur-total { margin-top: 4px; padding-top: 8px; border-top: 2px solid var(--accent-line); }
.facteur-total .facteur-line-val { font-size: 17px; color: var(--accent); }
.facteur-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 8px; padding: 6px 0; border-top: 1px solid var(--hairline); }
.facteur-name { flex: 1 1 auto; font-weight: 600; }
.facteur-eur { font-variant-numeric: tabular-nums; font-weight: 700; }
.facteur-pct { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.facteur-bar { flex: 1 1 100%; height: 4px; margin: 3px 0 1px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.facteur-fill { display: block; height: 100%; border-radius: 2px; }
.facteur-why { flex: 1 1 100%; font-size: 11px; color: var(--text-faint); }
.facteur-up { color: var(--accent); }
.facteur-down { color: var(--danger); }
.facteur-fill.facteur-up { background: var(--accent); }
.facteur-fill.facteur-down { background: var(--danger); }
.facteur-none { font-size: 12px; color: var(--text-faint); padding: 4px 0; }
.poi-dot { width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; flex: 0 0 auto; }

.poi-fam { border-top: 1px solid var(--hairline); }
.poi-fam:first-child { border-top: none; }
.poi-fam > summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 0; cursor: pointer; list-style: none; }
.poi-fam > summary::-webkit-details-marker { display: none; }
.poi-fam > summary::before { content: "▸"; color: var(--text-faint); font-size: 10px; line-height: 1.6; }
.poi-fam[open] > summary::before { content: "▾"; }
.poi-fam.empty > summary { cursor: default; color: var(--text-faint); }
.poi-fam.empty > summary::before { visibility: hidden; }
.poi-fam-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; }
.poi-fam.empty .poi-fam-name { color: var(--text-muted); }
.poi-fam-n { font-family: var(--font-display); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.poi-fam-near { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10.5px; color: var(--text-faint); min-width: 52px; text-align: right; }
.poi-subs { padding: 0 0 8px 18px; display: flex; flex-direction: column; gap: 5px; }
.poi-sub { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-muted); }
.poi-sub-name { flex: 1; }
.poi-sub-n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.poi-sub-near { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10px; color: var(--text-faint); min-width: 48px; text-align: right; }

/* Spinner de chargement PARTAGE (Atlas : carte ; Observatoire : graphes). Un chargement peut prendre 1-2 s :
   ring discret au-dessus du contenu, pour ne pas donner l'impression d'un gel. Piloté par window.Busy (shell.js).
   L'overlay .map-loading couvre son conteneur positionné (inset:0) ; une page peut le repositionner (cf. .obs-loading). */
.map-loading { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; pointer-events: none; }
.map-loading.on { display: flex; }
.map-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); animation: map-spin 0.7s linear infinite; filter: drop-shadow(0 1px 3px rgba(20,30,40,0.28)); }
@keyframes map-spin { to { transform: rotate(360deg); } }
