/* =====================================================
   图片滤镜切换工具 - image_filter_switch.css
   ===================================================== */

/* 容器 */
.ifs-container {
    padding: 0 !important;
}

/* ===== Tab 导航 ===== */
.ifs-tab-nav {
    display: flex;
    border-bottom: 2px solid #e8eaf6;
    background: #f8f9ff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ifs-tab-btn {
    padding: 13px 26px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.ifs-tab-btn:hover {
    color: #1565C0;
    background: rgba(25, 118, 210, 0.06);
}

.ifs-tab-btn.active {
    color: #1565C0;
    border-bottom-color: #1565C0;
    font-weight: 600;
}

/* ===== Tab 内容 ===== */
.ifs-tab-content {
    display: none;
    padding: 20px;
}

.ifs-tab-content.ifs-active {
    display: block;
    animation: ifs-fadein 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ifs-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ifs-hidden {
    display: none !important;
}

/* ===== 上传区域 ===== */
#ifsFileInput {
    display: none;
}

.ifs-upload-area {
    text-align: center;
    border: 2px dashed #90CAF9;
    border-radius: 14px;
    padding: 64px 24px;
    background: #f8fbff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.ifs-upload-area:hover,
.ifs-upload-area.drag-over {
    border-color: #1565C0;
    background: #e3f2fd;
    transform: scale(1.005);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.12);
}

.ifs-upload-icon {
    font-size: 60px;
    margin-bottom: 14px;
    line-height: 1;
}

.ifs-upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.ifs-upload-hint {
    font-size: 13px;
    color: #8a9bb0;
    margin-bottom: 22px;
}

.ifs-upload-paste-hint {
    font-size: 12px;
    color: #a0b0c8;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ===== 工作区 ===== */
.ifs-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: ifs-fadein 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 工具栏 ===== */
.ifs-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 10px 14px;
    background: #f5f7fa;
    border-radius: 10px;
    border: 1px solid #e4e8f0;
}

/* 工具栏按钮统一缩小尺寸 */
.ifs-toolbar .button,
.ifs-toolbar .secondary,
.ifs-toolbar .third {
    padding: 5px 12px;
    font-size: 12px;
}

/* 对比原图按钮激活态 - 使用 CSS 类控制，禁止内联样式 */
.ifs-btn-active {
    background: #1565C0 !important;
    color: #fff !important;
    border-color: #1565C0 !important;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.25) !important;
}

.ifs-shortcut-hint {
    font-size: 11px;
    color: #aab;
    margin-left: 6px;
    white-space: nowrap;
}

/* ===== 主体布局 ===== */
.ifs-main {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ifs-preview-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ifs-controls-pane {
    width: 284px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== Canvas 预览 ===== */
.ifs-canvas-wrap {
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    text-align: center;
    line-height: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ifsCanvas {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.ifs-image-info {
    font-size: 11px;
    color: #8a9bb0;
    text-align: center;
    padding: 4px 0 0;
    letter-spacing: 0.3px;
}

/* ===== 控制面板 section ===== */
.ifs-section {
    border: 1px solid #e4e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.ifs-section-title {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edf8 100%);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #3a4a6b;
    border-bottom: 1px solid #dde3f0;
    letter-spacing: 0.2px;
}

/* ===== 滤镜预设网格 ===== */
.ifs-presets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 8px;
}

.ifs-preset-card {
    cursor: pointer;
    border-radius: 7px;
    border: 2px solid transparent;
    overflow: hidden;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    background: #f4f6fc;
}

.ifs-preset-card:hover {
    border-color: #1976D2;
    transform: scale(1.04);
    box-shadow: 0 4px 10px rgba(25, 118, 210, 0.2);
    z-index: 1;
}

.ifs-preset-card.active {
    border-color: #1565C0;
    box-shadow: 0 0 0 1px #1565C0 inset;
}

.ifs-preset-card.active .ifs-preset-name {
    background: #ddeaff;
    color: #1565C0;
    font-weight: 700;
}

.ifs-preset-img {
    width: 100%;
    height: 48px;
    object-fit: cover;
}

/* 缩略图初始隐藏，加载后通过移除 ifs-hidden 显示 */
.ifs-preset-img.ifs-hidden {
    display: none !important;
}

.ifs-preset-placeholder {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #e8edf8, #d8e0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ifs-preset-name {
    font-size: 10px;
    color: #555;
    padding: 3px 2px;
    background: #f4f6fc;
    line-height: 1.3;
    font-weight: 500;
}

/* ===== 滑块调整 ===== */
.ifs-sliders {
    padding: 8px 12px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ifs-slider-row {
    display: grid;
    grid-template-columns: 54px 1fr 42px;
    align-items: center;
    gap: 6px;
}

.ifs-slider-label {
    font-size: 12px;
    color: #5a6a80;
    white-space: nowrap;
    font-weight: 500;
}

.ifs-slider {
    width: 100%;
    height: 4px;
    cursor: pointer;
    accent-color: #1976D2;
}

.ifs-slider-value {
    font-size: 11px;
    color: #1565C0;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: #e8f0fe;
    border-radius: 8px;
    padding: 1px 5px;
}

.ifs-slider-actions {
    display: flex;
    justify-content: flex-end;
    padding: 4px 12px 8px;
    border-top: 1px solid #eef0f5;
}

/* ===== AI Tab ===== */
.ifs-ai-intro {
    background: linear-gradient(135deg, #e8f0ff 0%, #f0f5ff 100%);
    border: 1px solid #c5d8f8;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: #3a4a6b;
    margin-bottom: 14px;
    line-height: 1.6;
}

.ifs-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ifs-form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ifs-form-row label {
    font-size: 13px;
    color: #4a5568;
    font-weight: 600;
}

.ifs-required {
    color: #e53935;
}

.ifs-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d0d8e8;
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.5;
}

.ifs-textarea:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}

.ifs-form-actions {
    display: flex;
    gap: 8px;
}

.ifs-quick-scenes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 8px;
    border: 1px solid #e4e8f5;
}

.ifs-quick-label {
    font-size: 12px;
    color: #8a9bb0;
    font-weight: 500;
    flex-basis: 100%;
    margin-bottom: 2px;
}

.ifs-quick-btn {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid #c5d0e8;
    background: #fff;
    border-radius: 14px;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.ifs-quick-btn:hover {
    border-color: #1976D2;
    color: #1565C0;
    background: #e8f0ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.15);
}

/* ===== AI 加载中 ===== */
.ifs-ai-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: #5a6a80;
    font-size: 13px;
    background: #f8f9ff;
    border-radius: 8px;
    margin-top: 12px;
    border: 1px solid #e4e8f5;
}

.ifs-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #c5d0e8;
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: ifs-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes ifs-spin {
    to { transform: rotate(360deg); }
}

/* ===== AI 推荐结果 ===== */
.ifs-ai-result {
    border: 1px solid #c5d8f8;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 14px;
    box-shadow: 0 2px 10px rgba(25, 118, 210, 0.08);
}

.ifs-ai-result-title {
    background: linear-gradient(135deg, #ddeaff 0%, #e8f0ff 100%);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #1565C0;
    border-bottom: 1px solid #c5d8f8;
    letter-spacing: 0.2px;
}

.ifs-ai-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.ifs-ai-item {
    padding: 10px 14px;
    border-right: 1px solid #eef2fb;
    border-bottom: 1px solid #eef2fb;
}

.ifs-ai-item:nth-child(even) {
    border-right: none;
}

.ifs-ai-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.ifs-ai-key {
    font-size: 11px;
    color: #8a9bb0;
    margin-bottom: 3px;
    font-weight: 500;
}

.ifs-ai-val {
    font-size: 13px;
    color: #2c3e50;
    font-weight: 600;
}

.ifs-ai-reason {
    padding: 10px 14px;
    border-top: 1px solid #eef2fb;
    font-size: 12px;
    color: #5a6a80;
    line-height: 1.6;
    background: #fafcff;
}

.ifs-ai-apply {
    padding: 10px 14px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eef2fb;
    background: #f8faff;
}

.ifs-raw-wrap {
    padding: 6px 14px 10px;
    border-top: 1px solid #eef2fb;
    background: #fafbff;
}

.ifs-raw-toggle-btn {
    background: none;
    border: none;
    color: #8a9bb0;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    transition: color 0.2s;
}

.ifs-raw-toggle-btn:hover {
    color: #1976D2;
}

.ifs-ai-raw {
    background: #f0f2f8;
    padding: 10px 12px;
    font-size: 11px;
    color: #5a6a80;
    white-space: pre-wrap;
    margin: 6px 0 0;
    border: 1px solid #dde3f0;
    border-radius: 6px;
    max-height: 140px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ===== Toast 通知 ===== */
.ifs-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    color: #fff;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 300px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.ifs-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ifs-toast.success { background: linear-gradient(135deg, #2e7d32, #43a047); }
.ifs-toast.warning { background: linear-gradient(135deg, #e65100, #fb8c00); }
.ifs-toast.error   { background: linear-gradient(135deg, #c62828, #e53935); }
.ifs-toast.info    { background: linear-gradient(135deg, #0277bd, #039be5); }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .ifs-controls-pane { width: 252px; }
}

@media (max-width: 768px) {
    .ifs-main { flex-direction: column; }
    .ifs-controls-pane { width: 100%; }
    .ifs-presets-grid { grid-template-columns: repeat(6, 1fr); }
    .ifs-tab-btn { padding: 11px 18px; font-size: 13px; }
}

@media (max-width: 640px) {
    .ifs-tab-content { padding: 14px; }
    .ifs-upload-area { padding: 40px 16px; }
    .ifs-upload-icon { font-size: 48px; }
    .ifs-upload-text { font-size: 15px; }
    .ifs-presets-grid { grid-template-columns: repeat(4, 1fr); }
    .ifs-toolbar { padding: 8px 10px; }
    .ifs-ai-grid { grid-template-columns: 1fr; }
    .ifs-toast { bottom: 14px; right: 12px; left: 12px; max-width: unset; }
    .ifs-shortcut-hint { display: none; }
}
