/**
 * AlloDentiste Before & After Widget – Stylesheet
 */

/* ============================================================
   Outer container
   ============================================================ */
.allo-before-after-widget {
    max-width: 1400px;
    margin: 0 auto;
    background-color: #DCF0F2;
    padding: 60px var(--allo-gutter);
    border-radius: 20px;
    box-sizing: border-box;
}

/* ============================================================
   Slides wrapper — only active slide visible
   ============================================================ */
.ba-slides {
    position: relative;
}

.ba-slide {
    display: none;
}

.ba-slide.is-active {
    display: flex;
    gap: 60px;
    align-items: flex-start;
}

/* ============================================================
   Two columns
   ============================================================ */
.ba-text-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ba-image-col {
    flex: 0 0 auto;
    width: 45%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================================
   Text column — heading & body
   ============================================================ */
.ba-heading {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.2;
}


.ba-body {
    margin: 0;
}

.ba-body p {
    margin: 0 0 0.75em;
    font-size: 0.9375rem;
    color: #444444;
    line-height: 1.7;
}

.ba-body p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Checklist section
   ============================================================ */
.ba-checklist-cols {
    display: flex;
    gap: 32px;
}

.ba-checklist-col {
    flex: 1 1 0;
    min-width: 0;
}

.ba-list-heading {
    margin: 0 0 12px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1A1A1A;
}

.ba-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ba-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ba-list-item svg {
    flex-shrink: 0;
}

.ba-list-item span {
    font-size: 0.875rem;
    color: #444444;
    line-height: 1.4;
}

/* ============================================================
   Image comparison wrapper
   ============================================================ */
.ba-image-wrapper {
    position: relative;
    width: 100%;
    /* No fixed height — wrapper is sized by the after image naturally.
       User can override via the Elementor height control if needed. */
    overflow: hidden;
    border-radius: 12px;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    --split: 50%;
}

/* After image: in normal flow — its natural height drives the wrapper size.
   No cropping, no fixed height required. */
.ba-after-img {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    object-fit: unset !important;
    z-index: 1;
    /* shows only the right portion */
    clip-path: inset(0 0 0 var(--split));
}

/* Before image: absolute overlay, same intrinsic size as after image.
   Safe to use object-fit:cover since both before/after photos must be
   the same dimensions for the comparison to make visual sense. */
.ba-before-img {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    z-index: 2;
    /* shows only the left portion */
    clip-path: inset(0 calc(100% - var(--split)) 0 0);
}

/* ============================================================
   Overlay — hard-clips divider, handle & labels to the image box
   ============================================================ */
.ba-overlay {
    position: absolute !important;
    inset: 0;
    /* clip-path:inset(0) is a hard paint clip — cannot be escaped by any
       child regardless of z-index, transform, or stacking context.
       Unlike overflow:hidden it cannot be overridden by Elementor. */
    clip-path: inset(0);
    pointer-events: none;
    z-index: 2;
}

/* Re-enable pointer events just on the handle so dragging works */
.ba-overlay .ba-handle {
    pointer-events: auto;
}

/* ============================================================
   Divider line
   ============================================================ */
.ba-divider {
    position: absolute;
    top: 0;
    height: 100%;
    left: var(--split);
    transform: translateX(-50%);
    width: 2px;
    background-color: #ffffff;
    z-index: 2;
    pointer-events: none;
}

/* ============================================================
   Drag handle
   ============================================================ */
.ba-handle {
    position: absolute;
    top: 50%;
    left: var(--split);
    transform: translate(-50%, -50%);
    z-index: 3;
    cursor: ew-resize;
    /* Ensure handle is visually centred even when overlay clips at edges */
    will-change: left;
}

.ba-handle-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   Labels (Before / After badges)
   ============================================================ */
.ba-label {
    position: absolute;
    top: 14px;
    z-index: 4;
    padding: 5px 14px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.35);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ba-label-before {
    left: 14px;
}

.ba-label-after {
    right: 14px;
}

/* ============================================================
   Image footer (caption + nav)
   ============================================================ */
.ba-image-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ba-caption {
    margin: 0;
    font-size: 0.875rem;
    font-style: italic;
    color: #666666;
}

/* ============================================================
   Navigation arrows
   ============================================================ */
.ba-nav {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ba-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: none;
    background-color: #00A1AD;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
}

.ba-nav-btn:hover,
.ba-nav-btn:focus,
.ba-nav-btn:active,
.ba-nav-btn:focus-visible {
    background-color: #008A94 !important;
    box-shadow: none !important;
    outline: none;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .ba-slide.is-active {
        gap: 40px;
    }

    .ba-image-col {
        width: 42%;
    }
}

@media (max-width: 768px) {
    .allo-before-after-widget {
        padding: 40px var(--allo-gutter);
        border-radius: 16px;
    }

    .ba-slide.is-active {
        flex-direction: column;
        gap: 32px;
    }

    .ba-image-col {
        width: 100%;
    }

    .ba-image-wrapper {
        /* no fixed height override at mobile — natural image ratio applies */
    }

    .ba-checklist-cols {
        gap: 16px;
    }

    .ba-heading {
        font-size: 1.625rem;
    }
}

@media (max-width: 480px) {
    .ba-checklist-cols {
        flex-direction: column;
        gap: 20px;
    }
}
