/**
 * Page Designer — Before/After Block — runtime styles
 * Namespace: pd-blk-ba-*
 * Introduced in PAGE_DESIGNER_VERSION 2.7.10
 *
 * Visual layout for the Before/After comparison slider. Uses CSS custom
 * properties set on the root element (via inline style) so the panel
 * and runtime JS can drive the appearance declaratively.
 *
 * Custom properties consumed:
 *   --pd-blk-ba-position        (0-100, unitless — current slider %)
 *   --pd-blk-ba-divider-color   (hex colour)
 *   --pd-blk-ba-divider-width   (px, unitless number)
 *   --pd-blk-ba-handle-size     (px, unitless number)
 *   --pd-blk-ba-overlay-before  (hex colour or empty)
 *   --pd-blk-ba-overlay-after   (hex colour or empty)
 *   --pd-blk-ba-overlay-opacity (0-1 decimal)
 *
 * STRICT ISOLATION: every selector starts with .pd-blk-ba. No overlap
 * with any other block, panel, or tool namespace.
 */

/* ── Root container ──────────────────────────────────────────────────── */
.pd-blk-ba {
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    line-height: 0;
}

/* ── Panes (before = bottom layer, after = top layer clipped) ──────── */
.pd-blk-ba-pane-before,
.pd-blk-ba-pane-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.pd-blk-ba-pane-before {
    z-index: 0;
}

.pd-blk-ba-pane-after {
    z-index: 1;
    clip-path: inset(0 0 0 calc(var(--pd-blk-ba-position, 50) * 1%));
}

/* Vertical orientation: clip from top instead of left */
.pd-blk-ba[data-pd-ba-orientation="vertical"] .pd-blk-ba-pane-after {
    clip-path: inset(calc(var(--pd-blk-ba-position, 50) * 1%) 0 0 0);
}

/* Contain mode overrides */
.pd-blk-ba[data-pd-ba-before-fit="contain"] .pd-blk-ba-pane-before {
    background-size: contain;
}
.pd-blk-ba[data-pd-ba-after-fit="contain"] .pd-blk-ba-pane-after {
    background-size: contain;
}

/* ── Placeholders (shown when no image is set) ───────────────────── */
.pd-blk-ba-pane-before .pd-blk-ba-placeholder,
.pd-blk-ba-pane-after .pd-blk-ba-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff; /* v3.7.19 — placeholder sits on the fixed dark pane; light text, no admin token */
    pointer-events: none;
}
.pd-blk-ba-pane-before .pd-blk-ba-placeholder .fa {
    font-size: 28px;
    opacity: 0.5;
}
.pd-blk-ba-pane-after .pd-blk-ba-placeholder .fa {
    font-size: 28px;
    opacity: 0.5;
}
.pd-blk-ba-pane-before {
    background-color: #374151;
}
.pd-blk-ba-pane-after {
    background-color: #1f2937;
}
/* Hide placeholder when an image is set */
.pd-blk-ba-pane-before.pd-blk-ba-has-image .pd-blk-ba-placeholder,
.pd-blk-ba-pane-after.pd-blk-ba-has-image .pd-blk-ba-placeholder {
    display: none;
}
/* Reset background when image is set — image uses background-image */
.pd-blk-ba-pane-before.pd-blk-ba-has-image {
    background-color: transparent;
}
.pd-blk-ba-pane-after.pd-blk-ba-has-image {
    background-color: transparent;
}

/* ── Overlays ────────────────────────────────────────────────────────── */
.pd-blk-ba-overlay-before,
.pd-blk-ba-overlay-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.pd-blk-ba-overlay-before {
    background-color: var(--pd-blk-ba-overlay-before, transparent);
    opacity: var(--pd-blk-ba-overlay-opacity, 0);
    z-index: 0;
}
.pd-blk-ba-overlay-after {
    background-color: var(--pd-blk-ba-overlay-after, transparent);
    opacity: var(--pd-blk-ba-overlay-opacity, 0);
    z-index: 0;
}

/* ── Divider line ────────────────────────────────────────────────────── */
.pd-blk-ba-divider {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

/* Horizontal divider (default) */
.pd-blk-ba:not([data-pd-ba-orientation="vertical"]) .pd-blk-ba-divider {
    top: 0;
    left: calc(var(--pd-blk-ba-position, 50) * 1%);
    width: calc(var(--pd-blk-ba-divider-width, 4) * 1px);
    height: 100%;
    transform: translateX(-50%);
    background-color: #ffffff; /* v3.7.19 — white divider (with shadow), no admin token */
}

/* Vertical divider */
.pd-blk-ba[data-pd-ba-orientation="vertical"] .pd-blk-ba-divider {
    left: 0;
    top: calc(var(--pd-blk-ba-position, 50) * 1%);
    height: calc(var(--pd-blk-ba-divider-width, 4) * 1px);
    width: 100%;
    transform: translateY(-50%);
    background-color: #ffffff; /* v3.7.19 — white divider, no admin token */
}

/* ── Handle (circle on the divider) ──────────────────────────────── */
.pd-blk-ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(var(--pd-blk-ba-handle-size, 40) * 1px);
    height: calc(var(--pd-blk-ba-handle-size, 40) * 1px);
    background: #ffffff; /* v3.7.19 — white handle, no admin token */
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151; /* v3.7.19 — dark arrows on the white handle, no admin token */
    pointer-events: none;
    z-index: 4;
}

/* Handle style: arrows (default) */
.pd-blk-ba-handle-arrows {
    display: block;
    width: 60%;
    height: 60%;
    fill: #374151; /* v3.7.19 — dark arrows on the white handle, no admin token */
}
/* Handle style: circle — hide arrows SVG, show a simple dot */
.pd-blk-ba[data-pd-ba-handle-style="circle"] .pd-blk-ba-handle-arrows {
    display: none;
}
/* Handle style: line — hide the entire handle circle */
.pd-blk-ba[data-pd-ba-handle-style="line"] .pd-blk-ba-handle {
    display: none;
}

/* ── Drag area (invisible touch target over divider) ─────────────── */
.pd-blk-ba-drag-area {
    position: absolute;
    z-index: 5;
    cursor: ew-resize;
}
.pd-blk-ba:not([data-pd-ba-orientation="vertical"]) .pd-blk-ba-drag-area {
    top: 0;
    left: calc(var(--pd-blk-ba-position, 50) * 1%);
    width: 40px;
    height: 100%;
    transform: translateX(-50%);
}
.pd-blk-ba[data-pd-ba-orientation="vertical"] .pd-blk-ba-drag-area {
    left: 0;
    top: calc(var(--pd-blk-ba-position, 50) * 1%);
    height: 40px;
    width: 100%;
    transform: translateY(-50%);
    cursor: ns-resize;
}

/* Hover mode: entire block is the drag area */
.pd-blk-ba[data-pd-ba-mode="hover"] .pd-blk-ba-drag-area {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
    cursor: col-resize;
}
.pd-blk-ba[data-pd-ba-mode="hover"][data-pd-ba-orientation="vertical"] .pd-blk-ba-drag-area {
    cursor: row-resize;
}

/* ── Labels ──────────────────────────────────────────────────────────── */
.pd-blk-ba-label-before,
.pd-blk-ba-label-after {
    position: absolute;
    z-index: 2;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff; /* v3.7.19 — label overlay on the image: light text on dark pill, no admin token */
    background: rgba(0, 0, 0, 0.55);
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
}

/* Hide labels when show-labels is false */
.pd-blk-ba[data-pd-ba-show-labels="false"] .pd-blk-ba-label-before,
.pd-blk-ba[data-pd-ba-show-labels="false"] .pd-blk-ba-label-after {
    display: none;
}

/* Horizontal: labels on left/right sides */
.pd-blk-ba:not([data-pd-ba-orientation="vertical"]) .pd-blk-ba-label-before {
    left: 12px;
}
.pd-blk-ba:not([data-pd-ba-orientation="vertical"]) .pd-blk-ba-label-after {
    right: 12px;
}

/* Vertical: labels on top/bottom */
.pd-blk-ba[data-pd-ba-orientation="vertical"] .pd-blk-ba-label-before {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}
.pd-blk-ba[data-pd-ba-orientation="vertical"] .pd-blk-ba-label-after {
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

/* Label position: top */
.pd-blk-ba:not([data-pd-ba-orientation="vertical"])[data-pd-ba-label-pos="top"] .pd-blk-ba-label-before,
.pd-blk-ba:not([data-pd-ba-orientation="vertical"])[data-pd-ba-label-pos="top"] .pd-blk-ba-label-after {
    top: 12px;
}
/* Label position: center (default) */
.pd-blk-ba:not([data-pd-ba-orientation="vertical"]):not([data-pd-ba-label-pos])[data-pd-ba-show-labels="true"] .pd-blk-ba-label-before,
.pd-blk-ba:not([data-pd-ba-orientation="vertical"]):not([data-pd-ba-label-pos])[data-pd-ba-show-labels="true"] .pd-blk-ba-label-after,
.pd-blk-ba:not([data-pd-ba-orientation="vertical"])[data-pd-ba-label-pos="center"] .pd-blk-ba-label-before,
.pd-blk-ba:not([data-pd-ba-orientation="vertical"])[data-pd-ba-label-pos="center"] .pd-blk-ba-label-after {
    top: 50%;
    transform: translateY(-50%);
}
/* Label position: bottom */
.pd-blk-ba:not([data-pd-ba-orientation="vertical"])[data-pd-ba-label-pos="bottom"] .pd-blk-ba-label-before,
.pd-blk-ba:not([data-pd-ba-orientation="vertical"])[data-pd-ba-label-pos="bottom"] .pd-blk-ba-label-after {
    bottom: 12px;
}

/* ── Keyboard focus indicator ────────────────────────────────────────── */
.pd-blk-ba:focus-visible {
    outline: 2px solid var(--pd-link-color, #89b4fa); /* v3.7.23 — focus ring follows Global Links */
    outline-offset: 2px;
}

/* ── Transitions (only on non-dragging state for smoothness) ─────── */
.pd-blk-ba:not(.pd-blk-ba-dragging) .pd-blk-ba-pane-after,
.pd-blk-ba:not(.pd-blk-ba-dragging) .pd-blk-ba-divider,
.pd-blk-ba:not(.pd-blk-ba-dragging) .pd-blk-ba-drag-area {
    transition: clip-path 0.15s ease, left 0.15s ease, top 0.15s ease;
}
