#programs-map {
  border-radius: 8px;
  overflow: hidden;
}

.leaflet-popup-content {
  line-height: 1.3;
}

.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background-color: rgba(51, 136, 255, 0.2);
}

.marker-cluster div {
  background-color: #3388ff;
  color: #fff;
  border: 2px solid #fff;
}

.custom-cluster {
  background: transparent;
}

.custom-cluster div {
  background-color: #3388ff;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
  margin: 0 !important;
  padding: 0;
  box-sizing: border-box;
}

.custom-cluster span {
  display: block;
  line-height: 1;
  text-align: center;
  padding: 0 4px;
}

.custom-cluster.cluster-small div {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

.custom-cluster.cluster-medium div {
  width: 44px;
  height: 44px;
  font-size: 13px;
}

.custom-cluster.cluster-large div {
  width: 56px;
  height: 56px;
  font-size: 14px;
}

.custom-cluster.cluster-xl div {
  width: 72px;
  height: 72px;
  font-size: 15px;
}

.custom-cluster:hover div {
  transform: scale(1.08);
}

/* Styles pour les popups enrichies */
.custom-popup {
  max-width: 300px;
}

.popup-image-container {
  position: relative;
  width: 100%;
  height: 150px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 12px;
}

.popup-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.popup-image:hover {
  transform: scale(1.05);
}

.popup-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.popup-info {
  font-size: 0.9rem;
  line-height: 1.4;
}

.popup-info i {
  width: 14px;
  text-align: center;
}

.popup-actions {
  margin-top: 12px;
}

.popup-actions .btn {
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.popup-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Styles pour les badges */
.badge {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.badge-success {
  background-color: #28a745 !important;
  color: white !important;
}

.badge-warning {
  background-color: #ffc107 !important;
  color: #212529 !important;
}

.badge-info {
  background-color: #17a2b8 !important;
  color: white !important;
}

/* Styles pour les marqueurs personnalisés
   NB: Leaflet ignore le param `style:` de L.divIcon ; la couleur de fond
   doit donc être injectée dans le HTML du marker via un wrapper interne
   `.map-marker-inner`. La classe `.custom-div-icon` reste transparente. */
.custom-div-icon {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.map-marker-inner {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.custom-div-icon:hover .map-marker-inner {
  transform: scale(1.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* Styles pour les POI */
.poi-div-icon {
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Styles pour le panneau de contrôles */
.form-check-label {
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.form-check-label:hover {
  color: #0056b3;
}

.form-check-input:checked + .form-check-label {
  font-weight: 500;
}

/* Styles pour les cartes du panneau latéral */
.card {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.card-header .btn-link {
  color: #495057;
  font-weight: 500;
}

.card-header .btn-link:hover {
  color: #0056b3;
  text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .popup-image-container {
    height: 120px;
  }
  
  .popup-title {
    font-size: 1rem;
  }
  
  .popup-info {
    font-size: 0.85rem;
  }
  
  .custom-popup {
    max-width: 250px;
  }
  
  /* Masquer le panneau de contrôles sur mobile par défaut */
  #layersControl {
    display: none;
  }
  
  #layersControl.show {
    display: block;
  }
}

/* Animation pour les éléments */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Styles pour les messages d'erreur */
.alert {
  border-radius: 8px;
  font-size: 0.9rem;
}

.alert-danger {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* Amélioration des contrôles Leaflet */
.leaflet-control-layers {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.leaflet-control-zoom {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.leaflet-control-zoom a {
  border-radius: 0;
  font-weight: bold;
}

.leaflet-control-zoom a:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.leaflet-control-zoom a:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Labels des lignes de transport */
.transport-label span {
  display: inline-block;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  white-space: nowrap;
  transform: translateY(-8px);
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}

/* Pastilles de légende (statuts + phases de chantier) */
.map-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.phase-legend .d-flex {
  line-height: 1.3;
}

/* Légende phase cliquable comme filtre */
.phase-legend .phase-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 6px;
  margin-bottom: 2px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.phase-legend .phase-toggle:hover {
  background: #f1f3f5;
  border-color: #dee2e6;
}

.phase-legend .phase-toggle:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

.phase-legend .phase-toggle.is-inactive {
  opacity: 0.4;
}

.phase-legend .phase-toggle.is-inactive .map-legend-dot {
  background: #ced4da !important;
}

.phase-legend .phase-toggle small {
  flex: 1;
}

.phase-legend-actions {
  margin-top: 6px;
  display: none;
}

.phase-legend-actions.is-visible {
  display: block;
}

.phase-legend-actions .btn-link {
  padding: 0;
  font-size: 0.75rem;
  text-decoration: none;
}

/* Compteur de programmes (A1) */
#map-counter {
  font-size: 0.85rem;
}

#map-counter strong {
  color: #212529;
}

#map-counter .text-warning {
  color: #b58900 !important;
}

#map-counter .btn-link {
  vertical-align: baseline;
  text-decoration: none;
}

/* Bouton Suivre dans la popup (A2) — état suivi */
.popup-follow-btn.is-following,
.custom-popup .program-card__follow-btn.is-following {
  background-color: #198754;
  border-color: #198754;
  color: #fff;
}
