/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 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 2px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 1.1rem;
    color: #666;
}

/* 导航标签样式 */
.nav-tabs {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 主要内容区域 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    margin-bottom: 3rem;
}

.tab-content {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 图表容器 */
.chart-container {
    text-align: center;
}

.chart-container h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

/* 控制按钮区域 */
.chart-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.control-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.control-select {
    padding: 0.5rem 1rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: #333;
    cursor: pointer;
}

/* 数据汇总卡片 */
.data-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card h3 {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.summary-card span {
    font-size: 1.8rem;
    font-weight: 700;
}

/* 公式显示区域 */
.formula-display {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-top: 2rem;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.formula-display p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    color: #2c3e50;
}

/* 坐标轴定制示例 */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.example-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.example-card:hover {
    transform: translateY(-5px);
}

.example-card h3 {
    margin-bottom: 1rem;
    color: #667eea;
    font-size: 1.2rem;
}

/* 关于页面 */
.about-container {
    max-width: 800px;
    margin: 0 auto;
}

.about-content {
    line-height: 1.8;
}

.about-content h3 {
    color: #667eea;
    margin: 1.5rem 0 1rem 0;
}

.about-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

/* 页脚 */
footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content p {
    color: #666;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .nav-tabs {
        justify-content: center;
    }
    
    .tab-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .data-summary {
        grid-template-columns: 1fr;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .customization-controls {
        grid-template-columns: 1fr;
    }
    
    .analysis-tools {
        grid-template-columns: 1fr;
    }
    
    .analysis-results {
        grid-template-columns: 1fr;
    }
    
    .metric-cards {
        grid-template-columns: 1fr;
    }
    
    .function-buttons {
        flex-direction: column;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    main {
        padding: 0 1rem;
    }
}

/* 图表canvas样式 */
canvas {
    max-width: 100%;
    height: auto !important;
    margin: 1rem 0;
}

/* 新增样式：图表行布局 */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.chart-main canvas {
    height: 400px !important;
}

.chart-side canvas {
    height: 300px !important;
}

.chart-side h4 {
    text-align: center;
    margin-top: 1rem;
    color: #667eea;
    font-weight: 600;
}

/* 新增样式：函数选择器 */
.function-selector {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.function-selector h3 {
    margin-bottom: 1rem;
    color: #333;
}

.function-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.func-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.func-btn:hover,
.func-btn.active {
    background: #667eea;
    color: white;
}

/* 新增样式：定制控制面板 */
.customization-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.control-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.control-panel h3 {
    margin-bottom: 1rem;
    color: #667eea;
    font-size: 1.1rem;
}

.spine-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.spine-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.position-controls label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.position-controls input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.tick-controls label {
    display: block;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.tick-controls select,
.tick-controls input[type="range"],
.tick-controls input[type="color"] {
    margin-left: 0.5rem;
}

.tick-controls input[type="range"] {
    width: 150px;
}

/* 示例代码样式 */
.example-code {
    margin-top: 1rem;
    padding: 0.8rem;
    background: #2d3748;
    color: #e2e8f0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
}

/* 实时预览样式 */
.live-preview {
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.live-preview h3 {
    margin-bottom: 1.5rem;
    color: #667eea;
    text-align: center;
}

/* 分析页面样式 */
.analysis-container {
    max-width: 1400px;
    margin: 0 auto;
}

.analysis-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.tool-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
}

.tool-section h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.import-controls,
.stats-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-input {
    padding: 0.5rem;
    border: 2px dashed #667eea;
    border-radius: 8px;
    background: white;
}

.analysis-results {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stats-panel,
.chart-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stats-panel h3,
.chart-panel h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.stats-content {
    line-height: 1.8;
}

.report-section {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
}

.report-section h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.report-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 150px;
}

/* 实时监控页面样式 */
.realtime-container {
    max-width: 1400px;
    margin: 0 auto;
}

.monitoring-controls {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.monitoring-dashboard {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
}

.metric-card h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.metric-card span {
    font-size: 1.8rem;
    font-weight: 700;
}

.alerts-panel {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 2rem;
}

.alerts-panel h4 {
    margin-bottom: 1rem;
    color: #856404;
}

.alerts-list {
    max-height: 200px;
    overflow-y: auto;
}

.alert-item {
    background: #f8f9fa;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.no-alerts {
    color: #6c757d;
    font-style: italic;
}

.historical-data {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.historical-data h3 {
    margin-bottom: 1.5rem;
    color: #667eea;
}

/* 参数控制样式 */
.parameters-control {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.parameters-control h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.param-group {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.param-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.param-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: center;
}

.param-controls input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 功能卡片网格 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: #667eea;
    font-size: 1.1rem;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
}

/* 版本信息样式 */
.version-info {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.version-info h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.version-info p {
    margin-bottom: 0.5rem;
    color: #666;
}

/* 时段分析样式 */
.analysis-section {
    margin-top: 2rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.analysis-section h3 {
    margin-bottom: 1.5rem;
    color: #667eea;
    text-align: center;
}

.period-analysis canvas {
    height: 250px !important;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滑块样式 */
input[type="range"] {
    width: 150px;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}