/* ==========================================================================
   index.css — Dashboard principal (views/index.php)
   Todas las clases son específicas de esta vista.
   Tokens de color: siempre desde theme.css, nunca hardcodeados.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Contenedor principal
   -------------------------------------------------------------------------- */
.dashboard-home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 40px;
}

/* --------------------------------------------------------------------------
   2. Hero — título y bienvenida
   -------------------------------------------------------------------------- */
.dashboard-hero {
  text-align: center;
  margin-bottom: 14px;
}

.dashboard-titulo {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.3px;
}

.dashboard-titulo-accent {
  color: var(--color-primario);
}

.dashboard-bienvenida {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* --------------------------------------------------------------------------
   3. Chips de alertas — compactos y elegantes
   -------------------------------------------------------------------------- */
.dashboard-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}

.dashboard-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.dashboard-chip:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-arrow {
  opacity: 0.6;
  font-size: 0.78rem;
}

/* Danger — vencidas */
.dashboard-chip-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #dc2626;
}

.dashboard-chip-danger .chip-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.20);
}

.dashboard-chip-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #dc2626;
}

html.modo-oscuro .dashboard-chip-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.30);
  color: #fca5a5;
}

html.modo-oscuro .dashboard-chip-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

/* Warning — por vencer */
.dashboard-chip-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
  color: #d97706;
}

.dashboard-chip-warning .chip-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.20);
}

.dashboard-chip-warning:hover {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
}

html.modo-oscuro .dashboard-chip-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.30);
  color: #fcd34d;
}

html.modo-oscuro .dashboard-chip-warning:hover {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}

/* Muted — sin actividad */
.dashboard-chip-muted {
  background: rgba(107, 114, 128, 0.10);
  border-color: rgba(107, 114, 128, 0.20);
  color: #6b7280;
}

.dashboard-chip-muted .chip-dot {
  background: #9ca3af;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.15);
}

.dashboard-chip-muted:hover {
  background: rgba(107, 114, 128, 0.16);
  color: #6b7280;
}

html.modo-oscuro .dashboard-chip-muted {
  background: rgba(107, 114, 128, 0.12);
  border-color: rgba(107, 114, 128, 0.25);
  color: #9ca3af;
}

html.modo-oscuro .dashboard-chip-muted:hover {
  background: rgba(107, 114, 128, 0.20);
  color: #9ca3af;
}
/* --------------------------------------------------------------------------
   3b. Variantes de alerta — vencida (rojo) y por vencer (amarillo)
   -------------------------------------------------------------------------- */
.dashboard-alert-danger {
  border-left-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.10) !important;
  color: #991b1b !important;
}

html.modo-oscuro .dashboard-alert-danger {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-left-color: #ef4444 !important;
}

html.modo-oscuro .dashboard-alert-danger .dashboard-alert-link {
  color: #f87171 !important;
}

.dashboard-alert-danger .dashboard-alert-link {
  color: #b91c1c !important;
}

.dashboard-alert-warning {
  border-left-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.10) !important;
  color: #92400e !important;
}

html.modo-oscuro .dashboard-alert-warning {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fcd34d !important;
  border-left-color: #f59e0b !important;
}

html.modo-oscuro .dashboard-alert-warning .dashboard-alert-link {
  color: #fbbf24 !important;
}

.dashboard-alert-warning .dashboard-alert-link {
  color: #b45309 !important;
}

/* --------------------------------------------------------------------------
   4. Botones de acción
   -------------------------------------------------------------------------- */
.dashboard-acciones {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.dashboard-btn-primary,
.dashboard-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.dashboard-btn-primary {
  background: var(--color-primario);
  color: #ffffff;
  border-color: var(--color-primario);
}

.dashboard-btn-primary:hover {
  opacity: 0.88;
  color: #ffffff;
}

.dashboard-btn-secondary {
  background: var(--surface-1);
  color: var(--text);
  border-color: var(--border-mid);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}

.dashboard-btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
  border-color: var(--color-primario);
}

body.modo-oscuro .dashboard-btn-secondary,
html.modo-oscuro .dashboard-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
}

body.modo-oscuro .dashboard-btn-secondary:hover,
html.modo-oscuro .dashboard-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

/* --------------------------------------------------------------------------
   5. Layout principal — gráficos + sidebar
   -------------------------------------------------------------------------- */
.dashboard-main {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: start;
}

.dashboard-main.sin-express {
  grid-template-columns: 1fr;
}

.dashboard-main.sin-express .dashboard-graficos {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   6. Gráficos — grilla de 3 columnas
   -------------------------------------------------------------------------- */
.dashboard-graficos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.grafico-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.grafico-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

body.modo-oscuro .grafico-card,
html.modo-oscuro .grafico-card {
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

body.modo-oscuro .grafico-card:hover,
html.modo-oscuro .grafico-card:hover {
  box-shadow: var(--shadow-lg);
}

.grafico-header {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

.grafico-body {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  width: 100%;
  padding: 8px;
}

.grafico-entrada {
  max-width: 150px !important;
  max-height: 150px !important;
  margin: 0 auto;
  display: block;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s ease, transform 0.6s ease;
  cursor: pointer;
}

.grafico-entrada.visible {
  opacity: 1;
  transform: scale(1);
}

.grafico-card:hover .grafico-entrada {
  transform: scale(1.03);
}

/* --------------------------------------------------------------------------
   7. Contadores clicables bajo cada gráfico
   -------------------------------------------------------------------------- */
.grafico-contadores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  margin-top: 10px;
}

.grafico-contador-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grafico-contador-item:hover {
  border-color: var(--border-mid);
  background: var(--surface-3);
}

.grafico-contador-item.contador-activo {
  border-color: var(--border-mid);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.grafico-contador-val {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
}

.grafico-contador-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   8. Sidebar — Tareas Express
   -------------------------------------------------------------------------- */
.express-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

body.modo-oscuro .express-card,
html.modo-oscuro .express-card {
  background: var(--surface-2);
}

.express-titulo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
}

.express-icono {
  font-size: 0.875rem;
}

.express-badge {
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.express-ver-todas {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-primario);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.express-ver-todas:hover {
  text-decoration: underline;
}

.express-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.express-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.express-item:hover {
  border-color: var(--border-mid);
  background: var(--surface-3);
}

.express-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.express-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.express-tech {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primario);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.express-falla {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.express-nota {
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   9. Tooltip flotante (gráficos)
   -------------------------------------------------------------------------- */
.tooltip-jarvis {
  position: fixed;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.tooltip-jarvis.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   10. main vacío (el <main> del template queda vacío en index)
   -------------------------------------------------------------------------- */
main.content-index {
  display: none;
}

/* --------------------------------------------------------------------------
   11. Responsive
   -------------------------------------------------------------------------- */

/* Pantallas grandes: más aire arriba */
@media (min-width: 1600px) {
  .dashboard-home {
    padding: 80px 24px 40px;
  }
}

@media (min-width: 1920px) {
  .dashboard-home {
    padding: 80px 24px 20px;
  }
}

/* Pantallas medianas */
@media (max-width: 1400px) and (min-width: 1025px) {
  .dashboard-home {
    padding: 60px 16px 24px;
  }

  .dashboard-main {
    grid-template-columns: 1fr 220px;
    gap: 12px;
  }

  .dashboard-graficos {
    gap: 10px;
  }

  .grafico-card {
    padding: 10px 8px 8px;
  }

  .grafico-entrada {
    max-width: 110px !important;
    max-height: 110px !important;
  }

  .grafico-contadores {
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }

  .grafico-contador-val {
    font-size: 0.8rem;
  }

  .grafico-contador-lbl {
    font-size: 0.65rem;
  }

  .dashboard-titulo {
    font-size: 1.2rem;
  }

  .dashboard-bienvenida {
    font-size: 0.8rem;
    margin-top: 2px;
  }

  .dashboard-hero {
    margin-bottom: 8px;
  }

  .dashboard-alert {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

  .dashboard-acciones {
    margin-bottom: 14px;
  }

  .express-card {
    padding: 10px;
  }

  .express-titulo {
    font-size: 0.8rem;
    margin-bottom: 7px;
  }

  .express-item {
    padding: 6px 8px;
  }

  .express-nota {
    font-size: 0.7rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .express-falla {
    font-size: 0.7rem;
  }

  .express-id {
    font-size: 0.65rem;
  }

  .express-list {
    gap: 4px;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .dashboard-graficos {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-express {
    max-width: 100%;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .dashboard-home {
    padding: 12px;
  }

  .dashboard-graficos {
    grid-template-columns: 1fr;
  }
}