/* ===== CSS Variables for Dark Theme ===== */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #1a1a1d;
    --bg-tertiary: #2d2d30;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-primary: #00d4ff;
    --accent-secondary: #ff6b6b;
    --healthy-color: #4ecdc4;
    --infected-color: #ff6b6b;
    --recovered-color: #ffd93d;
    --vaccinated-color: #6c5ce7;
    --border-color: #3a3a3d;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== Container Layout ===== */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===== Main Content Layout ===== */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 0;
    height: calc(100vh - 120px);
}

/* ===== Control Panel ===== */
.control-panel {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.controls-section h3,
.stats-section h3,
.legend-section h3 {
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ===== Control Groups ===== */
.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* ===== Sliders ===== */
.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.5);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.value-display {
    display: inline-block;
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* ===== Buttons ===== */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn:active {
    transform: translateY(0);
}

/* ===== Statistics Section ===== */
.stats-section {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.stat-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 0.5rem;
}

/* ===== Legend Section ===== */
.legend-section {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.8rem;
}

/* ===== Color Classes ===== */
.healthy-color { background-color: var(--healthy-color); }
.infected-color { background-color: var(--infected-color); }
.recovered-color { background-color: var(--recovered-color); }
.vaccinated-color { background-color: var(--vaccinated-color); }

/* ===== Simulation Area ===== */
.simulation-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

#simulation-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: radial-gradient(circle at center, #1a1a1d 0%, #0a0a0b 100%);
}

.canvas-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.fps-counter {
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* ===== Chart Container ===== */
.chart-container {
    height: 300px;
    background: var(--bg-secondary);
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

#epidemic-chart {
    width: 100% !important;
    height: 100% !important;
}

/* ===== Education Section ===== */
.education-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.education-content {
    padding: 2rem;
}

.education-content h3 {
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    text-align: center;
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.education-card {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.education-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--accent-primary);
}

.education-card h4 {
    color: var(--accent-primary);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.education-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--accent-secondary);
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 320px 1fr;
    }
    
    .control-panel {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .control-panel {
        order: 2;
        padding: 1rem;
    }
    
    .simulation-area {
        order: 1;
        min-height: 60vh;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .education-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .button-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .control-panel,
    .education-content {
        padding: 1rem;
    }
    
    .chart-container {
        height: 200px;
        padding: 0.5rem;
    }
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.stat-value {
    animation: pulse 2s infinite;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ===== Loading States ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== Accessibility ===== */
.btn:focus,
.slider:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
