/* ====================================================================
   SISMOSRD - PALETA "LUZ & CALIDEZ"
   Diseñado para máxima accesibilidad, niños, ancianos y familias.
   ==================================================================== */

:root {
  /* Paleta Luminosa Accesible (WCAG AAA) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-glass: rgba(255, 255, 255, 0.92);
  --border-subtle: #e2e8f0;
  --border-focus: #0284c7;

  /* Texto */
  --text-main: #0f172a;       /* Slate 900 - Contraste alto */
  --text-muted: #475569;      /* Slate 600 */
  --text-light: #64748b;      /* Slate 500 */
  --text-inverse: #ffffff;

  /* Colores Temáticos Amigables */
  --primary: #0284c7;         /* Azul Caribe institucional */
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  
  --warm-amber: #d97706;      /* Ámbar cálido */
  --warm-amber-bg: #fef3c7;
  
  --coral: #ea580c;           /* Coral vibrante */
  --coral-bg: #ffedd5;
  
  --soft-red: #dc2626;        /* Rojo advertencia accesible */
  --soft-red-bg: #fee2e2;
  
  --emerald: #059669;         /* Verde tranquilidad */
  --emerald-bg: #d1fae5;

  /* Elevaciones */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
  --shadow-float: 0 14px 34px rgba(15, 23, 42, 0.14);

  /* Tipografía */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Radios */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* Las vistas gestionan su propio scroll */
}

/* ================= HEADER / NAVEGACIÓN SUPERIOR ================= */
.app-header {
  height: 68px;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon-pulse {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background-color: #ffffff;
  border-radius: var(--radius-full);
}

.seismic-wave {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  border: 2px solid #38bdf8;
  animation: pulse-ring 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.9; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

.logo-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.logo-title .highlight {
  color: var(--primary);
}

.logo-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Indicador En Vivo */
.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: var(--emerald-bg);
  color: var(--emerald);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.live-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--emerald);
  border-radius: var(--radius-full);
  animation: live-blink 1.5s infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Navegación por pestañas */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: transparent;
  font-family: var(--font-family);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover altamente visible, luminoso y táctil */
.nav-btn:hover {
  color: var(--primary) !important;
  background-color: #e0f2fe !important;
  border-color: #38bdf8 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.22);
}

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

.nav-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  font-weight: 700;
}

/* Acciones rápidas en header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-surface);
  font-family: var(--font-family);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 42px;
}

.action-btn:hover {
  background-color: #f0f9ff;
  border-color: #0284c7;
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.18);
}

.action-btn.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.3);
  font-weight: 700;
}

.action-btn.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

/* ================= CONTENEDOR PRINCIPAL Y PANELES ================= */
.app-main {
  position: relative;
  width: 100%;
  height: calc(100vh - 68px);
  overflow: hidden;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.view-panel.active {
  display: block;
}

/* ================= 1. VISTA DE MAPA Y CONTROLES ================= */
#tab-map {
  position: relative;
  overflow: hidden;
}

.map-container {
  width: 100%;
  height: 100%;
  background-color: #e2e8f0;
  z-index: 1;
}

/* Barra flotante de filtros del mapa */
.map-overlay-controls {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none; /* Dejar pasar clics al mapa alrededor */
}

.filter-chips, .map-toggles {
  pointer-events: auto;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  background: transparent;
  font-family: var(--font-family);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
}

.chip .chip-title {
  font-size: 13.5px;
  font-weight: 700;
  display: block;
  white-space: nowrap;
}

.chip .chip-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
  display: block;
  white-space: nowrap;
}

.chip:hover {
  background-color: #e0f2fe;
  color: var(--primary);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.4);
}

.chip.active .chip-sub {
  color: #e0f2fe;
  opacity: 0.95;
}

/* Toggle Switch para fallas tectónicas */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: var(--radius-full);
  transition: 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  border-radius: var(--radius-full);
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #dc2626; /* Rojo para fallas */
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.btn-drawer-toggle {
  padding: 8px 16px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid rgba(2, 132, 199, 0.3);
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-drawer-toggle:hover {
  background: #bae6fd;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.2);
}

.btn-drawer-toggle:hover {
  background: #bae6fd;
}

/* Leyenda de magnitudes flotante */
.map-legend {
  position: absolute;
  bottom: 24px;
  left: 20px;
  z-index: 500;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 250px;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.legend-info-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Posicionamiento de Controles de Leaflet (Zoom y Capas): Despejados debajo de la barra superior en escritorio */
.leaflet-top.leaflet-right {
  top: 86px !important;
  right: 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden !important;
}

.leaflet-control-zoom a {
  background: var(--bg-surface-glass) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  color: var(--text-main) !important;
  transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
  background: #f1f5f9 !important;
  color: var(--primary) !important;
}

/* Selector de Capas Base de Leaflet */
.leaflet-control-layers {
  background: var(--bg-surface-glass) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 10px 14px !important;
  font-family: var(--font-family) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text-main) !important;
}

.leaflet-control-layers-base label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: color 0.2s;
}

.leaflet-control-layers-base label:hover {
  color: var(--primary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-muted);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  display: inline-block;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.dot-green { background-color: #10b981; }
.dot-yellow { background-color: #eab308; }
.dot-orange { background-color: #ea580c; }
.dot-red { background-color: #dc2626; }

.legend-size-hint {
  border-top: 1px dashed var(--border-subtle);
  padding-top: 6px;
  margin-top: 2px;
}

.circle-size-icon {
  font-size: 13px;
  line-height: 1;
}

/* Badges con codificación temporal (Rojo <=3h, Naranja 3-6h, Amarillo 6-9h, Verde >9h) */
.time-red {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
}

.time-orange {
  background-color: #ea580c !important;
  color: #ffffff !important;
  box-shadow: 0 0 8px rgba(234, 88, 12, 0.3);
}

.time-yellow {
  background-color: #eab308 !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.time-green {
  background-color: #10b981 !important;
  color: #ffffff !important;
}

/* Ondas sísmicas animadas en el mapa */
.epicenter-wave-marker {
  position: relative;
}

.epicenter-pulse-circle {
  border-radius: 50%;
  position: absolute;
  animation: map-wave 2.4s ease-out infinite;
}

@keyframes map-wave {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(3.5); opacity: 0; }
}

/* ================= PANEL LATERAL (DRAWER) DE SISMOS ================= */
.events-drawer {
  position: absolute;
  top: 0;
  right: -420px; /* Cerrado por defecto */
  width: 400px;
  height: 100%;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-float);
  z-index: 600;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.events-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.drawer-close-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.drawer-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.drawer-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fafbfc;
}

.drawer-search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-family);
  font-size: 13px;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s;
}

.drawer-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.events-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Tarjeta individual de sismo en la lista */
.sismo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}

.sismo-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.sismo-card.is-sentido {
  border-left: 4px solid var(--coral);
}

.sismo-mag-badge {
  min-width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.mag-green { background: linear-gradient(135deg, #10b981, #059669); }
.mag-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.mag-orange { background: linear-gradient(135deg, #ea580c, #c2410c); }
.mag-red { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.sismo-info {
  flex: 1;
}

.sismo-location {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.sismo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
  font-size: 13px;
  color: var(--text-muted);
}

.badge-felt {
  background-color: var(--coral-bg);
  color: var(--coral);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

/* ================= POPUP LEAFLET PERSONALIZADO ================= */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 4px !important;
  background: var(--bg-surface) !important;
}

.popup-card {
  font-family: var(--font-family);
  color: var(--text-main);
  padding: 8px;
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.popup-mag {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: #ffffff;
}

.popup-date {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.popup-body {
  font-size: 13px;
  margin-bottom: 12px;
}

.popup-loc {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.popup-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-app);
  padding: 8px;
  border-radius: var(--radius-sm);
}

.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.popup-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-app);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.popup-btn:hover {
  background: #e2e8f0;
}

.popup-btn.primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

.popup-btn.primary:hover {
  background: var(--primary-hover);
}

/* ================= 2. VISTA DE ESTADÍSTICAS ================= */
.stats-container, .edu-container, .tsunami-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.section-title-bar h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
}

.section-title-bar p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-download:hover {
  background: var(--bg-app);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* Cuadrícula de KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-blue .kpi-icon { background: var(--primary-light); }
.card-orange .kpi-icon { background: var(--coral-bg); }
.card-red .kpi-icon { background: var(--soft-red-bg); }
.card-green .kpi-icon { background: var(--emerald-bg); }

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin: 4px 0;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-light);
}

/* Gráficos con barras accesibles */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.chart-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-row-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.chart-track {
  height: 20px;
  background-color: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.chart-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Caja didáctica */
.didactic-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: #166534;
  font-size: 14px;
  margin-top: 10px;
}

.didactic-icon {
  font-size: 26px;
}

.didactic-box h4 {
  font-weight: 700;
  margin-bottom: 4px;
  color: #14532d;
}

/* ================= 3. VISTA EDUCATIVA & HISTORIA ================= */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
}

.edu-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.edu-card.full-width {
  grid-column: 1 / -1;
}

.edu-card-header {
  margin-bottom: 14px;
}

.edu-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 8px;
}

.badge-warning { background: var(--warm-amber-bg); color: var(--warm-amber); }
.badge-success { background: var(--emerald-bg); color: var(--emerald); }

.edu-card-header h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.edu-card-body p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Ilustración esquemática de placas */
.edu-illustration-card {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.plate.north { color: #0369a1; }
.plate-boundary {
  padding: 6px 0;
  color: #dc2626;
  font-size: 12px;
}
.plate.caribbean { color: #d97706; }

/* Línea de tiempo histórica */
.timeline-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 12px;
  border-left: 2px solid var(--border-subtle);
}

.timeline-item {
  position: relative;
  padding-left: 16px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
}

.timeline-year {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 2px;
}

.timeline-content strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}

.timeline-content p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Pasos de prevención ilustrados */
.prevention-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.step-card {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.step-card.highlight-step {
  background: #fef2f2;
  border-color: #fecaca;
}

.step-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

.step-card h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.step-card ul {
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Acordeón didáctico */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
}

.faq-item summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.faq-item p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}

/* ================= 4. VISTA DE TSUNAMIS ================= */
.tsunami-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.tsunami-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.tsunami-card.card-alert {
  border-color: #fed7aa;
  background: #fffaf5;
}

.tsunami-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.tsunami-icon {
  font-size: 28px;
}

.tsunami-card-header h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.tsunami-signals {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.signal-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.signal-num {
  width: 28px;
  height: 28px;
  background: #ea580c;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.signal-item strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}

.signal-item p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tsunami-action-banner {
  background: #ea580c;
  color: #ffffff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
}

/* ================= MODAL "¿LO SENTISTE?" ================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-enter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  padding: 0 20px;
}

.modal-tab-btn {
  padding: 12px 18px;
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #ffffff;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
}

.event-ref-banner {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-weight: 600;
}

/* Selector de Intensidades */
.intensity-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.intensity-option {
  cursor: pointer;
}

.intensity-option input {
  display: none;
}

.intensity-card {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  transition: all 0.2s ease;
  min-height: 110px;
  justify-content: center;
}

.intensity-card .i-icon {
  font-size: 24px;
}

.intensity-card strong {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.2;
}

.intensity-card small {
  font-size: 10px;
  color: var(--text-light);
  line-height: 1.2;
}

.intensity-option input:checked + .intensity-card {
  border-color: var(--primary);
  background: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-main);
  background: #ffffff;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.btn-secondary {
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-app);
  font-family: var(--font-family);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.btn-primary {
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
  transition: all 0.2s;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

/* Foro comunitario en el modal */
.forum-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.forum-item {
  background: #f8fafc;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s;
}

.forum-item.my-recent-post {
  border-color: #38bdf8;
  background: #f0f9ff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
}

.forum-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.forum-author {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-main);
}

.forum-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--coral-bg);
  color: var(--coral);
}

.forum-badge.recent-badge {
  background: var(--emerald-bg);
  color: var(--emerald);
}

.forum-body {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.forum-time {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
  display: block;
}

/* Pantalla de Confirmación de Reporte Enviado */
.report-success-card {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: modal-enter 0.3s ease;
}

.success-icon-badge {
  width: 72px;
  height: 72px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.25);
}

.success-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.success-desc {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.5;
}

.success-summary-box {
  width: 100%;
  max-width: 500px;
  background: #f8fafc;
  border: 1.5px solid var(--border-subtle);
  border-left: 5px solid #0284c7;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  font-size: 14.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.success-summary-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.success-summary-item strong {
  color: var(--text-muted);
}

.success-summary-item span {
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
  width: 100%;
}

/* ================= NOTIFICACIONES TOAST ================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #ffffff;
  border: 1px solid #bae6fd;
  border-left: 5px solid #0284c7;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
  max-width: 420px;
  animation: toast-slide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-slide {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
  font-size: 26px;
}

.toast-content strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}

.toast-content p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Botón de apoyo sutil */
.btn-support {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1.5px solid #fde68a !important;
  font-weight: 700 !important;
}

.btn-support:hover {
  background: #fde68a !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25) !important;
}

/* ================= 5. PANEL DE ADMINISTRADOR Y RECURSOS ================= */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.admin-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.recursos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 22px;
}

.recurso-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.recurso-card:hover {
  transform: translateY(-3px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.recurso-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.recurso-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
}

.badge-video { background: #fee2e2; color: #dc2626; }
.badge-doc { background: #e0f2fe; color: #0284c7; }
.badge-pres { background: #fef3c7; color: #b45309; }

.recurso-card h3 {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin: 8px 0 4px 0;
}

.recurso-speaker {
  font-size: 13.5px;
  font-weight: 600;
  color: #0284c7;
  display: flex;
  align-items: center;
  gap: 6px;
}

.recurso-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.recurso-notes {
  background: #f8fafc;
  border-left: 3px solid #0284c7;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: #334155;
  line-height: 1.4;
}

.recurso-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  font-size: 12.5px;
  color: var(--text-light);
}

.btn-open-resource {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-open-resource:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-del-resource {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-del-resource:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* ================= MODAL DE APOYO / BANCO ================= */
.bank-card {
  background: #f8fafc;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bank-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.bank-logo-badge {
  font-size: 32px;
}

.bank-header strong {
  display: block;
  font-size: 16px;
  color: var(--text-main);
}

.bank-header small {
  font-size: 12px;
  color: var(--text-muted);
}

.bank-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.b-label {
  color: var(--text-muted);
  font-weight: 500;
}

.b-val {
  font-weight: 700;
  color: var(--text-main);
}

.btn-copy-cuenta {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-cuenta:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
}

.bank-note {
  font-size: 13px;
  color: var(--text-muted);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.paypal-card {
  text-align: center;
  padding: 30px 20px;
}

.paypal-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.paypal-card p {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.btn-paypal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 15px;
  text-decoration: none;
}

/* ================= BARRA DE NAVEGACIÓN INFERIOR PARA MÓVILES (BOTTOM NAV) ================= */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  z-index: 2000;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -3px 15px rgba(15, 23, 42, 0.08);
}

.mobile-bottom-nav .nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 6px 2px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-btn .nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-bottom-nav .nav-btn.active {
  color: var(--primary);
  font-weight: 700;
  background: rgba(2, 132, 199, 0.06);
}

.mobile-bottom-nav .nav-btn.active .nav-icon {
  transform: scale(1.18);
}

/* ================= RESPONSIVE DESIGN (TABLETS & MÓVILES) ================= */

/* TABLETS EN MODO PAISAJE Y PORTRAIT (601px a 1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
  .app-header {
    padding: 0 16px;
    height: 64px;
  }
  .header-nav {
    padding: 4px 6px;
    gap: 4px;
  }
  .header-nav .nav-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .header-actions .action-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .events-drawer {
    width: 350px;
  }
  .edu-content-grid, .tsunami-grid, .recursos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* SMARTPHONES Y MÓVILES (<= 768px) */
@media (max-width: 768px) {
  /* Cabecera compacta */
  .app-header {
    height: 56px;
    padding: 0 12px;
  }
  .logo-title {
    font-size: 19px;
  }
  .logo-subtitle {
    display: none; /* Ahorra espacio vertical clave */
  }
  .logo-icon-pulse {
    width: 32px;
    height: 32px;
  }
  .live-pill {
    padding: 3px 8px;
    font-size: 11px;
  }
  
  /* Ocultar barra superior en móvil; se usa la barra inferior ergonómica */
  .header-nav {
    display: none;
  }
  
  /* Barra inferior móvil activa */
  .mobile-bottom-nav {
    display: flex;
  }
  
  /* Acciones de cabecera en móvil */
  .header-actions {
    gap: 6px;
  }
  .header-actions .action-text {
    display: none;
  }
  .header-actions .action-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
  }
  /* El botón de reporte se mantiene destacado y accesible */
  .header-actions .btn-primary {
    width: auto;
    padding: 0 12px;
  }
  .header-actions .btn-primary .action-text {
    display: inline;
    font-size: 12.5px;
  }

  /* Ajuste de vistas con espacio para la barra inferior */
  .app-main {
    height: calc(100vh - 56px);
  }
  .view-panel {
    padding-bottom: 75px;
  }
  #tab-map {
    height: calc(100vh - 56px - 60px);
    padding-bottom: 0;
  }

  /* Controles flotantes del mapa (Barra ancha con campos en dos filas en móvil) */
  .map-overlay-controls {
    top: 8px;
    left: 10px;
    right: 10px;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
  }
  .filter-chips {
    pointer-events: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
  }
  .chip {
    padding: 7px 6px;
    border-radius: var(--radius-sm);
    background: rgba(241, 245, 249, 0.7);
    border: 1.5px solid transparent;
  }
  .chip .chip-title {
    font-size: 12.5px;
    font-weight: 700;
  }
  .chip .chip-sub {
    font-size: 10.5px;
    font-weight: 500;
    opacity: 0.8;
  }
  .chip.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
  }
  .chip.active .chip-sub {
    color: #e0f2fe;
    opacity: 0.95;
  }

  .map-toggles {
    pointer-events: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 6px 12px;
  }
  .toggle-switch {
    background: var(--bg-surface-glass);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    box-shadow: var(--shadow-sm);
  }
  .btn-drawer-toggle {
    font-size: 12.5px;
    padding: 6px 14px;
    box-shadow: var(--shadow-sm);
  }

  /* Reposicionar Controles de Leaflet debajo de la barra flotante de 2 filas en móvil */
  .leaflet-top.leaflet-right {
    top: 146px !important;
    right: 10px !important;
  }

  /* Leyenda flotante sobre el mapa */
  .map-legend {
    bottom: 72px;
    left: 10px;
    padding: 8px 12px;
    font-size: 11px;
    max-width: 170px;
    gap: 4px;
  }
  .legend-header {
    font-size: 11.5px;
  }

  /* Drawer de sismos como panel completo / hoja */
  .events-drawer {
    width: 100%;
    right: -100%;
    top: 0;
    bottom: 60px;
    height: auto;
    border-radius: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  }

  /* Grids de contenido */
  .stats-container, .edu-container, .tsunami-container, .admin-container {
    padding: 16px 12px;
  }
  .section-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }
  .section-title-bar h2 {
    font-size: 20px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card {
    padding: 14px 12px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .charts-grid, .history-grid, .edu-content-grid, .tsunami-grid, .recursos-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Modales optimizados como Bottom Sheets en celulares */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-dialog {
    max-width: 100%;
    width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 90vh;
    animation: sheet-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes sheet-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-header {
    padding: 16px 18px;
  }
  .modal-body {
    padding: 18px;
    font-size: 15px;
  }
  .form-control, .form-select {
    font-size: 16px; /* Impide zoom forzado de iOS Safari */
    padding: 12px 14px;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .intensity-picker {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .intensity-btn {
    min-height: 52px;
  }
}

/* MÓVILES MUY COMPACTOS (<= 380px) */
@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .map-legend {
    display: none; /* Oculta leyenda en pantallas extremadamente angostas para ver mapa */
  }
}
