/* ══════════════════════════════════════════════════════════════════════
   Background Remover — page extras.
   Load AFTER app-file-compressor.css. Uses the theme variables
   (--black / --white / --gray / --primary-blue), so it follows the
   day/dark switch automatically (the dark CSS swaps those variables).
   ══════════════════════════════════════════════════════════════════════ */

[hidden] { display: none !important; }

/* Upload box text */
.app-card .upload-container h3 { font-family: 'Gabarito', sans-serif; margin-bottom: 6px; }
.app-card .upload-container span { display: block; font-size: 0.9rem; opacity: 0.7; }
.app-card .upload-container.over { background-color: var(--light-blue, #1a1a1a); }
.app-card .upload-container:focus-visible { outline: 3px solid var(--primary-blue); outline-offset: 4px; }

/* First-time note */
.first-note {
    width: 50%;
    margin: 16px auto 0;
    font-size: 0.9rem;
    opacity: 0.75;
}

/* Progress */
#progressSection { width: 50%; margin: 24px auto 0; text-align: left; }
.progress-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
}
.progress-track { height: 12px; border-radius: 999px; background: var(--gray); overflow: hidden; }
#progressFill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--primary-blue);
    transition: width 0.25s ease;
}
#progressFill.busy {
    width: 100% !important;
    background: repeating-linear-gradient(45deg, var(--primary-blue) 0 14px, rgba(0, 98, 255, 0.55) 14px 28px);
    background-size: 40px 40px;
    animation: bgr-stripes 0.9s linear infinite;
}
@keyframes bgr-stripes { to { background-position: 40px 0; } }

/* Error */
#errorBox { width: 50%; margin: 20px auto 0; font-weight: 600; color: red; }

/* Results */
#results {
    width: 70%;
    max-width: 1000px;
    margin: 30px auto 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.result-card { border: 2px solid var(--gray); border-radius: 12px; padding: 12px; background: var(--white); }
.result-card h3 { font-family: 'Gabarito', sans-serif; font-size: 1rem; margin-bottom: 10px; }
.result-card canvas { width: 100%; height: auto; display: block; border-radius: 8px; }
.result-actions { grid-column: 1 / -1; }

button.btn { border: 0; cursor: pointer; font-size: 1rem; }
button.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Transparent-background checkerboard */
.checker {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #d9d9d9 25%, transparent 25%, transparent 75%, #d9d9d9 75%),
        linear-gradient(45deg, #d9d9d9 25%, transparent 25%, transparent 75%, #d9d9d9 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* Before / After slider */
.compare-section { width: 100%; margin-top: 56px; padding: 0 16px; }
.compare-section h2 { font-family: 'Gabarito', sans-serif; color: var(--primary-blue); font-size: clamp(1.2rem, 4vw, 1.8rem); margin-bottom: 8px; }
.compare-section p { opacity: 0.7; margin-bottom: 22px; }

.compare {
    --pos: 50%;
    position: relative;
    width: min(100%, 560px);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--gray);
    cursor: ew-resize;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.compare:focus-within { outline: 3px solid var(--primary-blue); outline-offset: 3px; }
.compare-img, .compare-after, .compare-after img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.compare-after { clip-path: inset(0 0 0 var(--pos)); }
.compare-handle {
    position: absolute; top: 0; bottom: 0; left: var(--pos);
    width: 3px; margin-left: -1.5px; background: var(--primary-blue);
    pointer-events: none;
}
.compare-handle span {
    position: absolute; top: 50%; left: 50%; width: 44px; height: 44px;
    margin: -22px 0 0 -22px; border-radius: 50%;
    background: var(--primary-blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.compare-tag {
    position: absolute; top: 12px; padding: 4px 12px; border-radius: 999px;
    background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.8rem; font-weight: 700;
    pointer-events: none;
}
.compare-tag.before { left: 12px; }
.compare-tag.after { right: 12px; }
.compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }

/* Responsive */
@media (max-width: 1199px) { .first-note, #progressSection, #errorBox { width: 55%; } #results { width: 80%; } }
@media (max-width: 1024px) { .first-note, #progressSection, #errorBox { width: 65%; } }
@media (max-width: 900px)  { .first-note, #progressSection, #errorBox { width: 75%; } #results { width: 90%; } }
@media (max-width: 768px)  { .first-note, #progressSection, #errorBox { width: 82%; } }
@media (max-width: 640px) {
    .first-note, #progressSection, #errorBox { width: 90%; }
    #results { width: 92%; grid-template-columns: 1fr; }
    .compare-section { margin-top: 40px; }
}
@media (max-width: 480px) { .first-note, #progressSection, #errorBox { width: 94%; } }

@media (prefers-reduced-motion: reduce) {
    #progressFill.busy { animation-duration: 3s; }
}
