/* =====================================================================
   Estilos Principales - Sistema de Análisis de Peligrosidad Sísmica
   ===================================================================== */

:root {
  --primary-color: #0d6efd;
  --primary-dark: #0a58ca;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --card-bg: #ffffff;
  --text-main: #212529;
  --text-muted: #6c757d;
  
  /* Colores de Peligrosidad Sísmica Accesibles (WCAG AA) */
  --hazard-very-low: #198754;   /* Verde */
  --hazard-low: #0dcaf0;        /* Cyan */
  --hazard-moderate: #ffc107;   /* Amarillo / Ámbar */
  --hazard-high: #fd7e14;       /* Naranja */
  --hazard-very-high: #dc3545;  /* Rojo Carmesí */
  --hazard-nodata: #6c757d;     /* Gris */
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background-color: #f8fafc;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Hero */
.app-header {
  background: var(--bg-gradient);
  color: #ffffff;
  padding: 1.8rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-bottom: 3px solid #3b82f6;
}

.app-header h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-badge {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
}

/* Tarjetas y Contenedores */
.card-custom {
  background: var(--card-bg);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.card-header-custom {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.25rem;
  font-weight: 600;
  border-radius: 12px 12px 0 0 !important;
}

/* Mapas */
#input-map, #results-map {
  height: 440px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  z-index: 1;
}

#input-map {
  cursor: crosshair;
}

/* Autocomplete dropdown */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1050;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  transition: background-color 0.15s ease;
}

.autocomplete-item:hover, .autocomplete-item.active {
  background-color: #eff6ff;
  color: #1d4ed8;
}

/* Presets pills */
.preset-btn {
  font-size: 0.78rem;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background-color: #0d6efd;
  color: #ffffff;
  border-color: #0d6efd;
}

/* Banner de Resultado de Peligrosidad */
.hazard-banner {
  border-radius: 14px;
  padding: 1.75rem;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}

.hazard-banner.level-muy-bajo {
  background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}
.hazard-banner.level-bajo {
  background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
  color: #0f172a;
}
.hazard-banner.level-moderado {
  background: linear-gradient(135deg, #ffc107 0%, #d39e00 100%);
  color: #0f172a;
}
.hazard-banner.level-alto {
  background: linear-gradient(135deg, #fd7e14 0%, #d46307 100%);
}
.hazard-banner.level-muy-alto {
  background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
}
.hazard-banner.level-sin-datos {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.hazard-score-circle {
  width: 125px;
  height: 125px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.5);
  margin: 0 auto;
}

.hazard-score-number {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
}

.hazard-score-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

/* Indicadores estadísticos */
.metric-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  height: 100%;
}

.metric-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.metric-label {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Leyenda del mapa Leaflet */
.map-legend {
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 0.82rem;
  line-height: 1.4;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Marcador pulsante para el punto evaluado */
.target-marker-pulse {
  position: relative;
  width: 22px;
  height: 22px;
  background-color: #dc2626;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.8);
}

.target-marker-pulse::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #dc2626;
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

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

/* Canvas de Gráficos */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

/* Barra de progreso de sub-puntajes */
.progress-sub {
  height: 8px;
  border-radius: 4px;
}

/* Footer */
footer {
  margin-top: auto;
  background-color: #0f172a;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 1.5rem 0;
  border-top: 1px solid #1e293b;
}

footer a {
  color: #38bdf8;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Ajustes Responsive */
@media (max-width: 768px) {
  .app-header h1 {
    font-size: 1.4rem;
  }
  #input-map, #results-map {
    height: 320px;
  }
  .hazard-score-circle {
    width: 100px;
    height: 100px;
  }
  .hazard-score-number {
    font-size: 2.2rem;
  }
}

