/* ========================================
   LAYOUT PRINCIPAL
======================================== */
#leaflet-map-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 80px);
  /* Ajuster selon la hauteur du header */
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

#map.with-sidebar {
  width: 50%;
}

/* ========================================
   SIDEBAR POPUP
======================================== */
#sidebar-popup {
  position: absolute;
  top: 0;
  right: -50%;
  width: 50%;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  overflow-y: auto;
}

#sidebar-popup.active {
  right: 0;
}

.sidebar-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.sidebar-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.sidebar-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s;
}

.sidebar-close:hover {
  color: #111827;
}

.sidebar-content {
  padding: 1.5rem;
}

.gov-info {
  background: #f3f4f6;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.gov-count {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* ========================================
   LISTE ORGANISMES
======================================== */
.organismes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.organisme-card {
  border-radius: 8px;
  padding: 1.25rem;
  transition: all 0.2s;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
  border: 2px solid #e8ecf8;
}

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

.organisme-header {
  margin-bottom: 0.75rem;
}

.organisme-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.organisme-type {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 500;
}

.type-association {
  background: #dbeafe;
  color: #1e40af;
}

.type-gouvernemental {
  background: #fef3c7;
  color: #92400e;
}

.organisme-description {
  color: #4b5563;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0.75rem 0;
}

.organisme-services {
  margin: 0.75rem 0;
}

.services-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.services-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.service-tag {
  background: linear-gradient(135deg, #c7b7e2 0%, #764ba2 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.organisme-contact {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.875rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: #4b5563;
}

.contact-icon {
  width: 16px;
  height: 16px;
  color: #9ca3af;
}

.organisme-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #3b82f6;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

.organisme-link:hover {
  background: #2563eb;
}

/* ========================================
   MARKERS PERSONNALISÉS
======================================== */
.custom-marker {
  background: #3b82f6;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.custom-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000 !important;
}

.custom-marker.active {
  background: #ef4444;
  transform: scale(1.2);
  z-index: 1001 !important;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 768px) {
  #map.with-sidebar {
    width: 0%;
    display: none;
  }

  #sidebar-popup {
    width: 100%;
    right: -100%;
  }

  #sidebar-popup.active {
    right: 0;
  }
}

/* ========================================
   LOADING STATE
======================================== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.leaflet-marker-icon.custom-marker.leaflet-zoom-animated.leaflet-interactive {
  background: #764ba2 !important;
  display: flex !important;
}
