/* =====================================================
   AI图片生成页面样式
   ===================================================== */

/* 整体布局 */
.image-gen-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px);
    min-height: 600px;
}

/* 左侧配置面板 */
.config-panel {
    width: 400px;
    min-width: 360px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.config-panel-inner {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 配置区块 */
.config-section {
    margin-bottom: 18px;
    overflow: visible;
}

.config-section:last-of-type {
    margin-bottom: 12px;
}

.config-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #2D3436;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.config-section-title i {
    font-size: 15px;
    color: #4A90D9;
}

.config-hint {
    font-size: 11px;
    font-weight: 400;
    color: #999;
}

.config-hint.required {
    color: #E17055;
}

/* ===== 1. 工具卡片（直接显示Logo图片，占1/4宽） ===== */
.config-section-tool {
    margin-bottom: 12px;
}

.provider-cards {
    display: flex;
    gap: 8px;
}

.provider-logo-only {
    width: 25%;
    height: auto;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.provider-logo-only:hover {
    border-color: #4A90D9;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.2);
}

.provider-logo-only.active {
    border-color: #4A90D9;
    box-shadow: 0 2px 10px rgba(74, 144, 217, 0.25);
}

/* ===== 2. 模型选择（一行横排，hover提示描述） ===== */
.model-cards {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow: visible;
}

.model-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-align: center;
    overflow: visible;
}

.model-card:hover {
    border-color: #4A90D9;
    background: #f8faff;
}

.model-card.active {
    border-color: #4A90D9;
    background: linear-gradient(135deg, #4A90D9, #3a7bd5);
    color: #fff;
}

.model-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4A90D9, #6C5CE7);
    color: #fff;
}

.model-card.active .model-card-icon {
    background: rgba(255,255,255,0.25);
}

.model-card-info {
    min-width: 0;
}

.model-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #2D3436;
    white-space: nowrap;
}

.model-card.active .model-card-name {
    color: #fff;
}

.model-tag {
    display: none;
}

.model-card-desc {
    display: none;
}

.model-card-check {
    display: none;
}

/* 模型描述行（显示在卡片下方） */
.model-desc-line {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    text-align: center;
    min-height: 16px;
    transition: color 0.2s;
}

/* ===== 3. 比例选择（4个一行，等宽，2代专属放底部） ===== */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.ratio-separator {
    grid-column: 1 / -1;
    height: 1px;
    background: #e9ecef;
    margin: 4px 0;
}

.ratio-separator-label {
    grid-column: 1 / -1;
    font-size: 10px;
    color: #adb5bd;
    text-align: center;
    margin: 2px 0;
}

.ratio-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border: 1.5px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: #495057;
    background: #fff;
}

.ratio-item:hover {
    border-color: #4A90D9;
    background: #f8faff;
}

.ratio-item.active {
    border-color: #4A90D9;
    background: #4A90D9;
    color: #fff;
}

.ratio-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.ratio-preview {
    display: inline-block;
    border: 1.5px solid currentColor;
    border-radius: 1px;
    flex-shrink: 0;
}

.ratio-label {
    font-weight: 500;
    font-size: 11px;
}

/* ===== 4. 分辨率卡片 ===== */
.resolution-cards {
    display: flex;
    gap: 8px;
}

.resolution-card {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    border: 1.5px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.resolution-card:hover {
    border-color: #4A90D9;
    background: #f8faff;
}

.resolution-card.active {
    border-color: #4A90D9;
    background: linear-gradient(135deg, #4A90D9, #3a7bd5);
    color: #fff;
}

.resolution-label {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.resolution-desc {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 1px;
}

/* ===== 5. 参考图片（外框固定+内部网格） ===== */
.reference-upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    transition: all 0.2s;
    background: #fafafa;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.reference-upload-zone.dragover {
    border-color: #4A90D9;
    background: #f0f6ff;
}

.reference-upload-zone.has-images {
    justify-content: flex-start;
    align-items: flex-start;
    background: #fff;
    border-color: #e9ecef;
}

.upload-trigger-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    gap: 4px;
    color: #636E72;
    transition: color 0.2s;
    padding: 10px 0;
}

.upload-trigger-large:hover {
    color: #4A90D9;
}

.upload-trigger-large i {
    font-size: 24px;
}

.upload-trigger-large span {
    font-size: 12px;
}

.upload-hint {
    font-size: 10px !important;
    color: #adb5bd !important;
}

.reference-preview-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

.reference-preview-item, .upload-trigger {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1.5px dashed #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.reference-preview-item {
    border-style: solid;
    border-color: #e9ecef;
}

.upload-trigger:hover {
    border-color: #4A90D9;
    color: #4A90D9;
    background: #f0f6ff;
}

.upload-trigger i {
    font-size: 24px;
    color: #adb5bd;
    transition: color 0.2s;
}

.upload-trigger:hover i {
    color: #4A90D9;
}

.upload-trigger span {
    font-size: 10px;
    color: #adb5bd;
    margin-top: 4px;
    text-align: center;
    line-height: 1.2;
}

.reference-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.2s;
}

.reference-preview-item:hover img {
    transform: scale(1.05);
}

.reference-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    z-index: 10;
}

.reference-preview-item .remove-btn:hover {
    background: rgba(225, 112, 85, 0.9);
    transform: scale(1.1);
}

/* 上传中的占位状态 */
.reference-uploading {
    border-color: #4A90D9 !important;
}

.reference-uploading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    color: #4A90D9;
}

.prompt-input {
    width: 100%;
    border: 1.5px solid #e9ecef;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #2D3436;
    resize: vertical;
    min-height: 110px;
    transition: border-color 0.2s;
    font-family: inherit;
    line-height: 1.5;
}

.prompt-input:focus {
    outline: none;
    border-color: #4A90D9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.prompt-input::placeholder {
    color: #adb5bd;
    font-size: 12px;
}

.prompt-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.char-count {
    font-size: 11px;
    color: #adb5bd;
}

/* ===== 7. 生成按钮（固定在配置面板底部 + 流光追光特效） ===== */
.generate-action {
    flex-shrink: 0;
    padding: 12px 20px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.btn-generate {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #4A90D9, #6C5CE7);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.35);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.45);
}

.btn-generate:active {
    transform: translateY(0);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-generate:disabled .btn-glow {
    display: none;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.btn-content i {
    font-size: 18px;
}

/* 流光追光特效 */
.btn-glow {
    position: absolute;
    top: -2px;
    left: -100%;
    width: 60%;
    height: calc(100% + 4px);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-20deg);
    animation: glowSweep 2.5s ease-in-out infinite;
    z-index: 1;
}

@keyframes glowSweep {
    0% { left: -60%; }
    100% { left: 160%; }
}

/* 按钮边框流光 */
.btn-generate::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    background: linear-gradient(90deg, #4A90D9, #6C5CE7, #e84393, #4A90D9);
    background-size: 300% 100%;
    animation: borderGlow 3s linear infinite;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-generate:hover::before {
    opacity: 1;
}

.btn-generate::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4A90D9, #6C5CE7);
    z-index: 0;
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* ===== 右侧结果面板 ===== */
.result-panel {
    flex: 1;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.result-panel-inner {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 空状态 */
.result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    text-align: center;
    color: #636E72;
}

.empty-illustration {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f0f6ff, #e8f0fe);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-illustration i {
    font-size: 40px;
    color: #4A90D9;
}

.result-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2D3436;
    margin-bottom: 6px;
}

.result-empty p {
    font-size: 13px;
    color: #636E72;
    margin-bottom: 20px;
}

.empty-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #636E72;
    padding: 8px 14px;
    background: #f8f9fa;
    border-radius: 8px;
}

.tip-item i {
    color: #4A90D9;
    font-size: 14px;
    flex-shrink: 0;
}

/* 加载状态 */
.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    text-align: center;
}

.loading-animation {
    position: relative;
    width: 70px;
    height: 70px;
    margin-bottom: 20px;
}

.loading-spinner {
    width: 70px;
    height: 70px;
    border: 4px solid #e9ecef;
    border-top-color: #4A90D9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #4A90D9, #6C5CE7);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.result-loading h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D3436;
    margin-bottom: 6px;
}

.result-loading p {
    font-size: 13px;
    color: #636E72;
    margin-bottom: 20px;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4A90D9, #6C5CE7);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
    animation: progressIndeterminate 2s ease-in-out infinite;
}

@keyframes progressIndeterminate {
    0% { width: 0%; margin-left: 0; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* 结果展示 */
.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D3436;
    margin: 0;
    flex-shrink: 0;
}

.result-storage-hint {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #adb5bd;
    margin-right: 12px;
}

.result-storage-hint i {
    margin-right: 3px;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:first-child {
    /* 下载按钮 - 主色调 */
    background: linear-gradient(135deg, #4A90D9, #357ABD);
    color: #fff;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.btn-action:first-child:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
}

.btn-action:last-child {
    /* 优化按钮 - 次要色调 */
    background: linear-gradient(135deg, #6C5CE7, #5B4ED9);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.btn-action:last-child:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.result-image-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    margin-bottom: 12px;
}

.result-image {
    max-width: 100%;
    max-height: 50vh;
    object-fit: contain;
    border-radius: 10px;
}

.result-image-zoom {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 14px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.result-image-wrapper:hover .result-image-zoom {
    opacity: 1;
}

.result-image-zoom:hover {
    background: rgba(0, 0, 0, 0.8);
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 11px;
    color: #636E72;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item i {
    color: #4A90D9;
}

/* 错误状态 */
.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    text-align: center;
}

.error-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fdf0ed;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.error-icon i {
    font-size: 30px;
    color: #E17055;
}

.result-error h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D3436;
    margin-bottom: 6px;
}

.result-error p {
    font-size: 13px;
    color: #636E72;
    margin-bottom: 16px;
    max-width: 400px;
}

.btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: #4A90D9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-retry:hover {
    background: #3a7bd5;
}

/* ===== 底部区域：待优化 + 历史记录 ===== */
.bottom-section {
    display: flex;
    gap: 16px;
    margin-top: auto;
    border-top: 1px solid #e9ecef;
    padding-top: 16px;
    min-height: 200px;
    max-height: 280px;
    flex-shrink: 0;
}

/* 待优化面板 */
.optimize-panel {
    width: 33%;
    min-width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.optimize-header {
    margin-bottom: 10px;
}

.optimize-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: #2D3436;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.optimize-header h4 i {
    color: #6C5CE7;
}

.optimize-content {
    flex: 1;
    border-radius: 10px;
    overflow: hidden;
    max-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1.5px dashed #dee2e6;
}

.optimize-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #adb5bd;
    font-size: 12px;
}

.optimize-empty i {
    font-size: 28px;
}

.optimize-image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.optimize-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.optimize-actions {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.optimize-image-wrapper:hover .optimize-actions {
    opacity: 1;
}

.optimize-actions button {
    padding: 3px 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
}

/* 历史记录区 */
.history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.history-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: #2D3436;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-header h4 i {
    color: #4A90D9;
}

.btn-text {
    background: none;
    border: none;
    color: #4A90D9;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-text:hover {
    background: #f0f6ff;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-rows: minmax(100px, auto);
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.history-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s;
    aspect-ratio: 1;
}

.history-card:hover {
    border-color: #4A90D9;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.history-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    color: #fff;
    font-size: 9px;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-card:hover .history-card-overlay {
    opacity: 1;
}

.history-card-status {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 500;
}

.history-card-status.completed {
    background: rgba(0, 184, 148, 0.9);
    color: #fff;
}

.history-card-status.processing {
    background: rgba(253, 203, 110, 0.9);
    color: #333;
}

.history-card-status.failed {
    background: rgba(225, 112, 85, 0.9);
    color: #fff;
}

.history-card-status.pending {
    background: rgba(108, 92, 231, 0.9);
    color: #fff;
}

.history-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #adb5bd;
    font-size: 20px;
}

/* 生成中卡片的转圈动画 */
.history-card-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #4A90D9;
}

.history-card-spinner i {
    animation: spin 1.2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.history-card-pending {
    border-color: #4A90D9;
    border-style: dashed;
}

.history-empty {
    text-align: center;
    padding: 16px;
    color: #adb5bd;
    font-size: 12px;
    display: none;
}

/* 历史记录中选中子任务的提示词 */
.history-prompt {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #495057;
    line-height: 1.5;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    flex-shrink: 0;
}

.history-prompt-item {
    margin-bottom: 6px;
}

.history-prompt-item:last-child {
    margin-bottom: 0;
}

.history-prompt-item i {
    margin-right: 4px;
    font-size: 11px;
}

.history-prompt-item.ai-response {
    color: #4A90D9;
    background: #f0f6ff;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.history-prompt-item.ai-response i {
    color: #4A90D9;
}

.history-prompt i {
    margin-right: 4px;
    color: #6c5ce7;
    font-size: 11px;
}

/* 历史卡片删除按钮 */
.history-card {
    position: relative;
}

.history-card-delete {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.history-card:hover .history-card-delete {
    opacity: 1;
}

.history-card-delete:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

/* ===== 页面加载蒙版（覆盖page-container区域） ===== */
.page-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.page-loading-content {
    text-align: center;
}

.page-loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
}

.page-loading-content p {
    color: #636e72;
    font-size: 14px;
}

/* ===== 图片放大弹框（Lightbox） ===== */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    color: #2D3436;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

/* Lightbox下载按钮 */
.lightbox-actions {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.lightbox-download {
    background: linear-gradient(135deg, #4A90D9, #357ABD);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
    transition: all 0.2s;
}

.lightbox-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 144, 217, 0.4);
}

/* 分辨率remark提示 */
.resolution-remark {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 12px;
    color: #6c757d;
    display: none;
}

.resolution-remark i {
    margin-right: 6px;
    color: #4A90D9;
}

/* ===== 响应式设计 ===== */

@media (max-width: 1024px) {
    .image-gen-container {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }

    .config-panel {
        width: 100%;
        min-width: auto;
    }

    .result-panel {
        min-height: 500px;
    }

    .bottom-section {
        flex-direction: column;
        max-height: none;
    }

    .optimize-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .image-gen-container {
        gap: 12px;
    }

    .config-panel-inner,
    .result-panel-inner {
        padding: 14px;
    }

    .config-section {
        margin-bottom: 14px;
    }

    .model-cards {
        flex-wrap: wrap;
    }

    .ratio-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .btn-generate {
        font-size: 14px;
        padding: 10px 16px;
    }

    .result-image {
        max-height: 40vh;
    }

    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    .reference-preview-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .bottom-section {
        flex-direction: column;
        max-height: none;
    }

    .optimize-panel {
        width: 100%;
        min-width: auto;
    }
}

/* 滚动条美化 */
.config-panel-inner::-webkit-scrollbar,
.history-grid::-webkit-scrollbar {
    width: 5px;
}

.config-panel-inner::-webkit-scrollbar-track,
.history-grid::-webkit-scrollbar-track {
    background: transparent;
}

.config-panel-inner::-webkit-scrollbar-thumb,
.history-grid::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.config-panel-inner::-webkit-scrollbar-thumb:hover,
.history-grid::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.result-panel-inner::-webkit-scrollbar {
    width: 0;
    display: none;
}

.result-panel-inner {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
