/* Observatorio de Clima Espacial Academico · Tecnologico Universitario EuroAmericano · Prof. Feddor Derenzin M.
   Identidad visual gemela del Observatorio Climatologico (encabezado.css + boletin.css):
   Glassmorphism ejecutivo oscuro, pizarra profunda (#0b0f19 / #0f172a), acentos cian (#00e5ff / #0284c7) y JetBrains Mono. */

:root {
  --bg-page: #0b0f19;
  --bg-surface: rgba(9, 14, 26, 0.94);
  --bg-card: #111827;
  --bg-card-glass: rgba(15, 23, 42, 0.88);
  --bg-card-hover: #1f2937;
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(0, 229, 255, 0.35);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #00e5ff;
  --accent-sky: #38bdf8;
  --accent-blue: #0284c7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-orange: #ea580c;
  --accent-red: #e11d48;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html {
  overflow-x: clip;
}

body {
  background-color: var(--bg-page);
  background-image:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(2, 132, 199, 0.16), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(0, 229, 255, 0.06), transparent);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

/* ============================================================
   1. BARRA SUPERIOR FLOTANTE (IDENTICA A WEB CLIMATOLOGICA)
   ============================================================ */
.header-shell {
  position: sticky;
  top: 10px;
  z-index: 1000;
  max-width: 1320px;
  width: calc(100% - 28px);
  margin: 10px auto 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 14px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-top: 1px solid var(--border-accent);
  border-radius: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
  flex-wrap: nowrap;
}

@media (max-width: 1080px) {
  .top-bar {
    flex-wrap: wrap;
  }
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  padding: 2px 6px 2px 2px;
  border-radius: 9px;
  transition: background 0.2s ease;
}

.brand-cluster:hover {
  background: rgba(255, 255, 255, 0.05);
}

.brand-logo-wrap {
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 36px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  flex-shrink: 0;
  color: #0f172a;
  font-weight: 800;
}

.brand-logo-wrap img {
  height: 26px;
  width: auto;
  display: block;
  object-fit: contain;
}

.brand-accent-bar {
  width: 1.5px;
  height: 28px;
  background: linear-gradient(180deg, transparent, var(--accent-cyan), transparent);
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-main {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-sub {
  font-size: 10.5px;
  color: #7dd3fc;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

/* Cinta Central de Telemetria */
.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(4, 8, 16, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
}

.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-live 1.6s infinite;
}

.live-dot.falla {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

@keyframes pulse-live {
  0%, 100% { transform: scale(0.95); opacity: 0.75; }
  50% { transform: scale(1.25); opacity: 1; }
}

.telemetry-item {
  font-family: var(--font-mono);
  color: #e2e8f0;
  font-weight: 600;
  white-space: nowrap;
}

.telemetry-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.16);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-header:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-sky);
  color: #fff;
}

.btn-header-primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.btn-header-primary:hover {
  background: #0369a1;
  border-color: #0369a1;
}

/* Barra Secundaria de Secciones */
.subnav-bar {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.subnav-bar::-webkit-scrollbar {
  display: none;
}

.nav-pill {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-pill:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-pill.activo {
  color: #ffffff;
  background: rgba(2, 132, 199, 0.24);
  border-color: rgba(56, 189, 248, 0.45);
}

/* ============================================================
   2. CONTENEDOR Y BANNER PRINCIPAL
   ============================================================ */
.container {
  max-width: 1320px;
  width: 100%;
  margin: 22px auto 0;
  padding: 0 14px 54px;
  flex: 1;
}

.current-status-banner {
  background: #0f172a;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-blue);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

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

.badge-solo-observado {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.banner-caida {
  background: rgba(217, 119, 6, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-left: 4px solid var(--accent-amber);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
}

.banner-caida strong {
  color: #fbbf24;
}

/* ============================================================
   3. SEMAFOROS R / S / G Y TARJETAS KPI
   ============================================================ */
.semaforos-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.semaforo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.semaforo-card:hover {
  border-color: var(--accent-blue);
  background: #161f30;
}

.semaforo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.semaforo-titulo {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.semaforo-badge {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.nivel-0 { background: rgba(16, 185, 129, 0.16); color: #34d399; border-color: rgba(16, 185, 129, 0.45); }
.nivel-1 { background: rgba(234, 179, 8, 0.16); color: #facc15; border-color: rgba(234, 179, 8, 0.45); }
.nivel-2 { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border-color: rgba(245, 158, 11, 0.5); }
.nivel-3 { background: rgba(234, 88, 12, 0.22); color: #fb923c; border-color: rgba(234, 88, 12, 0.55); }
.nivel-4 { background: rgba(225, 29, 72, 0.22); color: #fda4af; border-color: rgba(225, 29, 72, 0.6); }
.nivel-5 { background: rgba(153, 27, 27, 0.35); color: #fecaca; border-color: rgba(239, 68, 68, 0.75); }
.nivel-sin { background: rgba(100, 116, 139, 0.22); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.4); }

.semaforo-valor {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-sky);
}

.semaforo-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ============================================================
   4. SECCIONES, GRAFICOS Y TABLAS
   ============================================================ */
.section-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.85fr 1fr;
  gap: 16px;
}

.suvi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.suvi-card {
  background: #0b0f19;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suvi-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
}

.suvi-caption {
  font-size: 12px;
  color: var(--text-muted);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  background: #090d16;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
}

.chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(9, 14, 26, 0.96);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-main);
  display: none;
  z-index: 10;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table th,
table.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

table.data-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(15, 23, 42, 0.85);
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.pill-estado {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.pill-ok { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.45); }
.pill-falla { background: rgba(225, 29, 72, 0.18); color: #fda4af; border: 1px solid rgba(225, 29, 72, 0.45); }
.pill-dia { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.45); }
.pill-noche { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.35); }

.filtros-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.btn-filtro {
  background: #0f172a;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-filtro.activo {
  color: #fff;
  background: rgba(2, 132, 199, 0.25);
  border-color: var(--accent-sky);
}

.mono { font-family: var(--font-mono); }
.texto-suave { color: var(--text-muted); }

.prose p {
  margin-bottom: 12px;
  text-align: justify;
  color: #cbd5e1;
  font-size: 14px;
}

.prose h3 {
  font-family: var(--font-title);
  font-size: 16px;
  margin: 18px 0 8px;
  color: var(--text-main);
}

/* ============================================================
   5. PIE DE PAGINA SOBRIO Y CENTRADO
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-strong);
  background: #0f172a;
  padding: 26px 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  line-height: 1.55;
}

.site-footer a {
  color: var(--accent-sky);
  text-decoration: none;
}

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

.aviso-legal {
  color: #cbd5e1;
  font-weight: 500;
  margin-top: 2px;
}

@media (max-width: 920px) {
  .semaforos-grid,
  .suvi-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .telemetry-strip {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   6. CENTRO DE MANDO GRAFANA + MAPA ECUADOR + VISOR SOLAR
   ============================================================ */
.grafana-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.grafana-kpi {
  background: #0f172a;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease;
}

.grafana-kpi:hover {
  border-color: var(--accent-sky);
}

.grafana-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.grafana-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grafana-kpi-val {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 800;
  color: var(--accent-sky);
  line-height: 1.15;
}

.grafana-kpi-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.cockpit-main-grid {
  display: grid;
  grid-template-columns: 1.18fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.grafana-panel {
  background: #0f172a;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
}

.grafana-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.grafana-panel-title {
  font-family: var(--font-title);
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sector-select {
  background: #090d16;
  color: #f8fafc;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  cursor: pointer;
}

.mapa-ecuador-wrap {
  position: relative;
  width: 100%;
  height: 410px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #070b14;
}

.mapa-capas-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.mapa-capas-bar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.diagnostico-canton-box {
  background: rgba(9, 13, 22, 0.85);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-sky);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.visor-solar-stage {
  position: relative;
  width: 100%;
  height: 350px;
  background: #000000;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visor-solar-stage img,
.visor-solar-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.visor-solar-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(9, 14, 26, 0.84);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.player-scrubber {
  flex: 1;
  min-width: 120px;
  accent-color: var(--accent-sky);
  cursor: pointer;
}

.grafana-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.chart-wrap-sm {
  position: relative;
  width: 100%;
  height: 225px;
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.chart-wrap-sm canvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 1140px) {
  .grafana-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .cockpit-main-grid,
  .grafana-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .header-shell {
    position: static;
    width: calc(100% - 16px);
    margin: 8px auto 0;
  }
  .top-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .brand-cluster {
    min-width: 0;
    flex: 1 1 100%;
  }
  .brand-main,
  .brand-sub {
    white-space: normal;
  }
  .brand-main {
    font-size: 11px;
  }
  .telemetry-strip {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 10px;
  }
  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }
  .btn-header {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 11.5px;
    padding: 6px 8px;
  }
  .container {
    margin-top: 14px;
    padding: 0 8px 36px;
  }
  .panel-card,
  .grafana-panel {
    padding: 12px;
    min-width: 0;
  }
  .grafana-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .grafana-kpi {
    padding: 9px 10px;
    min-width: 0;
  }
  .mapa-ecuador-wrap,
  .visor-solar-stage {
    height: 240px;
  }
}

@media (max-width: 420px) {
  .telemetry-divider {
    display: none;
  }
}
