/**
 * Image Comparison Slider Styles
 * Composant de comparaison avant/après avec curseur interactif
 */

.wc-pixel-image-comparison-wrapper {
    width: 100%;
}

.wc-pixel-image-comparison {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Container pour les images */
.comparison-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

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

/* Image de fond (après) */
.comparison-after {
    position: relative;
}

/* Mode auto-height : l'image "after" définit la hauteur */
.wc-pixel-image-comparison[data-auto-height="true"] .comparison-after {
    position: relative;
    height: auto;
}

.wc-pixel-image-comparison[data-auto-height="true"] .comparison-after img {
    position: relative;
    display: block;
    height: auto;
    width: 100%;
    object-fit: contain;
}

.wc-pixel-image-comparison[data-auto-height="true"] .comparison-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.wc-pixel-image-comparison[data-auto-height="true"] .comparison-before img {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: contain;
}

/* Image de dessus (avant) avec clip */
.comparison-before {
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    transition: clip-path 0.05s ease-out;
}

/* Labels des images */
.comparison-label {
    position: absolute;
    top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.comparison-label-before {
    left: 1rem;
}

.comparison-label-after {
    right: 1rem;
}

/* Curseur vertical */
.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Poignée du curseur */
.comparison-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: ew-resize;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: transform 0.2s ease;
}

.comparison-slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.comparison-slider-handle:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.comparison-slider-handle svg {
    width: 16px;
    height: 16px;
    color: #333;
}

/* État actif (drag en cours) */
.wc-pixel-image-comparison.is-dragging {
    cursor: ew-resize;
}

.wc-pixel-image-comparison.is-dragging .comparison-slider-handle {
    transform: translate(-50%, -50%) scale(1.15);
}

/* Animation de transition fluide */
.wc-pixel-image-comparison:not(.is-dragging) .comparison-before {
    transition: clip-path 0.1s ease-out;
}

.wc-pixel-image-comparison:not(.is-dragging) .comparison-slider {
    transition: left 0.1s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .comparison-label {
        font-size: 12px;
        padding: 0.4rem 0.8rem;
    }

    .comparison-slider-handle {
        width: 40px;
        height: 40px;
    }

    .comparison-slider-handle svg {
        width: 14px;
        height: 14px;
    }
}

/* Message d'erreur */
.wc-pixel-error {
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Accessibilité - focus visible au clavier */
.comparison-slider-handle:focus-visible {
    outline: 3px solid #4299e1;
    outline-offset: 2px;
}
