/* static/css/compare.css */
/* Compare Page Styles */

.compare-container {
    padding: 2rem;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Filter Card */
.filter-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.filter-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
}

.filter-form {
    margin-bottom: 1.5rem;
}

.filter-form .form-label {
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
}

.filter-form .form-select,
.filter-form .form-control {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.filter-form .form-select:focus,
.filter-form .form-control:focus {
    border-color: #7380ec;
    box-shadow: 0 0 0 0.2rem rgba(115, 128, 236, 0.25);
}

.filter-form .btn-primary {
    background: #7380ec;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-form .btn-primary:hover {
    background: #5a6ad8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(115, 128, 236, 0.3);
}

/* Date Range Display */
.date-range-display {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.date-info {
    font-size: 1.1rem;
}

.date-info strong {
    color: #333;
}

.date-value {
    color: #7380ec;
    font-weight: 600;
}

/* ========== Charts Grid with Enhanced Performance ========== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    contain: layout style;
    /* Enable hardware acceleration */
    transform: translateZ(0);
    /* Optimize grid performance */
    grid-auto-rows: minmax(auto, max-content);
    /* Progressive enhancement */
    will-change: auto;
}

/* Progressive enhancement for modern browsers */
@supports (display: subgrid) {
    .charts-grid {
        grid-template-rows: subgrid;
    }
}

/* Container queries for responsive charts */
@supports (container-type: inline-size) {
    .charts-grid {
        container-type: inline-size;
    }
    
    @container (min-width: 800px) {
        .chart-body {
            height: 350px;
        }
    }
    
    @container (min-width: 1200px) {
        .chart-body {
            height: 400px;
        }
    }
}

/* ========== Enhanced Chart Container ========== */
.chart-container {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* Performance optimizations */
    contain: layout style paint;
    isolation: isolate;
    will-change: auto; /* Changed from transform to auto for better performance */
    /* Optimize for loading states */
    min-height: 400px;
}

/* Loading state optimization */
.chart-container:not(.loaded) {
    /* Reduce GPU usage for unloaded charts */
    transform: none;
    will-change: auto;
}

.chart-container.loaded {
    /* Re-enable effects after loading */
    will-change: transform;
}

.chart-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
}

/* Loading state overlay */
.chart-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 5;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.chart-container.loaded::before {
    opacity: 0;
    pointer-events: none;
}

/* Error state */
.chart-container.error {
    border: 2px solid #dc3545;
    background: #fff5f5;
}

/* Chart container states */
.chart-container.visible {
    animation: slideIn 0.5s ease-out;
}

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

/* Intersection observer optimization */
.chart-container:not(.intersecting) {
    content-visibility: auto;
    contain-intrinsic-size: auto 450px;
}

.chart-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1rem;
}

.chart-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* ========== Chart Body Optimization ========== */
.chart-body {
    position: relative;
    height: 400px;
    /* Performance optimizations */
    contain: layout style paint;
    transform: translateZ(0);
    /* Prevent layout thrashing */
    overflow: hidden;
    /* Optimized GPU usage */
    will-change: auto;
}

/* Progressive loading optimizations */
.chart-body:not([data-chart-loaded="true"]) {
    /* Reduce resource usage for unloaded charts */
    pointer-events: none;
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

.chart-body[data-chart-loaded="true"] {
    /* Enable full functionality after loading */
    pointer-events: auto;
    content-visibility: visible;
}

/* Canvas optimization */
.chart-body canvas {
    max-width: 100%;
    height: auto;
    /* Improve canvas rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent canvas bleeding */
    border-radius: 8px;
}

/* Chart responsiveness */
.chart-body.responsive {
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 300px;
}

/* Chart container with data */
.chart-body[data-chart-loaded="true"] {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.chart-body[data-chart-loaded="false"] {
    opacity: 0.5;
}

/* Enhanced memory and performance optimization */
.chart-body:not(.visible) {
    pointer-events: none;
    /* Defer rendering for non-visible charts */
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

/* Optimize chart rendering */
.chart-body canvas {
    /* Improve rendering performance */
    image-rendering: auto;
    /* Reduce memory usage */
    will-change: auto;
}

/* Priority-based loading states */
.chart-container[data-priority="1"] {
    /* Critical charts - highest priority */
    content-visibility: visible;
}

.chart-container[data-priority="4"] {
    /* Complex charts - defer until needed */
    content-visibility: auto;
    contain-intrinsic-size: auto 450px;
}

/* Touch optimization for mobile */
@media (hover: none) and (pointer: coarse) {
    .chart-body {
        touch-action: pan-x pan-y;
    }
}

/* Legend */
.legend-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

/* ========== Enhanced Responsive Design ========== */
@media (max-width: 768px) {
    .compare-container {
        padding: 1rem;
    }
    
    .filter-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .date-range-display {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }
    
    .chart-body {
        height: 250px;
    }
    
    .chart-container {
        margin-bottom: 1.5rem;
        padding: 1rem;
        /* Optimize mobile performance */
        will-change: auto;
    }
    
    /* Reduce mobile animations */
    .chart-container:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .filter-form .row {
        gap: 1rem;
    }
    
    .chart-body {
        height: 200px;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .chart-container,
    .btn,
    .nav-tabs .nav-link,
    .chart-loading {
        transition: none;
        animation: none;
    }
    
    .chart-skeleton {
        animation: none;
        background: #f0f0f0;
    }
}

/* ========== Chart Color System ========== */
.chart-container {
    /* Primary colors */
    --color-gh1: #00BCD4;
    --color-gh2: #FFC107;
    --color-outside: #E91E63;
    --color-farm1: #00BCD4;
    --color-farm2: #E91E63;
    
    /* Chart-specific variables */
    --chart-grid-color: rgba(0, 0, 0, 0.05);
    --chart-text-color: #333;
    --chart-background: white;
    --chart-border-radius: 15px;
    --chart-shadow: 0 2px 10px rgba(0,0,0,0.08);
    --chart-hover-shadow: 0 5px 20px rgba(0,0,0,0.12);
    
    /* Animation variables */
    --chart-transition-duration: 0.3s;
    --chart-animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chart-container {
        --chart-background: #1a1a1a;
        --chart-text-color: #ffffff;
        --chart-grid-color: rgba(255, 255, 255, 0.1);
        --chart-shadow: 0 2px 10px rgba(0,0,0,0.3);
        --chart-hover-shadow: 0 5px 20px rgba(0,0,0,0.4);
        
        background: var(--chart-background);
        color: var(--chart-text-color);
    }
    
    .chart-header h3 {
        color: var(--chart-text-color);
    }
}

/* ========== Enhanced Loading States ========== */
.chart-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 300px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    backdrop-filter: blur(2px);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

.chart-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #7380ec;
    margin-bottom: 1rem;
}

.chart-loading-text {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

/* Button loading states */
.btn .btn-loading {
    display: none;
}

.btn:disabled .btn-text {
    display: none;
}

.btn:disabled .btn-loading {
    display: inline-block;
}

/* Skeleton loading for charts */
.chart-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    height: 300px;
    border-radius: 8px;
}

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

/* Error states */
.chart-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 200px;
    color: #dc3545;
    text-align: center;
}

.chart-error i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.chart-error .retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.chart-error .retry-btn:hover {
    background: #c82333;
}

/* ========== Form Enhancements ========== */

/* Month Selector Styling */
#monthSelect {
    text-transform: capitalize;
}

/* Enhanced input styling */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

/* Form validation indicators */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #28a745;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback,
.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Required field indicator */
.required::after {
    content: " *";
    color: #dc3545;
}

/* Form accessibility */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Security: Prevent content injection */
.chart-container * {
    max-width: 100%;
    max-height: 100%;
}

/* Print Styles */
/* ========== Print Styles ========== */
@media print {
    .compare-container {
        background: white !important;
        padding: 0 !important;
    }
    
    .filter-card {
        page-break-after: avoid;
        background: white !important;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .chart-container {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        background: white !important;
        margin-bottom: 1rem;
    }
    
    .btn,
    .nav-tabs,
    .spinner-border,
    .chart-loading {
        display: none !important;
    }
    
    .chart-header h3 {
        color: #000 !important;
        font-size: 1.1rem;
    }
    
    .page-title {
        color: #000 !important;
    }
}

/* Title Icon */
.title-icon.compare {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 
        0 10px 30px rgba(102, 126, 234, 0.3),
        0 5px 15px rgba(118, 75, 162, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

/* ========== Chart Selection UI ========== */

/* Chart Selection Card */
.chart-selection-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.selection-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selection-title i {
    color: #667eea;
    font-size: 1.75rem;
}

/* Chart Selector Form */
.chart-selector-form {
    margin-bottom: 0;
}

.chart-select {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.chart-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

.chart-select option {
    padding: 0.5rem;
    font-size: 0.95rem;
}

/* Load Chart Button */
#loadChartBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#loadChartBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

#loadChartBtn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Chart Display Section */
.chart-display-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.chart-display-section.show {
    opacity: 1;
    transform: translateY(0);
}

/* Dynamic Chart Container */
#dynamicChartContainer {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    min-height: 500px;
    position: relative;
}

/* Chart Header with Actions */
.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-actions .btn {
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chart-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Chart Placeholder */
.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #adb5bd;
}

.placeholder-content h4 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.placeholder-content p {
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* Dynamic Chart Body */
#dynamicChartBody {
    position: relative;
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
}

#dynamicChartBody canvas {
    width: 100% !important;
    height: 400px !important;
}

/* Loading States for Dynamic Charts */
.dynamic-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.dynamic-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.dynamic-loading-text {
    color: #6c757d;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
}

/* Error States for Dynamic Charts */
.dynamic-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #dc3545;
    text-align: center;
    background: #fff5f5;
    border-radius: 12px;
    border: 2px solid #f8d7da;
}

.dynamic-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dynamic-error h4 {
    color: #721c24;
    margin-bottom: 0.5rem;
}

.dynamic-error .retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dynamic-error .retry-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Success State */
.chart-loaded {
    animation: slideInUp 0.5s ease-out;
}

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

/* Fullscreen Mode */
.chart-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
    padding: 2rem;
    overflow: auto;
}

.chart-fullscreen #dynamicChartBody {
    height: calc(100vh - 200px);
}

.chart-fullscreen #dynamicChartBody canvas {
    height: calc(100vh - 200px) !important;
}

/* Charts Grid - Keep for backward compatibility */
.charts-grid {
    display: none; /* Hide old grid layout */
}

/* ========== Advanced Grid Layout ========== */

/* Grid Layout for larger screens with performance optimization */
@media (min-width: 1200px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Make complex charts full width */
    .chart-container:has(#moistureChart),
    .chart-container:has(#tempAirWaterChart) {
        grid-column: span 2;
    }
    
    /* Optimize large screen performance */
    .chart-container {
        contain: layout style paint;
    }
}

/* Ultra-wide screens */
@media (min-width: 1600px) {
    .charts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .chart-container:has(#moistureChart),
    .chart-container:has(#tempAirWaterChart) {
        grid-column: span 3;
    }
}

/* Chart Annotations */
.chart-annotation {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.875rem;
    color: #666;
    background: rgba(255,255,255,0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* ===== COMPARE PAGE IMPROVED DESIGN ===== */

/* Override base page-header for compare page */
.compare-page .page-header {
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    border-bottom: 2px solid #e9ecef;
    padding: 2rem 1.5rem;
}

/* Modern title design for compare page */
.compare-page .title-with-icon {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Refined icon design - smaller and more elegant */
.title-icon.compare {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Subtle animation */
.title-icon.compare::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    animation: shimmer 4s infinite;
}

@keyframes shimmer {
    0% {
        transform: rotate(45deg) translate(-100%, -100%);
    }
    100% {
        transform: rotate(45deg) translate(100%, 100%);
    }
}

/* Hover effect */
.title-icon.compare:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 32px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Title typography */
.compare-page .page-title {
    margin: 0;
}

.compare-page .title-prefix {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.compare-page .title-main {
    display: block;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.compare-page .page-subtitle {
    margin: 6px 0 0 0;
    color: #6b7280;
    font-size: 0.9375rem;
    font-weight: 400;
}

/* Live status indicator */
.compare-page .live-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #10b981;
    font-weight: 500;
}

.compare-page .live-status .pulse {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Filter card improvement */
.compare-page .filter-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
}

.compare-page .filter-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compare-page .filter-title i {
    color: #667eea;
}

/* Form improvements */
.compare-page .form-select,
.compare-page .form-control {
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.compare-page .form-select:focus,
.compare-page .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Button styling */
.compare-page .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.compare-page .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Date range display */
.compare-page .date-range-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.875rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.compare-page .date-info {
    font-size: 0.9375rem;
}

.compare-page .date-info strong {
    color: #4b5563;
    font-weight: 600;
}

.compare-page .date-value {
    color: #667eea;
    font-weight: 600;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
}

/* ========== Responsive Design for Chart Selection ========== */

@media (max-width: 768px) {
    .compare-page .title-icon.compare {
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 12px;
    }
    
    .compare-page .title-main {
        font-size: 1.5rem;
    }
    
    .compare-page .page-subtitle {
        font-size: 0.875rem;
    }
    
    .compare-page .date-range-display {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    /* Chart Selection Mobile */
    .chart-selection-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .selection-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .chart-selector-form .row {
        gap: 1rem;
    }
    
    .chart-selector-form .col-md-8,
    .chart-selector-form .col-md-4 {
        width: 100%;
        max-width: 100%;
    }
    
    #loadChartBtn {
        margin-top: 1rem;
    }
    
    /* Dynamic Chart Mobile */
    #dynamicChartContainer {
        padding: 1rem;
        min-height: 350px;
    }
    
    #dynamicChartBody {
        min-height: 300px;
    }
    
    #dynamicChartBody canvas {
        height: 300px !important;
    }
    
    .chart-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .chart-actions .btn {
        width: 100%;
        padding: 0.5rem;
    }
    
    .placeholder-icon {
        font-size: 2.5rem;
    }
    
    .placeholder-content h4 {
        font-size: 1.25rem;
    }
    
    .placeholder-content p {
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .chart-selection-card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }
    
    .selection-title {
        font-size: 1.125rem;
        gap: 0.5rem;
    }
    
    .chart-select {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    #loadChartBtn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    #dynamicChartContainer {
        padding: 0.75rem;
        min-height: 280px;
    }
    
    #dynamicChartBody {
        min-height: 250px;
    }
    
    #dynamicChartBody canvas {
        height: 250px !important;
    }
    
    .chart-fullscreen {
        padding: 1rem;
    }
    
    .chart-fullscreen #dynamicChartBody {
        height: calc(100vh - 150px);
    }
    
    .chart-fullscreen #dynamicChartBody canvas {
        height: calc(100vh - 150px) !important;
    }
}

/* Alternative minimal design - uncomment to use */
/*
.minimal-design .title-icon.compare {
    background: #f3f4f6;
    color: #667eea;
    box-shadow: none;
    border: 2px solid #e5e7eb;
}

.minimal-design .gradient-text {
    background: none;
    -webkit-text-fill-color: #1f2937;
    color: #1f2937;
}
*/