/* ==========================================
   VARIABLES BASE (Premium UI)
   ========================================== */
:root {
  --premium-bg: #f8fafc;
  --premium-card: rgba(255, 255, 255, 0.82);
  --premium-border: rgba(148, 163, 184, 0.2);
  --premium-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  --premium-accent: #0f172a;
  --premium-sky: #0ea5e9;
  --premium-rose: #f43f5e;
  --premium-gold: #fbbf24;
}

html {
  scroll-behavior: smooth;
}

/* Prevenir destello azul al tapear en Android/iOS */
button, a, input, select, article {
  -webkit-tap-highlight-color: transparent;
}

/* Ocultar barra de scroll para filtros horizontales móviles */
.hide-scrollbar {
  -ms-overflow-style: none; /* IE y Edge */
  scrollbar-width: none; /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
  display: none; /* Chrome, Safari y Opera */
}

/* ==========================================
   FONDOS Y MODO OSCURO
   ========================================== */
body {
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.11), transparent 28%),
    radial-gradient(circle at top right, rgba(244, 63, 94, 0.08), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, #eef5ff 28%, #f8fafc 100%);
}

.dark body {
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(244, 63, 94, 0.08), transparent 20%),
    linear-gradient(180deg, #020817 0%, #0f172a 22%, #020817 100%);
}

/* ==========================================
   MAPA LEAFLET Y CONTENEDOR
   ========================================== */
#mapa {
  z-index: 10;
}

#seccionMapa {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,252,0.92));
  box-shadow: var(--premium-shadow);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.dark #seccionMapa {
  background: linear-gradient(180deg, rgba(15,23,42,0.9), rgba(15,23,42,0.95));
}

#seccionMapa:hover {
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
}

/* Aceleración por hardware para despliegue suave */
#contenedorMapa {
  will-change: max-height, opacity;
}

#contenedorMapa .leaflet-container {
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* Adaptación del Popup de Leaflet en Dark Mode */
.dark .leaflet-popup-content-wrapper,
.dark .leaflet-popup-tip {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155;
}

.dark .leaflet-popup-content h3 {
  color: #f8fafc !important;
}

.dark .leaflet-popup-content p {
  color: #94a3b8 !important;
}

/* ==========================================
   INPUTS Y FILTROS
   ========================================== */
#buscarInput,
#filtroCiudad,
#filtroCategoria,
#filtroCosto,
#btnFiltroFavoritos,
#btnCercaDeMi {
  transition: all 0.2s ease;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.03);
}

#buscarInput:focus,
#filtroCiudad:focus,
#filtroCategoria:focus,
#filtroCosto:focus {
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12), 0 10px 22px rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.6);
}

#btnFiltroFavoritos.is-active {
  background: linear-gradient(135deg, #ff6b7a 0%, #e11d48 50%, #be123c 100%);
  border-color: rgba(190, 18, 60, 0.9);
  color: #fff !important;
  box-shadow: 0 12px 24px rgba(225, 29, 72, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px) scale(1.01);
}

#btnFiltroFavoritos.is-active i,
#btnFiltroFavoritos.is-active span,
#btnFiltroFavoritos.is-active #contadorFavoritosBadge {
  color: #fff !important;
}

#btnFiltroFavoritos.is-active #contadorFavoritosBadge {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ==========================================
   TARJETAS Y ANIMACIONES
   ========================================== */
article {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  will-change: transform;
}

#contenedorTarjetas > article {
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.04);
}

/* Hover solo aplicable en desktop/dispositivos con mouse */
@media (hover: hover) {
  #contenedorTarjetas > article:hover {
    transform: translateY(-3px);
    border-color: rgba(14, 165, 233, 0.25);
    box-shadow: 0 20px 42px rgba(14, 165, 233, 0.08), 0 12px 30px rgba(15, 23, 42, 0.06);
  }
}

#tarjetaCiudadHistoria {
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(239,246,255,0.7));
  border: 1px solid rgba(14, 165, 233, 0.12);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
}

.dark #tarjetaCiudadHistoria {
  background: linear-gradient(135deg, rgba(15,23,42,0.75), rgba(30,41,59,0.8));
  border-color: rgba(96, 165, 250, 0.2);
}

.city-card-animate {
  animation: cityCardFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Animación fluida GPU-Friendly (Sin filtro blur) */
@keyframes cityCardFadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================
   BOTÓN THEME TOGGLE (Modo Oscuro)
   ========================================== */
.theme-toggle {
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Ocultar barra de scroll en los chips manteniendo la funcionalidad táctil */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================
   OPTIMIZACIONES MÓVILES Y UX
   ========================================== */

/* La altura del mapa se adapta al contenedor responsivo de Tailwind. */
#mapa {
  height: 100% !important;
  min-height: 260px;
}