/* ===== 图片虚化工具样式 ===== */

/* ─── 通用隐藏类 ─── */
.ib-hidden {
    display: none !important;
}

/* ─── 上传区域 ─── */
#ib-upload-section {
    padding: 8px 0 16px;
}

.ib-upload-zone {
    position: relative;
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
    min-height: 220px;
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.06);
}

.ib-upload-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.ib-upload-zone.ib-drag-over {
    border-color: #667eea;
    background: #eef2ff;
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.18);
    transform: scale(1.01);
}

.ib-upload-placeholder {
    text-align: center;
    pointer-events: none;
    padding: 40px 24px;
}

.ib-upload-icon {
    font-size: 52px;
    margin-bottom: 12px;
    line-height: 1;
}

.ib-upload-title {
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.ib-upload-hint {
    font-size: 13px;
    color: #a0aec0;
}

/* 上传图标 hover 微浮动效 */
.ib-upload-zone:hover .ib-upload-icon {
    animation: ibIconFloat 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ibIconFloat {
    0%, 100% { transform: translateY(0); }
    40%       { transform: translateY(-8px); }
    70%       { transform: translateY(-3px); }
}

.ib-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* 上传提示 */
.ib-upload-tips {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.ib-tip {
    font-size: 13px;
    color: #718096;
}

/* ─── 工具栏 ─── */
.ib-toolbar {
    background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.06);
}

.ib-toolbar-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.ib-toolbar-row + .ib-toolbar-row {
    border-top: 1px solid #e8edf5;
    padding-top: 10px;
}

.ib-tool-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.ib-actions-group {
    margin-left: auto;
}

.ib-settings-group {
    flex: 1;
}

.ib-group-label {
    font-size: 11px;
    font-weight: 700;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    user-select: none;
}

/* ─── 模式按钮 ─── */
.ib-mode-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ib-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    color: #4a5568;
}

.ib-mode-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
}

.ib-mode-btn.ib-mode-active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.38);
}

.ib-mode-btn.ib-mode-active:hover {
    transform: scale(1.02);
    background: #5a6fd6;
}

.ib-btn-icon {
    font-size: 18px;
    line-height: 1;
}

.ib-btn-label {
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

/* ─── 对比预览原图按鈕激活态 ─── */
#btn-ib-preview.ib-preview-active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

#btn-ib-preview.ib-preview-active:hover {
    background: #5a6fd6;
    transform: scale(1.02);
}

/* ─── 操作按鈕区 ─── */
.ib-action-btns {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.ib-shortcut-hint {
    font-size: 0.8em;
    color: #a0aec0;
    opacity: 0.7;
    user-select: none;
}

.ib-action-btns .button:hover,
.ib-action-btns .third:hover {
    transform: scale(1.02);
}

/* ─── 参数设置 ─── */
.ib-settings {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ib-setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    user-select: none;
}

.ib-setting-name {
    color: #718096;
    font-size: 12px;
    white-space: nowrap;
}

.ib-slider {
    width: 160px;
    cursor: pointer;
    accent-color: #667eea;
    /* 渐变轨道：红→橙→绿 */
    background: linear-gradient(to right, #e53e3e, #ed8936, #38a169);
    border-radius: 4px;
    height: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ib-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 6px rgba(102, 126, 234, 0.4);
    transition: transform 0.15s ease;
}

.ib-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* ─── Firefox 滑块兼容样式 ─── */
.ib-slider::-moz-range-track {
    height: 4px;
    background: linear-gradient(to right, #e53e3e, #ed8936, #38a169);
    border-radius: 4px;
    border: none;
}

.ib-slider::-moz-range-thumb {
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 6px rgba(102, 126, 234, 0.4);
    transition: transform 0.15s ease;
}

.ib-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.ib-setting-val {
    font-size: 13px;
    font-weight: 700;
    color: #4a5568;
    min-width: 36px;
    background: #f0f4ff;
    padding: 2px 7px;
    border-radius: 5px;
    text-align: center;
}

/* ─── 局部虚化提示 ─── */
.ib-region-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 7px;
    animation: ibHintIn 0.3s ease;
}

@keyframes ibHintIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.ib-hint-icon {
    font-size: 16px;
}

.ib-hint-text {
    font-size: 12px;
    color: #92400e;
    font-weight: 500;
}

/* ─── 选区状态 ─── */
.ib-sel-status {
    display: flex;
    align-items: center;
    gap: 8px;
    animation: ibHintIn 0.3s ease;
}

.ib-sel-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 12px;
    background: #c6f6d5;
    color: #276749;
    border: 1px solid #9ae6b4;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ib-sel-badge.ib-badge-empty {
    background: #f0f4ff;
    color: #667eea;
    border-color: #c7d2fe;
}

.ib-clear-sel-btn {
    font-size: 12px;
}

/* ─── 信息栏 ─── */
.ib-info-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #fff 0%, #f8faff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ib-info-icon {
    font-size: 15px;
}

.ib-info-name {
    font-weight: 600;
    color: #2d3748;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ib-info-sep {
    color: #cbd5e0;
    user-select: none;
}

.ib-info-dim {
    color: #718096;
}

.ib-info-size {
    color: #a0aec0;
    font-size: 12px;
}

.ib-info-status {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    padding: 2px 8px;
    background: #f0f4ff;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

/* 预览原图状态：大圆色调表示当前为预览模式 */
.ib-info-status.ib-status-preview {
    color: #92400e;
    background: #fffbeb;
    border-color: #fcd34d;
}

/* ─── 画布区域 ─── */
.ib-canvas-wrap {
    width: 100%;
    max-height: 74vh;
    overflow: auto;
    user-select: none;
    background-color: #2d3748;
    background-image:
        linear-gradient(45deg, #374151 25%, transparent 25%),
        linear-gradient(-45deg, #374151 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #374151 75%),
        linear-gradient(-45deg, transparent 75%, #374151 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: 12px;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ib-canvas-inner {
    position: relative;
    display: inline-block;
    line-height: 0;
}

#ib-canvas {
    max-width: 100%;
    display: block;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#ib-canvas.ib-canvas-loaded {
    animation: ibCanvasIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ibCanvasIn {
    from { opacity: 0; transform: scale(1.02); }
    to   { opacity: 1; transform: scale(1); }
}

#ib-sel-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    cursor: crosshair;
}

/* ─── 快捷键提示 ─── */
.ib-shortcuts {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 0 6px;
}

.ib-sc {
    font-size: 12px;
    color: #a0aec0;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    background: #f7fafc;
    border: 1px solid #cbd5e0;
    border-bottom: 2px solid #a0aec0;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    color: #4a5568;
    line-height: 1.5;
    white-space: nowrap;
}

/* ─── Toast ─── */
.ib-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 240px;
    max-width: 380px;
    padding: 12px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-size: 14px;
    font-weight: 600;
    animation: ibToastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ib-toast-success {
    background: #c6f6d5;
    color: #276749;
    border: 1px solid #9ae6b4;
}

.ib-toast-error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.ib-toast-info {
    background: #ebf8ff;
    color: #2c5282;
    border: 1px solid #bee3f8;
}

.ib-toast-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.ib-toast-msg {
    flex: 1;
    line-height: 1.4;
}

.ib-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 18px;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.ib-toast-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes ibToastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ibToastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

.ib-toast-fading {
    animation: ibToastOut 0.3s ease forwards;
}

/* ─── 编辑区域淡入 ─── */
.ib-anim-show {
    animation: ibFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ibFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── 按鈕禁用态 ─── */
#btn-ib-export:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

#btn-ib-preview:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─── 响应式 ─── */
@media (max-width: 768px) {
    .ib-toolbar-row {
        flex-direction: column;
        gap: 10px;
    }

    .ib-actions-group {
        margin-left: 0;
    }

    .ib-mode-btns {
        gap: 5px;
    }

    .ib-mode-btn {
        min-width: 68px;
        padding: 7px 10px;
    }

    .ib-btn-icon {
        font-size: 15px;
    }

    .ib-btn-label {
        font-size: 10px;
    }

    .ib-slider {
        width: 110px;
    }

    .ib-settings {
        gap: 12px;
    }

    .ib-shortcuts {
        display: none;
    }

    .ib-upload-tips {
        flex-direction: column;
        gap: 6px;
    }
}

@media (max-width: 640px) {
    .ib-upload-zone {
        min-height: 150px;
    }

    .ib-upload-icon {
        font-size: 36px;
    }

    .ib-upload-title {
        font-size: 14px;
    }

    .ib-canvas-wrap {
        padding: 8px;
        max-height: 60vh;
    }

    .ib-info-bar {
        font-size: 12px;
        gap: 5px;
    }

    .ib-info-status {
        margin-left: 0;
    }
}
