/* ===== 3D 查看器样式 ===== */
:root {
    --panel-bg: #1a1a2e;
    --panel-border: rgba(255,255,255,0.06);
    --text: #e0e0f0;
    --text-dim: #8888aa;
    --primary: #4ECDC4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

/* ===== 导航 ===== */
.viewer-nav {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 48px;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--panel-border);
    gap: 12px;
}

.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
}
.back-link:hover { color: var(--primary); }

.viewer-title {
    font-weight: 600;
    font-size: 15px;
}

.viewer-id {
    color: var(--text-dim);
    font-size: 12px;
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===== 布局 ===== */
.viewer-layout {
    display: flex;
    height: calc(100vh - 48px);
}

/* ===== 左侧面板 ===== */
.panel-left {
    width: 280px;
    min-width: 280px;
    background: var(--panel-bg);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
}
.panel-header h3 { font-size: 14px; font-weight: 600; }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}
.btn-icon:hover { color: var(--primary); }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.panel-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--panel-border);
}

.btn-sm {
    flex: 1;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    text-align: center;
}
.btn-sm:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

/* ===== 分组 ===== */
.group-item { margin-bottom: 4px; }

.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    user-select: none;
}
.group-header:hover { background: rgba(255,255,255,0.04); }

.group-arrow {
    font-size: 10px;
    color: var(--text-dim);
    width: 12px;
}

.group-name { font-size: 13px; font-weight: 500; flex: 1; }
.group-count {
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 8px;
}

.group-labels { padding-left: 8px; }

/* ===== 标签控制 ===== */
.label-control {
    padding: 6px 8px 6px 12px;
    border-radius: 6px;
    margin-bottom: 2px;
}

.label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.label-name {
    font-size: 12px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.label-opacity-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding-left: 18px;
}

.opacity-label {
    font-size: 11px;
    color: var(--text-dim);
    width: 40px;
}

.label-opacity-row input[type="range"] {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
    outline: none;
}
.label-opacity-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

/* ===== 开关 ===== */
.switch {
    position: relative;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 18px;
    transition: 0.2s;
}
.slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(14px); }

/* ===== 3D 场景 ===== */
.viewer-main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#threeContainer {
    width: 100%;
    height: 100%;
}

/* ===== 人体方位图 ===== */
.orientation-box {
    position: absolute;
    bottom: 20px;
    right: 20px;
    border-radius: 12px;
    overflow: hidden;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.orientation-box:hover { opacity: 1; }

#orientationCanvas { display: block; }

/* ===== 自动旋转控制 ===== */
.rotation-control {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(26,26,46,0.85);
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}
.toggle-label input { accent-color: var(--primary); }

.rotation-control input[type="range"] {
    width: 60px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
}
.rotation-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

/* ===== 显示模式按钮 ===== */
.display-modes {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
}

.mode-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(26,26,46,0.85);
    color: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
}
.mode-btn.active {
    background: var(--primary);
    color: #0f0f1a;
    border-color: var(--primary);
}
.mode-btn:hover:not(.active) { background: rgba(255,255,255,0.08); }

/* ===== 滚动条 ===== */
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
