/**
 * Lukuro Product Carousel - Splide.js Styles
 * Minimal, performant styles for Splide.js based carousel
 * @version 3.0.0 (Splide.js Migration)
 */

/* ==========================================================================
   Component Base
   ========================================================================== */

.product-card__media-wrapper {
    aspect-ratio: 4/5;
    display: block;
    position: relative; /* establish containing block for absolute fill */
}

/* Base carousel wrapper */
.lukuro-splide-carousel-wrapper {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: transparent;
    contain: layout style paint;
}

/* Fill media wrapper reserved box when used inside product card */
.product-card__media-wrapper > .lukuro-splide-carousel-wrapper {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
}

/* Splide carousel container */
.lukuro-splide-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Splide track container */
.splide__track {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
}

/* Splide list container */
.splide__list {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Individual slides */
.splide__slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Images within slides */
.splide__slide img {
    display: block !important;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    max-width: none;
    max-height: none;
    border: none;
    outline: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Remove lazy loading opacity states since we disabled lazy loading */
.splide__slide img[data-splide-lazy] {
    opacity: 1 !important;
    transition: none;
}

.splide__slide img.is-loaded {
    opacity: 1 !important;
}

/* Navigation arrows */
.splide__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.splide__arrow--prev {
    left: 16px;
}

.splide__arrow--next {
    right: 16px;
}

.splide__arrow:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.splide__arrow:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.splide__arrow svg {
    width: 24px;
    height: 24px;
    color: #333;
}

/* Hide arrows on very small screens */
@media (max-width: 480px) {
    .splide__arrow {
        width: 36px;
        height: 36px;
    }
    
    .splide__arrow--prev {
        left: 8px;
    }
    
    .splide__arrow--next {
        right: 8px;
    }
    
    .splide__arrow svg {
        width: 20px;
        height: 20px;
    }
}

/* Touch/drag cursor */
.splide__track {
    cursor: grab;
}

.splide__track:active {
    cursor: grabbing;
}

/* Performance optimizations */
.lukuro-splide-carousel * {
    will-change: auto;
}

.splide__track {
    will-change: transform;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .lukuro-splide-carousel {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .splide__slide {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .splide__slide img {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Aspect ratio fallback */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    .lukuro-splide-carousel-wrapper {
        min-height: 300px;
    }
    
    .lukuro-splide-carousel {
        min-height: 300px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .splide__arrow {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .splide__slide img[data-splide-lazy] {
        transition: none;
    }
    
    .splide__arrow {
        transition: none;
    }
}

/* Loading state */
.lukuro-splide-carousel-wrapper[data-loading="true"] {
    background: #f5f5f5;
}

.lukuro-splide-carousel-wrapper[data-loading="true"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #e0e0e0;
    border-top-color: #666;
    border-radius: 50%;
    animation: lukuro-carousel-spin 1s linear infinite;
    z-index: 5;
}

@keyframes lukuro-carousel-spin {
    to { transform: rotate(360deg); }
}

/* Hover autoplay indicator (optional) */
.lukuro-splide-carousel[data-hover-autoplay="true"]:hover::after {
    content: '';
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: lukuro-autoplay-pulse 2s infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes lukuro-autoplay-pulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.2); }
}
