* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --panel-bg: #f8f9fa;
    --hover-color: #f0f0f0;
}

.dark-mode {
    --bg-color: #2a2a2a;
    --text-color: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #404040;
    --panel-bg: #1e1e1e;
    --hover-color: #404040;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    overflow: hidden;
}

/* 顶部工具栏 */
.topbar {
    background-color: #ffffff;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid #f2f1f1;
    border-radius: 12px;
    position: fixed;
    top: 8px;
    left: 8px;
    right: 8px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color, #333);
    padding: 0 8px;
    white-space: nowrap;
}

.topbar-center {
    flex: 1;
}

/* Topbar action buttons — ghost style, visible on hover */
.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary, #555);
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.topbar-btn i {
    font-size: 11px;
    opacity: 0.55;
    transition: opacity 0.12s;
}

.topbar-btn:hover {
    background: var(--hover-color, rgba(0,0,0,0.05));
    color: var(--text-color, #222);
}

.topbar-btn:hover i {
    opacity: 0.85;
}

.topbar-btn:active {
    background: var(--hover-color, rgba(0,0,0,0.08));
}

/* Logout — icon only, subtle until hovered */
.topbar-btn--logout {
    padding: 0 6px;
    color: var(--text-secondary, #999);
}

.topbar-btn--logout:hover {
    color: #c53030;
    background: rgba(197, 48, 48, 0.06);
}

.topbar-btn--logout:hover i {
    opacity: 1;
}

.topbar-divider {
    width: 1px;
    height: 16px;
    background: var(--border-color, #e0e0e0);
    margin: 0 6px;
    opacity: 0.6;
}

/* Dark mode */
.dark-mode .topbar-btn {
    color: #999;
}

.dark-mode .topbar-btn:hover {
    background: rgba(255,255,255,0.07);
    color: #e0e0e0;
}

.dark-mode .topbar-btn--logout:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

.dark-mode .topbar-divider {
    background: #555;
}

.tool-group {
    display: flex;
    gap: 2px;
    background-color: #f5f5f5;
    border-radius: 6px;
    padding: 4px;
}

/* 图标按钮 */
.icon-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background-color: #e8e8e8;
    color: #333;
}

/* 工具按钮 */
.tool-btn {
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #666;
    font-size: 12px;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background-color: #e0e0e0;
    color: #333;
}

.tool-btn i {
    font-size: 14px;
}

.tool-btn span {
    font-weight: 400;
}

/* 主要布局容器 */
.layout-container {
    display: flex;
    margin-top: 64px;
    height: calc(100vh - 64px);
}

/* 左侧面板 */
.sidebar {
    width: 280px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-radius: 12px;
    margin: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative; /* 为底部元素提供定位上下文 */
    min-height: calc(100vh - 80px); /* 确保有足够高度 */
}

/* 底部元素样式 - 距离底部1cm */
.sidebar-bottom-element {
    position: absolute;
    bottom: 1cm; /* 距离底部1cm */
    left: 16px;
    right: 16px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    text-align: center;
    border: 1px solid #e9ecef;
}

.panel-section {
    border-bottom: 1px solid #f2f1f1;
    display: flex;
    flex-direction: column;
    flex: 1; /* 允许面板区域扩展 */
    margin-bottom: 86px; /* 为底部元素预留空间 */
}

/* 面板标题样式 */
.panel-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    border-bottom: 1px solid #f2f1f1;
    background-color: #000000; /* 设置模型列表header的背景颜色 */
    border-radius: 12px 12px 0 0;
    color: #ffffff; /* 设置文字颜色以确保对比度 */
}

.model-list {
    min-height: 200px;
    max-height: calc(100vh - 200px); /* 确保不会超出视窗高度，预留空间给其他元素 */
    overflow-y: auto;
    background-color: #ffffff;
    flex: 1; /* 允许在可用空间内扩展 */
    padding: 8px;
}

/* 竖直胶囊容器样式 */
.vertical-capsule-container {
    position: fixed;
    left: 301px; /* sidebar宽度280px + margin 8px*2 + 5px间距 */
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.vertical-capsule {
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.capsule-item {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.capsule-item:hover {
    background-color: #000000;
}

/* 夜间模式 */
body.dark-mode {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

.dark-mode .topbar {
    background-color: #2c2c2c;
    border-bottom: 1px solid #444;
    color: #e0e0e0;
}

.dark-mode .sidebar {
    background-color: #2c2c2c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.dark-mode .model-list {
    background-color: #2c2c2c;
}

.dark-mode .sidebar-bottom-element {
    background-color: #3a3a3a;
    border: 1px solid #555;
    color: #ccc;
}

.dark-mode .viewport-info {
    background-color: rgba(44, 44, 44, 0.8);
    color: #CCCCCC;
}

.dark-mode .icon-btn {
    color: #ccc;
}

.dark-mode .icon-btn:hover {
    background-color: #444;
    color: #fff;
}

.dark-mode .bed-dimension {
    background-color: #555;
    color: #e0e0e0;
    border-color: #666;
}

.dark-mode .bed-label,
.dark-mode .bed-unit,
.dark-mode .bed-separator {
    color: #CCCCCC;
}

.dark-mode .panel-header {
    background-color: #3a3a3a;
    border-bottom: 1px solid #555;
}

.dark-mode .panel-section {
    border-bottom-color: #555;
}

.dark-mode .model-item {
    background-color: #3a3a3a;
    border: 1px solid #555;
}

.dark-mode .model-item:hover {
    background-color: #4a4a4a;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.dark-mode .model-item.selected {
    background-color: #000000;
    border-color: #333333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dark-mode .model-item.selected .model-name,
.dark-mode .model-item.selected .model-details {
    color: #ffffff;
}

.dark-mode .model-item.selected .model-icon {
    background-color: #ffffff;
    color: #000000;
}

.dark-mode .model-item.selected .model-action-btn {
    color: #ffffff;
}

.dark-mode .model-item.selected .model-number {
    color: #ffffff;
}

.dark-mode .model-item.selected .model-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.dark-mode .model-number {
    color: #4a90e2;
}

/* 夜间模式下的隐藏状态样式 */
.dark-mode .model-item.model-hidden {
    opacity: 0.5;
    background-color: #2a2a2a;
    border-color: #444;
}

.dark-mode .model-item.model-hidden:hover {
    opacity: 0.7;
    background-color: #333;
}

.dark-mode .model-item.model-hidden .model-name,
.dark-mode .model-item.model-hidden .model-details {
    color: #777;
    text-decoration: line-through;
}

.dark-mode .model-item.model-hidden .model-number {
    color: #777;
}

.dark-mode .model-item.model-hidden .model-icon {
    background-color: #555;
    color: #888;
}

.dark-mode .model-name, .dark-mode .model-details {
    color: #e0e0e0;
}

.dark-mode .model-action-btn {
    color: #ccc;
}

.dark-mode .model-action-btn:hover {
    background-color: #555;
    color: #fff;
}

.dark-mode .viewport-container {
    background: #3a3a3a;
}

.dark-mode .vertical-capsule {
    background-color: #2c2c2c;
    border-color: #555;
}

.dark-mode .capsule-item {
    background-color: #3a3a3a;
}

.dark-mode .capsule-item i {
    color: #ccc;
}

.dark-mode .capsule-item:hover {
    background-color: #555;
}

.dark-mode .capsule-item:hover i {
    color: #fff;
}

.capsule-item i {
    font-size: 16px;
    color: #666;
    transition: color 0.3s ease;
}

.capsule-item:hover i {
    color: #ffffff;
}

/* 主要视图区域 */
.main-viewport {
    flex: 1;
    /* background-color: #e8e8e8; */
    position: relative;
    overflow: hidden;
    margin: 8px 8px 8px 0;
    border-radius: 12px;
}

.viewport-container {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    position: relative;
}

/* 3D画布样式 */
#threejs-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 12px;
}

/* 视图信息栏 */
.viewport-info {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    color: #666;
    backdrop-filter: blur(5px);
}

.print-info {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 500;
}

.bed-label,
.bed-separator,
.bed-unit {
    color: #666;
    font-weight: 500;
}

.bed-dimension {
    color: #333;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    background-color: rgba(74, 144, 226, 0.05);
    border: 1px solid transparent;
    min-width: 24px;
    text-align: center;
}

.bed-dimension:hover {
    background-color: rgba(74, 144, 226, 0.15);
    border-color: rgba(74, 144, 226, 0.3);
    color: #4a90e2;
    transform: translateY(-1px);
}

/* 自定义滚动条 */
.model-list::-webkit-scrollbar {
    width: 6px;
}

.model-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.model-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.model-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 模型项目样式 */
.model-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

/* 模型编号样式 */
.model-number {
    font-size: 14px;
    font-weight: 700;
    color: #4a90e2;
    margin-right: 8px;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.model-item:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 选中状态样式 */
.model-item.selected {
    background-color: #000000;
    border-color: #333333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.model-item.selected .model-name,
.model-item.selected .model-details {
    color: #ffffff;
}

.model-item.selected .model-icon {
    background-color: #ffffff;
    color: #000000;
}

.model-item.selected .model-number {
    color: #ffffff;
}

.model-item.selected .model-action-btn {
    color: #ffffff;
}

.model-item.selected .model-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* 隐藏状态样式 */
.model-item.model-hidden {
    opacity: 0.5;
    background-color: #f0f0f0;
    border-color: #ddd;
}

.model-item.model-hidden:hover {
    opacity: 0.7;
    background-color: #e8e8e8;
}

.model-item.model-hidden .model-name,
.model-item.model-hidden .model-details {
    color: #999;
    text-decoration: line-through;
}

.model-item.model-hidden .model-number {
    color: #999;
}

.model-item.model-hidden .model-icon {
    background-color: #ccc;
    color: #888;
}

.model-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #000000;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.model-info {
    flex: 1;
    min-width: 0;
}

.model-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-details {
    font-size: 12px;
    color: #666;
}

.model-actions {
    display: flex;
    gap: 4px;
}

.model-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: none;
    border: none;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-action-btn:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* iOS风格Checkbox */
.checkbox-container {
    display: flex;
    gap: 20px;
    padding: 10px;
    background: var(--bg-color, #ffffff);
    border-radius: 12px;
}

.ios-checkbox {
    --checkbox-size: 28px;
    --checkbox-color: #1a1a1a;
    --checkbox-bg: #e8e8e8;
    --checkbox-border: #d0d0d0;

    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ios-checkbox input {
    display: none;
}

.checkbox-wrapper {
    position: relative;
    width: var(--checkbox-size);
    height: var(--checkbox-size);
    border-radius: 12px;
    transition: transform 0.2s ease;
}

.checkbox-bg {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    border: 2px solid var(--checkbox-border);
    background: #f5f5f5;
    transition: all 0.2s ease;
}

.checkbox-icon {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 80%;
    height: 80%;
    color: white;
    transform: scale(0);
    transition: all 0.2s ease;
}

.check-path {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    transition: stroke-dashoffset 0.3s ease 0.1s;
}

/* Checked State */
.ios-checkbox input:checked + .checkbox-wrapper .checkbox-bg {
    background: var(--checkbox-color);
    border-color: var(--checkbox-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ios-checkbox input:checked + .checkbox-wrapper .checkbox-icon {
    transform: scale(1);
}

.ios-checkbox input:checked + .checkbox-wrapper .check-path {
    stroke-dashoffset: 0;
}

/* Hover Effects */
.ios-checkbox:hover .checkbox-wrapper {
    transform: scale(1.05);
}

/* Active Animation */
.ios-checkbox:active .checkbox-wrapper {
    transform: scale(0.95);
}

/* Focus Styles */
.ios-checkbox input:focus + .checkbox-wrapper .checkbox-bg {
    box-shadow: 0 0 0 4px var(--checkbox-bg);
}

/* Animation */
@keyframes bounce {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.ios-checkbox input:checked + .checkbox-wrapper {
    animation: bounce 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 深色模式适配 */
.dark-mode .ios-checkbox {
    --checkbox-color: #4a4a4a;
    --checkbox-bg: #3a3a3a;
    --checkbox-border: #555;
}

.dark-mode .checkbox-bg {
    background: #3a3a3a;
    border-color: var(--checkbox-border);
}

.dark-mode .ios-checkbox input:checked + .checkbox-wrapper .checkbox-bg {
    background: var(--checkbox-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 日夜模式切换开关 */
.switch {
    font-size: 17px;
    position: relative;
    display: inline-block;
    width: 4em;
    height: 2.2em;
    border-radius: 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a2a2a;
    transition: 0.4s;
    border-radius: 30px;
    overflow: hidden;
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.2em;
    width: 1.2em;
    border-radius: 20px;
    left: 0.5em;
    bottom: 0.5em;
    transition: 0.4s;
    transition-timing-function: cubic-bezier(0.81, -0.04, 0.38, 1.5);
    box-shadow: inset 8px -4px 0px 0px #fff;
}

.switch input:checked + .slider {
    background-color: #00a6ff;
}

.switch input:checked + .slider:before {
    transform: translateX(1.8em);
    box-shadow: inset 15px -4px 0px 15px #ffcf48;
}

.star {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    width: 5px;
    transition: all 0.4s;
    height: 5px;
}

.star_1 {
    left: 2.5em;
    top: 0.5em;
}

.star_2 {
    left: 2.2em;
    top: 1.2em;
}

.star_3 {
    left: 3em;
    top: 0.9em;
}

.switch input:checked ~ .slider .star {
    opacity: 0;
}

.cloud {
    width: 3.5em;
    position: absolute;
    bottom: -1.4em;
    left: -1.1em;
    opacity: 0;
    transition: all 0.4s;
}

.switch input:checked ~ .slider .cloud {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .tool-btn span {
        display: none;
    }

    .tool-btn {
        padding: 6px 8px;
    }
}

/* 删除消息提示样式 */
.delete-message {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 消息提示样式 */
.message {
    position: absolute;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

.loading-message {
    top: 12px;
    left: 12px;
    background-color: rgba(255, 152, 0, 0.9);
    color: white;
    padding-left: 28px;
    position: relative;
}

.loading-message:before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    margin-top: -6px;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 1s linear infinite;
}

.success-message {
    top: 12px;
    left: 12px;
    background-color: rgba(76, 175, 80, 0.9);
    color: white;
}

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

/* 3D画布鼠标样式 */
#threejs-canvas {
    cursor: default;
    transition: cursor 0.2s ease;
}

/* 鼠标悬停在控制柄上时的样式 */
#threejs-canvas.hover-handle {
    cursor: pointer;
}

/* 拖拽模式时的样式 */
#threejs-canvas.dragging {
    cursor: move;
}

#threejs-canvas.dragging-axis {
    cursor: crosshair;
}

/* ==================== 右键菜单样式 ==================== */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 4px 0;
    min-width: 180px;
    z-index: 1000;
    font-size: 14px;
    user-select: none;
}

.dark-mode .context-menu {
    background: #2a2a2a;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #f0f0f0;
}

.dark-mode .menu-item:hover {
    background-color: #3a3a3a;
}

.menu-item i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    color: #666;
}

.dark-mode .menu-item i {
    color: #aaa;
}

.menu-item span {
    flex: 1;
    color: #333;
}

.dark-mode .menu-item span {
    color: #ddd;
}

.menu-item.danger {
    color: #e74c3c;
}

.menu-item.danger i,
.menu-item.danger span {
    color: #e74c3c;
}

.menu-item.danger:hover {
    background-color: #fee;
}

.dark-mode .menu-item.danger:hover {
    background-color: #3a2222;
}

.menu-separator {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

.dark-mode .menu-separator {
    background-color: #444;
}

/* 禁用状态 */
.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 模态框基础样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background-color: var(--bg-color, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color, #333);
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: var(--hover-color, #f0f0f0);
    color: var(--text-color, #333);
}

.modal-body {
    padding: 0;
}

/* 深色模式适配 */
.dark-mode .modal-content {
    background-color: #2a2a2a;
    color: #ffffff;
}

.dark-mode .modal-header {
    border-bottom-color: #404040;
}

.dark-mode .close-btn {
    color: #cccccc;
}

.dark-mode .close-btn:hover {
    background-color: #404040;
    color: #ffffff;
}

/* ==================== 角度计算器样式 ==================== */
.angle-calculator-window {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: flex-start;
    align-items: center;
    padding-left: 367px;
    z-index: 10000;
}

.angle-calculator-content {
    background-color: var(--bg-color, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 299px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease-out;
}

.dark-mode .angle-calculator-content {
    background-color: #2a2a2a;
    color: #ffffff;
}

.window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.dark-mode .window-header {
    border-bottom-color: #404040;
}

.window-header h3 {
    margin: 0;
    color: var(--text-color, #333);
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-mode .window-header h3 {
    color: #ffffff;
}

.calculator-body {
    padding: 24px;
}

.calculator-section {
    margin-bottom: 20px;
}

.calculator-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color, #333);
}

/* ==================== 登录界面样式 ==================== */
/* ── 登录 / 注册 ─────────────────────────────────────────────────── */

.login-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    justify-content: center;
    align-items: center;
    background: var(--bg-color, #f0f0f0);
    animation: loginFadeIn 0.35s ease-out;
}

@keyframes loginFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.login-container {
    width: 380px;
    max-width: 90vw;
    padding: 40px 36px 32px;
    background: var(--bg-color, #ffffff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: loginCardIn 0.4s ease-out both;
    animation-delay: 0.1s;
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #000;
    margin-bottom: 16px;
}

.login-icon i {
    font-size: 20px;
    color: #fff;
}

.login-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color, #333);
}

.login-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-secondary, #666);
    font-weight: 400;
}

/* Forms */
.login-forms-wrapper {
    position: relative;
    overflow: hidden;
}

.login-form {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.login-form--active {
    display: flex;
    animation: formFadeIn 0.3s ease-out both;
}

.login-form--exit {
    animation: formFadeOut 0.2s ease-in both;
}

@keyframes formFadeIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

/* Fields */
.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #666);
}

.login-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--panel-bg, #f8f9fa);
    color: var(--text-color, #333);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.login-field input:focus {
    border-color: #333;
    background: var(--bg-color, #ffffff);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.login-field input::placeholder {
    color: var(--text-secondary, #999);
}

/* Error */
.login-error {
    display: none;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: #dc2626;
    font-size: 13px;
    text-align: center;
}

/* Button */
.login-btn {
    width: 100%;
    height: 40px;
    background: var(--text-color, #1a1a1a);
    color: var(--bg-color, #fff);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 6px;
}

.login-btn:hover {
    opacity: 0.82;
}

.login-btn:active {
    transform: scale(0.98);
    opacity: 0.7;
}

.login-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* Dark mode */
.dark-mode .login-btn {
    background: #f0f0f0;
    color: #1a1a1a;
}

.dark-mode .login-btn:hover {
    opacity: 0.88;
}

/* Switch link */
.login-switch {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary, #666);
}

.login-switch a {
    color: #333;
    text-decoration: underline;
    font-weight: 500;
    margin-left: 2px;
}

.login-switch a:hover {
    text-decoration: underline;
}

/* Dark mode */
.dark-mode .login-overlay {
    background: #2c2c2c;
}

.dark-mode .login-container {
    background: #2c2c2c;
    border-color: #404040;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.dark-mode .login-icon {
    background: #fff;
}

.dark-mode .login-icon i {
    color: #000;
}

.dark-mode .login-btn {
    background: #fff;
    color: #000;
}

.dark-mode .login-btn:hover {
    background: #e0e0e0;
}

.dark-mode .login-field input {
    background: #1e1e1e;
    border-color: #404040;
    color: #fff;
}

.dark-mode .login-field input:focus {
    background: #2a2a2a;
    border-color: #ccc;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.dark-mode .login-switch a {
    color: #ccc;
}

.dark-mode .login-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Responsive */
@media (max-width: 480px) {
    .login-container {
        padding: 32px 24px 28px;
    }
}

.dark-mode .calculator-label {
    color: #ffffff;
}

.calculator-select,
.calculator-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--bg-color, #ffffff);
    color: var(--text-color, #333);
    transition: all 0.2s;
}

.calculator-select:focus,
.calculator-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.calculator-select:disabled {
    background-color: var(--hover-color, #f0f0f0);
    cursor: not-allowed;
    opacity: 0.6;
}

.dark-mode .calculator-select,
.dark-mode .calculator-input {
    background-color: #1e1e1e;
    border-color: #404040;
    color: #ffffff;
}

.dark-mode .calculator-select:disabled {
    background-color: #2a2a2a;
}

.calculator-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calculator-input-group .calculator-input {
    flex: 1;
}

.calculator-unit {
    font-size: 14px;
    color: var(--text-secondary, #666);
    min-width: 30px;
}

.dark-mode .calculator-unit {
    color: #cccccc;
}

.calculator-divider {
    height: 1px;
    background-color: var(--border-color, #e0e0e0);
    margin: 24px 0;
}

.dark-mode .calculator-divider {
    background-color: #404040;
}

.result-section {
    background-color: var(--panel-bg, #f8f9fa);
    padding: 16px;
    border-radius: 8px;
    transition: all 0.3s;
}

.dark-mode .result-section {
    background-color: #1e1e1e;
}

.result-section.highlight {
    background-color: #e3f2fd;
    box-shadow: 0 0 0 2px #4a90e2;
}

.dark-mode .result-section.highlight {
    background-color: #1a3a52;
}

.result-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
}

.result-value {
    font-size: 32px;
    font-weight: 600;
    color: #4a90e2;
}

.result-unit {
    font-size: 18px;
    color: var(--text-secondary, #666);
}

.dark-mode .result-unit {
    color: #cccccc;
}

.calculator-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background-color: #e3f2fd;
    border-left: 3px solid #4a90e2;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #1976d2;
}

.dark-mode .calculator-info {
    background-color: #1a3a52;
    color: #90caf9;
}

.calculator-info i {
    margin-top: 2px;
}

.calculator-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.calculator-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.calculator-btn.primary {
    background-color: #4a90e2;
    color: white;
}

.calculator-btn.primary:hover {
    background-color: #357abd;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.calculator-btn:not(.primary) {
    background-color: var(--panel-bg, #f8f9fa);
    color: var(--text-color, #333);
    border: 1px solid var(--border-color, #e0e0e0);
}

.calculator-btn:not(.primary):hover {
    background-color: var(--hover-color, #f0f0f0);
}

.dark-mode .calculator-btn:not(.primary) {
    background-color: #1e1e1e;
    color: #ffffff;
    border-color: #404040;
}

.dark-mode .calculator-btn:not(.primary):hover {
    background-color: #404040;
}

/* 自定义滚动条 */
.angle-calculator-content::-webkit-scrollbar {
    width: 8px;
}

.angle-calculator-content::-webkit-scrollbar-track {
    background: var(--panel-bg, #f8f9fa);
    border-radius: 4px;
}

.angle-calculator-content::-webkit-scrollbar-thumb {
    background: var(--border-color, #e0e0e0);
    border-radius: 4px;
}

.angle-calculator-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.dark-mode .angle-calculator-content::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.dark-mode .angle-calculator-content::-webkit-scrollbar-thumb {
    background: #404040;
}

.dark-mode .angle-calculator-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== 模型分析对话框样式 ===== */

.analysis-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.analysis-dialog-content {
    background-color: var(--bg-color, #ffffff);
    color: var(--text-color, #333333);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.analysis-dialog-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
}

.analysis-dialog-header .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary, #666666);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.analysis-dialog-header .close-btn:hover {
    background-color: var(--hover-color, #f0f0f0);
    color: var(--text-color, #333333);
}

.analysis-dialog-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 分析报告内容 */

.analysis-report h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-color, #333333);
}

.analysis-report h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-color, #333333);
    font-weight: 600;
}

.report-section {
    margin-bottom: 20px;
    padding: 12px;
    background-color: var(--panel-bg, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.report-section p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
}

.report-section p strong {
    color: var(--text-color, #333333);
    font-weight: 600;
}

.report-section .warning {
    color: #ff9800;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-section .success {
    color: #4caf50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 连通区域详情表格 */

.component-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}

.component-table thead {
    background-color: var(--hover-color, #f0f0f0);
}

.component-table th,
.component-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.component-table th {
    font-weight: 600;
    color: var(--text-color, #333333);
}

.component-table td {
    color: var(--text-secondary, #666666);
}

.component-table tbody tr:hover {
    background-color: var(--hover-color, #f0f0f0);
}

.component-table tbody tr:last-child td {
    border-bottom: none;
}

/* 暗黑模式支持 */

.dark-mode .analysis-dialog {
    background-color: rgba(0, 0, 0, 0.7);
}

.dark-mode .component-table thead {
    background-color: #404040;
}

/* 自定义滚动条 */

.analysis-dialog-body::-webkit-scrollbar {
    width: 8px;
}

.analysis-dialog-body::-webkit-scrollbar-track {
    background: var(--panel-bg, #f8f9fa);
    border-radius: 4px;
}

.analysis-dialog-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #e0e0e0);
    border-radius: 4px;
}

.analysis-dialog-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.dark-mode .analysis-dialog-body::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.dark-mode .analysis-dialog-body::-webkit-scrollbar-thumb {
    background: #404040;
}

.dark-mode .analysis-dialog-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.analysis-error {
    padding: 20px;
    text-align: center;
    color: #f44336;
    font-size: 14px;
}

/* 分析报告操作按钮 */

.report-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 16px 12px;
}

.analysis-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color, #e0e0e0);
    background-color: var(--bg-color, #ffffff);
    color: var(--text-color, #333333);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.analysis-btn:hover {
    background-color: var(--hover-color, #f0f0f0);
    border-color: var(--text-secondary, #666666);
}

.analysis-btn.primary {
    background-color: #4a90e2;
    color: #ffffff;
    border-color: #4a90e2;
}

.analysis-btn.primary:hover {
    background-color: #357abd;
    border-color: #357abd;
}

.dark-mode .analysis-btn {
    background-color: #1e1e1e;
    color: #ffffff;
    border-color: #404040;
}

.dark-mode .analysis-btn:hover {
    background-color: #404040;
    border-color: #666666;
}

/* ================================
   容器盒子生成器样式
   ================================ */

.container-box-modal {
    width: 299px;
}

/* ================================
   角度计算器样式
   ================================ */

.angle-calculator-modal {
    width: 299px;
}

.angle-calculator-modal .control-divider {
    height: 1px;
    background: var(--border-color, #e0e0e0);
    margin: 24px 0;
}

.angle-calculator-modal .result-group {
    background: var(--panel-bg, #f8f9fa);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.angle-calculator-modal .result-group label {
    font-weight: 600;
    margin-bottom: 8px;
}

.angle-calculator-modal .result-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.angle-calculator-modal .result-value {
    font-size: 24px;
    font-weight: 700;
    color: #4a90e2;
}

.angle-calculator-modal .info-text {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    border-radius: 4px;
    font-size: 13px;
    color: #1976d2;
    margin-top: 16px;
}

.angle-calculator-modal .info-text i {
    font-size: 16px;
}

/* 深色模式 */
.dark-mode .angle-calculator-modal .control-divider {
    background: #404040;
}

.dark-mode .angle-calculator-modal .result-group {
    background: #2a2a2a;
}

.dark-mode .angle-calculator-modal .result-value {
    color: #64b5f6;
}

.dark-mode .angle-calculator-modal .info-text {
    background: #1a237e;
    border-left-color: #448aff;
    color: #90caf9;
}

/* ================================
   ViewCube 视角控制器样式
   ================================ */

#viewcube-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    z-index: 100;
    pointer-events: auto;
    cursor: grab;
}

#viewcube-container:active {
    cursor: grabbing;
}



