
/* ==========================================================================
   base.css — Design system global
   Sommaire :
   1. Variables (:root)
   2. Reset & base
   3. Typographie
   4. Catégories (couleurs par type de lieu)
   5. Nav + mobile + dropdown langue
   6. Layout app (.app, .page, .layout, .aside, .main)
   7. Boutons
   8. Cards (générique, place, trail, event, city-tile)
   9. Tags / badges / pins
   10. Formulaires
   11. Messages / alertes
   12. Map helpers (leaflet popup)
   13. Blobs animés
   14. Animations
   15. Responsive
   ========================================================================== */

/* 1. VARIABLES ────────────────────────────────────────────────────────────── */
:root {
  /* Marque */
  --color-primary:      #4A7A40;
  --color-primary-dark: #2D5A28;
  --color-primary-light:#86EFAC;
  --color-accent:       #D97706;

  /* Neutres */
  --color-bg:       #FFFFFF;
  --color-bg-soft:  #FAFAF8;
  --color-bg-alt:   #F0EDE8;
  --color-text:     #111111;
  --color-muted:    #666666;
  --color-faint:    #AAAAAA;
  --color-border:   #EBEBEB;
  --color-border-soft: rgba(0,0,0,.08);

  /* Feedback */
  --color-success: #16A34A;
  --color-success-bg: #D1FAE5;
  --color-success-text: #065F46;
  --color-error:   #E11D48;
  --color-error-bg: #FEF2F2;
  --color-error-text: #991B1B;

  /* Typo */
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --font-serif:  'Playfair Display', Georgia, serif;

  /* Hauteur du bottom-nav mobile (passe à 60px en @media mobile).
     Permet aux éléments flottants (PWA install, etc.) de s'ancrer au-dessus. */
  --bottom-nav-h: 0px;

  /* Hauteur du top-nav : 52px de base + safe-area-inset-top (notch iOS PWA).
     En browser classique, safe-area = 0 → --nav-h = 52px. En PWA standalone
     sur iPhone X+, safe-area-inset-top ~44px → --nav-h = 96px.
     À utiliser dans tous les calc(100vh - X) au lieu de hardcoder 52px. */
  --nav-h: calc(52px + env(safe-area-inset-top));

  /* Spacings */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Rayons */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;
  --radius-pill: 999px;

  /* Ombres */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.10);
  --shadow-xl:  0 4px 32px rgba(0,0,0,.07);
}

/* 2. RESET & BASE ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html,
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img,
svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input,
textarea,
select { font: inherit; }

/* 3. TYPOGRAPHIE ──────────────────────────────────────────────────────────── */

.subline {
  font-size: 15px;
  color: #555;
  line-height: 1.6;
  max-width: 400px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-faint);
}

.title-serif {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--color-text);
}

/* 4. CATÉGORIES — couleurs par type de lieu ───────────────────────────────── */
.cat-cafe { --cat-color: #D97706; --cat-eyes: #92400E; --cat-soft: #FEF3C7; }
.cat-park { --cat-color: #16A34A; --cat-eyes: #14532D; --cat-soft: #DCFCE7; }
.cat-museum { --cat-color: #2563EB; --cat-eyes: #1e3a8a; --cat-soft: #DBEAFE; }
.cat-shop { --cat-color: #7C3AED; --cat-eyes: #3B0764; --cat-soft: #EDE9FE; }
.cat-restaurant { --cat-color: #E11D48; --cat-eyes: #9F1239; --cat-soft: #FFE4E6; }
.cat-leisure { --cat-color: #7C3AED; --cat-eyes: #3B0764; --cat-soft: #EDE9FE; }
.cat-sport { --cat-color: #0891B2; --cat-eyes: #0E4A5A; --cat-soft: #CFFAFE; }
.cat-other { --cat-color: #888888; --cat-eyes: #333333; --cat-soft: #EEEEEE; }

/* 5. NAV ─────────────────────────────────────────────────────────────────── */
.nav {
  /* En PWA installée (iOS / Android), l'app va sous la status bar (notch).
     padding-top: env(safe-area-inset-top) pousse le contenu de la nav sous
     le notch pour qu'il reste visible. En browser classique, safe-area = 0
     → aucun effet. Idem pour landscape avec notch latéral via inset-left/right. */
  padding-top: env(safe-area-inset-top);
  padding-left: max(var(--space-6), env(safe-area-inset-left));
  padding-right: max(var(--space-6), env(safe-area-inset-right));
  height: calc(52px + env(safe-area-inset-top));
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--color-text);
}
.nav-logo-name { font-size: 14px; font-weight: 700; letter-spacing: -.02em; }

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}

.nav-city {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-faint);
}
.nav-city.on { font-weight: 700; color: var(--color-text); }

.nav-sep {
  width: 1px;
  height: 14px;
  background: #E8E8E8;
  flex-shrink: 0;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #BBB;
  transition: color .12s;
}
.nav-link:hover { color: #555; }
.nav-link.on { color: var(--color-text); font-weight: 700; }

.nav-link-cta {
  color: var(--color-primary) !important;
  border: 1px solid #C8DBC4;
  border-radius: var(--radius-sm);
  padding: 3px 9px !important;
  transition: background .15s;
}
.nav-link-cta:hover { background: #E5EAE2; }

/* ============================================================================
   PWA UPDATE PILL — top nav
   ============================================================================
   Insérée par static/js/explorer-pwa.js quand le SW détecte une nouvelle
   version. Pill discrète noire avec dot animé + CTA "Rafraîchir". Cliquable
   pour activer le nouveau SW et recharger la page.
   Sur mobile (< 769px) on cache le label pour gain de place — juste le dot
   + "Rafraîchir" suffisent. */
.nav-update-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 10px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s ease, transform .25s ease, background .15s ease;
  white-space: nowrap;
}
.nav-update-pill.show {
  opacity: 1;
  transform: translateY(0);
}
.nav-update-pill:hover { background: #000; }
.nav-update-pill:active { transform: scale(.96); }
.nav-update-pill:disabled { opacity: .6; cursor: not-allowed; }
.nav-update-pill-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ADE80;  /* vert : indique du neuf disponible */
  flex-shrink: 0;
  animation: navUpdatePulse 2s ease-in-out infinite;
}
.nav-update-pill-label {
  /* Label complet, caché sur mobile pour gain de place */
}
.nav-update-pill-cta {
  opacity: .85;
  text-decoration: underline;
  text-underline-offset: 2px;
}
@keyframes navUpdatePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.85); }
}
@media (max-width: 768px) {
  /* Mobile : label caché, juste le dot + "Rafraîchir" */
  .nav-update-pill-label { display: none; }
  .nav-update-pill { padding: 5px 10px; }
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 3px;
  border-radius: var(--radius-pill);
  transition: background .12s;
}
.nav-user:hover { background: #F5F5F3; }
.nav-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}

.nav-burger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  border-radius: 8px;
  margin-left: 8px;
  cursor: pointer;
  transition: background .12s;
}
.nav-burger:hover { background: #FAFAF8; }
.nav-burger:active { background: #F0EFEB; }

/* Menu mobile déroulant */
.nav-mobile {
  display: none;
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid #EEE;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.nav-mobile.open {
  display: block;
  animation: navSlide .18s ease;
}
.nav-mobile a {
  display: block;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  border-bottom: 1px solid #F5F4F0;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover {
  background: #FAFAF8;
  color: #111;
}
.nav-mobile a.on { color: #111; }

@keyframes navSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Dropdown de langue */
.lang-drop { position: relative; margin-left: var(--space-2); }
.lang-trigger {
  display: flex; align-items: center; gap: 4px;
  border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: #888;
  padding: 0; border-radius: 7px;
  transition: all .15s;
}
.lang-trigger:hover { background: #F5F5F3; color: var(--color-text); }
.lang-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff;
  border: 1px solid #E8E8E8; border-radius: 10px;
  padding: 4px; min-width: 140px;
  z-index: 999;
  box-shadow: var(--shadow-md);
}
.lang-menu.open { display: block; animation: navSlide .15s ease; }
.lang-option {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) 10px;
  border: none; background: none; text-align: left;
  font-size: 13px; font-weight: 600; color: #555;
  border-radius: 7px;
  transition: background .12s;
}
.lang-option:hover,
.lang-option.on { background: #F5F5F3; color: var(--color-text); }
.lang-option svg { border-radius: 2px; flex-shrink: 0; }

/* 6. LAYOUT ──────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app--fullscreen { height: 100vh; overflow: hidden; }

.page {
  flex: 1;
  overflow-y: auto;
}
.page-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6) 100px;
}
.page--centered {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-5);
}

.main {
  flex: 1;
  overflow-y: auto;
}

/* 7. BOUTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  background: #fff;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn:hover { border-color: var(--color-text); }

.btn-primary {
  width: 100%;
  background: var(--color-text);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  margin-top: var(--space-2);
}
.btn-primary:hover { background: #000; }

.btn-cta {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary-dark);
  padding: 9px 14px;
  border-radius: 6px;
  text-align: center;
  transition: background .15s;
}
.btn-cta:hover { background: #1A3018; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #CCC;
  transition: color .15s;
}
.btn-ghost:hover { color: var(--color-text); }

/* 8. CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) 18px;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: #999; }

/* Card lieu : blob catégorie + infos */
.place-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: var(--space-3) 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color .15s;
}
.place-card:hover { border-color: var(--color-faint); }
.place-card .name { font-size: 14px; font-weight: 700; color: var(--color-text); margin-bottom: 2px; }
.place-card .cat { font-size: 12px; color: #BBB; }

/* Card parcours avec timeline */
.trail-card {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) 18px;
  display: block;
  position: relative;
  overflow: hidden;
  transition: border-color .15s;
}
.trail-card:hover { border-color: #999; }
.trail-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--color-text);
}
.trail-tags { font-size: 12px; color: #CCC; }

/* Blob décoratif fond de card */
.card-blob {
  position: absolute;
  right: -16px; bottom: -16px;
  opacity: .035;
  pointer-events: none;
  filter: saturate(0);
}

/* 9. TAGS / BADGES / PINS ────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.7);
  border: 1px solid var(--color-border-soft);
  font-size: 13px;
  font-weight: 600;
  color: #777;
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: #999;
  border: 1px solid #E8E8E8;
}
.badge-cat {
  color: var(--cat-eyes, #333);
  background: color-mix(in srgb, var(--cat-color, #888) 15%, transparent);
  border: none;
}

.soon-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #BBB;
  border: 1.5px solid #E0E0E0;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: #fff;
}

.pin { color: var(--cat-color, var(--color-primary)); }
.pin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color, var(--color-primary));
}

/* 10. FORMULAIRES ────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--space-4); }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--color-text);
  background: #FAFAF9;
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--color-primary);
  background: #fff;
}
.field-error {
  font-size: 12px;
  color: var(--color-error);
  margin-top: 4px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: var(--radius-xl);
  padding: var(--space-10) 36px;
  box-shadow: var(--shadow-xl);
}
.auth-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}
.auth-sub {
  font-size: 13px;
  color: #888;
  margin-bottom: 28px;
}

/* 11. MESSAGES / ALERTES ─────────────────────────────────────────────────── */
.msg {
  padding: 10px var(--space-5);
  font-size: 13px;
  text-align: center;
}
.msg-success { background: var(--color-success-bg); color: var(--color-success-text); }
.msg-error { background: var(--color-error-bg);   color: var(--color-error-text);   }

/* Bandeaux pays (suggestion géo + override) — barre fine en haut de page.
   .cb-suggest : "Vous semblez être en X ? Voir le contenu local"
   .cb-override : "Vous consultez le contenu X · Retour" */
.cb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 16px;
  font-size: 13px;
  line-height: 1.3;
  background: #F5F4F0;
  border-bottom: 1px solid var(--color-border, #ECECEC);
  color: var(--color-text, #111);
}
.cb[hidden] { display: none; }
.cb-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cb-text span:first-child { font-size: 15px; line-height: 1; }
.cb-action {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  background: #fff;
  color: var(--color-text, #111);
  border: 1px solid var(--color-border, #DDD);
  transition: background .15s, border-color .15s;
}
.cb-action:hover { background: var(--color-text, #111); color: #fff; border-color: var(--color-text, #111); }
.cb-action-primary {
  background: var(--color-text, #111);
  color: #fff;
  border-color: var(--color-text, #111);
}
.cb-action-primary:hover { background: #000; }
.cb-dismiss {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-muted, #888);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cb-dismiss:hover { background: rgba(0,0,0,.06); color: var(--color-text, #111); }
@media (max-width: 600px) {
  .cb { flex-wrap: wrap; gap: 8px; padding: 8px 12px; font-size: 12.5px; }
  .cb-action { padding: 4px 12px; font-size: 12px; }
}

/* 12. MAP HELPERS ────────────────────────────────────────────────────────── */
.drop-marker {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
  filter: none !important;
}
.lieu-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  border: 1px solid #E8E8E8;
  padding: 0;
}
.lieu-popup .leaflet-popup-content {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  min-width: 160px;
}
.lieu-popup .leaflet-popup-tip-container { display: none; }

/* 13. BLOBS ANIMÉS ───────────────────────────────────────────────────────── */

/* 14. ANIMATIONS ─────────────────────────────────────────────────────────── */
@keyframes fadeDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(16px);  } to { opacity: 1; transform: none; } }
@keyframes drift1 { to { transform: translate(-40px, 30px) scale(1.1);  } }
@keyframes drift2 { to { transform: translate(30px, -40px) scale(1.05); } }
@keyframes drift3 { to { transform: translate(-20px, 20px) scale(1.08); } }

/* 15. RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 var(--space-3); }
  .nav-right .nav-city,
.nav-right .nav-link,
.nav-right .nav-sep,
.nav-right .nav-user-name { display: none !important; }
  .lang-drop { margin-left: 4px !important; }
  /* PAS de burger en mobile : la bottom-nav le remplace (cf. règle ligne ~945
     dans la section bottom-nav qui cache aussi le burger). */
}

@media (min-width: 769px) {
  .nav-burger,
.nav-mobile { display: none !important; }
}

@media (max-width: 600px) {
  .page-inner { padding: var(--space-6) var(--space-4) 80px; }
}

/* ── Dropdowns nav (switcher pays/ville + switcher user) ──────────────────
   Le HTML utilise des wrappers .nav-place-switcher et .nav-user-switcher
   avec un .nav-*-trigger (bouton qui toggle .open sur le .nav-place-menu
   suivant). Sans ces rules, le menu est rendu mais invisible (display:none
   par défaut) et les liens dedans sont non-stylés. */

/* Pastille profil avec initiale */
.nav-user-blob {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2B2B28;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Bouton qui ouvre le menu pays / ville */
.nav-place-switcher { position: relative; }
.nav-place-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  background: #F5F5F3;
  border: 1px solid #E5E5E0;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit; font-size: 14px;
  color: #555;
  transition: background .12s, color .12s;
}
.nav-place-trigger:hover { background: #EAEAE5; color: #111; }
.nav-place-trigger.on    { color: #111; }
.nav-place-flag    { font-size: 16px; line-height: 1; }
.nav-place-name    { font-weight: 600; }
.nav-place-chevron { width: 10px; height: 10px; opacity: .55; }

/* Le dropdown lui-même : caché par défaut, visible avec .open */
.nav-place-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: 6px;
  min-width: 220px;
  display: none;
  z-index: 10001;
}
.nav-place-menu.open { display: block; }

/* Les liens dedans (villes + pays + items user) */
.nav-place-link {
  display: block;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  color: #333;
  transition: background .12s;
}
.nav-place-link:hover  { background: #F5F5F3; color: #111; }
.nav-place-link.active { background: #111; color: #fff; font-weight: 600; }
.nav-place-link-reset  { color: #888; font-size: 13px; }

/* Headers et separators dans le dropdown */
.nav-menu-label {
  padding: 4px 12px 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #999;
  text-transform: uppercase;
}
.nav-menu-divider {
  height: 1px;
  background: #F0F0F0;
  margin: 6px 0 4px;
}

/* Switcher de langue (FR/DE/IT) intégré dans le menu pays */
.nav-lang-row {
  display: flex;
  gap: 4px;
  padding: 4px 8px 6px;
}
.nav-lang-btn {
  flex: 1;
  border: 0;
  background: #F5F5F3;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  transition: all .12s;
}
.nav-lang-btn:hover  { color: #111; background: #EAEAE5; }
.nav-lang-btn.active { background: #111; color: #fff; }

/* Switcher user (avatar + nom → menu déroulant) */
.nav-user-switcher { position: relative; }
.nav-user-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0;
  padding: 2px 4px 2px 2px;
  cursor: pointer;
  font-family: inherit; font-size: 14px;
  color: #555;
  transition: color .12s;
}
.nav-user-trigger:hover { color: #111; }
.nav-user-form { margin: 0; padding: 0; }
.nav-user-form button {
  width: 100%; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  font: inherit; color: inherit;
}

/* Mobile : séparateurs et items pays dans le burger */
.nav-mobile-divider {
  height: 1px;
  background: #E5E5E0;
  margin: 8px 16px;
}
.nav-mobile-country { font-size: 14px; color: #555; }

/* Bouton "Déconnexion" dans le burger mobile : aligné avec les autres
   items <a> (mêmes padding/font/border-bottom) + icône logout discrète
   à droite pour signaler que c'est une action de sortie, pas une nav. */
.nav-mobile-logout-form { margin: 0; padding: 0; }
.nav-mobile-logout-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px var(--space-5);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #F5F5F5;
  cursor: pointer;
  transition: color .12s, background .12s;
}
.nav-mobile-logout-btn:hover { color: var(--color-text); background: #FAFAFA; }
.nav-mobile-logout-btn svg { opacity: .45; flex-shrink: 0; }
.nav-mobile-logout-btn:hover svg { opacity: 1; }

/* Badge "Admin" sur les liens staff (Discover, Codes) */
.nav-link-admin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #888;
  text-decoration: none;
}
.nav-link-admin:hover { color: #111; }
.nav-link-admin.on    { color: #111; font-weight: 600; }
.nav-link-admin-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 5px;
  border-radius: 3px;
}

/* ── PWA standalone : switcher pays adapté au contexte ────────────────────
   Quand l'app est installée à l'écran d'accueil (iOS / Android), elle est
   rattachée à UN SEUL host (ex: beboun.fr) — un clic sur un lien cross-
   domain ouvrirait Safari et sortirait du standalone, UX cassée.
   La nav contient 2 sets de liens pour chaque pays :
     .nav-country-link-cross  : https://beboun.ch (mode normal, change de host)
     .nav-country-link-local  : /set-country/?country=ch (mode PWA, cookie)
   On affiche l'un OU l'autre selon le contexte, sinon chaque pays apparaît
   deux fois. La classe .pwa-standalone est posée sur <html> par le JS au
   load (cf. base.html L562-568). Le @media est un fallback au cas où le JS
   n'a pas tourné encore. */
html:not(.pwa-standalone) .nav-country-link-local { display: none !important; }
html.pwa-standalone     .nav-country-link-cross { display: none !important; }
@media (display-mode: standalone) {
  .nav-country-link-cross { display: none !important; }
}
@media not all and (display-mode: standalone) {
  .nav-country-link-local { display: none !important; }
}
/* Le bouton "reset country" (revenir au pays du host) n'a pas de sens hors
   contexte PWA : en navigateur classique, l'user a juste à taper la bonne
   URL ou utiliser les liens cross-domain. */
html:not(.pwa-standalone) .nav-country-link-reset { display: none !important; }
@media not all and (display-mode: standalone) {
  .nav-country-link-reset { display: none !important; }
}

/* ─── Macaron mode kids : toggle flottant bas-droite ─────────────────
   Visible sur toutes les pages (HTML dans base.html), au-dessus du
   bottom-nav mobile. Au tap, toggle le mode kids global.
   - Repos : blob noir, fond blanc → discret
   - Hover/actif : blob orange, fond crème → ludique */
.kids-macaron {
  position: fixed;
  top: calc(52px + 16px);
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 940;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
}
.kids-macaron.dragging { cursor: grabbing; transition: none; opacity: .85; }
.kids-macaron svg { width: 30px; height: 28px; display: block; }
.kids-macaron .km-blob-c { fill: #111; transition: fill .2s; }

/* Tooltip pill à gauche du macaron, visible au hover/focus uniquement.
   pointer-events:none pour ne pas perturber le drag. */
.kids-macaron .km-tip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #111;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.kids-macaron .km-tip::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: inherit;
}
.kids-macaron:hover .km-tip,
.kids-macaron:focus-visible .km-tip { opacity: 1; }

.kids-macaron:hover {
  border-color: #2563EB;
  background: #FFF5EE;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18);
}
.kids-macaron:hover .km-blob-c { fill: #2563EB; }
.kids-macaron:active { transform: scale(0.92); }
body.kids-mode .kids-macaron {
  background: #FFEDDD;
  border-color: #2563EB;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}
body.kids-mode .kids-macaron .km-blob-c { fill: #2563EB; }
body.kids-mode .kids-macaron .km-tip { background: #2563EB; }
/* Petit halo orange pulsant quand mode kids actif */
body.kids-mode .kids-macaron {
  animation: km-pulse 2.4s ease-in-out infinite;
}
@keyframes km-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25); }
  50%      { box-shadow: 0 4px 22px rgba(37, 99, 235, 0.45); }
}



/* ──────────────────────────────────────────────────────────────────
   Bottom-nav mobile — visible ≤ 768px
   Architecture mobile :
   - Pages standard : padding-bottom réservé pour la bottom-nav
   - Pages fullscreen (.body--fullscreen) : layout 3 zones fixed
       nav top (52px)              ↑
       .app--fullscreen (middle)   |  ← map et contenu
       .bottom-nav (60px + safe)   ↓
   ────────────────────────────────────────────────────────────────── */

html, body { overscroll-behavior: none; }
body.body--fullscreen { overflow: hidden; }

/* ============================================================================
   ACCESSIBILITY UTILITIES
   ============================================================================
   .sr-only : visuellement caché mais lu par les screen readers. Utilisé pour
   les regions aria-live (annonces), les labels invisibles, etc. Pattern
   standard WCAG. Ne pas utiliser display:none qui retire du screen reader. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid #ececec;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 950;
  box-shadow: 0 -1px 0 rgba(0,0,0,.04), 0 -4px 16px rgba(0,0,0,.04);
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px 4px;
  text-decoration: none;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.bn-item:hover { color: #444; }
.bn-item.active { color: #111; }
.bn-item svg { width: 20px; height: 20px; transition: transform .15s; }
.bn-item.active svg { transform: scale(1.08); }
.bn-item-label { white-space: nowrap; font-size: 10px; letter-spacing: .01em; }

/* Mode kids : onglet actif en orange */
body.kids-mode .bn-item.active { color: #2563EB; }

@media (max-width: 768px) {
  :root { --bottom-nav-h: calc(56px + env(safe-area-inset-bottom)); }

  /* Top-nav cleanup : on cache burger et liens, on garde le place-switcher */
  .nav-burger, .nav-mobile, .nav-user-switcher, .nav-sep,
  .nav-right > a.nav-link {
    display: none !important;
  }
  .nav-place-switcher { display: inline-flex !important; }

  .bottom-nav { display: flex; }

  /* Pages standard : réserve la place pour la bottom-nav */
  body:not(.body--fullscreen) {
    padding-bottom: var(--bottom-nav-h);
  }

  /* Pages fullscreen : layout 3 zones strictement fixed */
  body.body--fullscreen .nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    z-index: 9000;
  }
  body.body--fullscreen .app--fullscreen {
    position: fixed;
    top: 52px;
    bottom: var(--bottom-nav-h);
    left: 0; right: 0;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden;
  }
}

