/* ═══════════════════════════════════════════════════════════
   HPS Servicio Social — Design System
   Inspirado en Google Data Studio / Looker Studio
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --color-brand:       #6366f1;
  --color-brand-dark:  #4f46e5;
  --color-brand-light: #e0e7ff;
  --color-bg:          #f8fafc;
  --color-surface:     #ffffff;
  --color-border:      #f1f5f9;
  --color-text:        #1e293b;
  --color-muted:       #64748b;
  --radius-card:       1rem;
  --shadow-card:       0 1px 3px 0 rgb(0 0 0 / .07), 0 1px 2px -1px rgb(0 0 0 / .05);
  --shadow-card-hover: 0 8px 25px -5px rgb(0 0 0 / .10), 0 4px 10px -5px rgb(0 0 0 / .06);
  --transition-base:   200ms cubic-bezier(.4, 0, .2, 1);
}

/* ── Reset mínimo ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--color-bg); color: var(--color-text); }

/* ═══════════════════════════════════════════════════════════
   ANIMACIONES
   ═══════════════════════════════════════════════════════════ */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-once {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

.animate-fade-in  { animation: fade-in  .35s ease both; }
.animate-slide-up { animation: slide-up .40s ease both; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar {
  box-shadow: 1px 0 0 0 #f1f5f9;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; height: 100%;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }
  .sidebar.open { transform: translateX(0); }
}

/* ── Nav links ─────────────────────────────────────────────── */
.nav-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .75rem;
  border-radius: .625rem;
  font-size: .8125rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  transition: background var(--transition-base), color var(--transition-base);
}
.nav-link:hover {
  background: #f8fafc;
  color: #1e293b;
}
.nav-link--active {
  background: var(--color-brand-light);
  color: var(--color-brand-dark);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════ */
.kpi-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.kpi-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.kpi-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
}

/* ═══════════════════════════════════════════════════════════
   CHART CARDS (Google Data Studio style)
   ═══════════════════════════════════════════════════════════ */
.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}
.chart-card:hover { box-shadow: var(--shadow-card-hover); }

.chart-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem .75rem;
  border-bottom: 1px solid #f8fafc;
}
.chart-card__title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-text);
}
.chart-card__sub {
  font-size: .75rem;
  color: var(--color-muted);
  margin-top: .125rem;
}
.chart-card__badge {
  font-size: .6875rem;
  font-weight: 600;
  padding: .25rem .625rem;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.chart-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
  position: relative;
  min-height: 220px;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: .375rem; }

.form-label {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .75rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-input {
  width: 100%;
  padding: .5rem .75rem;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--color-text);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  appearance: none;
}
.form-input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgb(99 102 241 / .12);
}
.form-input--error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgb(239 68 68 / .10);
}
.form-error {
  font-size: .75rem;
  color: #ef4444;
  margin-top: .125rem;
}
.form-select {
  width: 100%;
  padding: .5rem .75rem;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--color-text);
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .75rem center;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  outline: none;
  appearance: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.form-select:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgb(99 102 241 / .12);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-brand);
  border: none;
  border-radius: .625rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
}
.btn-primary:hover {
  background: var(--color-brand-dark);
  box-shadow: 0 4px 12px -2px rgb(99 102 241 / .40);
}
.btn-primary:active { transform: scale(.97); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: .625rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}
.btn-ghost:hover {
  background: #f8fafc;
  color: var(--color-text);
  border-color: #cbd5e1;
}

/* ═══════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════ */
.th {
  padding: .625rem 1rem;
  text-align: left;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
}
.td {
  padding: .75rem 1rem;
  font-size: .8125rem;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.status-activo    { background: #dcfce7; color: #15803d; }
.status-cerrado   { background: #f0fdf4; color: #166534; }
.status-derivado  { background: #fff7ed; color: #c2410c; }
.status-pendiente { background: #fefce8; color: #a16207; }

.vuln-badge {
  display: inline-flex;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .6875rem;
  font-weight: 700;
}
.vuln-bajo       { background: #dcfce7; color: #15803d; }
.vuln-medio      { background: #fefce8; color: #a16207; }
.vuln-alto       { background: #fff7ed; color: #c2410c; }
.vuln-critico    { background: #fef2f2; color: #b91c1c; }
.vuln-no_evaluado{ background: #f1f5f9; color: #64748b; }

/* ═══════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════ */
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 .5rem;
  border-radius: .375rem;
  font-size: .8125rem;
  color: #64748b;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  transition: background var(--transition-base), color var(--transition-base);
}
.pagination-btn:hover { background: #f8fafc; color: var(--color-text); }
.pagination-btn--active {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════════════════════════════════ */
.flash-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.flash-danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ═══════════════════════════════════════════════════════════
   CHART.JS: estilo Google Data Studio
   ═══════════════════════════════════════════════════════════ */
canvas {
  display: block;
  width: 100% !important;
}

/* ── Loading skeleton ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: .5rem;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Scrollbar personalizado ───────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
