/* ══════════════════════════════════════════════════════
   Serigest Gallery — vertical thumbnails left, main right
   ══════════════════════════════════════════════════════ */

/* Nothing to reset: product-image.php is overridden so WC never generates
   its own gallery markup on the single-product page. */

/* Our gallery replaces it completely */
.serigest-gallery {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
}

/* ── Thumbnails column (left) ── */
.serigest-gallery__thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 80px;
    flex-shrink: 0;
    max-height: 560px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.serigest-gallery__thumbs::-webkit-scrollbar {
    width: 4px;
}
.serigest-gallery__thumbs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.sg-thumb {
    display: block;
    width: 80px;
    height: 80px;
    padding: 0;
    margin: 0;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .18s, box-shadow .18s, transform .15s;
    outline: none;
}

.sg-thumb:hover {
    border-color: #aaa;
    transform: scale(1.04);
}

.sg-thumb.is-active {
    border-color: #111;
    box-shadow: 0 0 0 1px #111;
}

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

/* ── Main image (right) ── */
.serigest-gallery__main {
    position: relative;
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
}

.sg-main-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    transition: opacity .18s ease;
}

.sg-main-img.is-loading {
    opacity: .4;
}

/* Zoom button overlay */
.sg-zoom-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.85);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    backdrop-filter: blur(4px);
    transition: background .15s;
    pointer-events: all;
    z-index: 1;
}
.sg-zoom-btn:hover { background: rgba(255,255,255,1); }

/* ── Lightbox ── */
.sg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.sg-lightbox.is-open {
    display: flex;
}

.sg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.92);
}

.sg-lightbox__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 95vw;
    max-height: 95vh;
}

.sg-lightbox__img {
    max-width: 85vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    animation: sgLbFadeIn .2s ease;
}
@keyframes sgLbFadeIn {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: scale(1); }
}

.sg-lightbox__close {
    position: fixed;
    top: 18px;
    right: 18px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
}
.sg-lightbox__close:hover { background: rgba(255,255,255,.25); }

.sg-lightbox__prev,
.sg-lightbox__next {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
    line-height: 1;
}
.sg-lightbox__prev:hover,
.sg-lightbox__next:hover { background: rgba(255,255,255,.25); }
.sg-lightbox__prev:disabled,
.sg-lightbox__next:disabled { opacity: .3; cursor: default; }

/* ── Responsive ── */
@media (max-width: 640px) {

    /* Nasconde le miniature su mobile */
    .serigest-gallery__thumbs { display: none !important; }

    .serigest-gallery {
        flex-direction: column;
        width: 100%;
    }

    /* Carousel a scorrimento orizzontale */
    .serigest-gallery__main {
        width: 100%;
        flex: none;
        display: flex;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        cursor: grab;
        border-radius: 10px;
    }
    .serigest-gallery__main::-webkit-scrollbar { display: none; }
    .serigest-gallery__main:active { cursor: grabbing; }

    /* Ogni slide occupa tutta la larghezza */
    .sg-slide {
        width: 100%;
        flex-shrink: 0;
        scroll-snap-align: start;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
    }

    .sg-slide img {
        width: 100%;
        height: auto;
        max-height: 420px;
        object-fit: contain;
        display: block;
        pointer-events: none;
    }

    /* Dot indicators */
    .sg-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        align-self: anchor-center;
        gap: 6px;
        padding: 10px 0 4px;
    }

    .sg-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #ccc;
        border: none;
        padding: 0;
        cursor: pointer;
        transition: background .2s, transform .2s;
        flex-shrink: 0;
    }

    .sg-dot.is-active {
        background: #111;
        transform: scale(1.35);
    }

    /* CTA slide — "Configura ora il prodotto" */
    .sg-slide--cta {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: #f5f5f5;
        min-height: 300px;
        cursor: default;
    }

    .sg-cta-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        background: #111;
        color: #fff;
        border: none;
        border-radius: 14px;
        padding: 28px 36px;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 0.02em;
        line-height: 1.3;
        cursor: pointer;
        text-align: center;
        transition: background .2s, transform .15s;
    }

    .sg-cta-btn:active {
        background: #333;
        transform: scale(0.97);
    }

    .sg-cta-btn svg {
        width: 36px;
        height: 36px;
        animation: sg-cta-bounce 1.6s ease-in-out infinite;
    }

    @keyframes sg-cta-bounce {
        0%, 100% { transform: translateY(0); }
        50%       { transform: translateY(8px); }
    }

    /* Lightbox arrows su mobile */
    .sg-lightbox__prev,
    .sg-lightbox__next {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
    }
    .sg-lightbox__prev { left: 10px; }
    .sg-lightbox__next { right: 10px; }
    .sg-lightbox__content { gap: 0; }
}
