/* ════════════════════════════════════════════════════
   BASE UNIVERSELLE — style.css
   Partagé par toutes les cartes du blog.
   Ne contient que la structure et les composants.

   Pour personnaliser un pays → [pays]/theme.css
   Structure :
     1. Base
     2. Header
     3. Filtres
     4. Layout principal
     5. Panneau détail
     6. Bouton fermeture (mobile)
     7. Marqueurs
     8. Légende
     9. Popups Leaflet
    10. Responsive mobile
════════════════════════════════════════════════════ */


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

html, body {
  height: 100%;
  overflow: hidden;  /* ← empêche tout scroll externe */
  font-family: 'Inter', sans-serif;
  background: var(--birch);
  color: var(--ink);
}

body {
  display: flex;
  flex-direction: column;
}


/* ── 2. HEADER ───────────────────────────────────── */
#header {
  background: var(--sky);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#header h1 {
  font-family: var(--font-titre, 'Cinzel', serif);
  font-size: var(--font-titre-size, 36px);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

#header h1 span {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-top: 2px;
}

#header-right {
  font-size: 13px;
  opacity: 0.85;
  color: #fff;
}


/* ── 3. FILTRES ──────────────────────────────────── */
#filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--ger);
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  color: var(--muted);
}

.filter-btn:hover { filter: brightness(0.95); }

.filter-btn.active {
  color: #fff;
  border-color: transparent;
}

/* Couleurs actives générées dynamiquement via theme.css */
.filter-btn[data-cat="all"].active      { background: var(--sky); }
.filter-btn[data-cat="depart"].active   { background: var(--cat-depart,   #C0272D); }
.filter-btn[data-cat="etape"].active    { background: var(--cat-etape,    #1B4F8A); }
.filter-btn[data-cat="pratique"].active { background: var(--cat-pratique, #f3c600); color: #333; }
.filter-btn[data-cat="culture"].active  { background: var(--cat-culture,  #8B6BBE); }
.filter-btn[data-cat="nature"].active   { background: var(--cat-nature,   #2E8B57); }
.filter-btn[data-cat="frontiere"].active{ background: var(--cat-frontiere,#5D4037); }


/* ── 4. LAYOUT PRINCIPAL ─────────────────────────── */
#main {
  display: flex;
  flex: 1;           /* ← prend tout l'espace restant automatiquement */
  min-height: 0;     /* ← nécessaire pour que flex fonctionne dans un contexte contraint */
}

#map {
  flex: 1;
  min-width: 0;
}


/* ── 5. PANNEAU DÉTAIL ───────────────────────────── */
#detail {
  width: 370px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--birch);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

#detail-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  gap: 12px;
}

#detail-placeholder .big-emoji { font-size: 48px; }

#detail-placeholder p {
  font-size: 13px;
  line-height: 1.6;
}

#detail-content {
  display: none;
  flex-direction: column;
}

/* Hero coloré (couleur injectée dynamiquement) */
.detail-hero {
  position: sticky;
  top: 0;
  z-index: 5;
  color: #fff;
  padding: 18px 44px 16px 20px; /* droite large pour laisser place à la croix */
}

.detail-hero .cat-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 6px;
}

.detail-hero h2 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.detail-hero .ville {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

/* Corps du panneau */
.detail-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-section {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
}

.detail-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Bloc festival */
.detail-dates {
  background: #FFF8EC;
  border: 1px solid #F0C060;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #7A5500;
}

/* Bloc conseil vélo */
.detail-conseil {
  background: #EBF5EC;
  border-left: 3px solid var(--cat-nature, #2E8B57);
  padding: 10px 12px;
  font-size: 12.5px;
  border-radius: 0 6px 6px 0;
  color: #1A4020;
}

/* Bloc attention */
.detail-attention {
  background: #FEF0F0;
  border-left: 3px solid var(--ember, #8B1A1A);
  padding: 10px 12px;
  font-size: 12.5px;
  border-radius: 0 6px 6px 0;
  color: #6A1010;
}

/* Pills pack */
.pack-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pack-pill {
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
}

.pack-pill.aventurier  { background: #2A3A2A; color: #8BCA8B; }
.pack-pill.cle_en_main { background: #2A2A3A; color: #8B8BCA; }


/* ── 6. BOUTON FERMETURE ─────────────────────────── */
#detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.22);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
}

#detail-close:hover { background: rgba(0,0,0,0.38); }


/* ── 7. MARQUEURS LEAFLET ────────────────────────── */
.marker-pin {
  width: 35px;
  height: 35px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: filter 0.15s;
}

.marker-pin:hover { filter: brightness(1.15); }

.marker-pin .emoji {
  transform: rotate(45deg);
  font-size: 18px;
  line-height: 1;
}


/* ── 8. LÉGENDE ──────────────────────────────────── */
#legende {
  position: absolute;
  bottom: 24px;
  left: 12px;
  background: var(--legende-bg, #E8DABE);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 999;
  font-size: 11px;
  backdrop-filter: blur(4px);
}

#legende strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 7px;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: var(--muted);
}

.leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}


/* ── 9. POPUPS LEAFLET ───────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--birch);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.leaflet-popup-tip-container { display: none; }

.popup-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.popup-cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}


/* ── 10. RESPONSIVE MOBILE ───────────────────────── */
@media (max-width: 700px) {

  #main {
    flex-direction: column;
    height: calc(100vh - 90px);
    position: relative;
  }

  #map {
    width: 100%;
    height: 100%;
    min-height: 300px;
  }

  /* Panneau caché par défaut, slide depuis le bas au clic */
  #detail {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: 50vh;
    overflow-y: auto;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }

  #detail.open { transform: translateY(0); }

  /* Header compact */
  #header { padding: 8px 16px; }

  #header h1 { font-size: 28px; }

  #header h1 span { font-size: 11px; }

  #header-right { display: none; }

  /* Filtres scrollables horizontalement */
  #filters {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding: 8px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Dégradé sur la droite pour indiquer qu'il y a plus */
  -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
  mask-image: linear-gradient(to right, black 80%, transparent 100%);
}

  #filters::-webkit-scrollbar { display: none; }

  .filter-btn { flex-shrink: 0; }

  #legende { display: none; }
}
