/**
 * Before/After Widget — estilos frontend
 *
 * FIX responsive (v2): la imagen "after" va en FLUJO NORMAL y define la altura
 * real del wrapper; la "before" se superpone absoluta y recortada encima.
 *
 * Antes las dos imagenes eran position:absolute, asi que el wrapper no tenia
 * contenido en flujo y su altura era siempre fingida (padding-bottom / aspect-
 * ratio). Cuando ese calculo no se aplicaba, las imagenes salian a su tamano
 * natural y se montaban sobre la seccion siguiente. Con la "after" en flujo, el
 * container toma la altura REAL de la foto y se adapta a cualquier proporcion.
 */

.before-after-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    touch-action: none;
    user-select: none;
    line-height: 0; /* evita hueco fantasma bajo elementos inline */
}

.before-after-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* Sin altura fingida: la altura la pone la imagen "after" en flujo. */
}

/* ── Capa inferior "after": EN FLUJO, define la altura del wrapper ───────── */
.before-after-after {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
}

.before-after-after img {
    display: block;
    width: 100%;
    height: auto; /* altura natural de la foto → marca el alto del bloque */
}

/* ── Capa superior "before": OVERLAY absoluto y recortado ────────────────── */
.before-after-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

.before-after-before img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* encaja en la altura que marca la "after" */
}

/* ── Handle ──────────────────────────────────────────────────────────────── */
.before-after-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    z-index: 10;
    transform: translateX(-50%);
    cursor: ew-resize;
}

.before-after-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    background-color: #ffffff;
}

.before-after-handle-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    color: #333333;
}

.before-after-handle-icon svg {
    width: 24px;
    height: 24px;
    margin-top: 7px;
    color: #1B224E;
}

/* ── Labels ──────────────────────────────────────────────────────────────── */
.before-after-label {
    position: absolute;
    bottom: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    z-index: 5;
}

.before-after-label-before {
    left: 20px;
}

.before-after-label-after {
    right: 20px;
}

.before-after-widget-error {
    padding: 20px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .before-after-handle-icon {
        width: 40px;
        height: 40px;
    }

    .before-after-handle-icon svg {
        width: 20px;
        height: 20px;
    }

    .before-after-label {
        font-size: 10px;
        padding: 4px 10px;
        bottom: 10px;
    }

    .before-after-label-before {
        left: 10px;
    }

    .before-after-label-after {
        right: 10px;
    }
}