* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b1e24;
  display: flex;
  flex-direction: column;
}

#panel {
  z-index: 1000;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

/* Bandeau titre/statut, même traitement que les autres sites de moonstone.fr
   (Agenda Bordeaux) : barre pleine couleur, titre + sous-titre + statut. */
#topbar {
  background: #1976d2;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

#topbar .title { font-size: 15px; font-weight: 700; white-space: nowrap; }
#topbar .subtitle { font-size: 12px; color: #bbdefb; white-space: nowrap; }
#topbar .sep { color: #90caf9; margin: 0 4px; }
#topbar .info { font-size: 12px; color: #bbdefb; white-space: nowrap; }

#topbar .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  margin-left: 8px;
  flex-shrink: 0;
  animation: spin 0.7s linear infinite;
  display: none;
}
#topbar .spinner.active { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.toggle input, .taxons input { accent-color: #1976d2; }

#locate-btn, #btn-install {
  margin-left: auto;
  border: 1px solid #cfd4dc;
  background: #f6f7f9;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}
#locate-btn:hover, #btn-install:hover { background: #eceff3; }
#btn-install { margin-left: 6px; }

.taxons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}
.taxons label {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #f2f4f7;
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
  user-select: none;
}

.days {
  display: flex;
  gap: 4px;
  margin-left: auto;
  font-size: 12px;
}
.days button {
  border: 1px solid #cfd4dc;
  background: #fff;
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
}
.days button.active {
  background: #1976d2;
  border-color: #1976d2;
  color: #fff;
}

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

#map-loading {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}
#map-loading.hidden { display: none; }

.loading-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  padding: 28px 36px;
  text-align: center;
  max-width: 300px;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border: 4px solid #dbeafe;
  border-top-color: #1976d2;
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}

#loading-text {
  font-size: 14px;
  font-weight: 600;
  color: #1b1e24;
}

#detail {
  position: fixed;
  z-index: 1200;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.18);
  padding: 16px;
  max-height: 55vh;
  overflow-y: auto;

  left: 0;
  right: 0;
  bottom: 0;
}

@media (min-width: 640px) {
  #detail {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 340px;
    border-radius: 12px;
    max-height: 70vh;
  }
}

#detail.hidden { display: none; }

#detail-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  color: #6b7280;
}

.detail-commune { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.detail-maj { font-size: 11px; color: #6b7280; margin-bottom: 10px; }
.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  margin: 12px 0 4px;
  border-top: 1px solid #eef0f3;
  padding-top: 8px;
}
.detail-section-title:first-of-type { border-top: none; padding-top: 0; }
.detail-global { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.detail-line {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 13px;
}
.detail-line.dim { opacity: 0.45; }
.badge {
  display: inline-block;
  min-width: 1.6em;
  text-align: center;
  border-radius: 5px;
  padding: 1px 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}
.legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
