:root {
    --bg: #f5f5f5;
    --text: #1a1a1a;
    --card-bg: #ffffff;
    --accent: #3656e8;
    --border: #cccccc;
}

[data-theme="dark"] {
    --bg: #121212;
    --text: #eeeeee;
    --card-bg: #1e1e1e;
    --border: #444444;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 40px 16px;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    transition: 0.2s ease;
}

.container {
    width: 100%;
    max-width: 680px;
    background: var(--card-bg);
    padding: 32px 28px;
    border-radius: 20px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.12);
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 18px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
}

h1 {
    text-align: center;
    margin: 0 0 18px 0;
    font-size: 26px;
}

/* Upload area */
.drop-zone {
    border: 2px dashed var(--accent);
    border-radius: 16px;
    padding: 45px 20px;
    text-align: center;
    font-size: 15px;
    cursor: pointer;
    transition: 0.2s ease;
}

.drop-zone:hover {
    background: rgba(54,86,232,0.05);
}

/* Preview */
#preview {
    width: 100%;
    display: none;
    margin-top: 20px;
    border-radius: 12px;
    object-fit: contain;
    max-height: 300px;
}

/* Loader */
.loader {
    display: none;
    margin: 25px auto 10px auto;
    width: 55px;
    height: 55px;
    border: 6px solid #ddd;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Processing Message */
.processing-message {
    display: none;
    text-align: center;
    margin-top: 8px;
    font-size: 15px;
    opacity: 0.85;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
    background: #2f4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(54,86,232,0.25);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Secondary button */
.btn.secondary {
    background: #e0e0e0;
    color: #222;
}

.btn.secondary:hover {
    background: #d8d8d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

[data-theme="dark"] .btn.secondary {
    background: #3a3a3a;
    color: #f4f4f4;
}

[data-theme="dark"] .btn.secondary:hover {
    background: #4a4a4a;
    box-shadow: 0 4px 10px rgba(255,255,255,0.15);
}

/* Before/After labels */
.comparison-labels {
    display: none;
    margin-top: 25px;
    text-align: center;
    font-weight: bold;
}

.before-label { margin-right: 45%; }

/* SLIDER FIX — both images same displayed height */
.slider-container {
    display: none;
    position: relative;
    width: 100%;
    margin-top: 16px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-bg);
}

/* Maintain consistent aspect ratio */
.slider-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* CRITICAL FIX */
    background: var(--card-bg);
}

/* BEFORE wrapper (left side of slider) */
.before-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;        /* slider position updates this */
    height: 100%;
    overflow: hidden;
    background: var(--card-bg);
}

/* Slider handle */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--accent);
    cursor: ew-resize;
}

.slider-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Warning */
.warning {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    background: #fff3cd;
    color: #7a5900;
    border: 1px solid #ffe69c;
    text-align: center;
    display: none;
}

[data-theme="dark"] .warning {
    background: #4c3a00;
    color: #ffecb5;
    border-color: #665200;
}

/* Footer */
.footer {
    margin-top: 30px;
    text-align: center;
    opacity: 0.8;
    font-size: 14px;
}

.footer a {
    color: var(--accent);
}
