/* School Performance Dashboard V3.0 CSS */
/* Extends wizard-redesign.css patterns for dashboard-specific components */

/* Import wizard redesign patterns */
@import url('/css/wizard-redesign.css');

/* Dashboard-specific CSS variables */
:root {
    /* Extend wizard variables with dashboard-specific ones */
    --dashboard-primary: var(--wizard-primary);
    --dashboard-secondary: var(--wizard-secondary);
    --dashboard-success: var(--wizard-success);
    --dashboard-warning: var(--wizard-warning);
    --dashboard-danger: var(--wizard-danger);
    --dashboard-light: var(--wizard-light-gray);
    --dashboard-medium: var(--wizard-medium-gray);
    --dashboard-dark: var(--wizard-dark-gray);
    --dashboard-white: var(--wizard-white);
    
    /* Dashboard-specific variables */
    --dashboard-kpi-card-height: 120px;
    --dashboard-chart-height: 320px;
    --dashboard-chart-height-mobile: 250px;
    --dashboard-chart-height-tablet: 280px;
    --dashboard-border-radius: var(--wizard-border-radius);
    --dashboard-border-radius-lg: var(--wizard-border-radius-lg);
    --dashboard-shadow: var(--wizard-shadow);
    --dashboard-shadow-lg: var(--wizard-shadow-lg);
    --dashboard-transition: all 0.3s ease;
    
    /* Grid system */
    --dashboard-grid-gap: 1.25rem;
    --dashboard-section-gap: 1.25rem;
    --dashboard-padding: 1.5rem;
    --dashboard-padding-mobile: 1rem;
}

/* Dashboard Container */
.dashboard-container {
    background-color: var(--dashboard-light);
    min-height: 100vh;
    padding: var(--dashboard-padding) 1rem;
}

.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--dashboard-section-gap);
}

/* Date Range Picker Styles */
.date-range-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-picker-container {
    position: relative;
}

.date-picker-separator {
    color: #6c757d;
    font-size: 0.875rem;
}

.dashboard-date-picker {
    min-width: 140px;
}

/* Syncfusion Date Picker Customization */
.date-range-filter .e-input-group {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.date-range-filter .e-input-group:hover {
    border-color: #8B2784;
}

.date-range-filter .e-input-group.e-input-focus {
    border-color: #8B2784;
    box-shadow: 0 0 0 0.2rem rgba(139, 39, 132, 0.1);
}

.date-range-filter .e-float-input input {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #495057;
}

.date-range-filter .e-float-input label {
    font-size: 0.875rem;
    color: #6c757d;
}

.date-range-filter .e-input-group-icon {
    color: #8B2784;
}

/* Dashboard Header Section */
.dashboard-header-section {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
    border-radius: var(--dashboard-border-radius-lg);
    color: var(--dashboard-white);
    box-shadow: var(--dashboard-shadow-lg);
    overflow: hidden;
    padding: var(--dashboard-padding);
}

/* Bootstrap Grid Layout for Header */
.dashboard-header-section .container-fluid {
    padding: 0;
}

.dashboard-header {
    /* Legacy styles kept for backward compatibility */
    padding: var(--dashboard-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

/* Force gradient background with higher specificity */
.dashboard-header.gradient-primary,
.dashboard-header-section {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%) !important;
    color: var(--dashboard-white) !important;
}

.dashboard-header-content {
    flex: 1;
}

.dashboard-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dashboard-white);
}

.dashboard-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
    max-width: 600px;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.date-range-filter {
    display: flex;
    align-items: center;
}

.dashboard-select {
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--dashboard-border-radius);
    background: rgba(255, 255, 255, 0.1);
    color: var(--dashboard-white);
    font-size: 1rem;
    transition: var(--dashboard-transition);
    backdrop-filter: blur(10px);
}

.dashboard-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.dashboard-select option {
    background: var(--dashboard-white);
    color: var(--dashboard-dark);
}

/* Dashboard Buttons */
.dashboard-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--dashboard-border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--dashboard-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.dashboard-btn-primary {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
    color: var(--dashboard-white);
    box-shadow: var(--dashboard-shadow);
}

.dashboard-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--dashboard-shadow-lg);
}

.dashboard-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--dashboard-white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.dashboard-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* KPI Section - Bootstrap Compatible */
.dashboard-kpi-section,
.dashboard-v3-kpi-section {
    background: var(--dashboard-white);
    border-radius: var(--dashboard-border-radius-lg);
    padding: var(--dashboard-padding);
    box-shadow: var(--dashboard-shadow);
    border: 1px solid #e9ecef;
}

/* Remove grid styles - using Bootstrap grid now */
.kpi-grid-container {
    /* Bootstrap grid handles layout */
}

.kpi-card {
    background: var(--dashboard-white);
    border: 2px solid #e9ecef;
    border-radius: var(--dashboard-border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--dashboard-transition);
    position: relative;
    overflow: hidden;
}

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

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
}

.kpi-card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dashboard-white);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-card-content {
    flex: 1;
    min-width: 0;
}

.kpi-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dashboard-medium);
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dashboard-dark);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.kpi-trend.trend-up {
    color: var(--dashboard-success);
}

.kpi-trend.trend-down {
    color: var(--dashboard-danger);
}

.kpi-trend.trend-stable {
    color: var(--dashboard-medium);
}

.trend-period {
    opacity: 0.7;
    font-weight: 400;
}

/* Charts Section - Bootstrap Compatible */
.dashboard-charts-section {
    background: var(--dashboard-white);
    border-radius: var(--dashboard-border-radius-lg);
    padding: var(--dashboard-padding);
    box-shadow: var(--dashboard-shadow);
    border: 1px solid #e9ecef;
    position: relative;
    z-index: 1;
    overflow: visible; /* Allow chart statistics to display properly */
}

/* Remove grid styles - using Bootstrap grid now */
.charts-grid {
    /* Bootstrap grid handles layout */
}

.chart-container {
    background: var(--dashboard-white);
    border: 1px solid #e9ecef;
    border-radius: var(--dashboard-border-radius-lg);
    overflow: visible; /* Allow statistics sections to show properly */
    transition: var(--dashboard-transition);
    position: relative;
    z-index: 2;
    isolation: isolate; /* Create new stacking context */
}

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

.chart-header {
    background: var(--dashboard-light);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dashboard-dark);
    margin: 0;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--dashboard-border-radius);
    background: rgba(139, 39, 132, 0.1);
    color: var(--dashboard-primary);
    cursor: pointer;
    transition: var(--dashboard-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-btn:hover {
    background: var(--dashboard-primary);
    color: var(--dashboard-white);
    transform: scale(1.1);
}

.chart-content {
    padding: 1.5rem;
    min-height: var(--dashboard-chart-height);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--dashboard-medium);
    font-size: 1.1rem;
    gap: 1rem;
}

.chart-placeholder i {
    font-size: 3rem;
    opacity: 0.5;
}

/* Analytics Section */
.dashboard-analytics-section {
    background: var(--dashboard-white);
    border-radius: var(--dashboard-border-radius-lg);
    box-shadow: var(--dashboard-shadow);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.analytics-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.analytics-header {
    background: var(--dashboard-light);
    padding: 1.5rem var(--dashboard-padding);
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analytics-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dashboard-dark);
    margin: 0;
}

.analytics-actions {
    display: flex;
    gap: 1rem;
}

.analytics-content {
    padding: var(--dashboard-padding);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--dashboard-medium);
    gap: 1rem;
    padding: 3rem;
}

.analytics-placeholder i {
    font-size: 4rem;
    opacity: 0.5;
}

.analytics-placeholder h3 {
    font-size: 1.5rem;
    margin: 0;
}

.analytics-placeholder p {
    font-size: 1rem;
    margin: 0;
    max-width: 400px;
}

/* Loading Indicator Styles */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-container.with-background {
    background: var(--dashboard-white);
    border-radius: var(--dashboard-border-radius-lg);
    box-shadow: var(--dashboard-shadow);
    border: 1px solid #e9ecef;
}

.dashboard-loading {
    text-align: center;
    width: 100%;
    max-width: 1200px;
}

.loading-header {
    margin-bottom: 3rem;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--dashboard-light);
    border-top: 4px solid var(--dashboard-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dashboard-dark);
    margin: 0;
}

.loading-kpi-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--dashboard-grid-gap);
}

/* Skeleton Loading Animations */
.kpi-skeleton {
    background: var(--dashboard-white);
    border: 2px solid #e9ecef;
    border-radius: var(--dashboard-border-radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.skeleton-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skeleton-title,
.skeleton-value,
.skeleton-trend {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-title {
    height: 16px;
    width: 60%;
}

.skeleton-value {
    height: 32px;
    width: 40%;
}

.skeleton-trend {
    height: 14px;
    width: 80%;
}

.chart-skeleton {
    background: var(--dashboard-white);
    border: 1px solid #e9ecef;
    border-radius: var(--dashboard-border-radius-lg);
    overflow: hidden;
}

.skeleton-chart-header {
    background: var(--dashboard-light);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-chart-title {
    height: 20px;
    width: 150px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-chart-actions {
    height: 32px;
    width: 32px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-chart-body {
    padding: 1.5rem;
    height: 300px;
}

.skeleton-chart-area {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--dashboard-border-radius);
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Responsive Design - Minimal Bootstrap-compatible overrides */
@media (max-width: 1200px) {
    .chart-content {
        min-height: var(--dashboard-chart-height-tablet);
    }
}

@media (max-width: 768px) {
    :root {
        --dashboard-padding: var(--dashboard-padding-mobile);
        --dashboard-section-gap: 1rem;
        --dashboard-grid-gap: 1rem;
        --dashboard-chart-height: var(--dashboard-chart-height-mobile);
    }
    
    .dashboard-container {
        padding: var(--dashboard-padding-mobile) 0.5rem;
    }
    
    .dashboard-content {
        /* Natural scrolling restored */
    }
    
    .dashboard-title {
        font-size: 2rem;
    }
    
    .chart-content {
        min-height: var(--dashboard-chart-height-mobile);
        padding: 1rem;
    }
    
    .analytics-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .analytics-actions {
        justify-content: center;
    }
    
    .dashboard-analytics-section {
        /* Natural height for mobile */
    }
    
    .analytics-container {
        /* Natural height for mobile */
    }
    
    .analytics-content {
        /* Natural height for mobile */
    }
}

@media (max-width: 576px) {
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .dashboard-subtitle {
        font-size: 0.875rem;
    }
    
    .chart-content {
        height: 250px;
        padding: 1rem;
    }
    
    .analytics-placeholder {
        padding: 2rem 1rem;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

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

/* Course Statistics Containment - Fix for overlap issues */
.chart-container {
    position: relative;
    overflow: visible; /* Allow statistics to display properly */
    z-index: 1;
    isolation: isolate; /* Create new stacking context */
}

.course-statistics-container {
    position: relative;
    z-index: 2;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: var(--dashboard-border-radius);
    isolation: isolate;
    overflow: hidden;
}

.course-stat-card {
    position: relative;
    z-index: 3;
    background: white;
    border-radius: var(--dashboard-border-radius);
    padding: 1rem;
    box-shadow: var(--dashboard-shadow);
    transition: var(--dashboard-transition);
}

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

/* Ensure proper containment within component boundaries */
.charts-section {
    position: relative;
    z-index: 1;
}

.charts-section .col-12,
.charts-section .col-lg-6 {
    position: relative;
    z-index: auto;
}

/* Course Statistics Grid Layout */
.course-statistics-header {
    margin-bottom: 0.75rem;
}

.course-statistics-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dashboard-dark);
    margin: 0;
}

.course-statistics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.course-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dashboard-primary);
    line-height: 1.2;
}

.course-stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Additional responsive adjustments using Bootstrap grid system */

/* ===== CHART RESPONSIVE FIXES ===== */
/* Fixes for specific chart layout issues shown in user screenshots */

/* Ensure proper chart container responsiveness */
.charts-section .container-fluid {
    padding: 0 !important;
}

/* Chart grid responsive improvements */
.charts-section .row {
    margin: 0 !important;
}

.charts-section .col-12,
.charts-section .col-lg-6 {
    padding: 0.75rem !important;
}

/* Chart container height consistency */
.chart-container.card {
    min-height: 320px;
}

/* Mobile-first responsive heights */
@media (max-width: 576px) {
    .chart-container.card {
        min-height: 250px;
    }
    
    .charts-section .col-12,
    .charts-section .col-lg-6 {
        padding: 0.5rem !important;
    }
    
    .charts-section .row {
        margin: 0 -0.5rem !important;
    }
    
    .kpi-card {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .chart-container.card {
        min-height: 280px;
    }
    
    .charts-section .col-12,
    .charts-section .col-lg-6 {
        padding: 0.625rem !important;
    }
}

@media (max-width: 992px) {
    .chart-container.card {
        min-height: 300px;
    }
}

/* Force proper aspect ratio for charts */
.chart-content {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 250px;
}

/* Prevent overflow issues in chart containers */
.chart-container {
    overflow: visible !important;
}

.chart-container .card-body {
    padding: 1rem !important;
    overflow: visible !important;
}

/* Ensure Syncfusion charts are responsive */
.e-chart {
    width: 100% !important;
    height: 100% !important;
}

/* Fix for chart date range alerts on mobile */
@media (max-width: 576px) {
    .alert.chart-date-range {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
        margin: 0.5rem !important;
    }
    
    .alert.chart-date-range i {
        font-size: 0.75rem !important;
    }
}

/* ===== END CHART RESPONSIVE FIXES ===== */

/* ===== MODE-SPECIFIC DISPLAY RULES ===== */
/* Add smooth transitions to all dashboard sections */
.dashboard-kpi-section,
.dashboard-charts-section,
.dashboard-analytics-section {
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Fade-in animation for sections */
@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply fade-in animation to newly visible sections */
.dashboard-kpi-section,
.dashboard-charts-section,
.dashboard-analytics-section {
    animation: sectionFadeIn 0.6s ease-out;
}

/* Mode indicator styling */
.mode-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.5rem 1rem;
    background: rgba(139, 39, 132, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.mode-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced hover effects for mode selector */
.mode-option {
    overflow: hidden;
    position: relative;
}

.mode-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.mode-option:hover::before {
    left: 100%;
}

/* Pulse effect for active mode */
.mode-option.active {
    animation: activePulse 2s infinite;
}

@keyframes activePulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(139, 39, 132, 0.3);
    }
}

/* ===== END MODE-SPECIFIC DISPLAY RULES ===== */

/* Mobile Landscape Mode Alert */
.mobile-landscape-alert {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border: none;
    color: white;
    margin: 1rem;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
    border-radius: 8px;
}

.mobile-landscape-alert strong {
    color: white;
}

.mobile-rotate-icon {
    animation: mobileRotate 2s ease-in-out infinite;
    font-size: 1.2rem;
}

@keyframes mobileRotate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Show alert only on mobile portrait mode */
@media (max-width: 767px) and (orientation: portrait) {
    .mobile-landscape-alert {
        display: block !important;
    }
}

/* Hide alert on mobile landscape mode */
@media (max-width: 767px) and (orientation: landscape) {
    .mobile-landscape-alert {
        display: none !important;
    }
}

/* Hide alert on tablets and desktop */
@media (min-width: 768px) {
    .mobile-landscape-alert {
        display: none !important;
    }
}

/* ===== ANALYTICS MODE SELECTOR ===== */
.analytics-mode-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mode-selector-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-right: 0.5rem;
    white-space: nowrap;
}

.mode-selector-options {
    display: flex;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.25rem;
    gap: 0.25rem;
}

.mode-option {
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 2;
}

.mode-option:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

.mode-option.active {
    color: var(--dashboard-primary);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.mode-option-icon {
    font-size: 0.75rem;
    opacity: 0.8;
}

.mode-option.active .mode-option-icon {
    opacity: 1;
}

.mode-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.mode-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid rgba(0, 0, 0, 0.8);
}

.mode-option:hover .mode-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Mode-specific animations */
.mode-transition {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.mode-fade-enter {
    opacity: 0;
    transform: translateY(20px);
}

.mode-fade-enter-active {
    opacity: 1;
    transform: translateY(0);
}

.mode-fade-exit {
    opacity: 1;
    transform: translateY(0);
}

.mode-fade-exit-active {
    opacity: 0;
    transform: translateY(-20px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-header-section {
        padding: var(--dashboard-padding-mobile);
    }
    
    .analytics-mode-selector {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        width: 100%;
    }
    
    .mode-selector-label {
        margin-right: 0;
        text-align: center;
    }
    
    .mode-selector-options {
        width: 100%;
        justify-content: center;
    }
    
    .mode-option {
        flex: 1;
        justify-content: center;
        padding: 0.5rem;
        min-width: 60px;
    }
    
    /* Better spacing for mobile Bootstrap grid */
    .dashboard-header-section .row {
        margin: 0;
    }
    
    .dashboard-header-section .col-auto {
        padding: 0.25rem;
    }
}

@media (max-width: 576px) {
    .mode-option {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
        min-width: 50px;
    }
    
    .mode-option-icon {
        font-size: 0.625rem;
    }
    
    .mode-selector-label {
        font-size: 0.75rem;
    }
    
    /* Ultra-compact for very small screens */
    .dashboard-header-section .gy-3 {
        --bs-gutter-y: 1rem;
    }
    
    .dashboard-header-section .gy-2 {
        --bs-gutter-y: 0.5rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .dashboard-subtitle {
        font-size: 0.875rem;
    }
}

/* Bootstrap Grid Enhancements for Dashboard Header */
.dashboard-header-section .row.align-items-center {
    min-height: auto;
}

.dashboard-header-section .col-auto {
    flex-shrink: 0;
}

/* Date Range Filter Improvements */
.date-range-filter .d-flex {
    flex-wrap: nowrap;
}

@media (max-width: 575px) {
    .date-range-filter .d-flex {
        flex-wrap: wrap;
    }
    
    .date-picker-container {
        width: 100%;
        min-width: 140px;
    }
    
    .date-picker-separator {
        order: 2;
        margin: 0.25rem 0;
    }
}

/* Mode Selector Mobile Optimization */
@media (max-width: 991px) {
    .mode-option span {
        display: none !important;
    }
    
    .mode-option {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }
    
    .mode-option-icon {
        margin: 0 !important;
    }
}

/* Improved spacing for controls row */
.dashboard-header-section .row.gy-2 > .col-auto {
    margin-bottom: 0.5rem;
}

@media (min-width: 992px) {
    .dashboard-header-section .row.gy-2 > .col-auto {
        margin-bottom: 0;
    }
}

/* ===== END ANALYTICS MODE SELECTOR ===== */