.dash-layout {
  display: flex;
  min-height: 100vh;
  background-color: #f0f4f0;
  font-family: 'Lato', sans-serif;
}

/* Contenido principal a la derecha del sidebar */
.dash-main {
  flex: 1;
  overflow: auto;
  min-width: 0; /* Evita que el contenido desborde el flex */
}


/* ── SIDEBAR ──────────────────────────────────────────────── */

.sidebar {
  width: 210px;
  min-width: 210px;
  background: linear-gradient(180deg, #0f3d22 0%, #1a6b3c 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: 3px 0 15px rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Cabecera del sidebar con logo y nombre del proyecto */
.sidebar-header {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-logo {
  font-size: 30px;
  margin-bottom: 5px;
}

.sidebar-titulo {
  color: #fff;
  font-family: 'Merriweather', serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-subtitulo {
  color: rgba(255, 255, 255, 0.50);
  font-size: 10px;
  margin-top: 2px;
}

/* Boton de regreso al inicio */
.sidebar-back {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.2s;
  margin: 14px 14px 6px;
}

.sidebar-back:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Etiqueta de seccion MODULOS */
.sidebar-seccion-label {
  color: rgba(255, 255, 255, 0.35);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 18px 5px;
}

/* Lista de modulos en el sidebar */
.sidebar-modulos {
  padding: 0 10px;
  flex: 1;
}

/* Item de modulo activo (M1) */
.modulo-item-activo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  margin-bottom: 3px;
  border-left: 3px solid #2ecc71;
}

/* Items de modulos inactivos (M2, M3, M4) */
.modulo-item-inactivo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  margin-bottom: 3px;
  opacity: 0.40;
  cursor: not-allowed;
}

.modulo-icono {
    font-size: 16px;
    color: #ffffff;
    flex-shrink: 0;
}

.modulo-nombre {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.modulo-estado {
  color: rgba(255, 255, 255, 0.50);
  font-size: 10px;
}

/* Pie del sidebar */
.sidebar-footer {
  color: rgba(255, 255, 255, 0.28);
  font-size: 9px;
  text-align: center;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}


/* ── ENCABEZADO DEL DASHBOARD ─────────────────────────────── */

.dash-header {
  background: linear-gradient(135deg, #1a6b3c 0%, #2ecc71 100%);
  padding: 18px 26px;
  margin-bottom: 18px;
  box-shadow: 0 3px 12px rgba(26, 107, 60, 0.20);
}

.dash-header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dash-titulo {
  color: #fff;
  margin: 0;
  font-size: 19px;
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

.dash-subtitulo {
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  font-size: 12px;
}

.dash-badge {
  margin-left: auto;
}


/* ── PANEL DE FILTROS ─────────────────────────────────────── */

.filtros-card {
  border-radius: 12px !important;
  border: none !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07) !important;
  margin-bottom: 18px;
}

.filtro-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: block;
}


/* ── TARJETAS KPI ─────────────────────────────────────────── */

.kpi-card {
  border-radius: 10px !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  margin-bottom: 8px;
}

.kpi-valor {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}

.kpi-etiqueta {
  font-size: 11px;
  font-weight: 600;
  color: #2c3e50;
  margin-top: 2px;
}

.kpi-sub {
  font-size: 10px;
  color: #999;
}


/* ── TARJETAS DE GRAFICAS ─────────────────────────────────── */

.grafica-card {
  border-radius: 12px !important;
  border: none !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07) !important;
  background: #ffffff !important;
  height: 100%;
}


/* ── PANEL DE IA ──────────────────────────────────────────── */

.ia-panel {
  background: linear-gradient(135deg, #0f3d22 0%, #1a6b3c 100%);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(26, 107, 60, 0.25);
}

.ia-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.ia-panel-titulo {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Merriweather', serif;
}

.ia-panel-subtitulo {
  color: rgba(255, 255, 255, 0.60);
  font-size: 11px;
}

.ia-panel-placeholder {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-style: italic;
  margin: 0;
}

/* Boton de generar analisis */
.btn-ia {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  transition: background 0.2s;
}

.btn-ia:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Etiquetas de seccion dentro del panel IA */
.ia-seccion-label {
  color: #a5f3c8;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Texto de conclusion e IA */
.ia-texto {
  color: rgba(255, 255, 255, 0.90);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  padding-left: 24px;
}

.ia-texto-concientizacion {
  color: rgba(255, 255, 255, 0.90);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  padding-left: 24px;
  font-style: italic;
}

.ia-error {
  color: #ff9999;
  font-size: 13px;
  padding: 10px;
  background: rgba(255, 0, 0, 0.10);
  border-radius: 8px;
}

.ia-separador {
  border-color: rgba(255, 255, 255, 0.10);
  margin: 12px 0;
}


/* ── SECCION EXPLICATIVA DE PLOTLY ────────────────────────── */

.plotly-seccion {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e0e7e0;
  padding: 24px 28px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.plotly-seccion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e8f5e9;
}

.plotly-seccion-titulo {
  font-weight: 700;
  font-size: 15px;
  color: #1a6b3c;
  font-family: 'Merriweather', serif;
}

.plotly-seccion-sub {
  font-size: 11px;
  color: #888;
}

.plotly-card {
  background: #f8fff8;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #c8e6c9;
  height: 100%;
}

.plotly-card-titulo {
  font-weight: 700;
  font-size: 12px;
  color: #1a6b3c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Chips de codigo (imports) */
.codigo-chip {
  background: #e8f5e9;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #1a6b3c;
}

/* Items de graficas y componentes */
.plotly-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.plotly-item-icono {
  font-size: 14px;
  flex-shrink: 0;
}

.plotly-item-nombre {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  font-family: 'Courier New', monospace;
}

.plotly-item-desc {
  font-size: 10px;
  color: #888;
  margin-top: 1px;
}

/* Pasos del callback */
.callback-paso {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.callback-num {
  width: 18px;
  height: 18px;
  background: #1a6b3c;
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.callback-texto {
  font-size: 11px;
  color: #555;
}


/* ── PIE DE PAGINA DEL DASHBOARD ──────────────────────────── */

.dash-footer {
  text-align: center;
  font-size: 10px;
  color: #aaa;
  padding: 4px 0 12px;
}


/* ── RESPONSIVE ───────────────────────────────────────────── */

/* En pantallas pequeñas el sidebar se oculta */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .dash-titulo {
    font-size: 16px;
  }

  .dash-header {
    padding: 14px 16px;
  }
}
