/* 基础变量定义 */
:root {
    --primary-warm: #D4A574;
    --secondary-warm: #C19A6B;
    --light-warm: #E6D5B8;
    --pale-warm: #F5F0E8;
    --accent-warm: #B8956A;
    --contrast-warm-1: #8B7355;
    --contrast-warm-2: #A0826D;
    
    --text-primary: #4A3728;
    --text-secondary: #6B5D54;
    --card-bg: #FFFEF9;
    --border-warm: #E8D5C4;
    --shadow-warm: rgba(212, 165, 116, 0.15);
    
    --gradient-warm: linear-gradient(135deg, #D4A574 0%, #C19A6B 100%);
    --gradient-subtle: linear-gradient(135deg, #F5F0E8 0%, #E6D5B8 100%);
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #F5F0E8 0%, #E6D5B8 50%, #F5F0E8 100%);
    min-height: 100vh;
}

/* 页面布局 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: var(--card-bg);
    padding: 2rem 0;
    text-align: center;
    border-bottom: 3px solid var(--primary-warm);
    box-shadow: 0 4px 20px var(--shadow-warm);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-warm);
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-warm);
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* 导航栏样式 */
nav {
    background: var(--card-bg);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-warm);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow-warm);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-warm);
    transition: width 0.3s ease;
}

nav a:hover {
    background: var(--pale-warm);
    color: var(--primary-warm);
    transform: translateY(-2px);
}

nav a:hover::before {
    width: 100%;
}

/* 主要内容区域 */
main {
    padding: 3rem 0;
    min-height: calc(100vh - 200px);
}

/* 区块样式 */
section {
    margin-bottom: 4rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 8px 30px var(--shadow-warm);
    border: 1px solid var(--border-warm);
    position: relative;
    overflow: hidden;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-warm);
    opacity: 0.8;
}

section h2 {
    color: var(--primary-warm);
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* 示例卡片样式 */
.example-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px var(--shadow-warm);
    border: 1px solid var(--border-warm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-warm);
}

.example-card h3 {
    color: var(--primary-warm);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
    font-weight: 600;
}

/* 图表容器样式 */
.chart-container {
    position: relative;
    height: 400px;
    margin: 2rem 0;
    background: var(--pale-warm);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-container.large {
    height: 500px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.douyin-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

/* 页脚样式 */
footer {
    background: var(--card-bg);
    padding: 2rem 0;
    text-align: center;
    border-top: 3px solid var(--primary-warm);
    color: var(--text-secondary);
    box-shadow: 0 -4px 20px var(--shadow-warm);
}

footer p {
    margin: 0;
    font-size: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    section {
        margin-bottom: 2rem;
        padding: 1rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .douyin-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .checkbox-group {
        flex-direction: column;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeIn 0.6s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--pale-warm);
}

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

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

/* 选择文本样式 */
::selection {
    background: var(--accent-warm);
    color: white;
}

/* 焦点状态 */
button:focus,
select:focus,
input:focus {
    outline: 3px solid var(--accent-warm);
    outline-offset: 2px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--pale-warm);
    border-top: 3px solid var(--primary-warm);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--contrast-warm-1);
    color: var(--pale-warm);
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 成功/错误消息样式 */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: var(--pale-warm);
    color: var(--text-primary);
    border: 1px solid var(--border-warm);
}