/**
 * Carousel Styles - Catalogo Lilitech
 * 
 * Stili completi per il carosello immagini prodotto frontend. Include
 * navigazione, thumbnails, animazioni, e varianti di stile.
 *
 * @package CatalogoLilitech
 * @subpackage Assets/CSS
 * @version 1.0.0
 * @author Alientech S.r.l.
 *
 * Convenzioni:
 * - Prefisso: ltwp- (Lilitech WordPress)
 * - Metodologia: BEM-like
 * - Colori WordPress standard per coerenza
 * - GPU-accelerated animations (transform, opacity)
 */


/* ==========================================================================
   #CAROUSEL-CONTAINER
   Container principale del carosello
   ========================================================================== */

/**
 * Block: Product Carousel
 * Container root del carosello
 * 
 * Features:
 * - Max-width 600px centrato
 * - User-select disabled per migliore UX drag
 * - Tabindex 0 per keyboard navigation (aggiunto via JS)
 * 
 * @responsive Max-width 100% su mobile
 */
.ltwp-product-carousel {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    user-select: none;
}


/* ==========================================================================
   #CAROUSEL-MAIN
   Area immagine principale con slides
   ========================================================================== */

/**
 * Block: Carousel Main
 * Container per l'immagine principale
 * 
 * Features:
 * - Aspect ratio 1:1 forzato
 * - Background grigio per loading state
 * - Border radius arrotondato
 * - Box shadow per profondità
 */
.ltwp-carousel-main {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}


/* ==========================================================================
   #CAROUSEL-SLIDE
   Singola slide immagine
   ========================================================================== */

/**
 * Block: Carousel Slide
 * Singola immagine slide
 * 
 * Features:
 * - Posizionamento absolute per stacking
 * - Opacity 0 di default (visibile solo se .active)
 * - Transition opacity per fade effect
 * - Pointer-events none quando nascosta
 * - Flexbox per centrare immagine
 * 
 * States:
 * - .active - Slide visibile (opacity 1, z-index 1)
 * - .slide-in-right - Animazione entrata da destra
 * - .slide-in-left - Animazione entrata da sinistra
 * - .loading - Shimmer effect (vedi sezione LOADING)
 */
.ltwp-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/**
 * State: Slide Active
 * Slide correntemente visibile
 */
.ltwp-carousel-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

/**
 * Element: Slide > Image
 * Immagine prodotto
 * 
 * Features:
 * - Object-fit contain per preservare aspect ratio
 * - Full size del container
 */
.ltwp-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}


/* ==========================================================================
   #CAROUSEL-NAVIGATION
   Pulsanti frecce prev/next
   ========================================================================== */

/**
 * Block: Carousel Nav
 * Pulsante navigazione circolare
 * 
 * Features:
 * - Cerchi 48x48px
 * - Background bianco semitrasparente
 * - Posizionati absolute left/right al 50% verticale
 * - SVG inline per frecce
 * - Hover: scale 1.1 con shadow più forte
 * - Active: scale 0.95 (feedback tattile)
 * - Disabled: opacity 0.3, no hover effects
 * 
 * States:
 * - :hover - Scale 1.1 e shadow più forte
 * - :active - Scale 0.95 (pressed effect)
 * - :disabled - Opacity ridotta, cursor not-allowed
 * 
 * @responsive Dimensioni ridotte su mobile
 */
.ltwp-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/**
 * Modifier: Carousel Nav Previous
 * Posizione sinistra
 */
.ltwp-carousel-prev {
    left: 15px;
}

/**
 * Modifier: Carousel Nav Next
 * Posizione destra
 */
.ltwp-carousel-next {
    right: 15px;
}

/**
 * State: Nav Hover
 * Ingrandimento e shadow più forte
 */
.ltwp-carousel-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/**
 * State: Nav Active (pressed)
 * Scale ridotta per feedback tattile
 */
.ltwp-carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

/**
 * Element: Nav > SVG
 * Icona freccia
 */
.ltwp-carousel-nav svg {
    color: #333;
    pointer-events: none;
}

/**
 * State: Nav Disabled
 * Disabilitato su prima/ultima slide
 */
.ltwp-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ltwp-carousel-nav:disabled:hover {
    transform: translateY(-50%) scale(1);
}


/* ==========================================================================
   #CAROUSEL-COUNTER
   Contatore posizione corrente "X / Y"
   ========================================================================== */

/**
 * Block: Carousel Counter
 * Pill badge con contatore posizione
 * 
 * Features:
 * - Posizionato bottom-right
 * - Background nero semitrasparente
 * - Border radius pill (20px)
 * - Current number in bold
 */
.ltwp-carousel-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
}

/**
 * Element: Counter > Current Number
 * Numero corrente in grassetto
 */
.ltwp-carousel-counter .current {
    font-weight: 700;
}


/* ==========================================================================
   #CAROUSEL-THUMBNAILS
   Track scrollabile di thumbnails cliccabili
   ========================================================================== */

/**
 * Block: Carousel Thumbs
 * Container thumbnails con overflow hidden
 * 
 * Features:
 * - Padding laterale 40px per spazio frecce (opzionale)
 * - Overflow hidden per nascondere thumbs fuori viewport
 * - Scroll smooth gestito via JS
 */
.ltwp-carousel-thumbs {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 40px;
}

/**
 * Element: Thumbs > Track
 * Flexbox track che contiene i thumbs
 * 
 * Features:
 * - Display flex con gap
 * - Transition transform per scroll smooth
 * - Scrollabile orizzontalmente (gestito via JS)
 */
.ltwp-carousel-thumbs-track {
    display: flex;
    gap: 10px;
    transition: transform 0.3s ease;
}


/* ==========================================================================
   #CAROUSEL-THUMB
   Singola thumbnail cliccabile
   ========================================================================== */

/**
 * Block: Carousel Thumb
 * Singola thumbnail button
 * 
 * Features:
 * - 80x80px fixed size
 * - Border trasparente di default
 * - Border blu quando active
 * - Hover: border grigio e scale 1.05
 * - Cursor pointer
 * 
 * States:
 * - :hover - Border grigio e scale
 * - .active - Border blu WordPress + box-shadow
 * 
 * @responsive Dimensioni ridotte su mobile
 */
.ltwp-carousel-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f5f5f5;
    padding: 0;
}

/**
 * State: Thumb Hover
 * Evidenziazione on hover
 */
.ltwp-carousel-thumb:hover {
    border-color: #999;
    transform: scale(1.05);
}

/**
 * State: Thumb Active
 * Thumbnail della slide corrente
 */
.ltwp-carousel-thumb.active {
    border-color: #2271b1; /* WordPress blue-50 */
    box-shadow: 0 0 0 1px #2271b1;
}

/**
 * Element: Thumb > Image
 * Immagine thumbnail con crop
 */
.ltwp-carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* ==========================================================================
   #THUMBS-SCROLL-VARIANT
   Variante con gradient fade ai lati (opzionale)
   ========================================================================== */

/**
 * Modifier: Thumbs with Scroll Fade
 * Gradient fade ai lati per indicare contenuto scrollabile
 * 
 * Usage: Aggiungere classe .ltwp-carousel-thumbs-scroll al container thumbs
 * 
 * @optional Non applicato di default
 */
.ltwp-carousel-thumbs-scroll {
    position: relative;
}

/**
 * Pseudo-elements: Gradient Overlays
 * Fade left e right per indicare scroll
 */
.ltwp-carousel-thumbs-scroll::before,
.ltwp-carousel-thumbs-scroll::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 2;
}

.ltwp-carousel-thumbs-scroll::before {
    left: 0;
    background: linear-gradient(to right, white, transparent);
}

.ltwp-carousel-thumbs-scroll::after {
    right: 0;
    background: linear-gradient(to left, white, transparent);
}


/* ==========================================================================
   #RESPONSIVE
   Media queries per layout mobile
   ========================================================================== */

/**
 * Breakpoint: 782px (WordPress standard tablet breakpoint)
 * 
 * Changes:
 * - Carousel full width
 * - Nav buttons 40px
 * - Counter più piccolo
 * - Thumbs 60px
 */
@media screen and (max-width: 782px) {
    .ltwp-product-carousel {
        max-width: 100%;
    }
    
    .ltwp-carousel-nav {
        width: 40px;
        height: 40px;
    }
    
    .ltwp-carousel-prev {
        left: 10px;
    }
    
    .ltwp-carousel-next {
        right: 10px;
    }
    
    .ltwp-carousel-counter {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .ltwp-carousel-thumbs {
        padding: 0 30px;
    }
    
    .ltwp-carousel-thumb {
        width: 60px;
        height: 60px;
    }
}

/**
 * Breakpoint: 480px (Mobile small)
 * 
 * Changes:
 * - Nav buttons ancora più piccoli (36px)
 * - Thumbs 50px
 * - Padding ridotto
 */
@media screen and (max-width: 480px) {
    .ltwp-carousel-nav {
        width: 36px;
        height: 36px;
    }
    
    .ltwp-carousel-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .ltwp-carousel-thumbs {
        padding: 0 20px;
    }
    
    .ltwp-carousel-thumb {
        width: 50px;
        height: 50px;
        gap: 8px;
    }
}


/* ==========================================================================
   #ANIMATIONS
   Keyframes per transizioni slide
   ========================================================================== */

/**
 * Animation: Slide In From Right
 * Slide entra da destra con fade
 * 
 * Usage: Applicato via JS quando si va avanti
 * Duration: 0.4s (definito in classe)
 * Easing: ease
 */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/**
 * Animation: Slide In From Left
 * Slide entra da sinistra con fade
 * 
 * Usage: Applicato via JS quando si va indietro
 * Duration: 0.4s (definito in classe)
 * Easing: ease
 */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/**
 * State: Slide animating right
 * Classe applicata via JS
 */
.ltwp-carousel-slide.slide-in-right {
    animation: slideInFromRight 0.4s ease;
}

/**
 * State: Slide animating left
 * Classe applicata via JS
 */
.ltwp-carousel-slide.slide-in-left {
    animation: slideInFromLeft 0.4s ease;
}


/* ==========================================================================
   #VARIANT-MINIMAL
   Stile minimalista alternativo
   ========================================================================== */

/**
 * Variant: Minimal Style
 * Stile più pulito con bordi invece di shadow
 * 
 * Usage: Aggiungere classe .minimal al .ltwp-product-carousel
 * 
 * Example:
 * <div class="ltwp-product-carousel minimal">
 */
.ltwp-product-carousel.minimal .ltwp-carousel-main {
    box-shadow: none;
    border: 1px solid #e0e0e0;
}

.ltwp-product-carousel.minimal .ltwp-carousel-nav {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.ltwp-product-carousel.minimal .ltwp-carousel-thumb {
    border-radius: 4px;
}


/* ==========================================================================
   #VARIANT-DARK
   Stile dark mode
   ========================================================================== */

/**
 * Variant: Dark Mode
 * Palette scura per sfondi dark
 * 
 * Usage: Aggiungere classe .dark al .ltwp-product-carousel
 * 
 * Example:
 * <div class="ltwp-product-carousel dark">
 */
.ltwp-product-carousel.dark .ltwp-carousel-main {
    background: #2c3338; /* WordPress gray-90 */
}

.ltwp-product-carousel.dark .ltwp-carousel-nav {
    background: rgba(44, 51, 56, 0.95);
}

.ltwp-product-carousel.dark .ltwp-carousel-nav svg {
    color: white;
}

.ltwp-product-carousel.dark .ltwp-carousel-thumb {
    background: #2c3338;
    border-color: #3c4146; /* WordPress gray-80 */
}

.ltwp-product-carousel.dark .ltwp-carousel-thumb.active {
    border-color: #2271b1;
}


/* ==========================================================================
   #LOADING-STATE
   Shimmer effect per caricamento
   ========================================================================== */

/**
 * State: Loading
 * Gradient animato per stato loading
 * 
 * Usage: Aggiungere classe .loading a .ltwp-carousel-slide prima che immagine carichi
 * 
 * Features:
 * - Gradient grigio che si muove orizzontalmente
 * - Loop infinito 1.5s
 * - GPU-accelerated animation
 */
.ltwp-carousel-slide.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/**
 * Animation: Loading Shimmer
 * Movimento orizzontale del gradient
 */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}


/* ==========================================================================
   #ACCESSIBILITY
   Miglioramenti accessibilità
   ========================================================================== */

/**
 * Focus Visible: Carousel
 * Outline blu per keyboard navigation
 * 
 * Browser support: Modern browsers con :focus-visible
 */
.ltwp-product-carousel:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-radius: 8px;
}

/**
 * Focus Visible: Nav Buttons
 * Outline blu sui pulsanti
 */
.ltwp-carousel-nav:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/**
 * Focus Visible: Thumbs
 * Outline blu sui thumbs
 */
.ltwp-carousel-thumb:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/**
 * Reduced Motion: Disable Animations
 * Rispetta preferenza utente per animazioni ridotte
 * 
 * @a11y prefers-reduced-motion
 */
@media (prefers-reduced-motion: reduce) {
    .ltwp-carousel-slide,
    .ltwp-carousel-thumbs-track,
    .ltwp-carousel-nav,
    .ltwp-carousel-thumb {
        transition: none !important;
        animation: none !important;
    }
}


/* ==========================================================================
   #PRINT
   Ottimizzazioni per stampa
   ========================================================================== */

/**
 * Print: Carousel Simplified
 * Mostra solo slide attiva in stampa
 */
@media print {
    .ltwp-carousel-nav,
    .ltwp-carousel-counter,
    .ltwp-carousel-thumbs {
        display: none;
    }
    
    .ltwp-carousel-slide:not(.active) {
        display: none;
    }
    
    .ltwp-carousel-main {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
