/* public/assets/css/image/image-upscaler.css */

/* 1. 基础修复 */
.tool-surface, .tool-surface * { box-sizing: border-box; }

/* 2. 宏观布局 (CSS Grid 严防遮挡) */
.iu-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px; 
    gap: 24px;
    align-items: start;
    width: 100%;
}

.iu-preview-panel, .iu-control-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
}

.iu-preview-panel {
    position: sticky;
    top: 24px; 
    z-index: 10;
}

.iu-control-panel { gap: 20px; }

/* 3. 左侧组件 */
.iu-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8fafc;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.iu-upload-area:hover { background: rgba(0,102,204,0.05); border-color: var(--primary-color); color: var(--primary-color); }
.iu-upload-area i { font-size: 2rem; margin-bottom: 8px; }

.iu-canvas-container {
    flex: 1;
    min-height: 300px;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYBwhQYtZcCCQQvYhAEDBwZLAgAEEwIRx8tMlgAAAABJRU5ErkJggg==') repeat;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

#iuPreviewImage {
    max-width: 100%;
    max-height: 50vh;
    object-fit: contain;
}

.iu-empty-state { color: var(--text-muted); text-align: center; }
.iu-empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }

/* 状态角标 */
.iu-status-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 5;
}
.iu-status-badge.upscaled { background: var(--primary-color); }

/* 加载遮罩 */
.iu-loading-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 8;
    color: var(--primary-color);
}
[data-theme="dark"] .iu-loading-overlay { background: rgba(15, 23, 42, 0.8); }
.iu-loading-overlay i { font-size: 3rem; margin-bottom: 12px; }
.iu-loading-overlay p { font-size: 1.1rem; font-weight: 700; margin: 0; }

.iu-batch-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
}
.iu-batch-list::-webkit-scrollbar { height: 6px; }
.iu-batch-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.iu-thumb-item {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
    flex-shrink: 0;
    position: relative;
}
.iu-thumb-item:hover { opacity: 0.9; }
.iu-thumb-item.active { border-color: var(--primary-color); opacity: 1; }
/* 缩略图处理完成角标 */
.iu-thumb-item.processed::after {
    content: "✓";
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #10b981;
    color: #fff;
    font-size: 0.6rem;
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.iu-action-bar { display: flex; gap: 12px; }
.iu-btn-outline, .iu-btn-success {
    flex: 1;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.iu-btn-outline { background: var(--bg-body); border-color: var(--border-color); color: var(--text-main); }
.iu-btn-outline:hover:not(:disabled) { background: #e2e8f0; }
.iu-btn-success { background: #10b981; color: #fff; }
.iu-btn-success:hover:not(:disabled) { background: #059669; }
.iu-action-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 4. 右侧控制组件 */
.iu-panel-title {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}

.iu-settings-group { margin-bottom: 20px; }
.iu-group-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
}

/* Radio Cards */
.iu-radio-group { display: flex; gap: 12px; }
.iu-radio-card { flex: 1; position: relative; cursor: pointer; }
.iu-radio-card input { position: absolute; opacity: 0; }
.iu-rc-content {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    transition: 0.2s;
    background: var(--bg-body);
}
.iu-rc-title { display: block; font-size: 1.2rem; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.iu-rc-desc { display: block; font-size: 0.8rem; color: var(--text-muted); }
.iu-radio-card:hover .iu-rc-content { border-color: var(--primary-color); }
.iu-radio-card input:checked + .iu-rc-content {
    border-color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
}
.iu-radio-card input:checked + .iu-rc-content .iu-rc-title { color: var(--primary-color); }

.iu-select-ui {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
}
.iu-select-ui:focus { border-color: var(--primary-color); }

.iu-btn-start {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.iu-btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4); }

/* 5. SEO 组件复用 */
.tool-seo-content { margin-top: 40px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 40px; }
.tool-seo-content h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 24px; color: var(--text-main); }
.seo-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-bottom: 32px; }
.seo-feature-card { background: var(--bg-body); border: 1px solid var(--border-color); padding: 24px; border-radius: 12px; transition: 0.3s; }
.seo-feature-card:hover { border-color: var(--primary-color); transform: translateY(-2px); }
.seo-feature-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; color: var(--text-main); }
.seo-feature-card p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; margin: 0; }
.seo-divider { border: none; border-top: 1px dashed var(--border-color); margin: 40px 0; }
.seo-guide-box { background: rgba(0, 102, 204, 0.03); border-left: 4px solid var(--primary-color); padding: 20px 24px; border-radius: 0 8px 8px 0; }
.seo-guide-box p { font-size: 1rem; color: var(--text-main); margin-bottom: 12px; font-weight: 600; }
.seo-faq-list { display: flex; flex-direction: column; gap: 20px; }
.seo-faq-item h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; color: var(--text-main); }
.seo-faq-item p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; margin: 0; padding-left: 12px; border-left: 2px solid var(--border-color); }

/* 暗黑模式 */
[data-theme="dark"] .iu-upload-area { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .iu-rc-content, [data-theme="dark"] .iu-select-ui, [data-theme="dark"] .iu-btn-outline { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .iu-radio-card input:checked + .iu-rc-content { background: rgba(99, 102, 241, 0.1); border-color: var(--primary-color); }
[data-theme="dark"] .tool-seo-content { background: var(--bg-surface); }
[data-theme="dark"] .seo-feature-card { background: #0f172a; border-color: #334155; }

/* 移动端与窄屏自适应 */
@media (max-width: 900px) {
    .iu-workspace { grid-template-columns: 1fr; }
    .iu-preview-panel { position: relative; top: 0; z-index: 1; }
    .iu-canvas-container {
        position: sticky; top: 10px; z-index: 100;
        min-height: 150px; height: 35vh; 
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        background-color: var(--bg-surface);
    }
    .iu-action-bar { flex-direction: column; }
    .tool-seo-content { padding: 24px; margin-top: 24px; }
}