:root {
    /* 医疗蓝主题 (默认) */
    --primary: #0066cc;
    --primary-light: #4d94ff;
    --primary-dark: #004d99;
    --secondary: #00a8cc;
    --accent: #ff6b6b;
    --bg-primary: #0a1628;
    --bg-secondary: #0d1f33;
    --bg-card: rgba(13, 31, 51, 0.85);
    --text-primary: #ffffff;
    --text-secondary: #a0c4e8;
    --text-muted: #6b8cae;
    --border-color: rgba(0, 102, 204, 0.3);
    --shadow: 0 4px 20px rgba(0, 102, 204, 0.2);
    --glow: 0 0 20px rgba(0, 102, 204, 0.4);
}

/* 深色主题 */
[data-theme="dark"] {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #a855f7;
    --accent: #f43f5e;
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.9);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(99, 102, 241, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* 浅色主题 */
[data-theme="light"] {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #0891b2;
    --accent: #dc2626;
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --glow: none;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 头部 ===== */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo .icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title {
    text-align: center;
}

.title h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.time {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-light);
    font-family: 'Courier New', monospace;
}

.theme-switcher {
    display: flex;
    gap: 8px;
}

.theme-switcher button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.theme-switcher button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== 主网格布局 ===== */
.main-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 20px;
    padding: 20px;
    background: var(--bg-primary);
}

.panel-left, .panel-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-center {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    overflow: hidden;
}

/* ===== 卡片样式 ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 实时计数器 ===== */
.realtime-counter {
    text-align: center;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.1), rgba(0, 168, 204, 0.1));
}

.counter-box {
    margin: 20px 0;
}

.counter {
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.unit {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.rate-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-top: 10px;
}

.live-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--accent);
}

.pulse {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* ===== 今日统计 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
    font-family: 'Courier New', monospace;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ===== 风险因素 ===== */
.risk-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.risk-name {
    width: 80px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.risk-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.risk-bar div {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 1s ease;
}

.risk-percent {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--primary-light);
    font-weight: 600;
}

/* ===== 年度概览 ===== */
.overview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    transition: background 0.3s;
}

.overview-item:hover {
    background: rgba(0, 102, 204, 0.15);
}

.overview-icon {
    font-size: 1.5rem;
}

.overview-data {
    flex: 1;
}

.overview-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-light);
}

.overview-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== 地区排名 ===== */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    transition: all 0.3s;
}

.rank-item:hover {
    background: rgba(0, 102, 204, 0.2);
    transform: translateX(5px);
}

.rank-item.highlight {
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.rank-num {
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 10px;
}

.rank-country {
    flex: 1;
    font-size: 0.9rem;
}

.rank-value {
    font-weight: 600;
    color: var(--primary-light);
}

/* ===== 地图容器 ===== */
.map-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#worldMap {
    flex: 1;
    min-height: 0;
}

.map-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.gradient {
    width: 150px;
    height: 8px;
    background: linear-gradient(90deg, #1a4d6d, #2980b9, #e74c3c, #c0392b);
    border-radius: 4px;
}

/* ===== 新闻滚动条 ===== */
.news-ticker {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.2), rgba(0, 168, 204, 0.2));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    overflow: hidden;
}

.ticker-label {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.ticker-content {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-content span {
    display: inline-block;
    padding: 0 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: ticker 20s linear infinite;
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ===== 图表容器 ===== */
.chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#trendChart, #ageChart {
    flex: 1;
    min-height: 0;
}

/* ===== 底部栏 ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer span {
    margin: 0 10px;
}

/* ===== 响应式布局 ===== */
@media (max-width: 1400px) {
    .main-grid {
        grid-template-columns: 280px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .panel-left, .panel-right {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .title h2 {
        font-size: 1.1rem;
    }
    
    .counter {
        font-size: 2.5rem;
    }
    
    .panel-left, .panel-right {
        grid-template-columns: 1fr;
    }
    
    .footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
