/* =========================================
   Woo Product Gallery - Robust Layout Fix
   ========================================= */

.wpg-bento-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

/* Auto Height: Let content dictate height, but align sidebar */
.wpg-bento-grid.wpg-auto-height {
    height: auto !important;
    align-items: stretch;
}

/* --- Main Area (Left) --- */
.wpg-bento-main {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    /* If auto height, this container grows with the image inside */
    display: flex;
    flex-direction: column;
}

.wpg-main-swiper {
    width: 100%;
    height: 100%;
    flex-grow: 1;
}

.wpg-main-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.wpg-auto-height .wpg-main-swiper,
.wpg-auto-height .wpg-main-swiper .swiper-slide {
    height: auto;
}


/* --- Sidebar (Right) --- */
.wpg-bento-side {
    position: relative;
    /* Critical anchor */
    width: 100%;
    height: auto;
    /* Allow it to stretch */
    overflow: hidden;
    min-height: 100px;
    /* Safety min-height */
}

/* FIXED: Absolute positioning for Vertical Swiper logic */
/* In a grid/flex auto-height scenario, child 100% height often fails.
   Absolute positioning forces it to fill the resolved space. */
.wpg-side-swiper {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100% !important;
}

.wpg-side-swiper .swiper-slide {
    width: 100%;
    /* Swiper calculates height automatically in vertical mode */
    overflow: hidden;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    opacity: 1;
    /* Fixed: No Fading */
    transition: none;
    display: block;
    /* Ensure visibility */
    box-sizing: border-box;
}

.wpg-side-swiper .swiper-slide-thumb-active {
    opacity: 1;
}

/* --- Images --- */
.wpg-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* --- Navigation Buttons --- */
.wpg-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.wpg-prev {
    left: 10px;
}

.wpg-next {
    right: 10px;
}

/* --- Mobile --- */
@media (max-width: 767px) {
    .wpg-bento-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    .wpg-bento-main {
        height: auto;
        min-height: 300px;
        /* Ensure visible on mobile */
    }

    .wpg-bento-side {
        height: 100px;
        /* Explicit height for thumbs row */
        margin-top: 10px;
    }

    .wpg-side-swiper {
        position: relative !important;
        /* Revert to relative for stacking */
        height: 100% !important;
    }
}