html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'Inter', Arial, sans-serif;
  background: white;
  overflow: hidden;
}

#map {
  position: relative;
  z-index: 10;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 32px 80px rgba(0,0,0,0.12);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  height: 100vh;
  max-width: 100vw;
  /* Optimisations pour les performances */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.leaflet-container {
  height: 100%;
  width: 100%;
  z-index: 1;
}

/* Marqueurs colorés par catégorie - Optimisés pour différents formats */
.custom-marker {
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
  /* Optimisations pour les performances */
  will-change: transform;
  transform: translateZ(0);
}

.marker-inner {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  display: block !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.13) !important;
  background-color: #F5FF78 !important; /* Couleur par défaut */
  position: relative;
  transition: box-shadow 0.18s, transform 0.18s;
  cursor: pointer;
  /* Optimisations pour les performances */
  will-change: transform, box-shadow;
  transform: translateZ(0);
}

/* Classes de couleurs pour les marqueurs par catégorie */
.marker-color-plages {
  background-color: #F5FF78 !important;
}

.marker-color-sports {
  background-color: #9A82F5 !important;
}

.marker-color-culture {
  background-color: #96F8B4 !important;
}

.marker-color-weekend {
  background-color: #F0ECE8 !important;
}

.custom-marker:hover .marker-inner,
.marker-hover .marker-inner {
  box-shadow: 0 8px 28px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.13) !important;
  transform: scale(1.15);
  z-index: 2;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.marker-appear .marker-inner {
  animation: markerAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes markerAppear {
  0% { 
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(-90deg);
    opacity: 0.8;
  }
  100% { 
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes markerFadeIn {
  0% { 
    transform: scale(0); 
    opacity: 0; 
  }
  100% { 
    transform: scale(1); 
    opacity: 1; 
  }
}

.bounce .marker-inner {
  animation: markerBounce 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes markerBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.25); }
  45% { transform: scale(0.9); }
  65% { transform: scale(1.1); }
  85% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

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

.citygo-btn {
  display: block;
  background: linear-gradient(135deg, #faff70 0%, #f5ff78 100%);
  color: #181818;
  padding: 12px 0;
  border-radius: 999px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.07);
  text-decoration: none;
  font-size: 16px;
  width: 100%;
  max-width: 320px;
  min-width: 160px;
  margin: 16px auto 0 auto;
  text-align: center;
  letter-spacing: 0.02em;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  /* border: 1.5px solid #e6c800; */
  box-shadow: 0 6px 24px 0 rgba(0,0,0,0.13), 0 1.5px 6px 0 rgba(0,0,0,0.10);
  position: relative;
  overflow: hidden;
}

.citygo-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.citygo-btn:hover::before {
  left: 100%;
}

.citygo-btn:hover {
  background: linear-gradient(135deg, #f5ff78 0%, #f0ff60 100%);
  color: #111;
  box-shadow: 0 8px 28px 0 rgba(255, 230, 0, 0.28), 0 2px 8px 0 rgba(0,0,0,0.10);
  /* border-color: #d4b800; */
  transform: translateY(-2px);
}

.citygo-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(250, 255, 112, 0.3);
}

.citygo-btn.disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.citygo-btn.disabled:hover {
  background: #f3f4f6;
  color: #9ca3af;
  transform: none;
  box-shadow: none;
}

/* Popup optimisée et responsive - Adaptée aux différents formats */
.popup {
  position: fixed !important;
  left: 50% !important;
  bottom: 0 !important;
  transform: translateX(-50%) !important;
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  color: #181818 !important;
  border-radius: 20px 20px 0 0 !important;
  padding: 20px 18px 20px 18px !important;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.15) !important;
  max-width: 380px !important;
  width: 92vw !important;
  max-height: 70vh !important;
  overflow-y: auto !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  animation: popupInUnified 0.5s cubic-bezier(0.16, 1, 0.3, 1) both !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  margin: 0 auto !important;
}

/* En-tête de la popup */
.popup-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.popup-cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.popup-category, .popup-departement-badge {
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  align-self: flex-start;
  box-shadow: 0 3px 12px rgba(0,0,0,0.12);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 0 !important;
  border: none;
  display: inline-block;
}

.popup-category {
  background: #F5FF78;
  color: #222;
}

.popup-departement-badge {
  background: #f8f9fa;
  color: #495057;
}

.popup-category:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.popup-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0.3em;
}

.popup-title-row h2 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.popup-departement-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.popup h2 {
  color: #181818;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* Contenu principal */
.popup-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popup-description {
  color: #374151;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* Informations détaillées */
.popup-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-item:hover {
  background: rgba(248, 249, 250, 0.6);
  transform: translateX(4px);
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
}

.detail-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.detail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.detail-label {
  color: #6b7280;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.detail-value {
  font-size: 14px;
  color: #1f2937;
  line-height: 1.4;
  word-break: break-word;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.detail-value span {
  flex: 1;
  min-width: 0;
}

/* Bouton de copier-coller à côté de l'adresse */
.copy-address-btn {
  background: #fff;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  padding: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.copy-address-btn:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #d1d5db;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.copy-address-btn.copied {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
  transform: scale(1.1);
}

.copy-address-btn .copy-icon {
  font-size: 12px;
}

.popup-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
}

.popup-nav-btn {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
}

.popup-nav-btn:hover {
  background: rgba(255,255,255,1);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  border-color: rgba(0,0,0,0.12);
}

.popup-nav-btn:active {
  transform: translateY(0) scale(1);
}

.popup-nav-btn svg {
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
}

.popup-nav-btn svg path {
  stroke: #374151;
  stroke-width: 2.5;
  transition: all 0.3s ease;
}

.popup-nav-btn:hover svg path {
  stroke: #1f2937;
  stroke-width: 3;
}

#close-popup {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: #6b7280;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  z-index: 10;
}

#close-popup:hover {
  background: rgba(255,255,255,1);
  color: #374151;
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  border-color: rgba(0,0,0,0.12);
}

#close-popup:active {
  transform: translateY(0) scale(1);
}

@keyframes popupInUnified {
  0% { 
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  100% { 
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.popup.popup-closing {
  animation: popupOutUnified 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes popupOutUnified {
  0% { 
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  100% { 
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
}

.popup.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(100%) !important;
}

/* Responsive design optimisé */
@media (max-width: 480px) {
  .popup {
    padding: 16px 14px 16px 14px !important;
    border-radius: 16px 16px 0 0 !important;
    gap: 10px !important;
  }
  
  .popup h2 {
    font-size: 18px !important;
    margin: 0 0 4px 0 !important;
  }
  
  .popup-category, .popup-departement-badge {
    padding: 6px 10px !important;
    font-size: 10px !important;
    letter-spacing: 0.8px !important;
  }
  
  .popup-description {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }
  
  .detail-item {
    padding: 8px 0 !important;
    gap: 10px !important;
  }
  
  .detail-label {
    font-size: 9px !important;
    letter-spacing: 0.6px !important;
  }
  
  .detail-value {
    font-size: 13px !important;
    line-height: 1.3 !important;
  }
  
  .citygo-btn {
    font-size: 15px !important;
    padding: 10px 0 !important;
    margin: 12px auto 0 auto !important;
  }
  
  .copy-address-btn {
    width: 24px !important;
    height: 24px !important;
  }
}

@media (max-width: 600px) and (min-height: 1000px) {
  .popup h2 {
    font-size: 22px !important;
  }
  .popup-description {
    font-size: 15px !important;
  }
  .detail-label {
    font-size: 11px !important;
  }
  .detail-value {
    font-size: 15px !important;
  }
  .citygo-btn {
    font-size: 17px !important;
  }
}

@media (max-width: 600px) {
  .popup-departement-badge {
    font-size: 10px !important;
  }
  
  .popup-title-row {
    gap: 8px !important;
  }
}

@media (min-width: 768px) {
  .popup {
    max-width: 420px !important;
    padding: 24px 22px 24px 22px !important;
  }
  
  .popup h2 {
    font-size: 22px !important;
  }
  
  .citygo-btn {
    font-size: 17px !important;
    padding: 14px 0 !important;
  }
}

@media (min-width: 1024px) {
  .popup {
    max-width: 450px !important;
  }
  
  .popup h2 {
    font-size: 24px !important;
  }
  
  .popup-description {
    font-size: 15px !important;
  }
  
  .detail-value {
    font-size: 15px !important;
  }
}

/* Optimisations pour les écrans tactiles */
@media (hover: none) and (pointer: coarse) {
  .custom-marker:hover .marker-inner {
    transform: scale(1.1) !important;
  }
  
  .copy-address-btn {
    min-width: 32px !important;
    min-height: 32px !important;
  }
  
  .popup-nav-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}
