:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --text-primary: #333333;
    --text-secondary: #666666;
    --card-bg: #ffffff;
    --card-border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-gradient-start: #0f3460;
    --bg-gradient-end: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --card-bg: #16213e;
    --card-border: #2a2a4e;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(102, 126, 234, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* API Status Banner */
.api-status-banner {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(255, 68, 68, 0.3);
    animation: slideDown 0.3s ease-out;
}

.api-status-banner.hidden {
    display: none;
}

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

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#theme-switch {
    display: none;
}

.theme-label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    padding: 10px 15px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
}

.theme-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.theme-label span {
    font-size: 1.5rem;
    transition: opacity 0.3s ease;
}

.sun {
    opacity: 1;
}

.moon {
    opacity: 0.3;
}

[data-theme="dark"] .sun {
    opacity: 0.3;
}

[data-theme="dark"] .moon {
    opacity: 1;
}

/* Header */
header {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

header h1 {
    font-size: 4rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
}

/* Sections */
section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    transition: all 0.3s ease;
}

h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--bg-gradient-start);
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stats-update {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.chart-container {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 10px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.time-selector {
    display: flex;
    gap: 5px;
    background: var(--card-bg);
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
}

.time-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.time-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.time-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chart-container canvas {
    max-height: 300px;
}

/* Download Section */
.download-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 40px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--card-bg);
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

footer a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    section {
        padding: 25px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .time-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .time-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}
