/* Comparison Slider Component - Mobile First */

/* Base styles (Mobile) */
.comparison-slider {
    width: 100%;
    max-width: 220px;
    margin: 16px auto 0;
    touch-action: pan-y pinch-zoom;
}

.comparison-slider-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.15);
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.comparison-slider-container.dragging {
    cursor: grabbing;
}

/* After Image (full background) */
.comparison-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.comparison-after img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Before Image (clipped overlay) */
.comparison-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: inset(0 50% 0 0);
}

.comparison-before img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Labels - Mobile first */
.comparison-label {
    position: absolute;
    top: 6px;
    padding: 3px 8px;
    border-radius: 50px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    pointer-events: none;
    z-index: 5;
}

.before-label {
    left: 6px;
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.after-label {
    right: 6px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #fff;
}

/* Drag Handle - Mobile optimized (larger touch target) */
.comparison-handle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: ew-resize;
}

.comparison-handle-line {
    flex: 1;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.comparison-handle-circle {
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.comparison-handle-circle i {
    font-size: 10px;
    color: #4F46E5;
}

/* Active state for touch */
.comparison-handle:active .comparison-handle-circle,
.comparison-slider-container.dragging .comparison-handle-circle {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Hint animation on mobile - subtle pulse to indicate interactivity */
@keyframes slider-hint {
    0%, 100% { transform: translateX(-50%); }
    50% { transform: translateX(-70%); }
}

.comparison-slider-container:not(.touched) .comparison-handle {
    animation: slider-hint 2s ease-in-out 1s 2;
}

/* Once touched or dragging, disable animation completely */
.comparison-slider-container.touched .comparison-handle,
.comparison-slider-container.dragging .comparison-handle {
    animation: none !important;
}

/* Tablet - 600px and up */
@media (min-width: 600px) {
    .comparison-slider {
        max-width: 220px;
    }
    
    .comparison-slider-container {
        border-radius: 10px;
    }
    
    .comparison-label {
        top: 8px;
        padding: 4px 8px;
        font-size: 9px;
    }
    
    .before-label {
        left: 8px;
    }
    
    .after-label {
        right: 8px;
    }
    
    .comparison-handle-circle {
        width: 30px;
        height: 30px;
    }
    
    .comparison-handle-circle i {
        font-size: 11px;
    }
}

/* Desktop - 992px and up */
@media (min-width: 992px) {
    .comparison-slider {
        max-width: 260px;
    }
    
    .comparison-slider-container {
        border-radius: 10px;
        box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.15);
    }
    
    .comparison-label {
        top: 8px;
        padding: 4px 10px;
        font-size: 9px;
    }
    
    .before-label {
        left: 8px;
    }
    
    .after-label {
        right: 8px;
    }
    
    .comparison-handle {
        width: 32px;
    }
    
    .comparison-handle-circle {
        width: 32px;
        height: 32px;
    }
    
    .comparison-handle-circle i {
        font-size: 12px;
    }
    
    .comparison-handle:hover .comparison-handle-circle {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

/* Large desktop - 1200px and up */
@media (min-width: 1200px) {
    .comparison-slider {
        max-width: 280px;
    }
}
