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

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

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

.ir-preview-panel, .ir-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;
}

/* 左侧桌面端吸顶 */
.ir-preview-panel {
    position: sticky;
    top: 24px; 
    z-index: 10;
}

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

/* 3. 左侧组件 */
.ir-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;
}
.ir-upload-area:hover { background: rgba(0,102,204,0.05); border-color: var(--primary-color); color: var(--primary-color); }
.ir-upload-area i { font-size: 2rem; margin-bottom: 8px; }

.ir-canvas-container {
    flex: 1;
    min-height: 250px;
    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;
}

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

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

/* 图片尺寸状态角标 */
.ir-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;
    font-family: ui-monospace, monospace;
}
.ir-status-badge.resized { background: var(--primary-color); }

/* 加载遮罩 */
.ir-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"] .ir-loading-overlay { background: rgba(15, 23, 42, 0.8); }
.ir-loading-overlay i { font-size: 3rem; margin-bottom: 12px; }
.ir-loading-overlay p { font-size: 1.1rem; font-weight: 700; margin: 0; }

/* 批量缩略图列表 */
.ir-batch-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
}
.ir-batch-list::-webkit-scrollbar { height: 6px; }
.ir-batch-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.ir-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;
}
.ir-thumb-item:hover { opacity: 0.9; }
.ir-thumb-item.active { border-color: var(--primary-color); opacity: 1; }
/* 处理完成打个小绿勾 */
.ir-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);
}

.ir-action-bar { display: flex; gap: 12px; }
.ir-btn-outline, .ir-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;
}
.ir-btn-outline { background: var(--bg-body); border-color: var(--border-color); color: var(--text-main); }
.ir-btn-outline:hover:not(:disabled) { background: #e2e8f0; }
.ir-btn-success { background: #10b981; color: #fff; }
.ir-btn-success:hover:not(:disabled) { background: #059669; }
.ir-action-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 4. 右侧参数面板 */
.ir-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);
}

.ir-settings-group {
    background: var(--bg-body);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}
.ir-group-title { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin-bottom: 12px; }

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

/* 输入框和复选框 */
.ir-input-row { display: flex; gap: 12px; margin-bottom: 16px; }
.ir-input-wrap { flex: 1; }
.ir-input-wrap label {
    display: flex; justify-content: space-between;
    font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px;
}
.ir-input-wrap input[type="number"] {
    width: 100%; padding: 12px; border-radius: 8px; border: 2px solid var(--border-color);
    background: var(--bg-surface); color: var(--text-main); font-size: 1rem; outline: none;
}
.ir-input-wrap input[type="number"]:focus { border-color: var(--primary-color); }
.ir-input-wrap input[type="range"] { width: 100%; accent-color: var(--primary-color); cursor: pointer; margin-top: 8px; }

.ir-checkbox-list { display: flex; flex-direction: column; gap: 12px; }
.ir-checkbox-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ir-checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary-color); cursor: pointer; }
.ir-checkbox-item span { font-size: 0.9rem; color: var(--text-main); font-weight: 500; }

.ir-btn-start {
    width: 100%; padding: 16px; background: linear-gradient(135deg, #3b82f6, #2563eb);
    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(37, 99, 235, 0.3);
}
.ir-btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(37, 99, 235, 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"] .ir-upload-area { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .ir-settings-group, [data-theme="dark"] .ir-rc-content, [data-theme="dark"] .ir-input-wrap input { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .ir-radio-card input:checked + .ir-rc-content { background: rgba(59, 130, 246, 0.1); border-color: var(--primary-color); }
[data-theme="dark"] .ir-btn-outline { background: #0f172a; border-color: #334155; }
[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) {
    .ir-workspace { grid-template-columns: 1fr; }
    .ir-preview-panel { position: relative; top: 0; z-index: 1; }
    .ir-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);
    }
    .ir-action-bar { flex-direction: column; }
    .tool-seo-content { padding: 24px; margin-top: 24px; }
}