/* ================================================================
   ACF Before After Widget — Frontend CSS  v2.0
   ================================================================ */

/* ── Container ─────────────────────────────────────────────────── */
.acfba-container {
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    cursor: col-resize;
    line-height: 1;        /* NON 0: gli span label figli collasserebbero */
    border-radius: 8px;
    display: block;
    width: 100%;
}
/* Il line-height:0 serve solo sui wrap immagine per evitare spazi sotto le img */
.acfba-after-wrap,
.acfba-before-wrap {
    line-height: 0;
}
.acfba-container.acfba-vertical { cursor: row-resize; }

/* ── Immagini ────────────────────────────────────────────────────── */
.acfba-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* ── Layer AFTER (base) ─────────────────────────────────────────── */
.acfba-after-wrap {
    position: relative;
    width: 100%;
}
/* Se è impostata un'altezza fissa, i layer devono riempirla */
.acfba-container[style*="height"] .acfba-after-wrap,
.acfba-container[style*="height"] .acfba-before-wrap {
    height: 100%;
}
.acfba-container[style*="height"] .acfba-after-wrap .acfba-img,
.acfba-container[style*="height"] .acfba-before-wrap .acfba-img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* ── Layer BEFORE (sovrapposto, clippato) ──────────────────────── */
.acfba-before-wrap {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}

/* ── Etichette ──────────────────────────────────────────────────── */
.acfba-label {
    position: absolute;
    bottom: 14px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    line-height: 1.4;
    pointer-events: none;
    color: #fff;
    background-color: rgba(26,26,26,0.55);
    transition: opacity .2s ease;
    /* sempre adattato al contenuto, non al contenitore */
    display: inline-block;
    width: auto;
    height: auto;
    white-space: nowrap;
    max-width: fit-content;
    /* bottom default; viene sovrascritto inline per posizione centro/top */
    bottom: 14px;
    top: auto;
}
.acfba-label-before { left: 14px; }
.acfba-label-after  { right: 14px; left: auto; }

/* ── Divisore ───────────────────────────────────────────────────── */
.acfba-divider {
    position: absolute;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* orizzontale */
.acfba-horizontal .acfba-divider {
    height: 100%;
    width: 0;
    flex-direction: column;
}
.acfba-horizontal .acfba-divider-line {
    flex: 1;
    width: 2px;
    background-color: #fff;
    opacity: .85;
}

/* verticale */
.acfba-vertical .acfba-divider {
    left: 0;
    top: 0;
    width: 100%;
    height: 0;
    flex-direction: row;
}
.acfba-vertical .acfba-divider-line {
    flex: 1;
    height: 2px;
    background-color: #fff;
    opacity: .85;
}

/* ── Handle — base ──────────────────────────────────────────────── */
.acfba-handle {
    flex-shrink: 0;
    position: relative;
    z-index: 11;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    cursor: grab;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 2px 16px rgba(0,0,0,.28);
}
.acfba-handle:active { cursor: grabbing; transform: scale(1.06); }

/* ── Forme handle ───────────────────────────────────────────────── */

/* Pillola */
.acfba-handle-pill .acfba-handle {
    width: 48px;
    height: 80px;
    border-radius: 999px;   /* pillola */
}
/* verticale: pillola ruotata */
.acfba-vertical.acfba-handle-pill .acfba-handle {
    width: 80px;
    height: 48px;
    border-radius: 999px;
}

/* Cerchio */
.acfba-handle-circle .acfba-handle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* Quadrato */
.acfba-handle-square .acfba-handle {
    width: 48px;
    height: 48px;
    border-radius: 6px;
}

/* ── Icona frecce ───────────────────────────────────────────────── */
.acfba-arrows {
    width: 20px;
    height: 20px;
    color: #1a1a1a;
    pointer-events: none;
    display: block;
    flex-shrink: 0;
}
.acfba-vertical .acfba-arrows { transform: rotate(90deg); }

/* ── Hover / Focus ──────────────────────────────────────────────── */
.acfba-container:hover .acfba-handle {
    box-shadow: 0 4px 22px rgba(0,0,0,.38);
}
.acfba-handle:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 3px;
}
