/* main.css — Tema "estación meteorológica" (Lima la gris) */

:root {
  --bg: #0d1117;
  --bg-2: #131b24;
  --panel: #161f29;
  --panel-2: #1b2530;
  --border: #243040;
  --border-soft: #1e2630;
  --txt: #e6edf3;
  --txt-dim: #9aa7b4;
  --txt-faint: #6b7785;
  --sky: #6db5e8;
  --gold: #f5b716;
  --radius: 16px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--display);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fondo atmosferico: cielo de Lima derivando a claro */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 80% -5%, rgba(109, 181, 232, 0.18), transparent 70%),
    radial-gradient(50% 45% at 10% 0%, rgba(245, 183, 22, 0.1), transparent 70%),
    linear-gradient(180deg, #0f1820 0%, var(--bg) 55%);
}
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.5;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  animation: subir 0.6s ease both;
}
.hero-mark {
  font-size: 38px;
  color: var(--sky);
  filter: drop-shadow(0 0 14px rgba(109, 181, 232, 0.5));
  line-height: 1;
}
.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero-sub {
  color: var(--txt-dim);
  font-size: 0.95rem;
  font-weight: 500;
}
.badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--txt-dim);
  white-space: nowrap;
}
.badge.ok { color: #7ee0a8; border-color: rgba(126, 224, 168, 0.3); }
.badge.warn { color: var(--gold); border-color: rgba(245, 183, 22, 0.35); }

/* ---------- Panel de control ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 26px;
  animation: subir 0.6s 0.05s ease both;
}
.panel-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}
.panel-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--txt-faint);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  --accent: var(--sky);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--txt-dim);
  font-family: var(--display);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.chip:hover { transform: translateY(-2px); color: var(--txt); }
.chip-ico { width: 20px; height: 20px; color: var(--accent); display: inline-flex; }
.chip-ico svg { width: 100%; height: 100%; }
.chip.activo {
  color: #fff;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2));
  box-shadow: 0 0 0 1px var(--accent), 0 6px 18px -8px var(--accent);
}

.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  padding: 10px 18px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--txt);
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); border-color: var(--sky); }
.btn-primary {
  background: linear-gradient(135deg, var(--sky), #4f9fd6);
  border-color: transparent;
  color: #06121c;
}
.btn-primary:hover { box-shadow: 0 8px 22px -8px var(--sky); }

/* ---------- Bloques ---------- */
.bloque { margin-bottom: 30px; animation: subir 0.6s 0.1s ease both; }
.bloque-titulo {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.bloque-titulo span { color: var(--txt-faint); font-weight: 500; font-size: 0.85rem; }
.hint {
  color: var(--txt-faint);
  font-size: 0.85rem;
  font-style: italic;
  margin: -4px 0 14px;
}

/* ---------- Tarjetas de prediccion ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-day {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--txt-faint);
}
.card-ico { width: 30px; height: 30px; color: var(--txt); }
.card-ico svg { width: 100%; height: 100%; }
.card-state { font-size: 0.92rem; font-weight: 700; min-height: 2.6em; }
.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--border-soft);
  overflow: hidden;
  margin: 10px 0 8px;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-pct { font-family: var(--mono); font-size: 1.25rem; font-weight: 600; }

/* ---------- Grafico ---------- */
.chart-box {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  height: 360px;
}

.pie {
  text-align: center;
  color: var(--txt-faint);
  font-size: 0.8rem;
  margin-top: 36px;
}

/* ---------- Modales ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(4px);
  z-index: 50;
}
.modal.abierto { display: flex; animation: aparecer 0.2s ease; }
.modal-caja {
  width: 100%;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px -20px #000;
  animation: subir 0.3s ease;
}
.modal-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-cabecera h3 { font-size: 1.1rem; font-weight: 700; }
.modal-x {
  background: none;
  border: none;
  color: var(--txt-dim);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.modal-x:hover { color: var(--txt); }
.modal-cuerpo { padding: 22px; }
.tabla-scroll { overflow-x: auto; }

/* Tabla de matriz */
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.82rem; }
th, td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border-soft); }
thead th { color: var(--sky); font-weight: 600; text-align: center; }
tbody th { color: var(--txt-dim); text-align: left; font-weight: 500; white-space: nowrap; }
tbody td { color: var(--txt); }

/* Vector estacionario */
.vec-titulo { font-weight: 700; margin-bottom: 18px; }
.vector { display: flex; align-items: stretch; gap: 6px; justify-content: center; margin-bottom: 20px; }
.vec-bracket { font-family: var(--mono); font-size: 2.4rem; color: var(--txt-faint); }
.vec-col { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.vec-val {
  --accent: var(--sky);
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: right;
  padding: 2px 12px;
  border-right: 3px solid var(--accent);
}
.vec-orden { color: var(--txt-faint); font-size: 0.8rem; font-style: italic; margin-bottom: 8px; }
.vec-leyenda { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.vec-leyenda li { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--txt-dim); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* ---------- Animaciones ---------- */
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-wrap: wrap; }
  .badge { margin-left: 0; order: 3; width: 100%; text-align: center; }
}
@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
}
