/* --- DASHBOARD ANALÍTICO --- */

.dashboard-container {
  padding: 24px;
  background: var(--bg);
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

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

.dashboard-header h2 {
  color: var(--text);
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dashboard-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-update {
  color: var(--text-light);
  font-size: 0.875rem;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* --- KPI CARDS --- */
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.kpi-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.kpi-content {
  flex: 1;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 0.875rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- CHARTS --- */
.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 32px;
  margin-bottom: 40px;
}

.chart-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.chart-container:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.chart-container h3 {
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-container h3::before {
  content: 'chart';
  font-size: 20px;
  color: var(--primary);
}

.chart {
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-light);
}

.chart canvas {
  width: 100%;
  height: auto;
  max-height: 280px;
}

.chart-placeholder {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-light);
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-light);
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.legend-item::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--gradient-primary);
}

/* --- ALERTS --- */
.dashboard-alerts {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.dashboard-alerts h3 {
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-alerts h3::before {
  content: 'notifications';
  font-size: 20px;
  color: var(--accent);
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border-left: 4px solid;
  transition: all 0.2s ease;
  background: var(--bg);
}

.alert-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.alert-warning {
  border-left-color: var(--accent);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(251, 191, 36, 0.1) 100%);
}

.alert-info {
  border-left-color: var(--primary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.alert-success {
  border-left-color: var(--secondary);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(52, 211, 153, 0.1) 100%);
}

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.alert-warning .alert-icon {
  background: var(--gradient-accent);
}

.alert-info .alert-icon {
  background: var(--gradient-primary);
}

.alert-success .alert-icon {
  background: var(--gradient-secondary);
}

.alert-content {
  flex: 1;
}

.alert-message {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.alert-action {
  background: var(--gradient-button);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.alert-action:hover {
  background: var(--gradient-button-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
  .dashboard-container {
    padding: 20px;
  }
  
  .dashboard-kpis {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }
  
  .dashboard-charts {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 16px;
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .dashboard-header h2 {
    font-size: 2rem;
  }
  
  .dashboard-kpis {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
  }
  
  .kpi-card {
    padding: 20px;
    gap: 16px;
  }
  
  .kpi-icon {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }
  
  .kpi-value {
    font-size: 1.75rem;
  }
  
  .chart-container {
    padding: 20px;
  }
  
  .chart-container h3 {
    font-size: 1.25rem;
  }
  
  .dashboard-alerts {
    padding: 20px;
  }
  
  .dashboard-alerts h3 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .dashboard-container {
    padding: 12px;
  }
  
  .dashboard-header h2 {
    font-size: 1.75rem;
  }
  
  .dashboard-kpis {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .kpi-card {
    padding: 16px;
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .kpi-icon {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }
  
  .kpi-value {
    font-size: 2rem;
  }
  
  .kpi-label {
    font-size: 0.8rem;
  }
  
  .chart-container {
    padding: 16px;
  }
  
  .chart {
    padding: 12px;
  }
  
  .chart canvas {
    max-height: 200px;
  }
  
  .dashboard-alerts {
    padding: 16px;
  }
  
  .alert-item {
    padding: 16px;
    gap: 12px;
  }
  
  .alert-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .alert-message {
    font-size: 0.9rem;
  }
}

/* --- ANIMAÇÕES --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-card {
  animation: fadeInUp 0.5s ease forwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }
.kpi-card:nth-child(5) { animation-delay: 0.5s; }

.chart-container {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.3s;
}

.dashboard-alerts {
  animation: fadeInUp 0.7s ease forwards;
  animation-delay: 0.5s;
}

/* --- DARK MODE SUPPORT --- */
@media (prefers-color-scheme: dark) {
  .alert-warning {
    background: rgba(251, 191, 36, 0.15);
  }
  
  .alert-info {
    background: rgba(59, 130, 246, 0.15);
  }
  
  .alert-success {
    background: rgba(16, 185, 129, 0.15);
  }
}
