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

/* 根变量定义 */
:root {
    --primary-color: #1890ff;
    --secondary-color: #52c41a;
    --accent-color: #722ed1;
    --background-color: #f5f7fa;
    --card-background: #ffffff;
    --text-primary: #262626;
    --text-secondary: #595959;
    --border-color: #d9d9d9;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 基础布局 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 控制面板 */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 20px;
}

.theme-selector,
.layout-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-selector label,
.layout-selector label {
    font-weight: 600;
    color: var(--text-primary);
}

select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

select:hover {
    border-color: var(--primary-color);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 主题内容区域 */
.main-content {
    min-height: 600px;
}

.theme-section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.theme-section.active {
    display: block;
}

.theme-section h2 {
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

/* 图表网格布局 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.charts-grid.layout-1x1 {
    grid-template-columns: 1fr;
}

.charts-grid.layout-1x1 .chart-container {
    height: 600px;
}

.charts-grid.layout-1x2 {
    grid-template-columns: 1fr 1fr;
}

.charts-grid.layout-1x2 .chart-container {
    height: 400px;
}

.charts-grid.layout-2x2 {
    grid-template-columns: 1fr 1fr;
}

.charts-grid.layout-2x2 .chart-container {
    height: 350px;
}

/* 图表卡片 */
.chart-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.chart-card h3 {
    color: var(--text-primary);
    font-size: 1.2em;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-card h3::before {
    content: '📊';
    font-size: 1.2em;
}

/* 图表类型选择器 */
.chart-type-selector {
    margin-bottom: 15px;
}

.chart-type {
    width: 100%;
    max-width: 200px;
}

/* 图表容器 */
.chart-container {
    width: 100%;
    height: 350px;
    min-height: 300px;
    border-radius: var(--border-radius);
    background: #fafafa;
    border: 1px solid #e8e8e8;
}

/* 响应式布局 */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid.layout-2x2 {
        grid-template-columns: 1fr;
    }
    
    .charts-grid.layout-1x2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .control-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .theme-selector,
    .layout-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .charts-grid.layout-1x1 .chart-container {
        height: 400px;
    }
    
    .charts-grid.layout-1x2 .chart-container {
        height: 300px;
    }
    
    .charts-grid.layout-2x2 .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .header p {
        font-size: 1em;
    }
    
    .theme-section h2 {
        font-size: 1.6em;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .charts-grid.layout-1x1 .chart-container {
        height: 350px;
    }
    
    .charts-grid.layout-1x2 .chart-container {
        height: 250px;
    }
    
    .charts-grid.layout-2x2 .chart-container {
        height: 200px;
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    color: var(--text-secondary);
    border-top: 3px solid var(--primary-color);
}

/* 通知提示 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: var(--transition);
    z-index: 1000;
    max-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background: var(--secondary-color);
}

.notification.warning {
    background: #faad14;
}

.notification.error {
    background: #f5222d;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 200px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 特殊主题颜色 */
.theme-section#overview {
    --theme-color: #1890ff;
}

.theme-section#position {
    --theme-color: #52c41a;
}

.theme-section#ticks {
    --theme-color: #722ed1;
}

.theme-section#spine {
    --theme-color: #fa541c;
}

/* 布局切换时的过渡效果 */
.charts-grid {
    transition: grid-template-columns 0.3s ease;
}

.chart-container {
    transition: height 0.3s ease;
}

/* 调试样式 */
.debug-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    color: #856404;
}

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

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

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}