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

body {
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 头部样式 */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1.5rem 0;
}

header h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

nav a {
    text-decoration: none;
    color: #3498db;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: rgba(52, 152, 219, 0.1);
    font-size: 0.9rem;
}

nav a:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

/* 主内容样式 */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.6s ease-out;
    border-left: 5px solid transparent;
    transition: border-color 0.3s ease;
}

section:nth-child(odd) {
    border-left-color: #3498db;
}

section:nth-child(even) {
    border-left-color: #9b59b6;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

section:nth-child(odd):hover {
    border-left-color: #2980b9;
}

section:nth-child(even):hover {
    border-left-color: #8e44ad;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid transparent;
    padding-bottom: 0.5rem;
    background: linear-gradient(135deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom-color: #3498db;
}

section:nth-child(even) h2 {
    border-bottom-color: #9b59b6;
}

/* 图表容器布局 */
.chart-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.chart {
    width: 100%;
    height: 550px;
    border-radius: 15px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 450px;
    position: relative;
    overflow: hidden;
}

.chart-info {
    padding: 1rem;
}

.chart-info h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.chart-info p {
    color: #7f8c8d;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* 控制按钮样式 */
.controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.controls button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    text-align: center;
}

.controls button:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.controls button:active {
    transform: translateX(2px);
}

/* 按钮颜色变体 */
section:nth-child(odd) .controls button:nth-child(2) {
    background: linear-gradient(135deg, #00bcd4, #00acc1);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.3);
}

section:nth-child(even) .controls button:nth-child(2) {
    background: linear-gradient(135deg, #00bcd4, #00acc1);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.3);
}

section:nth-child(odd) .controls button:nth-child(3) {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* 等高线图按钮特殊样式 */
#section-8-1 .controls button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#section-8-1 .controls button:nth-child(2) {
    background: linear-gradient(135deg, #00bcd4, #00acc1);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.3);
}

#section-8-1 .controls button:nth-child(3) {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* 页脚样式 */
footer {
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

footer p {
    color: #7f8c8d;
    font-size: 1rem;
    margin: 0.5rem 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .chart-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart {
        height: 400px;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .controls button {
        flex: 1;
        min-width: 120px;
    }
}

/* 等高线图简化样式 */
#contour-chart {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    nav ul {
        gap: 0.5rem;
        padding: 0 0.5rem;
    }
    
    nav a {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    main {
        padding: 0 0.5rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    section h2 {
        font-size: 1.5rem;
    }
    
    .chart {
        height: 350px;
    }
    
    .controls button {
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    nav {
        text-align: center;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
    }
    
    nav a {
        width: 90%;
        text-align: center;
        padding: 0.5rem;
    }
    
    section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    section h2 {
        font-size: 1.3rem;
    }
    
    .chart {
        height: 250px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .controls button {
        width: 100%;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    background: #f8f9fa;
    border-radius: 15px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 数据表格样式 */
.data-table {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
    font-size: 0.9rem;
}

.data-table th {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-weight: 600;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 工具提示样式 */
.tooltip {
    position: absolute;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tooltip.show {
    opacity: 1;
}

/* 特殊效果 */
section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

section:hover::before {
    opacity: 1;
    animation: slideGradient 2s linear infinite;
}

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

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #9b59b6);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #8e44ad);
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    body {
        background: white;
        color: black;
    }
    
    header {
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    section {
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        border: 1px solid black;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}