/* Tabs */
.bg-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--sr-color-border);
}
.bg-tab {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--sr-color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    user-select: none;
}
.bg-tab:hover {
    color: var(--sr-color-primary);
}
.bg-tab.active {
    color: var(--sr-color-primary);
    border-bottom-color: var(--sr-color-primary);
    font-weight: 600;
}
/* 类别列表 */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.cat-item {
    padding: 4px 14px;
    border: 1.5px solid var(--sr-color-border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    color: var(--sr-color-text);
    background: #fff;
    transition: all 0.2s;
    user-select: none;
}
.cat-item:hover {
    border-color: var(--sr-color-primary);
}
.cat-item.active {
    border-color: var(--sr-color-primary);
    background: var(--sr-color-primary);
    color: #fff;
}
/* 背景网格 */
.bg-list-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
}
.bg-list-grid::-webkit-scrollbar {
    width: 4px;
}
.bg-list-grid::-webkit-scrollbar-track {
    background: transparent;
}
.bg-list-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.scene-hint {
    font-size: 12px;
    color: var(--sr-color-text-muted);
    margin: 0 0 6px;
}
.bg-list-grid::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
@media (max-width: 1500px) {
    .bg-list-grid {
        max-height: 280px;
    }
}
.bg-list-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.bg-list-item:hover {
    border-color: var(--sr-color-primary);
}
.bg-list-item.active {
    border-color: var(--sr-color-primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.bg-list-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.bg-list-item .bg-name {
    font-size: 11px;
    text-align: center;
    padding: 4px 2px;
    color: var(--sr-color-text);
    background: #f9fafb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bg-loading-tip {
    font-size: 12px;
    color: var(--sr-color-text-muted);
    text-align: center;
    padding: 20px 0;
    grid-column: 1 / -1;
}
/* 自定义选项卡 */
.custom-section {
    margin-bottom: 12px;
}
.custom-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--sr-color-text);
    margin: 0 0 6px;
}
.custom-input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--sr-color-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--sr-color-text);
    box-sizing: border-box;
    outline: none;
    background: #fafbfc;
    transition: border-color 0.2s;
}
.custom-input:focus {
    border-color: var(--sr-color-primary);
    background: #fff;
}
.custom-input::placeholder {
    color: var(--sr-color-text-muted);
}
.custom-textarea {
    min-height: 80px;
    resize: vertical;
}
.bg-ref-upload-box {
    width: 100%;
    max-height: 130px;
    aspect-ratio: 1 / 1;
    border: 2px dashed var(--sr-color-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    background: #fafbfc;
    position: relative;
    box-sizing: border-box;
}
.bg-ref-upload-box:hover {
    border-color: var(--sr-color-primary);
    background: #f5f3ff;
}
.bg-ref-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--sr-color-text-muted);
    font-size: 12px;
    user-select: none;
}
.bg-ref-upload-placeholder svg {
    width: 28px;
    height: 28px;
}
.bg-ref-upload-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    background: #fafbfc;
}
/* 选项卡内容容器 */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
/* 加载进度条 */
.loading-progress-wrapper {
    padding: 0 20px;
    margin-top: 20px;
    text-align: center;
}
.loading-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 10px;
    transition: width 0.3s ease;
}
.loading-progress-text {
    font-size: 13px;
    color: var(--sr-color-text-secondary);
    margin-top: 8px;
}
/* 场景推荐区域 — flex 撑满，按钮始终在底部 */
#sceneRecommendSection {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
#sceneRecommendSection .pose-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.pose-card {
    border: 1.5px solid var(--sr-color-border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    user-select: none;
}
.pose-card:hover {
    border-color: var(--sr-color-primary);
}
.pose-card.selected {
    border-color: var(--sr-color-primary);
    background: #f5f3ff;
    box-shadow: 0 0 0 1.5px rgba(99,102,241,0.2);
}
.pose-card .pose-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sr-color-text);
    margin-bottom: 4px;
}
.pose-card .pose-desc {
    font-size: 12px;
    color: var(--sr-color-text-secondary);
    line-height: 1.5;
}
.pose-card .pose-check {
    float: right;
    width: 28px;
    height: 28px;
    border: 3px solid var(--sr-color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    flex-shrink: 0;
    transition: all 0.2s;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}
.pose-card.selected .pose-check {
    border-color: var(--sr-color-primary);
    background: var(--sr-color-primary);
}
.pose-card.selected .pose-check::after {
    content: '✓';
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}
.pose-card .pose-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
/* 结果预览网格 */
.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px 0;
    justify-items: center;
}
.result-box {
    width: 100%;
    /*height: 320px; */
    border: 2px solid var(--sr-color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
    position: relative;
    overflow: hidden;
}
.result-box .result-label {
    font-size: 12px;
    color: var(--sr-color-text-secondary);
    text-align: center;
    padding: 0 6px;
    line-height: 1.3;
}
.result-box .result-status {
    font-size: 13px;
    color: var(--sr-color-text-muted);
    margin-top: 6px;
}
.result-box .result-status.generating {
    color: var(--sr-color-primary);
}
.result-box .result-status.done {
    color: #10b981;
}
.result-box .result-status.failed {
    color: #ef4444;
}
.result-box .result-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    cursor: pointer;
}
.result-box.has-result .result-img {
    display: block;
}
.result-box.has-result .result-placeholder {
    display: none;
}
/* 进度条 */
    .result-progress-wrap {
    width: 80%;
    margin-top: 8px;
    text-align: center;
}
.result-progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.result-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.result-progress-text {
    font-size: 11px;
    color: var(--sr-color-primary);
    margin-top: 4px;
}
/* 结果图预览浮层 */
.result-preview-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.result-preview-overlay .preview-content {
    position: relative;
    max-width: 800px;
    width: 90vw;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #fff;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.result-preview-edit-btn {
    position: initial !important;
}
.result-preview-overlay .preview-content img {
    max-width: 760px;
    max-height: 760px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.result-preview-overlay .preview-actions-bar {
    position: absolute;
    bottom: -44px;
    right: 0;
    display: flex;
    gap: 12px;
}
.result-preview-overlay .preview-actions-bar .img-redraw-open-btn,
.result-preview-overlay .preview-actions-bar .psd-export-btn {
    margin-top: 0;
    margin-left: 0;
}
    .inspiration-hero-placeholder {
        max-width: 100% !important;
    }

/* 移动端响应式 */
@media (max-width: 639px) {
    /* 结果网格一行显示一个 */
    .result-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    /* 去掉inspiration-hero最大高度限制 */
    .inspiration-hero {
        max-height: none !important;
        padding: 2px;
    }

    /* 结果框高度自适应 */
    .result-box {
        height: auto;
    }

    .result-box .result-label {
        display: block;
        line-height: 32px;
    }
}
