/* ===== 图片对比工具样式 ===== */

/* ─── 上传区域 ─── */
#ic-upload-section {
    padding: 8px 0 16px;
}

.ic-upload-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 16px;
}

.ic-upload-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #a0aec0;
    padding: 0 12px;
    flex-shrink: 0;
    user-select: none;
}

.ic-upload-zone {
    flex: 1;
    position: relative;
    border: 2px dashed #c7d2fe;
    border-radius: 12px;
    background: #fafbff;
    min-height: 160px;
    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;
}

.ic-upload-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ic-upload-zone.ic-drag-over {
    border-color: #667eea;
    background: #eef2ff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.ic-upload-zone.ic-has-image {
    border-color: #48bb78;
    border-style: solid;
    background: #f0fff4;
}

.ic-upload-placeholder {
    text-align: center;
    pointer-events: none;
    padding: 24px 16px;
}

.ic-upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
    line-height: 1;
}

.ic-upload-title {
    font-size: 15px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}

.ic-upload-hint {
    font-size: 13px;
    color: #a0aec0;
}

.ic-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* 缩略图 */
.ic-thumb-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    animation: icThumbIn 0.4s ease;
}

.ic-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ic-thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
    padding: 20px 10px 8px;
    color: #fff;
    pointer-events: none;
}

.ic-thumb-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ic-thumb-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
}

.ic-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ic-remove-btn:hover {
    background: #e53e3e;
    transform: scale(1.08);
}

/* 提示条 */
.ic-upload-tips {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.ic-tip {
    font-size: 13px;
    color: #718096;
}

.ic-upload-status {
    font-size: 13px;
    color: #a0aec0;
    margin-left: 12px;
    vertical-align: middle;
}

/* 隐藏工具类 */
.ic-hidden {
    display: none !important;
}

/* ─── 工具栏 ─── */
.ic-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f8faff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.ic-mode-tabs {
    display: flex;
    gap: 4px;
}

.ic-mode-btn {
    padding: 7px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ic-mode-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
}

.ic-mode-btn.ic-mode-active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

.ic-tool-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ic-zoom-label {
    font-size: 13px;
    color: #4a5568;
    font-weight: 600;
    min-width: 42px;
    text-align: center;
    user-select: none;
}

/* ─── 信息栏 ─── */
.ic-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ic-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 160px;
}

.ic-info-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}

.ic-badge-a {
    background: #667eea;
}

.ic-badge-b {
    background: #ed8936;
}

.ic-info-name {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.ic-info-meta {
    font-size: 12px;
    color: #a0aec0;
    white-space: nowrap;
}

.ic-info-sep {
    font-size: 18px;
    color: #cbd5e0;
    flex-shrink: 0;
    user-select: none;
}

/* ─── 画布外层 ─── */
.ic-canvas-outer {
    width: 100%;
    background: #1a202c;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

/* 画布模式 cursor 控制类 */
.ic-canvas-outer.ic-cursor-slider {
    cursor: col-resize;
}

.ic-canvas-outer.ic-cursor-pan {
    cursor: grab;
}

.ic-canvas-outer.ic-cursor-pan:active {
    cursor: grabbing;
}

.ic-canvas-outer.ic-cursor-pointer {
    cursor: pointer;
}

.ic-zoom-layer {
    display: inline-block;
    transform-origin: center center;
    transition: transform 0.15s ease;
    line-height: 0;
}

/* ─── 模式视图基础 ─── */
.ic-mode-view {
    display: block;
}

/* ─── ① 滑动对比容器 ─── */
.ic-slider-container {
    position: relative;
    display: inline-block;
    user-select: none;
    overflow: hidden;
    cursor: col-resize;
    line-height: 0;
}

.ic-cmp-img {
    display: block;
}

/* B图裁切层 */
.ic-clip-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.ic-clip-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* 滑动条 */
.ic-slider-bar {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 20;
    cursor: col-resize;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.ic-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    z-index: 21;
    cursor: col-resize;
}

.ic-arrow {
    font-size: 11px;
    color: #4a5568;
    line-height: 1;
}

/* 角标 */
.ic-corner-label {
    position: absolute;
    bottom: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
    z-index: 15;
    letter-spacing: 0.5px;
}

.ic-lbl-a {
    left: 12px;
    background: rgba(102, 126, 234, 0.85);
    color: #fff;
}

.ic-lbl-b {
    right: 12px;
    background: rgba(237, 137, 54, 0.85);
    color: #fff;
}

/* ─── ② 并排对比 ─── */
.ic-sbs-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.ic-sbs-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ic-sbs-header {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 20px;
    letter-spacing: 0.5px;
    border-radius: 4px 4px 0 0;
    line-height: 1;
}

.ic-sbs-header-a {
    background: rgba(102, 126, 234, 0.85);
    color: #fff;
}

.ic-sbs-header-b {
    background: rgba(237, 137, 54, 0.85);
    color: #fff;
}

.ic-sbs-img {
    display: block;
}

.ic-sbs-divider {
    width: 3px;
    background: rgba(255, 255, 255, 0.5);
    align-self: stretch;
    flex-shrink: 0;
}

/* ─── ③ 交替对比 ─── */
.ic-ov-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.ic-ov-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
    transition: background 0.25s ease;
    color: #fff;
    background: rgba(102, 126, 234, 0.85);
}

.ic-ov-badge.ic-badge-showing-b {
    background: rgba(237, 137, 54, 0.85);
}

/* 交替控制条 */
.ic-ov-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #f8faff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 10px;
}

.ic-ov-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    user-select: none;
}

.ic-ov-option input[type="range"] {
    width: 100px;
    cursor: pointer;
}

/* ─── 快捷键提示条 ─── */
.ic-shortcuts {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 8px 0 4px;
}

.ic-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;
}

/* ─── 动画 ─── */
@keyframes icFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes icThumbIn {
    from { opacity: 0; transform: scale(1.04); }
    to   { opacity: 1; transform: scale(1); }
}

#ic-compare-section {
    animation: icFadeIn 0.3s ease;
}

/* ─── 响应式 ─── */
@media (max-width: 768px) {
    .ic-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ic-tool-btns {
        flex-wrap: wrap;
        gap: 4px;
    }

    .ic-mode-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .ic-upload-arrow {
        display: none;
    }

    .ic-upload-row {
        flex-direction: column;
        gap: 12px;
    }

    .ic-upload-tips {
        flex-direction: column;
        gap: 6px;
    }

    .ic-shortcuts {
        display: none;
    }

    .ic-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .ic-upload-zone {
        min-height: 120px;
    }

    .ic-upload-icon {
        font-size: 28px;
    }

    .ic-upload-title {
        font-size: 14px;
    }
}

/* ─── 交替对比图片过渡 ─── */
#ic-ov-img {
    transition: opacity 0.12s ease;
}

#ic-ov-img.ic-ov-fading {
    opacity: 0;
}

/* ─── 上传状态文字就绪样式 ─── */
.ic-upload-status.ic-status-ready {
    color: #276749;
    font-weight: 600;
}

/* ─── 快捷键提示（按钮旁） ─── */
.ic-shortcut-hint {
    font-size: 0.8em;
    color: #a0aec0;
    margin-left: 8px;
    vertical-align: middle;
    opacity: 0.7;
    user-select: none;
}

/* ─── 开始对比处理中按钮状态 ─── */
#btn-start-compare.ic-processing {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ─── Toast 通知 ─── */
.ic-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 240px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-size: 14px;
    animation: icToastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ic-toast-success {
    background: #c6f6d5;
    color: #276749;
    border: 1px solid #9ae6b4;
}

.ic-toast-error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.ic-toast-info {
    background: #ebf8ff;
    color: #2c5282;
    border: 1px solid #bee3f8;
}

.ic-toast-msg {
    flex: 1;
    line-height: 1.4;
}

.ic-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;
}

.ic-toast-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes icToastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes icToastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

.ic-toast-fading {
    animation: icToastOut 0.3s ease forwards;
}
