@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Montserrat:wght@400;500;600;700;800&display=swap');

body {
  font-family: 'Inter', sans-serif;
  color: #f3f4f6;
  min-height: 100vh;

  /* CONFIGURACIÓN DEL FONDO (Restaurada) */
  background-image: url('./FONDO_PAGINA.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: #1a1a1a;
}

.logo-font {
  font-family: 'Montserrat', sans-serif;
  letter-spacing: -0.5px;
}

.nav-font {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1,
h2,
h3,
button {
  font-family: 'Montserrat', sans-serif;
}

/* ¡AQUÍ ESTABA EL BLOQUE HEADER! 
           Lo hemos borrado definitivamente para aniquilar la franja traslúcida.
        */

/* Patrón de fondo */
.hero-bg-pattern {
  background-image: radial-gradient(rgba(37, 99, 235, 0.15) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, black 20%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 20%, transparent 100%);
}

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background-color: #1f2937;
  padding: 2rem;
  border-radius: 1rem;
  max-width: 90%;
  width: 500px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid #374151;
  max-height: 90vh;
  overflow-y: auto;
}

/* Modal de Mapa (Estilo "Pantalla Completa" adaptado) */
.map-modal-content {
  width: 98%;
  height: 90vh;
  /* Alto fijo relativo a la pantalla */
  max-width: 1400px;
  /* Ancho máximo igual que los juegos */
  display: flex;
  flex-direction: column;
  background-color: #1a1a1a;
  /* Fondo oscuro igual que el juego */
  border: 1px solid #374151;
  border-radius: 1rem;
  position: relative;
  padding: 1.5rem;
  /* Un poco de margen interno */
}

/* Ajuste específico para móviles */
@media (max-width: 640px) {
  .map-modal-content {
    height: 95vh;
    /* En móvil aprovechamos más altura */
    padding: 1rem;
    width: 100%;
    border-radius: 0;
    /* Bordes rectos en móvil queda mejor a veces, o redondeados pequeños */
  }
}

/* Modal especial para el juego a pantalla completa */
.game-modal-content {
  width: 98%;
  height: 95vh;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  background-color: #1a1a1a;
  border: 1px solid #374151;
  border-radius: 1rem;
  position: relative;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background-color: #4b5563;
  border-radius: 4px;
}

.lds-dual-ring {
  display: inline-block;
  width: 20px;
  height: 20px;
}

.lds-dual-ring:after {
  content: " ";
  display: block;
  width: 16px;
  height: 16px;
  margin: 1px;
  border-radius: 50%;
  border: 3px solid #fff;
  border-color: #fff transparent #fff transparent;
  animation: lds-dual-ring 1.2s linear infinite;
}

@keyframes lds-dual-ring {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Animación de parpadeo con MÁS CONTRASTE */
@keyframes soft-pulse {

  0%,
  100% {
    border-color: #4b5563;
  }

  50% {
    border-color: #60a5fa;
    background-color: rgba(37, 99, 235, 0.4);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
  }
}

.animate-soft-pulse {
  animation: soft-pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.leaflet-container {
  background-color: #1a1a1a;
  font-family: 'Inter', sans-serif;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background-color: #1f2937;
  color: #fff;
}

.map-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tool-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  background-color: #374151;
  color: #9ca3af;
  border: 1px solid #4b5563;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-btn:hover {
  background-color: #4b5563;
  color: white;
}

.tool-btn.active {
  background-color: #2563eb;
  color: white;
  border-color: #3b82f6;
}

.tool-btn.hidden {
  display: none !important;
}

/* =========================================
   RECUADRO DE SELECCIÓN DE ZONA
   ========================================= */
#selection-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  /* Hacemos el recuadro notablemente más grande */
  width: 500px;
  height: 500px;

  /* Sin borde azul y fondo totalmente transparente */
  border: none !important;
  background: transparent;

  /* Esquinas muy redondeadas siguiendo la estética de los nuevos botones (24px) */
  border-radius: 24px;

  /* La magia del exterior oscuro: una sombra infinita hacia afuera */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);

  pointer-events: none;
  z-index: 400;
}

/* Ajuste responsive para que quepa bien en las pantallas de los móviles */
@media (max-width: 768px) {
  #selection-box {
    width: 280px;
    height: 280px;
    border-radius: 20px;
  }
}

/* HUD del Juego */
.game-hud {
  background: rgba(31, 41, 55, 0.95);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid #374151;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

/* Estilos personalizados para los popups del juego */
.game-popup-green .leaflet-popup-content-wrapper,
.game-popup-green .leaflet-popup-tip {
  background-color: #15803d;
  /* green-700 */
  color: white;
  border: 1px solid #4ade80;
  font-weight: 600;
}

.game-popup-red .leaflet-popup-content-wrapper,
.game-popup-red .leaflet-popup-tip {
  background-color: #b91c1c;
  /* red-700 */
  color: white;
  border: 1px solid #f87171;
  font-weight: 600;
}

.game-popup-yellow .leaflet-popup-content-wrapper,
.game-popup-yellow .leaflet-popup-tip {
  background-color: #facc15;
  /* yellow-400 */
  color: black;
  border: 1px solid #eab308;
  font-weight: 700;
}

/* Marcadores A y B para el juego de sentidos */
.direction-marker {
  /* Centrado Flexbox Forzado */
  display: flex !important;
  justify-content: center;
  align-items: center;

  /* Estructura */
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  /* Evita que el borde descuadre el tamaño */

  /* Tipografía y Color */
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;

  /* --- AJUSTES DE CENTRADO FINO --- */
  font-size: 16px;
  /* Tamaño fijo para asegurar proporciones */
  line-height: 1;
  /* Elimina el espacio invisible arriba/abajo de la fuente */
  padding-top: 2px;
  /* Pequeño empujón hacia abajo para centrar la mayúscula */
}

.marker-a {
  background-color: #2563eb;
}

/* Blue */
.marker-b {
  background-color: #facc15;
  color: black;
}

/* Yellow-400 (Amarillo chillón), texto negro */

/* Estilos para sugerencias de búsqueda */
#search-suggestions {
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
  /* Z-index aumentado para superar al selection-box (1000) */
  z-index: 2000;
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s;
}

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

.suggestion-item:hover {
  background-color: #374151;
}

@media (max-width: 640px) {
  #selection-box {
    width: 250px;
    height: 250px;
  }

  .game-hud {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

/* --- ESTILO BOCADILLO (SOLO ESTÉTICA) --- */
.neighborhood-label {
  background-color: #2563eb;
  /* Azul sólido */
  border: 2px solid white;
  color: white;
  padding: 5px 12px;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  text-align: center;
}

/* --- ESTILO TRIÁNGULO --- */
.label-triangle {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #2563eb;
  /* Coincide con el azul */
  margin-top: -2px;
  /* Para que muerda un poco el borde blanco y no se vea raya */
}

/* Animación de entrada */
@keyframes pop-in {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

/* Quitar estilos por defecto del popup de Leaflet */
.custom-game-popup .leaflet-popup-content-wrapper {
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

.custom-game-popup .leaflet-popup-tip {
  display: none;
}

.custom-game-popup .leaflet-popup-content {
  margin: 0;
}

/* Icono flotante para añadir vértice (Geométrico) */
.add-vertex-icon {
  background-color: #22c55e;
  /* Verde */
  border: 2px solid white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
  /* Para anclar las barras de la cruz */
}

/* Barra Horizontal */
.add-vertex-icon::before {
  content: '';
  position: absolute;
  background-color: white;
  height: 2px;
  width: 10px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 1px;
}

/* Barra Vertical */
.add-vertex-icon::after {
  content: '';
  position: absolute;
  background-color: white;
  height: 10px;
  width: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 1px;
}

.add-vertex-icon:hover {
  transform: scale(1.2);
  background-color: #16a34a;
}

/* Estilo base para el manejador (vértice editable) */
.edit-handle-icon {
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #2563eb;
  /* Azul */
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cuando se arrastra un vértice */
.leaflet-marker-draggable.leaflet-marker-dragging .edit-handle-icon {
  cursor: grabbing;
  transform: scale(1.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* ESTADO DE "PAPELERA": Cuando otro vértice pasa por encima */
.edit-handle-icon.is-delete-target {
  background-color: #ef4444 !important;
  /* Rojo intenso */
  border-color: #b91c1c !important;
  /* Rojo oscuro */
  /* Aumentamos la escala de 1.5 a 2.25 (un 50% más grande que antes) */
  transform: scale(2.25) !important;
  z-index: 3000 !important;
  /* Asegurar que quede por encima del que arrastras */
}

/* ==========================================
   CURSOR PERSONALIZADO PARA "DIBUJA LA RUTA"
   ========================================== */

/* 1. Estado por defecto: Una cruz precisa para indicar "Aquí pongo el punto" */
#draw-route-map {
  cursor: crosshair !important;
}

/* 2. Estado al mantener pulsado para mover (Leaflet añade esta clase) */
#draw-route-map.leaflet-dragging,
#draw-route-map:active {
  cursor: grabbing !important;
}

/* Icono de papelera dentro del círculo rojo (usando CSS puro) */
.edit-handle-icon.is-delete-target::after {
  content: '';
  /* Un icono de papelera simple en SVG inline blanco */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'%3E%3C/polyline%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3Cline x1='10' y1='11' x2='10' y2='17'%3E%3C/line%3Cline x1='14' y1='11' x2='14' y2='17'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  width: 14px;
  height: 14px;
  display: block;
}

/* =========================================
   ESTILOS BOTÓN BORRAR (Papelera)
   ========================================= */
#tool-clear {
  background-color: #dc2626 !important; 
  border-color: #b91c1c !important;
  color: white !important;
  /* Al quitar 'forwards', cuando termina la animación de entrada libera el botón para que Tailwind tome el control */
  animation: popIn 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

#tool-clear:hover {
  /* Congelamos el color rojo base para que no se oscurezca NADA */
  background-color: #dc2626 !important; 
  /* Aplicamos la misma ampliación que al resto de botones */
  transform: scale(1.1) !important;
}

/* =========================================
   ANIMACIONES DE APARICIÓN (UI Mapa)
   ========================================= */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(5px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-pop-in {
  opacity: 0;
  /* Animación ralentizada a 0.9 segundos */
  animation: popIn 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.delay-100 {
  animation-delay: 100ms;
}

.delay-200 {
  animation-delay: 200ms;
}

.delay-300 {
  animation-delay: 300ms;
}

/* =========================================
   HERRAMIENTAS FLOTANTES ACTIVAS
   ========================================= */
.tool-btn-float.active {
  background-color: #2563eb !important;
  color: white !important;
  border-color: #3b82f6 !important;
}

/* =========================================
   CONTROLES DE ZOOM DE LEAFLET (Personalizados)
   ========================================= */
/* Quitamos el borde cuadrado por defecto y hacemos forma de píldora vertical */
.leaflet-bar {
  border: none !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
  border-radius: 9999px !important;
  overflow: hidden;
  background-color: #374151;
  /* Color de la pequeña línea separadora horizontal */
  display: flex;
  flex-direction: column;
  gap: 1px;
  /* Para que se vea la línea entre los botones */
}

/* Estilo de cada botón individual (+ y -) */
.leaflet-bar a {
  background-color: #1f1f1f !important;
  color: #9ca3af !important;
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: bold !important;
  font-size: 18px !important;
  border-bottom: none !important;
  transition: all 0.2s ease !important;
}

/* Hover de los botones de zoom (oscurecer a negro puro y ampliar) */
.leaflet-bar a:hover {
  background-color: #000000 !important;
  color: white !important;
  transform: scale(1.15) !important;
}

/* Separar los controles del borde para que no queden pegados a la esquina inferior derecha */
.leaflet-control-zoom {
  margin-right: 24px !important;
  margin-bottom: 32px !important;
}

/* --- SCROLLBAR PERSONALIZADA NEUTRA --- */
::-webkit-scrollbar {
  width: 12px;
  /* Grosor de la barra */
}

::-webkit-scrollbar-track {
  background: #000000;
  /* Fondo negro puro */
}

::-webkit-scrollbar-thumb {
  background: #262626;
  /* Gris neutro oscuro */
  border-radius: 10px;
  /* Bordes redondeados */
  border: 3px solid #000000;
  /* Le da un efecto de margen con el fondo */
}

::-webkit-scrollbar-thumb:hover {
  background: #404040;
  /* Gris un poco más claro al pasar el ratón */
}

/* =========================================
   NUEVAS: Animaciones de Expansión Unificada (Premium)
   ========================================= */

/* 1. Blindaje del Plan Trimestral (Hover) */
/* Le inyectamos el scale con !important para que overridee las transformaciones del JavaScript de scroll */
#plan-trimestral:hover {
  transform: scale(1.05) !important;
  transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1) !important;
  /* Efecto de elevación con sombra premium */
  box-shadow: 0 30px 60px -15px rgba(0,0,0,0.5) !important;
}

/* 2. Micro-interacciones de letras en el Hero (Doble Física) */
/* Primero definimos el estado base de cada letra (can-hover-letter) */
[can-hover-letter] {
  display: inline-block;
  transform: translateY(0); /* Estado base */
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Curva rápida */
}

/* Segundo: Definimos cómo reaccionan las letras al hover */
/* Solo se activará cuando al contenedor principal le hayamos añadido la clase .animation-complete desde JS */
[can-hover-letter]:hover {
  transform: scale(1.1) translateY(-3px); /* Crece y sube ligeramente */
  /* Hemos eliminado la línea del color para que se mantengan en blanco puro */
}