/* --- 1. Variables & Palette Neutre --- */
:root {
  --brand-header: #064e3b; /* Vert tapis sombre */
  --btn-primary: #064e3b;  /* Boutons principaux */
  --btn-hover: #047557;    /* Survol boutons */
  
  --ink: #0f172a;          /* Texte principal */
  --muted: #64748b;        /* Texte secondaire */
  --bg: #064e3b;            /* Fond de page léger */
  --surface: #ffffff;      /* Surface des cartes et panneaux */
  --line: #e2e8f0;         /* Séparateurs */
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* --- 2. En-tête & Menu Déroulant --- */
header {
  background: var(--brand-header);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 2000;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.header-titre {
  display: flex;
  align-items: center;
  gap: 12px;
}

.titre-textes {
  display: flex;
  flex-direction: column;
}

.logo-site {
  height: 42px; 
  width: auto;
  object-fit: contain;
}

header p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-dropdown {
  position: relative;
  display: inline-block;
}

.btn-burger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 36px;
  height: 36px;
  padding: 9px 7px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  pointer-events: none;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 45px;
  background: #ffffff;
  min-width: 200px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  z-index: 99999;
}

.dropdown-content.show {
  display: block !important;
}

.dropdown-content a {
  color: var(--ink);
  padding: 10px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.dropdown-content a:hover {
  background-color: #f1f5f9;
  color: var(--btn-primary);
}

footer {
  padding: 10px 24px;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* --- 3. Disposition principale --- */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 0;
}

aside {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  z-index: 5;
}

#map {
  height: 100%;
  min-height: 0;
  background: #cbd5e1;
}

/* --- 4. Filtres --- */
.filters {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #f1f5f9;
}

.filters-content {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

/* Masque le bouton d'accordéon sur PC */
summary.btn-mobile-summary {
  display: none !important;
}

/* Bascule du texte dynamique (partout) */
.texte-cacher {
  display: none;
}

details[open] .texte-afficher {
  display: none;
}

details[open] .texte-cacher {
  display: inline;
}

.filters label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

select {
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

select:focus-visible, a:focus-visible, .card:focus-visible {
  border-color: var(--btn-primary);
  outline: 2px solid var(--btn-primary);
  outline-offset: 1px;
}

/* --- 5. Liste & Cartes --- */
#count {
  padding: 14px 16px 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

#list {
  overflow-y: auto;
  flex: 1;
  padding: 12px 16px 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--c);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.4;
}

/* --- 6. Badges & Boutons --- */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 6px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 14px;
  background: var(--btn-primary);
  color: #fff !important;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--btn-hover);
}

.btn-maps {
  background: var(--btn-primary);
}

.btn-maps:hover {
  background: var(--btn-hover);
}

.btn-proposer {
  padding: 8px 16px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-proposer:hover {
  background: #f8fafc;
}

/* --- 7. Modale --- */
#dlg-tournoi {
  width: min(680px, 92vw);
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

#dlg-tournoi::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
}

.dlg-barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--brand-header);
  color: #fff;
}

.dlg-barre h2 {
  margin: 0;
  font-size: 1.05rem;
}

#dlg-close {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}

.dlg-corps {
  padding: 16px;
}

#dlg-frame {
  width: 100%;
  height: 68vh;
  border: 0;
}

/* --- 8. Marqueurs et Clusters Leaflet --- */
.chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.custom-cluster {
  background: var(--brand-header) !important;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.custom-cluster div {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-cluster span {
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
}

/* --- 9. Mobile --- */
@media(max-width: 800px) {
  /* 1. Optimisation du Header */
  header {
    flex-wrap: nowrap;
    padding: 10px 12px;
  }
  
  header h1, 
  header p,
  .titre-textes {
    display: none !important; 
  }

  .logo-site {
    height: 36px;
    flex-shrink: 0;
  }

  .header-actions {
    flex: 1;
    justify-content: flex-end;
  }

  .btn-proposer {
    padding: 8px 12px;
    font-size: 0.8rem;
    text-align: center;
  }

  /* 2. Disposition principale */
  main {
    grid-template-columns: 1fr;
    grid-template-rows: 40vh 1fr;
    gap: 8px;
    padding-top: 8px;
    padding-left: 8px;
    padding-right: 8px;
  }
  
  #map {
    order: -1;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
  }
  
  aside {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
  }

  /* 3. Compactage des filtres */
  .filters {
    padding: 10px 12px;
    gap: 8px;
    border-bottom: none;
  }

  .filters label {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  select {
    flex: 1;
    max-width: 65%;
    font-size: 0.82rem;
    padding: 6px 10px;
  }

  /* Bouton d'accordéon affiché sur mobile uniquement */
  summary.btn-mobile-summary {
    display: block !important;
    width: 100%;
    padding: 10px;
    background-color: var(--btn-primary);
    color: white;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    list-style: none;
  }
  
  summary.btn-mobile-summary::-webkit-details-marker {
    display: none;
  }
}