/* ============================================================
   IGN BÉNIN — WEBMAP SHELL
   Carte interactive grand public (recherche, couches, mesure).
   Ne pas confondre avec le Géoportail (IDS complète à venir).
   Strictly token-based.
   ============================================================ */

/* Cette page n'inclut pas header.css (topbar dédiée, voir webmap.php),
   qui porte normalement ce reset de base — on le redéclare ici pour que la
   page utilise la même police/charte que le reste du site. */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; }
p { text-align: justify; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-semibold); padding: 10px 16px; border-radius: var(--radius-md); border: 1.5px solid transparent; cursor: pointer; transition: var(--transition); line-height: 1; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn-primary { background: var(--green-600); color: #fff; } .btn-primary:hover { background: var(--green-700); }
.btn-secondary { background: var(--bg-surface); color: var(--green-700); border-color: var(--green-300); } .btn-secondary:hover { background: var(--green-50); border-color: var(--green-500); }
.btn-ghost { background: transparent; color: var(--text-secondary); } .btn-ghost:hover { background: var(--bg-sunken); color: var(--text-primary); }
.btn-sm { padding: 7px 12px; font-size: var(--fs-xs); }

/* ============================================================
   APP SHELL — full viewport below slim nav
   ============================================================ */
.geo-app { position: relative; height: calc(100vh - var(--geo-topbar, 56px)); min-height: 520px; overflow: hidden; background: var(--green-800); display: flex; }

/* slim top bar (app-specific, sits under main nav context) */
.geo-topbar { height: 56px; display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-5); background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); position: relative; z-index: 30; }
.geo-topbar .gt-brand { display: flex; align-items: center; gap: var(--space-3); }
.geo-topbar .gt-mark { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--green-600); display: grid; place-items: center; flex-shrink: 0; }
.geo-topbar .gt-mark svg { width: 100%; height: 100%; }
.geo-topbar .gt-logo { height: 36px; width: auto; display: block; flex-shrink: 0; }
.geo-topbar .gt-title { font-weight: var(--fw-extra); font-size: var(--fs-md); letter-spacing: var(--tracking-tight); }
.geo-topbar .gt-title b { color: var(--green-600); }
.geo-topbar .gt-tag { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-muted); padding: 3px 8px; background: var(--bg-sunken); border-radius: var(--radius-sm); text-transform: uppercase; letter-spacing: var(--tracking-wide); border: 1px solid transparent; cursor: pointer; transition: var(--transition); }
.geo-topbar .gt-tag:hover { border-color: var(--green-300); color: var(--green-700); }
.geo-topbar .gt-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }
/* contact (remarque wetest : en-tête Webmap incomplet par rapport à
   l'ancien site, qui affichait téléphone/email dans sa barre applicative) */
.geo-topbar .gt-contact { display: flex; align-items: center; gap: var(--space-3); padding-right: var(--space-4); border-right: 1px solid var(--border-subtle); }
.geo-topbar .gt-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
.geo-topbar .gt-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.geo-topbar .gt-link:hover { color: var(--green-700); }
.geo-topbar .gt-coord { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-muted); }
.geo-topbar .gt-back { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-secondary); font-weight: var(--fw-semibold); text-decoration: none; }
.geo-topbar .gt-back svg { width: 16px; height: 16px; }
.geo-topbar .gt-back:hover { color: var(--green-700); }

/* ============================================================
   LEFT PANEL — collapsible layer tree + search
   ============================================================ */
.layer-panel { width: 320px; flex-shrink: 0; background: var(--bg-surface); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; z-index: 20; transition: margin-left var(--transition); box-shadow: var(--shadow-sm); }
.geo-app.panel-collapsed .layer-panel { margin-left: -320px; }
.lp-head { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.lp-head h2 { font-size: var(--fs-sm); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.lp-head h2 svg { width: 17px; height: 17px; color: var(--green-600); }
.lp-collapse { width: 30px; height: 30px; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; transition: var(--transition); }
.lp-collapse:hover { background: var(--bg-sunken); color: var(--text-primary); }
.lp-collapse svg { width: 18px; height: 18px; }

.lp-scroll { flex: 1; overflow-y: auto; }

/* geographic search */
.geo-search { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.geo-search .gs-field { display: flex; align-items: center; gap: var(--space-2); padding: 0 4px 0 12px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-surface); transition: var(--transition); }
.geo-search .gs-field:focus-within { border-color: var(--green-500); box-shadow: var(--shadow-focus); }
.geo-search .gs-field svg { width: 17px; height: 17px; color: var(--text-muted); flex-shrink: 0; }
.geo-search .gs-field input { flex: 1; min-width: 0; border: none; outline: none; font-family: var(--font-sans); font-size: var(--fs-sm); background: transparent; padding: 10px 0; }
.geo-search .gs-go { flex-shrink: 0; width: 28px; height: 28px; border: none; border-radius: var(--radius-sm); background: var(--green-600); color: #fff; display: grid; place-items: center; cursor: pointer; transition: var(--transition); }
.geo-search .gs-go:hover { background: var(--green-700); }
.geo-search .gs-go svg { width: 14px; height: 14px; }
.geo-search .gs-scopes { display: flex; gap: 5px; margin-top: var(--space-3); flex-wrap: wrap; }
.gs-scope { font-size: 11px; font-weight: var(--fw-semibold); padding: 4px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.gs-scope:hover { border-color: var(--green-400); color: var(--green-700); }
.gs-scope.active { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.geo-search .gs-hint { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-muted); margin-top: var(--space-3); display: flex; align-items: center; gap: 6px; }
.geo-search .gs-hint svg { width: 12px; height: 12px; }
.geo-search .gs-feedback { margin-top: var(--space-3); font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--green-50); color: var(--green-700); }
.geo-search .gs-feedback.error { background: #FDECEC; color: #B3261E; }

/* layer tree */
.layer-tree { padding: var(--space-3) var(--space-4) var(--space-5); }
.lt-label { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); padding: var(--space-3) var(--space-2) var(--space-2); }
.lt-label .lt-src { font-weight: var(--fw-medium); text-transform: none; letter-spacing: normal; font-family: var(--font-mono); color: var(--text-muted); opacity: 0.7; }

/* bloc présentation institutionnelle, bas du panneau de couches (voir
   .layer-panel plus haut ; comportement du vrai webmap ign.bj) */
.lp-about { border-top: 1px solid var(--border-subtle); background: var(--bg-sunken); }
.lp-about-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); cursor: pointer; font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-secondary); }
.lp-about-head .chev { width: 15px; height: 15px; color: var(--text-muted); transition: transform var(--transition); }
.lp-about.collapsed .lp-about-head .chev { transform: rotate(180deg); }
.lp-about-body { padding: 0 var(--space-4) var(--space-4); }
.lp-about.collapsed .lp-about-body { display: none; }
.lp-about-body p { margin: 0 0 var(--space-3); font-size: var(--fs-xs); line-height: var(--lh-normal); color: var(--text-secondary); }
.lp-about-clock { display: flex; gap: var(--space-3); font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-muted); }
.layer-item { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); margin-bottom: var(--space-2); overflow: hidden; transition: var(--transition); }
.layer-item.on { border-color: var(--green-200); }
.layer-item.error { border-color: #E8AFAF; background: #FDECEC; }
.li-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.li-swatch { width: 18px; height: 18px; border-radius: var(--radius-sm); flex-shrink: 0; border: 1px solid rgba(0,0,0,0.08); }
.li-name { flex: 1; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary); min-width: 0; }
.li-count { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-muted); }
.li-info { width: 22px; height: 22px; border: none; background: transparent; color: var(--text-muted); border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: var(--transition); }
.li-info:hover { background: var(--green-50); color: var(--green-700); }
.li-info svg { width: 15px; height: 15px; }
/* toggle switch */
.li-toggle { position: relative; width: 38px; height: 22px; border-radius: var(--radius-pill); background: var(--neutral-300); border: none; cursor: pointer; transition: var(--transition); flex-shrink: 0; }
.li-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: var(--transition); }
.layer-item.on .li-toggle { background: var(--green-600); }
.layer-item.on .li-toggle::after { transform: translateX(16px); }
/* opacity row */
.li-opacity { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-3) var(--space-3); }
.layer-item:not(.on) .li-opacity { display: none; }
.li-opacity .oicon { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.li-opacity input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: var(--radius-pill); background: var(--green-200); outline: none; }
.li-opacity input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--green-600); cursor: pointer; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.li-opacity input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--green-600); cursor: pointer; border: 2px solid #fff; }
.li-opacity .oval { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-secondary); width: 34px; text-align: right; }
/* note d'échelle (couches à forte densité de points, visibles à partir d'un certain zoom) */
.li-hint { font-size: var(--fs-2xs); color: var(--text-muted); padding: 0 var(--space-3) var(--space-3); margin-top: -4px; }

/* couches pas encore alimentées en données réelles — honnête plutôt que simulé */
.layer-item.soon { background: var(--bg-sunken); opacity: 0.75; }
.layer-item.soon .li-swatch { background: var(--neutral-200); border-color: var(--neutral-300); }
.layer-item.soon .li-name { color: var(--text-muted); font-weight: var(--fw-medium); }
.li-badge { font-family: var(--font-mono); font-size: 10px; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-muted); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); padding: 3px 8px; flex-shrink: 0; }
.li-sublist { padding: 0 var(--space-3) var(--space-3) 40px; display: flex; flex-direction: column; gap: 4px; }
.li-subrow { font-size: var(--fs-xs); color: var(--text-muted); position: relative; padding-left: var(--space-3); }
.li-subrow::before { content: "—"; position: absolute; left: 0; }

/* collapsed rail (desktop) — reopen button */
.panel-reopen { position: absolute; top: var(--space-4); left: var(--space-4); z-index: 18; display: none; }
.geo-app.panel-collapsed .panel-reopen { display: inline-flex; }

/* ============================================================
   MAP AREA — moteur cartographique réel (OpenLayers)
   ============================================================ */
/* fond institutionnel atténué (remarque wetest : le vert dominait trop
   visuellement, gênant la lecture des couches superposées) — teinte plus
   neutre et moins saturée que l'ancien vert vif (#0f4a30/#082C1D), toujours
   dans la charte mais discrète. */
.map-area { flex: 1; position: relative; overflow: hidden; background: #24352C; }
#map { position: absolute; inset: 0; }

/* fond "institutionnel IGN" — pas de tuiles externes, juste notre propre habillage,
   pour que les couches vectorielles (communes/départements) ressortent nettement */
.map-area[data-basemap="institutionnel"] #map { background: radial-gradient(ellipse at 30% 20%, #2E4A3D 0%, #1A2420 70%); }
.map-area[data-basemap="institutionnel"] #map::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(127,211,168,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(127,211,168,0.08) 1px, transparent 1px); background-size: 44px 44px; pointer-events: none; }

/* attribution OpenLayers — cohérence visuelle avec le chrome sombre de l'appli */
.ol-attribution { bottom: 4px !important; right: 4px !important; }
.ol-attribution:not(.ol-collapsed) { background: rgba(8,44,29,0.7) !important; border-radius: var(--radius-sm) !important; }
.ol-attribution ul { color: rgba(255,255,255,0.8) !important; font-family: var(--font-mono) !important; font-size: 10px !important; }
.ol-attribution a { color: #fff !important; }
.ol-attribution button { background: rgba(8,44,29,0.7) !important; }

/* info-bulle d'identification d'objet (clic sur une commune/département/localité) */
.feature-popup { position: absolute; display: none; min-width: 200px; max-width: 280px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--space-4); z-index: 19; }
.feature-popup.open { display: block; }
.feature-popup::after { content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%) rotate(45deg); width: 12px; height: 12px; background: var(--bg-surface); border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.fp-close { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: none; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 50%; display: grid; place-items: center; }
.fp-close:hover { background: var(--bg-sunken); color: var(--text-primary); }
.fp-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 var(--space-5) var(--space-2) 0; }
.fp-row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-xs); color: var(--text-muted); padding: 3px 0; }
.fp-row b { color: var(--text-secondary); font-weight: var(--fw-semibold); text-align: right; }
/* vignette photo (chefs-lieux dép./commune, comportement du vrai webmap
   ign.bj) et lien Google Maps direct — voir photoBlock()/gmapsLink() */
.fp-photo { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: var(--radius-sm); margin: 0 0 var(--space-3); background: var(--bg-sunken); }
.fp-gmaps { display: flex; align-items: center; gap: 6px; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--green-700); text-decoration: none; }
.fp-gmaps svg { width: 14px; height: 14px; flex-shrink: 0; }
.fp-gmaps:hover { color: var(--green-900); text-decoration: underline; }

/* ============================================================
   TOP-RIGHT FLOATING TOOLBAR
   ============================================================ */
.map-toolbar { position: absolute; top: var(--space-4); right: var(--space-4); z-index: 16; display: flex; flex-direction: column; gap: var(--space-2); }
.tool-group { background: var(--bg-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--border-subtle); display: flex; flex-direction: column; }
.tool-btn { width: 42px; height: 42px; border: none; background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; display: grid; place-items: center; transition: var(--transition); position: relative; }
.tool-btn svg { width: 19px; height: 19px; }
.tool-btn + .tool-btn { border-top: 1px solid var(--border-subtle); }
.tool-btn:hover { background: var(--green-50); color: var(--green-700); }
.tool-btn.active { background: var(--green-600); color: #fff; }
.tool-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); background: var(--neutral-900); color: #fff; font-family: var(--font-sans); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); padding: 5px 9px; border-radius: var(--radius-sm); white-space: nowrap; pointer-events: none; z-index: 5; }

/* measure popover */
.measure-pop { position: absolute; top: var(--space-4); right: 68px; z-index: 17; width: 220px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--space-4); display: none; }
.measure-pop.open { display: block; }
.measure-pop .mp-t { font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-muted); margin-bottom: var(--space-3); }
.measure-pop .mp-opts { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); }
.measure-pop .mp-opt { flex: 1; padding: 8px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-surface); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-secondary); cursor: pointer; transition: var(--transition); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.measure-pop .mp-opt svg { width: 18px; height: 18px; }
.measure-pop .mp-opt.active { border-color: var(--green-600); background: var(--green-50); color: var(--green-700); }
.measure-pop .mp-result { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--green-700); background: var(--green-50); padding: var(--space-3); border-radius: var(--radius-sm); text-align: center; }
.measure-pop .mp-opts.stack { flex-direction: column; gap: 6px; }
.measure-pop .mp-opt.row { flex-direction: row; justify-content: flex-start; }

/* popover partage — même composant que la mesure, positionné à côté */
#sharePop { top: var(--space-4); right: 68px; width: 240px; }

/* ============================================================
   BOTTOM-LEFT — legend + scale + basemap
   ============================================================ */
.map-bl { position: absolute; left: var(--space-4); bottom: var(--space-4); z-index: 15; display: flex; align-items: flex-end; gap: var(--space-5); }
.legend-box { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-md); width: 220px; overflow: hidden; }
.legend-box .lb-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); cursor: pointer; }
.legend-box .lb-head .t { font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-secondary); }
.legend-box .lb-head .chev { width: 15px; height: 15px; color: var(--text-muted); transition: transform var(--transition); }
.legend-box.collapsed .lb-head .chev { transform: rotate(180deg); }
.legend-box .lb-body { padding: 0 var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.legend-box.collapsed .lb-body { display: none; }
.legend-row { display: flex; align-items: center; gap: var(--space-3); font-size: var(--fs-xs); color: var(--text-secondary); }
.legend-row .ls { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.legend-row .ls.line { height: 3px; border-radius: 2px; }
.legend-row .ls.dot { border-radius: 50%; width: 12px; height: 12px; }

/* bloc distinct du bloc légende (demande IGN : position à la Google Maps,
   sélecteur de fond + échelle séparés de la légende, pas mêlés dans le même
   groupe visuel) — même langage de carte (fond/bordure/ombre) que .legend-box. */
.scale-basemap { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.scale-bar { background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 4px 10px; min-height: 26px; display: flex; align-items: center; }
/* OpenLayers injecte son propre contrôle d'échelle dynamique ici */
.scale-bar .ol-scale-line { position: static; background: none; }
.scale-bar .ol-scale-line-inner { color: var(--text-secondary); font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); border-color: var(--text-secondary); }

/* ============================================================
   BOTTOM-RIGHT — mini-carte (équivalent du plugin MiniMap du vrai
   webmap ign.bj, ici via ol.control.OverviewMap natif OpenLayers)
   ============================================================ */
.ol-overviewmap { position: absolute; right: var(--space-4); bottom: var(--space-4); left: auto; z-index: 15; }
.ol-overviewmap.ol-uncollapsible { bottom: var(--space-4); }
.ol-overviewmap:not(.ol-collapsed) { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 4px; }
.ol-overviewmap .ol-overviewmap-map { border: none; width: 150px; height: 150px; margin: 2px; }
.ol-overviewmap button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: var(--radius-sm); border: none; background: var(--bg-surface); color: var(--text-secondary); box-shadow: var(--shadow-sm); cursor: pointer; }
.ol-overviewmap.ol-collapsed button { position: static; box-shadow: var(--shadow-md); }
.ol-overviewmap .ol-overviewmap-box { border: 2px solid var(--green-600); }

/* basemap switcher — 6 fonds, grille 3x2 */
.basemap-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 168px; }
.bm-opt { border-radius: var(--radius-md); overflow: hidden; border: 2px solid transparent; cursor: pointer; box-shadow: var(--shadow-sm); transition: var(--transition); background: var(--bg-surface); }
.bm-opt:hover { transform: translateY(-2px); }
.bm-opt.active { border-color: var(--green-600); }
.bm-opt .bm-thumb { height: 32px; position: relative; }
.bm-opt .bm-name { font-size: 8px; font-weight: var(--fw-bold); text-align: center; padding: 2px; color: var(--text-secondary); background: var(--bg-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-opt.active .bm-name { color: var(--green-700); }
.bm-thumb.plan { background: linear-gradient(135deg, #EEF1F0, #DEE4E2); }
.bm-thumb.sat { background: linear-gradient(135deg, #1c3a2a, #0B4029); }
.bm-thumb.topo { background: linear-gradient(135deg, #E8F0E5, #C9DEC2); }
.bm-thumb.clair { background: linear-gradient(135deg, #FAFAF8, #ECECE8); }
.bm-thumb.sombre { background: linear-gradient(135deg, #2b2b2b, #121212); }
.bm-thumb.institutionnel { background: radial-gradient(ellipse at 30% 20%, #0f4a30, #082C1D); }

/* ============================================================
   MOBILE — bottom sheet + FAB
   ============================================================ */
.geo-fab { display: none; position: absolute; right: var(--space-4); bottom: var(--space-5); z-index: 24; flex-direction: column-reverse; align-items: center; gap: var(--space-3); }
.fab-main { width: 56px; height: 56px; border-radius: 50%; background: var(--green-600); color: #fff; border: none; box-shadow: var(--shadow-lg); cursor: pointer; display: grid; place-items: center; transition: var(--transition); }
.fab-main svg { width: 24px; height: 24px; transition: transform var(--transition); }
.geo-fab.open .fab-main { background: var(--green-800); }
.geo-fab.open .fab-main svg { transform: rotate(45deg); }
.fab-actions { display: flex; flex-direction: column; gap: var(--space-2); align-items: center; opacity: 0; visibility: hidden; transform: translateY(10px); transition: var(--transition); }
.geo-fab.open .fab-actions { opacity: 1; visibility: visible; transform: translateY(0); }
.fab-act { display: flex; align-items: center; gap: var(--space-3); }
.fab-act .fl { font-size: var(--fs-2xs); font-weight: var(--fw-bold); color: #fff; background: var(--neutral-900); padding: 4px 9px; border-radius: var(--radius-sm); white-space: nowrap; box-shadow: var(--shadow-sm); }
.fab-act .fb { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-surface); color: var(--green-700); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-md); cursor: pointer; display: grid; place-items: center; }
.fab-act .fb svg { width: 19px; height: 19px; }

/* mobile layers bottom-sheet */
.geo-sheet-scrim { position: absolute; inset: 0; background: rgba(8,44,29,0.45); opacity: 0; visibility: hidden; transition: var(--transition); z-index: 25; }
.geo-sheet-scrim.open { opacity: 1; visibility: visible; }
.geo-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 26; background: var(--bg-surface); border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; box-shadow: var(--shadow-xl); transform: translateY(100%); transition: transform 300ms cubic-bezier(0.4,0,0.2,1); max-height: 82%; display: flex; flex-direction: column; }
.geo-sheet.open { transform: translateY(0); }
.geo-sheet .gsh-grip { width: 44px; height: 5px; border-radius: 99px; background: var(--border-strong); margin: var(--space-3) auto var(--space-2); }
.geo-sheet .gsh-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-5) var(--space-3); border-bottom: 1px solid var(--border-subtle); }
.geo-sheet .gsh-head .t { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.geo-sheet .gsh-body { overflow-y: auto; }
.geo-sheet .gsh-tabs { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.gsh-tab { font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 7px 13px; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.gsh-tab.active { background: var(--green-600); border-color: var(--green-600); color: #fff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .layer-panel { position: absolute; inset: 0 auto 0 0; }
  .geo-app .layer-panel { display: none; }
  .panel-reopen { display: none !important; }
  .geo-fab { display: flex; }
  .map-toolbar { display: none; }
  .map-bl { left: var(--space-3); bottom: var(--space-3); flex-direction: column-reverse; align-items: flex-start; gap: var(--space-2); }
  .legend-box { width: 168px; }
  .basemap-switch { width: 150px; }
  .geo-topbar .gt-coord, .geo-topbar .gt-tag, .geo-topbar .gt-contact { display: none; }
  .ol-attribution { bottom: 60px !important; }
  .feature-popup { max-width: calc(100vw - 32px); }

  /* la barre d'outils desktop est cachée : les popovers mesure/partage,
     ouverts depuis le FAB, s'ancrent près de lui plutôt qu'en haut à droite */
  .measure-pop, #sharePop { top: auto; right: var(--space-4); bottom: 86px; max-width: calc(100vw - 32px); }

  .geo-sheet .layer-panel, .geo-sheet .geo-search, .geo-sheet .layer-tree { display: block; position: static; width: auto; margin: 0; box-shadow: none; border: none; }
}
@media (min-width: 881px) { .geo-sheet, .geo-sheet-scrim, .geo-fab { display: none !important; } }

/* ============================================================
   IMPRESSION — carte plein cadre, sans chrome applicatif
   ============================================================ */
@media print {
  .geo-topbar, .layer-panel, .panel-reopen, .map-toolbar, .geo-fab, .feature-popup,
  .measure-pop, #sharePop, .geo-sheet, .geo-sheet-scrim, .lp-collapse { display: none !important; }
  .geo-app { height: 100vh; }
  .map-bl { display: none; }
}
