/* ══════════════════════════════════════════════════════════════
   DASHBOARD REDESIGN — CEO-OPTIMIZED STYLES
   Structure: KPIs → Alerts → Performers → Insights → Ranking
   ══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────
   NIVEL 1: KPIs GLOBALES
   ────────────────────────────────────────────────────────────── */

.kpi-global-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.kpi-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-main);
  margin: 0;
}

.kpi-period {
  font-size: 13px;
  color: var(--graphite-400);
  font-weight: 500;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: #FAFBFC;
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card:hover {
  background: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--graphite-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-arrow {
  font-size: 18px;
  font-weight: bold;
}

.kpi-arrow.positive {
  color: #10B981;
}

.kpi-arrow.negative {
  color: #EF4444;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-main);
  margin-bottom: 8px;
}

.kpi-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.kpi-target {
  color: var(--graphite-500);
  font-weight: 500;
}

.kpi-status {
  font-weight: 600;
  color: #10B981;
}

.kpi-status:contains('BELOW') {
  color: #EF4444;
}

/* ──────────────────────────────────────────────────────────────
   NIVEL 2: ZONA CRÍTICA (Intervención urgente)
   ────────────────────────────────────────────────────────────── */

.critical-zone {
  background: linear-gradient(135deg, #FEF2F2 0%, #FAFBFC 100%);
  border: 2px solid #FEE2E2;
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.critical-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #FEE2E2;
}

.critical-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #DC2626;
  margin: 0 0 4px 0;
}

.critical-subtitle {
  font-size: 14px;
  color: var(--graphite-500);
  margin: 0;
}

.critical-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.critical-card {
  background: var(--bg-card);
  border: 2px solid #FEE2E2;
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.3s ease;
}

.critical-card:hover {
  border-color: #FCA5A5;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.critical-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.critical-status {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-main);
}

.critical-level {
  font-size: 11px;
  font-weight: 700;
  color: #DC2626;
  background: #FEE2E2;
  padding: 4px 8px;
  border-radius: 4px;
}

.critical-stats {
  margin-bottom: 12px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--graphite-500);
  font-weight: 500;
}

.stat-value {
  font-weight: 700;
  color: var(--accent-main);
}

.stat-value .trend {
  margin-left: 4px;
  font-size: 14px;
}

.stat-value .trend.negative {
  color: #EF4444;
}

.critical-action {
  margin-top: 12px;
}

.btn-coaching {
  width: 100%;
  padding: 8px 12px;
  background: #EF4444;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-coaching:hover {
  background: #DC2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────────────────────
   NIVEL 3: TOP PERFORMERS
   ────────────────────────────────────────────────────────────── */

.top-performers-zone {
  background: linear-gradient(135deg, #F0FDF4 0%, #FAFBFC 100%);
  border: 2px solid #DCFCE7;
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.performers-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #DCFCE7;
}

.performers-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #059669;
  margin: 0;
}

.performers-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.performer-card {
  background: var(--bg-card);
  border: 2px solid #DCFCE7;
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.3s ease;
}

.performer-card:hover {
  border-color: #86EFAC;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.performer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.performer-status {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-main);
}

.performer-badge {
  font-size: 11px;
  font-weight: 700;
  color: white;
  background: #10B981;
  padding: 4px 8px;
  border-radius: 4px;
}

.performer-stats {
  margin-bottom: 12px;
}

.performer-pattern {
  font-size: 13px;
  color: var(--graphite-500);
  margin-bottom: 12px;
  padding: 8px;
  background: #F0FDF4;
  border-radius: 6px;
  border-left: 3px solid #10B981;
}

.performer-action {
  margin-top: 12px;
}

.btn-learn {
  width: 100%;
  padding: 8px 12px;
  background: #10B981;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-learn:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.arrow-up {
  color: #10B981;
  font-weight: bold;
}

/* ──────────────────────────────────────────────────────────────
   NIVEL 4: INSIGHTS & PATRONES
   ────────────────────────────────────────────────────────────── */

.insights-zone {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
}

.insights-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.insights-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-main);
  margin: 0;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.insight-box {
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
}

.insight-box.success {
  background: #F0FDF4;
  border-left-color: #10B981;
}

.insight-box.warning {
  background: #FEF3C7;
  border-left-color: #EAB308;
}

.insight-box h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px 0;
}

.insight-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.insight-box li {
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--graphite-700);
}

.insight-box li strong {
  color: var(--accent-main);
}

.who {
  display: block;
  font-size: 11px;
  color: var(--graphite-500);
  margin-top: 2px;
}

.impact {
  margin-left: 8px;
  font-weight: 600;
  color: #EF4444;
}

.insight-recommendation {
  background: #EEF2FF;
  border: 1px solid #E0E7FF;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 14px;
  color: var(--accent-main);
  border-left: 4px solid var(--accent-primary);
}

/* ──────────────────────────────────────────────────────────────
   NIVEL 5: RANKING COMPLETO
   ────────────────────────────────────────────────────────────── */

.ranking-zone {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ranking-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-main);
  margin: 0;
}

.btn-sort-toggle {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sort-toggle:hover {
  background: var(--accent-light);
  border-color: var(--border-hover);
}

.ranking-table-container {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ranking-table thead {
  background: var(--accent-light);
  border-bottom: 2px solid var(--border);
}

.ranking-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--graphite-600);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.ranking-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.ranking-table tbody tr:hover {
  background: var(--accent-light);
}

.ranking-row.ranking-critical {
  background: rgba(239, 68, 68, 0.05);
}

.ranking-row.ranking-warning {
  background: rgba(234, 179, 8, 0.05);
}

.ranking-table td {
  padding: 12px;
  color: var(--graphite-700);
}

.name-cell {
  font-weight: 600;
  color: var(--accent-main);
}

.metric-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-cell .value {
  font-weight: 600;
  color: var(--accent-main);
}

.metric-cell .trend {
  font-weight: bold;
  color: #10B981;
}

.metric-cell .trend.negative {
  color: #EF4444;
}

.status-cell {
  font-size: 16px;
}

.action-cell {
  text-align: center;
}

.btn-action {
  padding: 6px 12px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
}

.btn-action.btn-coaching {
  border-color: #EF4444;
  color: #EF4444;
}

.btn-action.btn-coaching:hover {
  background: #EF4444;
  color: white;
}

.btn-action.btn-monitor {
  border-color: #10B981;
  color: #10B981;
}

.btn-action.btn-monitor:hover {
  background: #10B981;
  color: white;
}

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

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .critical-cards-container,
  .performers-cards-container {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-global-container,
  .critical-zone,
  .top-performers-zone,
  .insights-zone,
  .ranking-zone {
    padding: 20px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .critical-cards-container,
  .performers-cards-container {
    grid-template-columns: 1fr;
  }

  .ranking-table {
    font-size: 12px;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 8px;
  }
}

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

  .kpi-card {
    padding: 12px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .critical-header,
  .performers-header,
  .insights-header,
  .ranking-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-sort-toggle {
    margin-top: 12px;
  }

  .ranking-table-container {
    overflow: auto;
  }
}

/* ──────────────────────────────────────────────────────────────
   ANIMATIONS
   ────────────────────────────────────────────────────────────── */

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-global-container,
.critical-zone,
.top-performers-zone,
.insights-zone,
.ranking-zone {
  animation: slideInUp 0.4s ease-out;
}

.critical-card,
.performer-card {
  animation: slideInUp 0.4s ease-out;
}
