/**
 * ============================================================================
 * PPG REFINISH CRM v2.0 - ANALYTICS DASHBOARD STYLES
 * ============================================================================
 * Week 2 - Days 7-8: Dashboard styling for Chart.js visualizations
 * ============================================================================
 */

/* ====================================================================
   ANALYTICS DASHBOARD LAYOUT
   ==================================================================== */

.analytics-dashboard {
    padding: 0;
}

/* Dashboard Header */
.dashboard-header {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dashboard-header .page-title {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.dashboard-tabs .tab-btn {
    padding: 12px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.dashboard-tabs .tab-btn:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

.dashboard-tabs .tab-btn.active {
    background: #1976D2;
    border-color: #1976D2;
    color: #fff;
}

.dashboard-tabs .tab-btn i {
    font-size: 16px;
}

/* Dashboard Controls */
.dashboard-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.dashboard-controls .form-control {
    width: 180px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.dashboard-controls .btn {
    padding: 8px 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ====================================================================
   KPI CARDS GRID
   ==================================================================== */

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

.kpi-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: all 0.3s ease;
}

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

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon i {
    font-size: 24px;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
    line-height: 1;
}

.kpi-change {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-change.positive {
    color: #388E3C;
}

.kpi-change.negative {
    color: #C62828;
}

.kpi-change i {
    font-size: 12px;
}

/* ====================================================================
   CHARTS GRID
   ==================================================================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 24px;
}

.chart-card {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-card-wide {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.chart-info {
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-info i {
    color: #1976D2;
}

.chart-container {
    position: relative;
    width: 100%;
}

/* ====================================================================
   RESPONSIVE DESIGN
   ==================================================================== */

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card-wide {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 16px;
    }
    
    .dashboard-header .page-title {
        font-size: 20px;
    }
    
    .dashboard-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .dashboard-tabs .tab-btn {
        width: 100%;
        justify-content: center;
    }
    
    .dashboard-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .dashboard-controls .form-control {
        width: 100%;
    }
    
    .dashboard-controls .btn {
        width: 100%;
        justify-content: center;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        padding: 16px;
    }
    
    .chart-container {
        height: 300px !important;
    }
}

@media (max-width: 480px) {
    .kpi-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .kpi-value {
        font-size: 24px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ====================================================================
   DASHBOARD-SPECIFIC STYLES
   ==================================================================== */

/* Revenue Dashboard */
.dashboard-revenue {
    /* Specific styles for revenue dashboard if needed */
}

/* Training Dashboard */
.dashboard-training {
    /* Specific styles for training dashboard if needed */
}

/* Health Dashboard */
.dashboard-health {
    /* Specific styles for health dashboard if needed */
}

/* Digital Dashboard */
.dashboard-digital {
    /* Specific styles for digital dashboard if needed */
}

/* ====================================================================
   CHART CUSTOMIZATION
   ==================================================================== */

/* Ensure charts are responsive */
canvas {
    max-width: 100%;
    height: auto !important;
}

/* Loading state */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #888;
    font-size: 14px;
}

.chart-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #888;
    text-align: center;
}

.chart-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    color: #ddd;
}

.chart-empty p {
    margin: 0;
    font-size: 14px;
}

/* ====================================================================
   PRINT STYLES
   ==================================================================== */

@media print {
    .dashboard-header {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .dashboard-tabs,
    .dashboard-controls {
        display: none;
    }
    
    .chart-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .kpi-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
