/* Image Background Remover — ibr- */
.ibr-upload-zone {
    border: 2px dashed rgba(139, 92, 246, 0.35);
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.04);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}

.ibr-upload-zone:hover,
.ibr-upload-zone:focus,
.ibr-upload-zone.ibr-drag-over {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.08);
}

.ibr-upload-icon {
    font-size: 3rem;
    color: #8B5CF6;
    opacity: 0.7;
    margin-bottom: 14px;
    display: block;
}

.ibr-upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.ibr-upload-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.ibr-section {
    padding: 40px 0 60px;

}

.ibr-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem
}

.ibr-badge {
    width: 44px;
    height: 44px;
    background: rgba(139, 92, 246, .15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #8B5CF6;
    flex-shrink: 0
}

.ibr-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 .2rem
}

.ibr-subtitle {
    font-size: 0.9375rem;
    color: #64748B;
    margin: 0
}

.ibr-controls {
    background: #F8FAFC;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    gap: .75rem
}

.ibr-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    align-items: end
}

.ibr-group {
    display: flex;
    flex-direction: column;
    gap: .4rem
}

.ibr-label {
    font-size: 0.9375rem;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: .5rem
}

.ibr-val-badge {
    background: #F1F5F9;
    border-radius: 4px;
    padding: .1rem .4rem;
    font-size: 0.8125rem;
    color: #8B5CF6;
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
    text-align: center
}

.ibr-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #F1F5F9;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    width: 100%
}

.ibr-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8B5CF6;
    cursor: pointer
}

.ibr-color-row {
    display: flex;
    align-items: center;
    gap: .5rem
}

.ibr-color-input {
    width: 40px;
    height: 36px;
    border: 2px solid #E2E8F0;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0
}

.ibr-pick-btn {
    flex: 1
}

.ibr-note {
    font-size: 0.8125rem;
    color: #64748B;
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    margin: 0
}

.ibr-canvas-wrap {
    display: block;
    max-width: 100%;
    cursor: default;
    position: relative;
}

.ibr-canvas-wrap.ibr-picking {
    cursor: crosshair
}

#ibr-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #E2E8F0
}

.ibr-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 1.25rem
}

.ibr-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .2s, transform .1s
}

.ibr-btn:active {
    transform: scale(.97)
}

.ibr-btn--primary {
    background: #8B5CF6;
    color: #fff
}

.ibr-btn--ghost {
    background: #F1F5F9;
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.ibr-btn--ghost:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.ibr-btn--success {
    background: #22C55E;
    color: #fff
}

.ibr-btn--secondary {
    background: transparent;
    border: 1px solid #8B5CF6;
    color: #8B5CF6;
}

.ibr-btn--secondary:hover {
    background: rgba(139, 92, 246, 0.08);
}

.ibr-btn--ai {
    background: linear-gradient(135deg, #8B5CF6, #6366F1);
    color: #fff;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.35);
}

.ibr-btn--ai:hover {
    filter: brightness(1.1);
}

.ibr-btn--ai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.ibr-beta-tag {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: middle;
}

.ibr-ai-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ibr-ai-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.ibr-ai-progress[hidden] {
    display: none !important;
}

.ibr-ai-progress-track {
    height: 6px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.ibr-ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #6366F1, #8B5CF6);
    background-size: 200% 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.2s ease;
    animation: ibr-shimmer 1.8s infinite linear;
}

@keyframes ibr-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

#ibr-ai-progress-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.ibr-result-label {
    font-size: 0.9375rem;
    color: #64748B;
    margin-bottom: .5rem
}

#ibr-result-canvas {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: repeating-conic-gradient(#E2E8F0 0% 25%, #FFFFFF 25% 50%) 0 0/20px 20px;
    border: 1px solid #E2E8F0;
    display: block
}

@media(max-width:600px) {
    .ibr-row {
        grid-template-columns: 1fr
    }
}

/* ── Eyedropper active state ── */
.ibr-eyedropper--active {
    background: #8B5CF6 !important;
    color: #fff !important;
    border-color: #8B5CF6 !important;
}

.ibr-mask-btn--active {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #EF4444 !important;
    color: #EF4444 !important;
}

/* ── Side-by-side split layout ── */
.ibr-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: flex-start;
    margin-top: 12px;
}

.ibr-pane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ibr-pane-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.ibr-result-pane {
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    background: #F8FAFC;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ibr-result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    opacity: 0.45;
    font-size: 0.9rem;
    padding: 40px 20px;
    text-align: center;
}

.ibr-result-placeholder i {
    font-size: 2.5rem;
}

/* ── Processing spinner overlay ── */
.ibr-proc-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ibr-spin-ring {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8B5CF6;
    border-radius: 50%;
    animation: ibr-spin 0.8s linear infinite;
    display: block;
}

@keyframes ibr-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media(max-width:768px) {
    .ibr-split-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Phase label ────────────────────────────────────────────────── */
#ibr-ai-phase-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8B5CF6;
    min-height: 1em;
}

/* ── Batch queue ─────────────────────────────────────────────── */
#ibr-batch-queue {
    margin-bottom: 14px;
    background: #F8FAFC;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 10px;
    overflow: hidden;
}

.ibr-batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.ibr-batch-list {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
}

.ibr-batch-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.15s;
}

.ibr-batch-item:last-child {
    border-bottom: none;
}

.ibr-batch-item i {
    font-size: 1rem;
    flex-shrink: 0;
}

.ibr-batch-item--waiting i {
    color: #94A3B8;
}

.ibr-batch-item--processing i {
    color: #8B5CF6;
}

.ibr-batch-item--done i {
    color: #10B981;
}

.ibr-batch-item--done {
    cursor: pointer;
}

.ibr-batch-item--done:not(.ibr-batch-item--active):hover {
    background: rgba(0, 0, 0, 0.03);
}

.ibr-batch-item--active {
    background: rgba(139, 92, 246, 0.07);
    border-left: 3px solid #8B5CF6;
    padding-left: 11px;
}

.ibr-batch-item--error i {
    color: #EF4444;
}

.ibr-batch-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.ibr-batch-dl {
    background: none;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    padding: 3px 7px;
    cursor: pointer;
    color: #8B5CF6;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.ibr-batch-dl:hover {
    background: rgba(139, 92, 246, 0.08);
}

@keyframes ibr-batch-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ibr-batch-spin {
    display: inline-block;
    animation: ibr-batch-spin 0.8s linear infinite;
}