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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
  width: 100%;
  height: 100%;
}

/* Search bar */
#search-form {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 60px;
  z-index: 1000;
  display: flex;
  gap: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

#search-input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 8px 0 0 8px;
  font-size: 16px;
  background: #fff;
  color: #333;
  outline: none;
}

#search-input::placeholder {
  color: #999;
}

#search-btn {
  width: 48px;
  height: 44px;
  border: none;
  border-radius: 0 8px 8px 0;
  background: #2d5016;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#search-btn:active {
  background: #1e3a0e;
}

/* Search suggestions */
#search-suggestions {
  position: fixed;
  top: 56px;
  left: 12px;
  right: 60px;
  z-index: 1000;
  list-style: none;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  max-height: 240px;
  overflow-y: auto;
}

#search-suggestions.hidden {
  display: none;
}

#search-suggestions li {
  padding: 10px 14px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  border-top: 1px solid #eee;
}

#search-suggestions li:first-child {
  border-top: none;
}

#search-suggestions li:hover,
#search-suggestions li:focus {
  background: #f0f4e8;
}

/* Geolocate FAB */
#geolocate-btn {
  position: fixed;
  bottom: 28px;
  right: 16px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #2d5016;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#geolocate-btn:active {
  background: #e8e8e8;
}

/* Legend toggle */
#legend-toggle {
  position: fixed;
  bottom: 28px;
  left: 16px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#legend-toggle:active {
  background: #e8e8e8;
}

/* Legend panel */
#legend {
  position: fixed;
  bottom: 86px;
  left: 16px;
  z-index: 1000;
  background: rgba(255,255,255,0.95);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: opacity 0.2s, transform 0.2s;
}

#legend.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

#legend h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #333;
  padding: 3px 0;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  transition: opacity 0.3s;
}

#toast.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.leaflet-popup-content {
  margin: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
}

.popup-name {
  font-weight: 700;
  font-size: 15px;
  color: #222;
}

.popup-reseau {
  font-style: italic;
  color: #555;
  margin: 2px 0 4px;
}

.popup-desc {
  font-size: 12px;
  color: #666;
}

.popup-distance {
  font-size: 12px;
  font-weight: 600;
  color: #2d5016;
  margin-top: 4px;
}

/* Pulsing geolocation dot */
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(2.5); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.geo-pulse {
  width: 16px;
  height: 16px;
  background: #2563eb;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(37,99,235,0.5);
}

.geo-pulse::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 16px;
  height: 16px;
  border: 3px solid #2563eb;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
