/* ══════════════════════════════════════════════════════════════════════
   ALERTAS — DASHBOARD + NAVBAR (merge de base.css)
   --------------------------------------------------------------------
   Colisiones resueltas respecto a base.css:
     • body          → regla unificada (gradiente del dashboard)
     • .cuerpo       → renombrada a .cuerpo-alertas
     • :root         → variables de ambos archivos combinadas (sin choque)
   Lo que NO se incluye de base.css: #particles-js, submenús, .cuerpo base.
══════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  /* ── Dashboard de alertas ── */
  --bg-dark: #2C3E50;
  --accent: #e5e820;
  --accent2: #4FC3F7;
  --green: #27ae60;
  --yellow: #f39c12;
  --red: #e74c3c;
  --card-bg: rgba(255,255,255,0.04);
  --card-border: rgba(255,255,255,0.10);
  --text: #ecf0f1;
  --text-muted: #c8dcde;
  --radius: 14px;
  --transition: .22s cubic-bezier(.4,0,.2,1);

  /* ── Navbar (de base.css) ── */
  --nav-height: 60px;
  --nav-pad-bottom: 5px;
  --nav-bg: #303C48;
  --nav-color: #ffffff;
  --nav-hover: #cedebd;
}

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

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(79,195,247,.14), transparent 30%),
    linear-gradient(135deg, #101923 0%, #172433 50%, #233344 100%);
}

/* ══════════════════════════════════════════════════════════════════════
   NAVBAR (adaptado de base.css, sin jQuery ni particles)
══════════════════════════════════════════════════════════════════════ */
.navbody {
  margin: 0 0 65px 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

header {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 80px var(--nav-pad-bottom) 80px;
  background: var(--nav-bg);
  width: 100%;
  box-sizing: border-box;
  box-shadow: 2px 2px 5px #e5e820;
  z-index: 50;
}

header .logo {
  float: left;
  height: var(--nav-height);
  line-height: var(--nav-height);
}

header .logo .navbar-brand {
  padding-top: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  height: 100%;
}

header .logo .navbar-brand img {
  height: 35px;
  vertical-align: middle;
}

.brand-text {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  letter-spacing: .5px;
}

header nav {
  float: right;
  height: var(--nav-height);
}

header nav ul {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  height: 100%;
  z-index: 999;
  list-style: none;
}

header nav ul li a {
  display: block;
  font-size: 17px;
  height: 40px;
  line-height: 40px;
  padding: 0 18px;
  color: var(--nav-color);
  text-decoration: none;
  transition: box-shadow 0.2s ease, color 0.2s ease;
}

header nav ul li a:hover {
  color: var(--nav-hover);
  border-radius: 5px;
  box-shadow: 0 0 5px #411f1f, 0 0 5px #ffffff;
  text-decoration: none;
}

.menu-toggle {
  display: none;
  float: right;
  height: var(--nav-height);
  line-height: var(--nav-height);
  font-size: 24px;
  color: var(--nav-color);
  cursor: pointer;
}

@media (max-width: 1300px) {
  header {
    padding: 0 20px var(--nav-pad-bottom) 20px;
  }

  .menu-toggle { display: block; }

  header nav {
    position: absolute;
    width: 100%;
    height: auto;
    background: var(--nav-bg);
    top: calc(var(--nav-height) + var(--nav-pad-bottom));
    left: -100%;
    transition: left 0.3s ease;
  }

  header nav.active {
    left: 0;
    z-index: 999;
  }

  header nav ul {
    display: block;
    text-align: center;
    height: auto;
  }

  header nav ul li a {
    height: 50px;
    line-height: 50px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  header nav ul li a:hover {
    color: var(--nav-hover);
    background: #343e40;
    border-radius: 5px;
    box-shadow: 0 0 5px #411f1f, 0 0 5px #ffffff;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD — CONTENEDOR PRINCIPAL  (antes .cuerpo)
══════════════════════════════════════════════════════════════════════ */
.cuerpo-alertas {
    max-width: 90%;
    width: calc(100% - 48px);
    margin-left: auto;
    margin-right: auto;
    padding-top: 24px;
    padding-bottom: 40px;
}

.plant-header {
  justify-content: center;
  text-align: center;
  font-size: clamp(16px, 28px, 32px);
  margin-bottom: 16px;
  padding:20px 30px;
  border-radius: 22px;
  background: rgba(9, 20, 31, .78);
  border: 1px solid rgba(79,195,247,.20);
  box-shadow: 0 16px 45px rgba(0,0,0,.28);
  position: relative;
}



/* ══════════════════════════════════════════════════════════════════════
   BANNER DE VENTANA (90 días / histórico)
══════════════════════════════════════════════════════════════════════ */
.ventana-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px 22px;
  background: rgba(79,195,247,.10);
  border: 1px solid rgba(79,195,247,.30);
  border-left: 4px solid var(--accent2);
  border-radius: 14px;
}

.ventana-banner--completo {
  background: rgba(229,232,32,.08);
  border-color: rgba(229,232,32,.35);
  border-left-color: var(--accent);
}

.ventana-banner__texto {
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
}

.ventana-banner__btn {
  border: 1px solid rgba(79,195,247,.45);
  background: rgba(79,195,247,.16);
  color: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.ventana-banner__btn:hover:not(:disabled) {
  background: rgba(79,195,247,.28);
}

.ventana-banner__btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════════════ */
.control-card,
.kpi-card,
.chart-card,
.table-card {
  background: rgba(9, 20, 31, .78);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 20px;
  box-shadow: 0 14px 38px rgba(0,0,0,.26);
  color: var(--text);
}

.control-card {
  padding: 26px 32px;
  margin-bottom: 28px;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px;
  background: rgba(255,255,255,.045);
  border-radius: 16px;
  margin-bottom: 24px;
  margin-top: 4px;
  justify-content: flex-start;
}

.view-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 12px;
  padding: 9px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}

.view-tab.active {
  color: #fff;
  background: rgba(79,195,247,.18);
  border-color: rgba(79,195,247,.38);
}

.view-panel {
  display: none;
}

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

.dashboard-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 32px;
}

.dashboard-grid--2x2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card {
  height: 390px;
  min-height: 390px;
  padding: 28px 32px;
  overflow: hidden;
}

.chart-card--full {
  height: 430px;
  min-height: 430px;
  margin-bottom: 28px;
}

.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
  max-height: 300px !important;
  display: block;
}

.chart-card--full canvas {
  height: 340px !important;
  max-height: 340px !important;
}

.insight-card {
  height: 390px;
  overflow-y: auto;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
  margin: 0;
}

.insights-list li {
  background: rgba(255,255,255,.055);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: .88rem;
  line-height: 1.5;
}

.kpi-card {
  min-height: 112px;
}

.kpi-value--small {
  font-size: 1.05rem;
  line-height: 1.25;
  word-break: break-word;
}

@media (max-width: 900px) {
  .dashboard-grid--2x2 {
    grid-template-columns: 1fr;
  }

  .chart-card,
  .chart-card--full {
    height: 390px;
    min-height: 390px;
  }

  .chart-card canvas,
  .chart-card--full canvas {
    height: 300px !important;
    max-height: 300px !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   FILTROS
══════════════════════════════════════════════════════════════════════ */
.control-row-filters {
  display: grid;
  grid-template-columns: 1.2fr 140px 140px 1.1fr 1.1fr 2fr;
  gap: 16px;
  align-items: end;
  padding-top: 20px;
}

.filter-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  width: 100%;
}

.filter-wrap--sm,
.filter-wrap--lg {
  min-width: 0;
  width: 100%;
}

.filter-label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
}

.filter-input,
.custom-select-wrap select {
  width: 100%;
  height: 38px;
  appearance: none;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: .84rem;
  padding: 9px 12px;
}

.custom-select-wrap select option {
  background: #172433;
  color: #fff;
}

@media (max-width: 1200px) {
  .control-row-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .control-row-filters {
    grid-template-columns: 1fr;
  }
}

/* ── KPI grid — Alertas ── */
.kpi-grid--alertas {
  width: 100%;
  margin: 20px 0 32px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}

.kpi-grid--alertas .kpi-card {
  width: 100%;
  min-height: 104px;
  padding: 20px 22px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-grid--alertas .kpi-title {
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 7px;
}

.kpi-grid--alertas .kpi-value {
  color: var(--accent2);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.12;
}

.kpi-grid--alertas .kpi-value--small {
  font-size: .98rem;
  line-height: 1.2;
  word-break: break-word;
}

@media (max-width: 1200px) {
  .kpi-grid--alertas {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .kpi-grid--alertas {
    grid-template-columns: 1fr;
  }
}

/* ── KPI grid — Comunicación (compacto) ── */
.kpi-grid--comunicacion {
  width: 100%;
  margin: 16px 0 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-grid--comunicacion .kpi-card {
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-grid--comunicacion .kpi-title {
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
}

.kpi-grid--comunicacion .kpi-value {
  color: var(--accent2);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 1100px) {
  .kpi-grid--comunicacion {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .kpi-grid--comunicacion {
    grid-template-columns: 1fr;
  }
}

/* ── Barra de navegación de la control-card ── */
.control-row-nav {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.control-row-nav h3 {
  margin: 0;
  font-size: 1.05rem;
}

.data-badge {
  justify-self: end;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .control-row-nav {
    grid-template-columns: 1fr;
  }

  .data-badge {
    justify-self: start;
  }

  .view-tabs {
    justify-content: flex-start;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   TABLAS
══════════════════════════════════════════════════════════════════════ */
.table-card {
  /* width: 90%; */
  /* margin: 0 auto 32px; */
  padding: 28px 32px;
}

.table-card h3 {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
}

.table-card table {
  width: 100%;
  min-width: 1050px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.table-card thead th {
  background: rgba(7, 17, 27, .95);
  color: #9ed8ff;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(79,195,247,.22);
  white-space: nowrap;
}

.table-card tbody td {
  color: #eaf3f8;
  font-size: .82rem;
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.055);
  vertical-align: middle;
}

.table-card tbody tr:nth-child(even) {
  background: rgba(255,255,255,.025);
}

.table-card tbody tr:hover {
  background: rgba(79,195,247,.08);
}

.table-card tbody td:first-child {
  color: var(--accent2);
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════════════
   DETALLE / PAGINACIÓN / BOTONES
══════════════════════════════════════════════════════════════════════ */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.detail-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 20px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: var(--text-muted);
  font-size: .88rem;
}

.pagination-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pagination-controls button {
  min-width: 105px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: .20s;
    color: white;
}

.btn-nuevo {
    background: linear-gradient(135deg, #1786c8, #4FC3F7);
    box-shadow: 0 8px 18px rgba(79,195,247,.22);
}

.btn-nuevo:hover {
    transition: .22s cubic-bezier(.4,0,.2,1);
}

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

.btn-action:disabled {
    opacity: .35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ══════════════════════════════════════════════════════════════════════
   CHART CARD HEADER + MINI FILTROS
══════════════════════════════════════════════════════════════════════ */
.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.chart-card h3 {
  margin: 0;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.chart-mini-filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.mini-filter label {
  font-size: .66rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mini-filter select {
  height: 34px;
  min-width: 130px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: .78rem;
  padding: 0 10px;
  outline: none;
}

.mini-filter select option {
  background: #172433;
  color: #fff;
}

.trend-card canvas {
  height: 300px !important;
  max-height: 300px !important;
}

@media (max-width: 900px) {
  .chart-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-mini-filters {
    width: 100%;
  }

  .mini-filter {
    flex: 1 1 130px;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   TOAST (mínimo, para que los mensajes de error se vean bien)
══════════════════════════════════════════════════════════════════════ */
.toast-success {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(9,20,31,.96);
  color: var(--text);
  border: 1px solid rgba(79,195,247,.35);
  border-left: 4px solid var(--accent2);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: .85rem;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
  z-index: 1100;
  max-width: 360px;
}

.toast-success.error {
  border-left-color: var(--red);
}

/* ══════════════════════════════════════════════════════════════════════
   LOADING OVERLAY & PROGRESS INDICATOR
══════════════════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  display: flex;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: rgba(44, 62, 80, 0.95);
  padding: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(79, 195, 247, 0.2);
  border-top-color: #4FC3F7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-container p {
  font-size: 1.1rem;
  color: #ecf0f1;
  margin: 0;
  font-weight: 500;
}

.progress-indicator {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.95);
  padding: 16px 24px;
  border-radius: 8px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.progress-text {
  color: #ecf0f1;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.progress-dots .dot {
  width: 8px;
  height: 8px;
  background: #4FC3F7;
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

.progress-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.progress-dots .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1); }
}
