/* ============================================
   KPI Cards - Dashboard
   ============================================ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

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

.kpi-card:nth-child(2)::before {
    background: linear-gradient(90deg, var(--success-500), var(--success-400));
}

.kpi-card:nth-child(3)::before {
    background: linear-gradient(90deg, var(--warning-500), var(--warning-400));
}

.kpi-card:nth-child(4)::before {
    background: linear-gradient(90deg, var(--danger-500), var(--danger-400));
}

.kpi-card:nth-child(5)::before {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.kpi-card:nth-child(6)::before {
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
}

.kpi-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem 0;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

/* ============================================
   Quota Bar
   ============================================ */

.quota-bar {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
}

.quota-bar p {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

progress {
    width: 100%;
    height: 12px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--gray-200);
}

progress::-webkit-progress-bar {
    background: var(--gray-200);
    border-radius: var(--radius-full);
}

progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: var(--radius-full);
}

/* Custom div-based progress bar (used where native <progress> isn't suitable) */
.progress-track {
    background: var(--gray-200);
    border-radius: 999px;
    height: 24px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: 999px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.progress-track-sm { height: 8px; }

/* Dashboard-specific layout helpers */
.form-inline-compact {
    margin: 0;
    max-width: none;
    flex-direction: row;
}

.chart-thumb {
    width: 120px;
    height: 120px;
}

.chart-max-h-160 {
    max-height: 160px;
}


/* ============================================
   Stats Cards (Alternative KPI)
   ============================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
    color: var(--primary-600);
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success-100, #d1fae5), var(--success-50));
    color: var(--success-600);
}

.stat-icon.warning {
    background: linear-gradient(135deg, #fef3c7, var(--warning-50));
    color: var(--warning-600);
}

.stat-icon.danger {
    background: linear-gradient(135deg, #fee2e2, var(--danger-50));
    color: var(--danger-600);
}

.stat-content h4 {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-content .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-content .trend {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.stat-content .trend.up {
    color: var(--success-500);
}

.stat-content .trend.down {
    color: var(--danger-500);
}


/* ============================================
   Charts Container
   ============================================ */

.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}


/* ============================================
   Glassmorphism Effects
   ============================================ */

.kpi-card,
.stat-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .kpi-card,
[data-theme="dark"] .stat-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}


/* ============================================
   Card Stagger Animations
   ============================================ */

.stats-row .stat-card,
.kpi-grid .kpi-card {
    animation: cardFadeIn 0.4s ease-out backwards;
    will-change: transform, opacity;
}

.stats-row .stat-card:nth-child(1),
.kpi-grid .kpi-card:nth-child(1) { animation-delay: 0.05s; }
.stats-row .stat-card:nth-child(2),
.kpi-grid .kpi-card:nth-child(2) { animation-delay: 0.1s; }
.stats-row .stat-card:nth-child(3),
.kpi-grid .kpi-card:nth-child(3) { animation-delay: 0.15s; }
.stats-row .stat-card:nth-child(4),
.kpi-grid .kpi-card:nth-child(4) { animation-delay: 0.2s; }
.stats-row .stat-card:nth-child(5),
.kpi-grid .kpi-card:nth-child(5) { animation-delay: 0.25s; }
.stats-row .stat-card:nth-child(6),
.kpi-grid .kpi-card:nth-child(6) { animation-delay: 0.3s; }

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

