/**
 * Before/After Image Slider Styles
 * Modern, responsive design with smooth animations
 */

.before-after-slider {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Image container */
.ba-images {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.ba-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ba-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* After image (bottom layer) */
.ba-after {
    z-index: 1;
}

/* Before image (top layer, clipped) */
.ba-before {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
    transition: clip-path 0.1s ease-out;
}

.before-after-slider.is-dragging .ba-before {
    transition: none;
}

/* Slider control line */
.ba-slider-control {
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 255, 255, 0.9) 100%
    );
    z-index: 10;
    transform: translateX(-50%);
    transition: left 0.1s ease-out;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.before-after-slider.is-dragging .ba-slider-control {
    transition: none;
}

/* Drag handle */
.ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ba-handle:hover {
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.ba-handle.dragging {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.ba-handle-icon {
    width: 24px;
    height: 24px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ba-handle-icon svg {
    width: 100%;
    height: 100%;
}

/* Labels */
.ba-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.ba-label {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .before-after-slider {
        min-height: 300px;
    }

    .ba-handle {
        width: 40px;
        height: 40px;
    }

    .ba-handle:hover {
        width: 44px;
        height: 44px;
    }

    .ba-label {
        font-size: 12px;
        padding: 6px 12px;
        top: 15px;
    }

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

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

@media (max-width: 480px) {
    .before-after-slider {
        min-height: 250px;
    }

    .ba-handle {
        width: 36px;
        height: 36px;
    }

    .ba-handle:hover {
        width: 40px;
        height: 40px;
    }

    .ba-label {
        font-size: 11px;
        padding: 5px 10px;
        top: 10px;
    }

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

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

/* Loading state */
.before-after-slider.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility - keyboard focus */
.ba-handle:focus {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .ba-slider-control,
    .ba-handle,
    .ba-labels {
        display: none;
    }

    .ba-before {
        clip-path: inset(0 50% 0 0);
    }
}
