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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 主应用容器 */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航栏 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.mode-switcher {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.mode-btn.active {
    background-color: white;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 主内容区域 */
.main-content {
    display: flex;
    flex: 1;
    padding: 1rem;
    gap: 1rem;
}

/* 左侧控制面板 */
.control-panel {
    width: 300px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    border-bottom: 2px solid #e0e7ff;
    padding-bottom: 0.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.view-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-controls .control-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e7ff;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.6);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.6);
}

.control-group span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
    align-self: flex-end;
}

.control-group select {
    padding: 0.6rem;
    border: 2px solid #e0e7ff;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.control-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.info-display {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-display p {
    font-size: 0.9rem;
    color: #555;
    display: flex;
    justify-content: space-between;
}

.info-display span {
    font-weight: 600;
    color: #667eea;
}

/* 中央Canvas区域 */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    padding: 1rem;
}

#graph-canvas {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: crosshair;
    background: #fafbfc;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 1000px;
    height: auto;
    aspect-ratio: 1 / 1;
}

.canvas-info {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* 底部信息栏 */
.footer {
    background: white;
    color: #666;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: visible;
    }
    
    .panel-section {
        flex: 1;
        min-width: 250px;
    }
    
    #graph-canvas {
        width: 100%;
        max-width: 800px;
        height: auto;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .navbar h1 {
        font-size: 1.5rem;
    }
    
    .control-panel {
        flex-direction: column;
    }
    
    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .canvas-container {
        padding: 0.5rem;
    }
}

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

.panel-section {
    animation: fadeIn 0.3s ease-out;
}

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

.control-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}