/* ========================================
   ANALYTICS DASHBOARD - COMPREHENSIVE STYLING
   ======================================== */

.analytics-dashboard-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem 1rem;
}

/* ========== PAGE HEADER ========== */
.analytics-page-header {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
}

.analytics-page-header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.analytics-page-header .header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.analytics-page-header .header-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.analytics-page-header .header-text h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.85rem;
    color: #2c3e50;
    font-weight: 700;
}

.analytics-page-header .header-text .subtitle {
    margin: 0;
    color: #6c757d;
    font-size: 1rem;
}

.analytics-page-header .header-actions {
    display: flex;
    gap: 1rem;
}

.analytics-page-header .btn-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.analytics-page-header .btn-refresh {
    background: #6c757d;
    color: white;
}

.analytics-page-header .btn-refresh:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.analytics-page-header .btn-export {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.analytics-page-header .btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}

/* ========== METRICS SUMMARY ========== */
.metrics-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, rgba(102, 126, 234, 1) 0%, rgba(118, 75, 162, 1) 100%);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.metric-card.metric-primary::before {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.metric-card.metric-success::before {
    background: linear-gradient(180deg, #28a745 0%, #20c997 100%);
}

.metric-card.metric-info::before {
    background: linear-gradient(180deg, #17a2b8 0%, #138496 100%);
}

.metric-card.metric-warning::before {
    background: linear-gradient(180deg, #ffc107 0%, #ff9800 100%);
}

.metric-card .metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.metric-primary .metric-icon {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
}

.metric-success .metric-icon {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(32, 201, 151, 0.1) 100%);
    color: #28a745;
}

.metric-info .metric-icon {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1) 0%, rgba(19, 132, 150, 0.1) 100%);
    color: #17a2b8;
}

.metric-warning .metric-icon {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 152, 0, 0.1) 100%);
    color: #ffc107;
}

.metric-card .metric-content {
    flex: 1;
}

.metric-card .metric-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.metric-card .metric-content p {
    margin: 0 0 0.5rem 0;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 600;
}

.metric-card .metric-change {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
}

.metric-card .metric-change.positive {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.metric-card .metric-change.negative {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.metric-card .metric-change.neutral {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

/* ========== CHARTS GRID ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

.chart-container.chart-large {
    grid-column: span 12;
}

.chart-container.chart-medium {
    grid-column: span 6;
}

.chart-container.chart-small {
    grid-column: span 4;
}

/* ========== INSIGHTS PANEL ========== */
.insights-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    padding: 2rem;
}

.insights-panel .panel-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.insights-panel .panel-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.insights-panel .panel-header h2 i {
    color: #ffc107;
    font-size: 1.5rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.insight-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.insight-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.insight-card.insight-success {
    border-left-color: #28a745;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0%, rgba(32, 201, 151, 0.05) 100%);
}

.insight-card.insight-warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.05) 0%, rgba(255, 152, 0, 0.05) 100%);
}

.insight-card.insight-info {
    border-left-color: #17a2b8;
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.05) 0%, rgba(19, 132, 150, 0.05) 100%);
}

.insight-card.insight-primary {
    border-left-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.insight-card .insight-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.insight-success .insight-icon {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.insight-warning .insight-icon {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.insight-info .insight-icon {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
}

.insight-primary .insight-icon {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.insight-card .insight-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    color: #2c3e50;
    font-weight: 700;
}

.insight-card .insight-content p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .chart-container.chart-medium {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .analytics-dashboard-wrapper {
        padding: 1rem 0.5rem;
    }

    .analytics-page-header {
        padding: 1.25rem;
    }

    .analytics-page-header .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .analytics-page-header .header-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .analytics-page-header .header-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .analytics-page-header .header-text h1 {
        font-size: 1.5rem;
    }

    .analytics-page-header .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .analytics-page-header .btn-header {
        width: 100%;
        justify-content: center;
    }

    .metrics-summary-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container.chart-large,
    .chart-container.chart-medium,
    .chart-container.chart-small {
        grid-column: span 1;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card {
    animation: fadeInUp 0.5s ease-out;
}

.metric-card:nth-child(1) { animation-delay: 0.1s; }
.metric-card:nth-child(2) { animation-delay: 0.2s; }
.metric-card:nth-child(3) { animation-delay: 0.3s; }
.metric-card:nth-child(4) { animation-delay: 0.4s; }

.chart-container {
    animation: fadeInUp 0.6s ease-out;
}

.insight-card {
    animation: fadeInUp 0.5s ease-out;
}

/* ========== PRINT STYLES ========== */
@media print {
    .analytics-page-header .header-actions,
    .btn-refresh-chart {
        display: none !important;
    }

    .analytics-dashboard-wrapper {
        background: white;
    }

    .metric-card,
    .chart-container,
    .insights-panel {
        box-shadow: none;
        page-break-inside: avoid;
    }
}
