/* ===== 参数面板样式 ===== */
/* /ai 三个滑动控制区独立成卡片，保持参数区域清晰分隔。 */
.slider-control-card {
    border: 1px solid #d8dee8;
    border-radius: 7px;
    padding: 8px 10px 7px;
    background: #fff;
}
.slider-product-card { border-left: 3px solid #0d6efd; }
.slider-reference-card { border-left: 3px solid #198754; }
.slider-freedom-card { border-left: 3px solid #8b5cf6; }
[data-theme="dark"] .slider-control-card {
    border-color: #3d3d54;
    background: #20203a;
}
.param-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: #495057;
}

.model-selection-area .param-label {
    font-size: 0.7rem;
    margin-bottom: 3px;
    color: #6c757d;
}

.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    padding: 6px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area-xs {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    border-width: 1.5px;
}

.upload-area:hover {
    border-color: #0d6efd;
    background: #f8f9fa;
}

.upload-area.has-image {
    border-color: #198754;
    background: #f0f9f0;
}

.upload-preview {
    max-width: 100%;
    max-height: 100px;
    border-radius: 4px;
}

/* 超小尺寸组件 */
.btn-xs {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 3px;
    line-height: 1.3;
}

.form-control-xs,
.form-select-xs {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 3px;
    min-height: auto;
    height: calc(1.3em + 6px + 2px);
}

/* 需求输入框高度由 rows 属性控制 */
textarea.requirement-input {
    height: auto !important;
    min-height: calc(1.3em * 6 + 6px + 2px);
}

.input-group-xs > .form-control,
.input-group-xs > .form-select,
.input-group-xs > .btn {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 3px;
}

.form-check-xs {
    min-height: 1rem;
    padding-left: 1.4rem;
}

.form-check-xs .form-check-input {
    width: 1em;
    height: 1em;
    margin-left: -1.4em;
    margin-top: 0.15em;
}

.form-check-xs .form-check-label {
    font-size: 0.7rem;
    line-height: 1;
}

.xs {
    font-size: 0.7rem;
}

.reference-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
    max-height: 100px;
    overflow-y: auto;
}
.reference-preview-grid:empty { display: none; }
.reference-preview-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ced4da;
}
.reference-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}
.reference-preview-item img:hover {
    opacity: 0.85;
}
.reference-preview-item button {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    padding: 0;
    line-height: 14px;
    border-radius: 50%;
    z-index: 2;
    font-size: 0.65rem;
}

/* ===== 历史记录样式 ===== */
.history-grid {
    display: grid;
    grid-template-columns: repeat(var(--history-columns, 3), 1fr);
    gap: 8px;
    transition: grid-template-columns 0.2s ease;
}

.history-item {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-item:hover .history-overlay {
    opacity: 1;
}

.history-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s;
}

/* ==================== 按项目分组的历史记录样式 ==================== */

.project-history-list {
    display: flex;
    flex-direction: column;
}

/* 项目卡片 */
.project-card {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.project-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* 项目头部：名称 + 计数 */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.project-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.project-name i {
    color: #ffc107;
    margin-right: 3px;
    font-size: 0.7rem;
}

.project-badge {
    font-size: 0.65rem;
    color: #999;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.project-badge:hover {
    background: #0d6efd;
    color: #fff;
}

.project-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-edit-project {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.btn-edit-project:hover {
    color: #4a6cf7;
    background: #eef1ff;
}

/* 图片容器：换行显示（缩略图放大后不再横向挤出可视区） */
.project-images-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 2px;
}

/* 缩略图 - 默认35px，随"大图/小图"滑块变化 */
.project-thumb {
    width: var(--history-thumb-size, 35px);
    height: var(--history-thumb-size, 35px);
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    cursor: pointer;
    border: 1px solid #eee;
    transition: border-color 0.2s;
}

.project-thumb:hover {
    border-color: #007bff;
}

/* 剩余数量遮罩 - 尺寸随缩略图滑块变化 */
.project-more {
    width: var(--history-thumb-size, 35px);
    height: var(--history-thumb-size, 35px);
    background: rgba(0,0,0,0.65);
    color: white;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: bold;
    transition: background 0.2s;
}

.project-more:hover {
    background: rgba(0,0,0,0.8);
}

/* ===== 结果面板样式 ===== */

/* ==================== 第四列按项目分组样式（新） ==================== */

.history-by-project {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-project-group {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border-color, #eee);
}

.history-project-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.history-project-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--panel-text, #333);
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.history-project-header:hover {
    color: #007bff;
}

.history-project-header .badge {
    font-size: 0.65rem;
    padding: 2px 6px;
}

.history-project-images {
    display: grid;
    grid-template-columns: repeat(var(--history-columns, 3), 1fr);
    gap: 4px;
    margin-top: 6px;
    transition: grid-template-columns 0.2s ease;
}

.history-item-sm {
    aspect-ratio: 1;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.history-item-sm:hover {
    border-color: #007bff;
}

.history-item-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.result-image {
    max-width: 100%;
    max-height: 65vh;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.result-actions {
    margin-top: 15px;
}

/* ===== 收藏夹样式 ===== */
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.favorite-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.favorite-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.favorite-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 图片权重滑动条样式 ===== */
.weight-slider {
    height: 6px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.weight-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* 产品图 - 蓝色 */
.weight-slider.product::-webkit-slider-thumb {
    background: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.2);
}
.weight-slider.product::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px rgba(13,110,253,0.3);
}

/* 参考图 - 绿色 */
.weight-slider.reference::-webkit-slider-thumb {
    background: #198754;
    box-shadow: 0 0 0 3px rgba(25,135,84,0.2);
}
.weight-slider.reference::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px rgba(25,135,84,0.3);
}

/* Firefox */
.weight-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
.weight-slider.product::-moz-range-thumb {
    background: #0d6efd;
}
.weight-slider.reference::-moz-range-thumb {
    background: #198754;
}

/* 权重刻度标签 */
.weight-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: #adb5bd;
    margin-top: 1px;
}

/* 权重数值徽章 */
.badge-weight {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    font-weight: 600;
}
.badge-product {
    background: #cfe2ff;
    color: #084298;
}
.badge-reference {
    background: #d1e7dd;
    color: #0f5132;
}

/* ===== AI 智能补全按钮样式 ===== */
.ai-suggest-btn {
    font-size: 0.65rem !important;
    padding: 1px 4px !important;
    line-height: 1.2 !important;
    border-color: #ffc107 !important;
    color: #856404 !important;
    background-color: #fff3cd !important;
    transition: all 0.2s;
}

.ai-suggest-btn:hover {
    background-color: #ffc107 !important;
    color: #212529 !important;
    border-color: #ffc107 !important;
}

.ai-suggest-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-suggest-btn i {
    margin-right: 2px;
}

/* ===== 两阶段生图 [新增] — 模型选择网格样式 ===== */
.model-selection-area {
    margin-bottom: 8px;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 2px;
}

.model-grid-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.model-grid-item:hover {
    border-color: #0d6efd;
    background: #f8f9fa;
}

.model-grid-item.selected {
    border-color: #0d6efd;
    background: #e7f1ff;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.2);
}

.model-grid-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    margin-bottom: 3px;
}

.model-grid-icon-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
    color: #6c757d;
    font-size: 0.8rem;
}

.model-grid-name {
    font-size: 0.65rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    word-break: break-all;
    max-width: 100%;
}

.model-price {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.55rem;
    color: #dc3545;
    background: #fff;
    padding: 0 3px;
    border-radius: 2px;
    border: 1px solid #dc3545;
    line-height: 1.2;
}

/* ===== 阶段2模型多选勾选角标 [新增] ===== */
.model-check {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.7rem;
    line-height: 1;
    color: #adb5bd;
}
.model-grid-item.selected .model-check {
    color: #0d6efd;
}
/* ===== 阶段2模型多选勾选角标 [新增结束] ===== */

/* ===== 生成3D浮动按钮 [新增]：固定图片右上角，常显，与底部悬浮操作条区分 ===== */
.btn-3d-float {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #7c4dff 0%, #00bcd4 100%);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 3px 10px rgba(124, 77, 255, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}
.btn-3d-float:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(124, 77, 255, 0.55);
    color: #fff;
}
.btn-3d-float.sm {
    top: 6px;
    right: 6px;
    padding: 3px 9px;
    font-size: 0.68rem;
    border-radius: 14px;
}
/* ===== 生成3D浮动按钮 [新增结束] ===== */
/* ===== 两阶段生图 [新增结束] ===== */

/* ===== 侧边栏项目功能区 ===== */
.sidebar-top-space {
    height: 20px;
    flex-shrink: 0;
}

.sidebar-top-action {
    padding: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.sidebar-btn-full {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.7rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn-full:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

.sidebar-section {
    padding: 6px 4px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.sidebar-section-header {
    font-size: 0.65rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
    padding-left: 2px;
}

.sidebar-project-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.sidebar-btn {
    flex: 1;
    min-width: 32px;
    padding: 4px 2px;
    font-size: 0.65rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

/* ===== 侧边栏项目按钮 ===== */
.sidebar-project-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 3px;
    font-size: 0.72rem;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--panel-text, #212529);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.sidebar-project-btn:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

.sidebar-project-btn.active {
    background: #cfe2ff;
    border-color: #0d6efd;
    color: #0d6efd;
    font-weight: 600;
}

.sidebar-project-btn.pinned {
    border-left: 3px solid #ffc107;
    padding-left: 6px;
}

.sidebar-project-btn .sidebar-project-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-project-btn .sidebar-project-info > i {
    margin-right: 4px;
    color: #ffc107;
}

.sidebar-project-desc {
    display: block;
    font-size: 0.6rem;
    color: #999;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 18px;
    margin-top: 1px;
}

/* 第四列标签栏 */
.history-tabs {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.history-tab-btn {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.history-tab-btn.active {
    background: #0d6efd;
    color: #fff;
}

.history-tab-btn.active:hover {
    background: #0b5ed7;
}

.history-tab-back {
    color: #dc3545;
}

.history-tab-back:hover {
    background: #f8d7da;
    color: #b02a37;
}

/* 项目内的操作按钮组（悬停显示） */
.sidebar-item-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: 4px;
}

.sidebar-project-btn:hover .sidebar-item-actions {
    opacity: 1;
}

.sidebar-project-action {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 0.6rem;
    padding: 2px 3px;
    border-radius: 3px;
    transition: all 0.15s;
    line-height: 1;
}

.sidebar-project-action:hover {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.1);
}

.sidebar-project-action.active {
    color: #ffc107;
}

/* ===== 设计模式按钮组 ===== */
.design-mode-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.design-mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1.5px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-size: 0.7rem;
    line-height: 1.3;
}
.design-mode-btn:hover {
    border-color: #ffc107;
    background: #fffdf0;
}
.design-mode-btn.active {
    border-color: #ffc107;
    background: #fff8e1;
    box-shadow: 0 0 0 2px rgba(255,193,7,0.2);
}
.mode-icon {
    font-size: 1rem;
    flex-shrink: 0;
}
.mode-name {
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}
.mode-desc {
    color: #999;
    font-size: 0.6rem;
    margin-left: auto;
    white-space: nowrap;
}

/* ===== 快捷标签 ===== */
.quick-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.quick-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.65rem;
    color: #495057;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.quick-tag:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

/* ===== 结构/布局保留度 ===== */
.structure-weight-section {
    padding: 4px 0;
}
.weight-slider.structure::-webkit-slider-thumb {
    background: #0dcaf0;
    box-shadow: 0 0 0 3px rgba(13,202,240,0.2);
}
.weight-slider.structure::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px rgba(13,202,240,0.3);
}
.weight-slider.structure::-moz-range-thumb {
    background: #0dcaf0;
}
.badge-structure {
    background: #cff4fc;
    color: #055160;
}
.structure-weight-hint {
    font-size: 0.6rem;
    color: #6c757d;
    margin-top: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f8f9fa;
}
.structure-weight-hint.strict { color: #dc3545; background: #f8d7da; }
.structure-weight-hint.strong { color: #fd7e14; background: #fff3cd; }
.structure-weight-hint.normal { color: #0dcaf0; background: #cff4fc; }
.structure-weight-hint.weak { color: #6f42c1; background: #e2d9f3; }
.structure-weight-hint.free { color: #20c997; background: #d1e7dd; }

.sidebar-project-action.active:hover {
    color: #e0a800;
}

/* ===== 参数面板工具列表 ===== */
.param-tool-list {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
}

.param-tool-item {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 0.7rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.param-tool-item:hover {
    background: #f8f9fa;
    border-color: #0d6efd;
}

.param-tool-item.active {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
    font-weight: 500;
}

.param-tool-name {
    white-space: nowrap;
}

/* ===== 第四列缩略图大小控制条 ===== */
.history-size-toolbar {
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: rgba(0,0,0,0.02);
    flex-shrink: 0;
}

.history-size-slider {
    height: 4px;
    cursor: pointer;
    flex: 1;
    min-width: 60px;
}

.history-size-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
}

.history-size-slider::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    background: #0d6efd;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.15s, background 0.15s;
}

.history-size-slider::-webkit-slider-thumb:hover {
    background: #0b5ed7;
    transform: scale(1.15);
}

.history-size-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
}

.history-size-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #0d6efd;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.history-size-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #0d6efd;
    min-width: 22px;
    text-align: center;
}

/* ===== AI 设计指令输入框 + 设计素材按钮 ===== */
.ai-command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.ai-command-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ai-command-textarea {
    width: 100% !important;
    min-height: 120px !important;
    font-size: 0.75rem !important;
    resize: vertical;
}
.ai-command-editor {
    position: relative;
}
.ai-command-placeholder {
    position: absolute;
    inset: 1px;
    padding: 9px 12px;
    color: #8a94a6;
    font-size: 0.75rem;
    line-height: 1.5;
    cursor: text;
    pointer-events: none;
    transition: opacity 0.16s ease;
}
.ai-command-placeholder.is-visible {
    pointer-events: none;
}
/* 占位层只在空输入框时显示；不能覆盖已编辑的设计需求 */
.ai-command-textarea:not(:placeholder-shown) + .ai-command-placeholder {
    pointer-events: none !important;
}
.ai-command-placeholder .ai-placeholder-text,
.ai-command-placeholder .ai-placeholder-hint {
    pointer-events: auto;
}
.ai-command-placeholder.is-hidden {
    opacity: 0;
    pointer-events: none;
}
.ai-placeholder-hint {
    margin-left: 6px;
    color: #667eea;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}
.ai-history-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #d8dee8;
    border-radius: 5px;
    background: #fff;
    color: #6c757d;
    font-size: 0.7rem;
    transition: all 0.16s ease;
}
.ai-history-btn:hover:not(:disabled) {
    color: #667eea;
    border-color: #667eea;
    background: #f4f5ff;
}
.ai-history-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}
[data-theme="dark"] .ai-command-placeholder { color: #9a9ab0; }
[data-theme="dark"] .ai-placeholder-hint { color: #a7b0ff; }
[data-theme="dark"] .ai-history-btn { background: #20203a; border-color: #3d3d54; color: #b8b8c8; }
.ai-suggestion-row {
    display: flex;
    justify-content: center;
    margin: 6px 0 2px;
}
.ai-suggestion-btn {
    min-width: 96px;
    border-radius: 6px;
    font-weight: 600;
}
.ai-suggestion-error {
    width: 100%;
    margin-top: 5px;
    padding: 6px 9px;
    border: 1px solid #f1aeb5;
    border-radius: 5px;
    background: #fff1f2;
    color: #b42318;
    font-size: .72rem;
    text-align: left;
    line-height: 1.4;
}
[data-theme="dark"] .ai-suggestion-error {
    background: #3a2028;
    border-color: #82404b;
    color: #ffb4bc;
}
.ai-material-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}
.ai-material-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ===== 智能标签弹窗 ===== */
.ai-material-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 360px;
    max-width: 90vw;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: popupFadeIn 0.2s ease;
}
@keyframes popupFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}
.popup-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
}
.popup-close {
    cursor: pointer;
    color: #999;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}
.popup-close:hover {
    color: #333;
    background: #e9ecef;
}
.popup-body {
    padding: 10px 14px;
    overflow-y: auto;
    flex: 1;
}
.popup-section {
    margin-bottom: 12px;
}
.popup-section:last-child {
    margin-bottom: 0;
}
.popup-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
}
.popup-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.popup-tag {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.65rem;
    color: #495057;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.popup-tag:hover {
    background: #e7f1ff;
    border-color: #667eea;
    color: #667eea;
}
.popup-tag.style-tag {
    background: #fff3e0;
    border-color: #ffc107;
    color: #e65100;
}
.popup-tag.style-tag:hover {
    background: #ffe0b2;
    border-color: #ff9800;
    color: #e65100;
}
.popup-templates {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.popup-template {
    padding: 6px 10px;
    font-size: 0.7rem;
    color: #495057;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.popup-template:hover {
    background: #e7f1ff;
    border-color: #667eea;
    color: #667eea;
}

/* ===== 空间自由度滑条 ===== */
.spatial-freedom-section {
    padding: 4px 0;
}
.spatial-freedom-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}
.spatial-freedom-slider {
    height: 8px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #0d6efd 0%, #0d6efd 30%, #ffc107 30%, #ffc107 70%, #dc3545 70%, #dc3545 100%);
    border-radius: 4px;
    outline: none;
}
.spatial-freedom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    background: var(--slider-color, #ffc107);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.15s, background 0.15s;
}
.spatial-freedom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.spatial-freedom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    background: var(--slider-color, #ffc107);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.spatial-freedom-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: #adb5bd;
    margin-top: 2px;
}
.spatial-freedom-hint {
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 4px;
    transition: all 0.3s;
}
.spatial-freedom-hint.locked { color: #084298; background: #cfe2ff; }
.spatial-freedom-hint.balanced { color: #664d03; background: #fff3cd; }
.spatial-freedom-hint.free { color: #842029; background: #f8d7da; }

/* ===== 浅色 / 深色模式：/ai 第一列（侧边栏）与第四列（历史面板）配色 =====
   底栏 #f8f9fa / 白色按钮 / 蓝色选中块是硬编码的浅色值，
   深色模式下会变成浅底浅字，这里统一改为跟随主题变量。 */
.sidebar-border {
    background: var(--panel-bg, #ffffff);
}

.sidebar-footer {
    background: var(--panel-bg, #ffffff);
    border-top-color: var(--panel-border-color, #dee2e6);
}

.sidebar-top-action,
.sidebar-section {
    border-bottom-color: var(--panel-border-color, #dee2e6);
}

.sidebar-section-header {
    color: var(--panel-text-muted, #6c757d);
}

.sidebar-btn-full,
.sidebar-btn {
    background: var(--panel-bg, #fff);
    color: var(--panel-text, #495057);
    border-color: var(--panel-border-color, #dee2e6);
}

.sidebar-btn-full:hover,
.sidebar-btn:hover {
    background: var(--panel-bg, #fff);
    border-color: #0d6efd;
    color: #0d6efd;
}

.sidebar-project-btn {
    color: var(--panel-text, #212529);
}

.sidebar-project-btn:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

.sidebar-project-btn.active,
.sidebar-project-btn.active:hover {
    background: #cfe2ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

.sidebar-project-desc {
    color: var(--panel-text-muted, #999);
}

.sidebar-project-action {
    color: var(--panel-text-muted, #adb5bd);
}

.sidebar-footer-item {
    color: var(--panel-text-muted, #6c757d);
}

.history-size-toolbar {
    background: var(--panel-bg, #fff);
    border-bottom-color: var(--panel-border-color, #e9ecef);
}

/* 深色模式的悬停 / 选中色（浅底会与深色文字对比度过低） */
[data-theme="dark"] .sidebar-btn-full:hover,
[data-theme="dark"] .sidebar-btn:hover {
    background: var(--theme-surface-strong, #2d2d44);
    color: #6ea8fe;
}

[data-theme="dark"] .sidebar-project-btn:hover {
    background: #2d2d44;
    color: #6ea8fe;
}

[data-theme="dark"] .sidebar-project-btn.active,
[data-theme="dark"] .sidebar-project-btn.active:hover {
    background: #23324a;
    color: #6ea8fe;
}

[data-theme="dark"] .sidebar-project-action:hover {
    color: #6ea8fe;
    background: rgba(110, 168, 254, 0.15);
}

[data-theme="dark"] .sidebar-footer-item:hover {
    background: #2d2d44;
    color: #6ea8fe;
}

[data-theme="dark"] .sidebar-credits,
[data-theme="dark"] #sidebarCreditsContainer .sidebar-credits {
    background: #3a3320;
    border-color: #6b5a20;
    color: #ffe08a;
}

[data-theme="dark"] .mobile-credits {
    background: #3a3320;
    border-color: #6b5a20 !important;
    color: #ffe08a;
}

[data-theme="dark"] .history-tab-btn {
    color: var(--panel-text-muted, #9a9ab0);
}

[data-theme="dark"] .history-tab-btn:hover {
    background: #2d2d44;
    color: var(--panel-text, #e0e0e0);
}

[data-theme="dark"] .history-tab-back {
    color: #ff8a95;
}

[data-theme="dark"] .history-tab-back:hover {
    background: #3a2028;
    color: #ffb4bc;
}

[data-theme="dark"] .history-size-toolbar small,
[data-theme="dark"] .history-size-label {
    color: #6ea8fe;
}

[data-theme="dark"] .history-size-slider::-webkit-slider-runnable-track {
    background: var(--theme-border, #3d3d54);
}

[data-theme="dark"] .history-size-slider::-moz-range-track {
    background: var(--theme-border, #3d3d54);
}
