/* ===========================================================================
   Carte de mes voyages — thème clair, aligné sur la charte Omnia amplecti.
   Le bandeau et le pied viennent de /assets/site.css ; ce fichier style le
   contenu de la page : carte plein écran possible, panneaux repliables placés
   DANS la carte (outils, légende unique), encarts outre-mer sur le côté.
   =========================================================================== */
:root {
  --ink: #1a1814;
  --paper: #f2f5fa;
  --paper-dark: #e6ecf6;
  --brand: #1d3a5f;
  --gold: #b89a5a;
  --gold-light: #d4b87a;
  --muted: #7a7060;
  --nav-h: 72px;
  --line: rgba(184, 154, 90, 0.28);
  --habite: #166534;
  --sejour: #3f9d5a;
  --visite: #8ec99a;
  --passe: #e0a92f;
  --mer: #dbe6f1;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Montserrat", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--paper); }
body { font-family: var(--sans); font-weight: 300; background: var(--paper); color: var(--ink); min-height: 100vh; }

/* ── En-tête de page (sous le bandeau fixe) ── */
.entete {
  max-width: 1180px; margin: 0 auto;
  padding: calc(var(--nav-h) + 2.2rem) 2rem 0.5rem; text-align: center;
}
.eyebrow { font-size: 0.68rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); margin: 0 0 0.6rem; }
.entete h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.03; margin: 0; color: var(--brand);
}
.entete h1 em { font-style: normal; color: var(--brand); }
.accroche { max-width: 680px; margin: 0.8rem auto 0; font-size: 0.96rem; line-height: 1.6; color: var(--muted); }

.enveloppe { max-width: 1180px; margin: 0 auto; padding: 0 1.4rem 2rem; }

/* ── Bandeau d'invitation à se connecter ── */
.banniere {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  max-width: 1180px; margin: 0.6rem auto 0; padding: 11px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(184,154,90,0.09), rgba(184,154,90,0.03));
  font-size: 13.5px; color: var(--ink);
}
.banniere[hidden] { display: none; }
.banniere .b-ico { font-size: 1.15rem; color: var(--gold); }
.banniere strong { color: var(--brand); font-weight: 600; }
.banniere .b-txt { flex: 1 1 260px; line-height: 1.45; }
.banniere .b-btn {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: #fff; background: var(--brand);
  text-decoration: none; border: none; border-radius: 9px; padding: 8px 16px; cursor: pointer; transition: background 0.15s;
}
.banniere .b-btn:hover { background: #16324f; }
.banniere .b-fermer { background: none; border: none; color: var(--muted); padding: 4px 8px; font-size: 17px; cursor: pointer; line-height: 1; }
.banniere .b-fermer:hover { color: var(--ink); }

/* ── Carte ── */
.scene { max-width: 1180px; margin: 0.9rem auto 0; padding: 0 1.4rem; }
#carte {
  position: relative;
  height: 66vh; min-height: 380px;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--mer); cursor: crosshair;
  box-shadow: 0 8px 26px rgba(29, 58, 95, 0.08);
}
/* Plein écran (API native ou repli en position fixe) */
#carte:fullscreen, #carte:-webkit-full-screen { height: 100%; width: 100%; border-radius: 0; border: none; }
#carte.plein { position: fixed; inset: 0; z-index: 4000; height: 100vh; width: 100vw; border-radius: 0; border: none; }
.leaflet-container { background: var(--mer); font-family: var(--sans); }
.leaflet-interactive:focus { outline: none; }

/* ── Panneaux flottants (repliables) DANS la carte ── */
.panneau {
  position: absolute; z-index: 700;
  background: rgba(255, 255, 255, 0.95); border: 1px solid var(--line);
  border-radius: 11px; backdrop-filter: blur(3px);
  box-shadow: 0 6px 20px rgba(29, 58, 95, 0.13);
  font-size: 12px; line-height: 1.45; max-width: min(78vw, 340px);
}
.pan-tete {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 8px 7px 12px; cursor: default;
}
.pan-tete h4 {
  font-family: var(--sans); font-size: 10px; font-weight: 600; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.16em; margin: 0;
}
.pan-toggle {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.pan-toggle:hover { color: var(--brand); background: var(--paper-dark); }
.pan-corps { padding: 2px 12px 12px; }
.panneau.replie .pan-corps { display: none; }
.panneau.replie .pan-tete { padding-bottom: 7px; }
.panneau.replie .pan-toggle { transform: rotate(-90deg); }

.outils { top: 12px; left: 12px; width: 250px; }
.legende { top: 12px; right: 12px; width: 172px; }
.outremer { bottom: 12px; left: 12px; width: 216px; }

/* Segmented vue France / Monde */
.vue-seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; margin-bottom: 10px; }
.vue-seg button {
  flex: 1; font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--muted);
  background: transparent; border: none; cursor: pointer; padding: 7px 6px; transition: color 0.15s, background 0.15s;
}
.vue-seg button + button { border-left: 1px solid var(--line); }
.vue-seg button.actif { color: #fff; background: var(--brand); }
.vue-seg button:not(.actif):hover { color: var(--brand); background: var(--paper-dark); }

/* Pinceaux */
.pinceaux { display: flex; flex-wrap: wrap; gap: 6px; }
.pinceau {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--ink); background: #fff; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px 5px 8px; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.pinceau .pastille { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.18); }
.pinceau:hover { background: var(--paper-dark); }
.pinceau.actif { border-color: var(--gold); box-shadow: 0 0 0 1.5px var(--gold-light) inset; }
.pinceau.gomme .pastille { background: repeating-linear-gradient(45deg, #cfc8bb, #cfc8bb 3px, #fff 3px, #fff 6px); }

/* Actions (plein écran / effacer / stats / synchro) */
.outils-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.mini-btn {
  font-family: var(--sans); font-size: 11.5px; font-weight: 500; color: var(--brand);
  text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: #fff; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.mini-btn:hover { color: var(--gold); border-color: var(--gold); background: var(--paper-dark); }
.etat-sync { font-family: var(--serif); font-style: italic; font-size: 0.92rem; color: var(--muted); flex-basis: 100%; }
.etat-sync.ok { color: var(--sejour); }
.etat-sync.err { color: #b5544b; }

/* Légende UNIQUE (avec compteur intégré) */
.legende .cat { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; color: var(--ink); }
.legende .sw { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.2); }
.legende .cat .lbl { flex: 1; }
.legende .cat .cnt { font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.legende .note { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; line-height: 1.4; }

/* Encarts outre-mer (mini-cartes à échelle normalisée) */
.outremer .grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.inset {
  border: 1px solid var(--line); border-radius: 8px; background: var(--mer); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: border-color 0.15s, box-shadow 0.15s;
}
.inset:hover { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.inset svg { display: block; width: 100%; height: 44px; }
.inset svg path { stroke: rgba(20,16,12,0.4); stroke-width: 0.7; }
.inset .nm { font-size: 8.5px; text-align: center; color: var(--muted); padding: 2px 2px 3px; line-height: 1.1; background: #fff; }

/* Contrôles Leaflet clairs */
.leaflet-tooltip {
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--sans); font-size: 12px; font-weight: 500; box-shadow: 0 4px 14px rgba(29,58,95,0.14);
}
.leaflet-tooltip-top:before { border-top-color: var(--line); }
.leaflet-bar a { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.leaflet-bar a:hover { background: var(--paper-dark); color: var(--brand); }
.leaflet-control-attribution { display: none; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--brand); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13px;
  z-index: 5000; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25); max-width: 90vw; text-align: center;
}
.toast.montre { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Modale d'édition des catégories ── */
.voile {
  position: fixed; inset: 0; z-index: 6000; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(20, 25, 35, 0.45); backdrop-filter: blur(3px);
}
.voile.ouvert { display: flex; }
.modale {
  width: min(470px, 100%); max-height: 86vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 24px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.modale h2 { font-family: var(--serif); font-weight: 600; font-size: 1.6rem; color: var(--brand); margin: 0 0 4px; }
.modale .intro { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-bottom: 16px; }
.cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.cat-row input[type="color"] { width: 36px; height: 34px; min-width: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 2px; cursor: pointer; }
.cat-row input[type="text"] { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font-family: var(--sans); font-size: 13.5px; color: var(--ink); outline: none; }
.cat-row input[type="text"]:focus { border-color: var(--gold); }
.cat-row .suppr { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 5px 8px; border-radius: 6px; line-height: 1; }
.cat-row .suppr:hover { color: #b5544b; background: var(--paper-dark); }
.modale .ajouter { margin-top: 4px; }
.modale .err { color: #b5544b; font-size: 12.5px; margin-top: 10px; min-height: 1em; }
.modale .m-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }
.btn-brand { font-family: var(--sans); font-size: 13px; font-weight: 600; color: #fff; background: var(--brand); border: none; border-radius: 9px; padding: 10px 18px; cursor: pointer; transition: background 0.15s; }
.btn-brand:hover { background: #16324f; }

/* ── Responsive ── */
@media (max-width: 760px) {
  .entete { padding: calc(var(--nav-h) + 1.4rem) 1rem 0.3rem; }
  .banniere, .scene { padding-left: 1rem; padding-right: 1rem; }
  #carte { height: 70vh; }
  .outils { width: 210px; }
  .outremer { width: 174px; }
  .legende { width: 150px; }
}
