/* Container principale: due colonne */
.woobedding-product-gallery {
    display: flex;
    width: 100%;
    height: 200vh; /* Altezza aumentata per desktop */
    position: relative;
}

/* Colonna delle miniature: visualizza le anteprime in colonna, una sotto l'altra */
.gallery-thumbnails {
    flex: 0 0 120px; /* Larghezza fissa per la colonna delle miniature */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    margin-right: 10px;
    padding: 10px 0;
    /* Stile scrollbar per le miniature */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

/* Stile scrollbar webkit per le miniature */
.gallery-thumbnails::-webkit-scrollbar {
    width: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Ogni miniatura */
.gallery-thumbnails .thumbnail {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.3s, opacity 0.3s;
    flex-shrink: 0;
}

/* Immagine della miniatura */
.gallery-thumbnails .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hover sulla miniatura */
.gallery-thumbnails .thumbnail:hover {
    opacity: 0.8;
}

/* Evidenzia la miniatura attiva */
.gallery-thumbnails .thumbnail.active {
    border-color: #0073aa;
}

/* Colonna principale: contiene tutte le immagini grandi con scroll */
.gallery-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 20px 0; /* Aggiunto padding verticale */
    /* Stile scrollbar per le immagini principali */
    scrollbar-width: none;
    -ms-overflow-style: none;
    scrollbar-color: #ccc #f5f5f5;
    height: 135vh;
}

/* Stile scrollbar webkit per le immagini principali */
.gallery-main::-webkit-scrollbar {
    display: none;
}

.gallery-main::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.gallery-main::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.gallery-main::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Ogni immagine grande */
.gallery-main .large-image {
    width: 100%;
    margin-bottom: 30px; /* Aggiunto spazio tra le immagini */
    flex-shrink: 0;
}

/* Le immagini grandi si adattano alla larghezza del container */
.gallery-main .large-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Tablet */
@media (max-width: 1024px) {
    .woobedding-product-gallery {
        height: 800px; /* Altezza intermedia per tablet */
    }

    .gallery-main {
        height: 800px;
        padding: 15px 0;
    }

    .gallery-main .large-image {
        margin-bottom: 25px;
    }
}

/* Responsive: su schermi piccoli */
@media (max-width: 768px) {
    .woobedding-product-gallery {
        flex-direction: column; /* Layout verticale su mobile */
        height: auto; /* Altezza automatica */
        max-height: 600px;
    }

    /* Miniature in alto con scroll orizzontale */
    .gallery-thumbnails {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row; /* Miniature in orizzontale */
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 5px;
        margin-right: 0;
        margin-bottom: 10px;
        /* Scrollbar orizzontale sottile */
        scrollbar-width: thin;
    }

    .gallery-thumbnails::-webkit-scrollbar {
        height: 6px;
        width: auto;
    }

    .gallery-thumbnails .thumbnail {
        width: 70px;
        height: 70px;
        margin-right: 10px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .gallery-thumbnails .thumbnail:last-child {
        margin-right: 5px;
    }

    /* Galleria principale con scroll ORIZZONTALE */
    .gallery-main {
        flex: 1;
        flex-direction: row; /* Immagini in orizzontale */
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        height: 450px;
    }

    /* Scrollbar orizzontale per la galleria principale */
    .gallery-main::-webkit-scrollbar {
        display: block;
        height: 6px;
    }

    .gallery-main .large-image {
        min-width: 100%;
        width: 100%;
        margin-right: 20px;
        margin-bottom: 0;
        scroll-snap-align: start;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .gallery-main .large-image:last-child {
        margin-right: 0;
    }

    .gallery-main .large-image img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }
}

/* Smartphone piccoli in portrait */
@media (max-width: 480px) {
    .woobedding-product-gallery {
        flex-direction: column;
        height: auto;
        max-height: 500px;
    }

    .gallery-thumbnails {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 5px;
        margin-bottom: 8px;
    }

    .gallery-thumbnails .thumbnail {
        width: 60px;
        height: 60px;
        margin-right: 8px;
        margin-bottom: 0;
    }

    /* Galleria con scroll orizzontale */
    .gallery-main {
        flex: 1;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        height: 400px;
    }

    .gallery-main .large-image {
        min-width: 100%;
        width: 100%;
        margin-right: 15px;
        margin-bottom: 0;
        scroll-snap-align: center;
    }
}

/* Desktop grandi e 4K */
@media (min-width: 1920px) {
    .woobedding-product-gallery {
        height: 1400px; /* Altezza extra per schermi molto grandi */
    }

    .gallery-main {
        height: 160vh;
        padding: 30px 0;
    }

    .gallery-main .large-image {
        margin-bottom: 40px;
    }
}

/* Indicatore di scroll (opzionale) */
.gallery-main-scroll-indicator {
    position: absolute;
    bottom: 10px;
    right: 20px;
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 3px;
    display: none;
}

.gallery-main.has-scroll .gallery-main-scroll-indicator {
    display: block;
}