/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--theme);
    min-height: 100vh;
    padding: 20px;
    color: var(--primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--entry);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
    transition: background-color 0.3s ease;
}

/* 头部 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

header h1 {
    font-size: 2.5em;
    color: var(--primary);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--secondary);
    font-size: 1.1em;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--entry);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.alert {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    animation: pulse 2s infinite;
}

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

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-change {
    font-size: 0.9em;
    opacity: 0.9;
}

.stat-deviation {
    font-size: 0.85em;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* 控制面板 */
.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #555;
}

.controls select {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.controls select:hover {
    border-color: #667eea;
}

.controls select:focus {
    outline: none;
    border-color: #667eea;
}

/* 图表容器 */
.chart-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    width: 100%;
    overflow-x: auto;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

/* 信息区域 */
.info-section {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.info-section h3 {
    color: #667eea;
    margin-bottom: 15px;
}

#statistics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.stat-item-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-item-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

/* 页脚 */
footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
    color: #999;
    font-size: 0.9em;
}

footer p {
    margin: 5px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
    }

    .stat-value {
        font-size: 1.5em;
    }

    .chart-container {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-container canvas {
        min-height: 250px !important;
    }
}
