/* ========================================
   专业编辑器样式
   深色主题 | 全屏布局 | 现代化设计
   ======================================== */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主题颜色 */
    --bg-dark: #1e1e1e;
    --bg-darker: #252526;
    --bg-panel: #2d2d30;
    --bg-hover: #37373d;
    --bg-active: #094771;
    --bg-input: #3c3c3c;
    
    /* 边框颜色 */
    --border-color: #3e3e42;
    --border-light: #555558;
    
    /* 文字颜色 */
    --text-primary: #cccccc;
    --text-secondary: #9d9d9d;
    --text-disabled: #666666;
    
    /* 强调色 */
    --accent-blue: #0e639c;
    --accent-blue-light: #1177bb;
    --accent-green: #00ff00;
    --accent-yellow: #ffff00;
    --accent-red: #ff0000;
    
    /* 尺寸 */
    --toolbar-height: 40px;
    --panel-width: 280px;
    --timeline-height: 80px;
    --spacing: 8px;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-dark);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   顶部工具栏
   ======================================== */

.toolbar {
    height: var(--toolbar-height);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing);
    gap: var(--spacing);
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: var(--spacing);
}

.toolbar-section.center {
    flex: 1;
    justify-content: center;
}

.toolbar-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 8px;
}

.toolbar-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: normal;
}

.toolbar-btn {
    height: 28px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.toolbar-btn:active {
    background: var(--bg-active);
}

.toolbar-btn .icon {
    font-size: 14px;
}

.toolbar-select {
    height: 28px;
    padding: 0 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    min-width: 200px;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--accent-blue-light);
}

.toolbar-select option {
    background: var(--bg-panel);
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

/* ========================================
   主容器布局
   ======================================== */

.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ========================================
   左侧面板
   ======================================== */

.left-panel {
    width: var(--panel-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.panel-header {
    padding: 10px 12px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.panel-content {
    padding: var(--spacing);
}

/* 场景树 */
.scene-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tree-item {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.tree-item:hover {
    background: var(--bg-hover);
}

.tree-item.active {
    background: var(--bg-active);
}

.tree-icon {
    font-size: 14px;
}

.tree-label {
    flex: 1;
    font-size: 12px;
}

.tree-count {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 视图选项 */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
}

.option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue-light);
}

.option-item span {
    font-size: 12px;
}

/* ========================================
   Canvas 区域
   ======================================== */

.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-dark);
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* 统计面板 */
.stats-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(45, 45, 48, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px 14px;
    backdrop-filter: blur(10px);
    min-width: 220px;
}

.stats-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--accent-green);
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

.control-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45, 45, 48, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ========================================
   右侧面板
   ======================================== */

.right-panel {
    width: var(--panel-width);
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* 属性区块 */
.property-section {
    border-bottom: 1px solid var(--border-color);
}

.section-header {
    padding: 8px 12px;
    background: var(--bg-darker);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.property-group {
    padding: var(--spacing);
}

.property-row {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.property-row label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.property-row input[type="number"] {
    width: 100%;
    height: 24px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    padding: 0 8px;
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.property-row input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-blue-light);
}

/* 自定义number输入框的上下按钮（深色主题） */
.property-row input[type="number"]::-webkit-inner-spin-button,
.property-row input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    background: var(--bg-hover);
    border-left: 1px solid var(--border-color);
    cursor: pointer;
}

.property-row input[type="number"]::-webkit-inner-spin-button:hover,
.property-row input[type="number"]::-webkit-outer-spin-button:hover {
    background: var(--border-light);
}

.property-row input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.property-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-blue-light);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.property-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.property-row input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent-blue-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue-light);
}

/* 信息项 */
.info-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 11px;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ========================================
   底部时间轴
   ======================================== */

.timeline-container {
    height: var(--timeline-height);
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.timeline-controls {
    height: 32px;
    display: flex;
    align-items: center;
    gap: var(--spacing);
    padding: 0 12px;
    border-bottom: 1px solid var(--border-color);
}

.timeline-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.timeline-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.timeline-btn:active:not(:disabled) {
    background: var(--bg-active);
}

.timeline-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    padding: 0 8px;
    color: var(--text-primary);
}

.time-separator {
    color: var(--text-secondary);
}

.timeline-track {
    flex: 1;
    position: relative;
    padding: 0 12px;
    display: flex;
    align-items: center;
}

.timeline-track input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    position: relative;
    z-index: 2;
}

.timeline-track input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-blue-light);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.timeline-track input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-blue-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.timeline-markers {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 4px;
    pointer-events: none;
    z-index: 1;
}

.timeline-info {
    height: 32px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    font-size: 11px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.speed-btn {
    padding: 2px 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    transition: all 0.15s ease;
}

.speed-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.speed-btn.active {
    background: var(--bg-active);
    border-color: var(--accent-blue-light);
    color: var(--text-primary);
}

/* ========================================
   模态框
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-body h3 {
    font-size: 14px;
    margin: 16px 0 8px 0;
    color: var(--text-primary);
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body ul {
    list-style: none;
    padding: 0;
}

.modal-body li {
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.modal-body kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 11px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--text-primary);
}

.modal-body p {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 8px 0;
}

/* ========================================
   滚动条样式
   ======================================== */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 6px;
    border: 2px solid var(--bg-darker);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1200px) {
    :root {
        --panel-width: 240px;
    }
}

@media (max-width: 900px) {
    .left-panel,
    .right-panel {
        position: absolute;
        height: calc(100% - var(--toolbar-height) - var(--timeline-height));
        z-index: 100;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .left-panel {
        left: -var(--panel-width);
        transition: left 0.3s ease;
    }
    
    .left-panel.show {
        left: 0;
    }
    
    .right-panel {
        right: -var(--panel-width);
        transition: right 0.3s ease;
    }
    
    .right-panel.show {
        right: 0;
    }
}

/* ========================================
   动画
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* ========================================
   算法效率对比面板
   ======================================== */

.comparison-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comparison-item {
    background: var(--bg-darker);
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.comparison-item.highlight {
    background: rgba(14, 99, 156, 0.2);
    border-color: var(--accent-blue-light);
}

.comparison-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.comparison-value {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--accent-blue-light);
}

.comparison-value.green {
    color: #51cf66;
}

.comparison-value.red {
    color: #ff6b6b;
}

.comparison-value.yellow {
    color: #ffd43b;
}

.comparison-note {
    margin-top: 12px;
    padding: 10px;
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-primary);
}

.comparison-note strong {
    color: var(--accent-blue-light);
}

/* ========================================
   性能对比面板（浮动）
   ======================================== */

.perf-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    z-index: 999;
    min-width: 500px;
}

.perf-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.perf-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.perf-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.perf-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.perf-content {
    padding: 16px;
}

#perfChart {
    width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.perf-legend {
    margin-top: 12px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

/* ========================================
   工具按钮状态
   ======================================== */

.tool-btn {
    min-width: 32px;
    position: relative;
}

.tool-btn.active {
    background: var(--bg-active);
    border-color: var(--accent-blue-light);
}

.tool-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-blue-light);
}

/* ========================================
   工具选项面板
   ======================================== */

.tool-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-row label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.option-select {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.option-select:focus {
    outline: none;
    border-color: var(--accent-blue-light);
}

/* ========================================
   快速操作面板
   ======================================== */

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action-btn {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.action-btn .icon {
    font-size: 14px;
}

/* ========================================
   统计面板分隔线
   ======================================== */

.stat-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}
