/**
 * WooCommerce Swiper Product Gallery Styles
 *
 * Vertical thumbnail carousel on the left, main preview on the right
 */

/* Main wrapper - flexbox layout */
.swiper-product-gallery-wrapper {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    max-width: 100%;
}

/* =============================================
   Thumbnail Swiper (Left Side - Vertical)
   ============================================= */
.swiper-thumbs-container {
    position: relative;
    width: 100px;
    min-width: 100px;
    height: 520px;
    flex-shrink: 0;
}

.swiper-thumbs {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.swiper-thumbs .swiper-wrapper {
    flex-direction: column;
}

.swiper-thumbs .swiper-slide {
    width: 100px !important;
    height: 100px !important;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.3s ease, border-color 0.3s ease;
    border: 2px solid transparent;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;

}

.swiper-thumbs .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: cover;
    object-position: center;

}

.swiper-thumbs .swiper-slide:hover {
    opacity: 0.8;
}

.swiper-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var( --e-global-color-primary );
}

/* Thumbnail navigation buttons (vertical) */
.swiper-thumbs-prev,
.swiper-thumbs-next {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
    width: 30px;
    height: 30px;
    z-index: 10;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.swiper-thumbs-prev {
    top: -5px;
}

.swiper-thumbs-next {
    bottom: -5px;
}

.swiper-thumbs-prev::after,
.swiper-thumbs-next::after {
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.swiper-thumbs-prev.swiper-button-disabled,
.swiper-thumbs-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* =============================================
   Main Swiper (Preview - Right Side)
   ============================================= */
.swiper-main-container {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 520px;
}

.swiper-main.swiper-main {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f8f8;
}

.swiper-main.swiper-main .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.swiper-main.swiper-main .swiper-slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.swiper-main.swiper-main .swiper-slide img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Main navigation buttons */
.swiper-main-prev,
.swiper-main-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    z-index: 10;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease, transform 0.3s ease;
}

.swiper-main-prev {
    left: 10px;
}

.swiper-main-next {
    right: 10px;
}

.swiper-main-prev:hover,
.swiper-main-next:hover {
    background: #fff;
}

.swiper-main-prev::after,
.swiper-main-next::after {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.swiper-main-prev.swiper-button-disabled,
.swiper-main-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* =============================================
   Responsive Adjustments
   ============================================= */

/* Tablet */
@media (max-width: 991px) {
    .swiper-thumbs-container {
        width: 80px;
        min-width: 80px;
        height: 400px;
    }

    .swiper-thumbs .swiper-slide {
        width: 80px !important;
        height: 80px !important;
    }

    .swiper-main-container {
        height: 400px;
    }
}

/* Mobile - Stack vertically with horizontal thumbnails */
@media (max-width: 767px) {
    .swiper-product-gallery-wrapper {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .swiper-thumbs-container {
        width: 100%;
        min-width: 100%;
        height: 80px;
        order: 2;
    }

    .swiper-thumbs {
        height: 80px;
    }

    .swiper-thumbs .swiper-wrapper {
        flex-direction: row;
    }

    .swiper-thumbs .swiper-slide {
        width: 70px !important;
        height: 70px !important;
    }

    /* Horizontal navigation for mobile */
    .swiper-thumbs-prev,
    .swiper-thumbs-next {
        top: 50%;
        transform: translateY(-50%) rotate(0);
    }

    .swiper-thumbs-prev {
        left: 0;
    }

    .swiper-thumbs-next {
        right: 0;
        left: auto;
        bottom: auto;
    }

    .swiper-main-container {
        height: 350px;
        order: 1;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .swiper-main-container {
        height: 280px;
    }

    .swiper-thumbs .swiper-slide {
        width: 60px !important;
        height: 60px !important;
    }

    .swiper-thumbs-container {
        height: 70px;
    }

    .swiper-thumbs {
        height: 70px;
    }
}

/* =============================================
   WooCommerce Overrides
   ============================================= */

/* Hide default WooCommerce gallery elements */
.woocommerce-product-gallery__trigger,
.woocommerce-product-gallery .flex-control-thumbs {
    display: none !important;
}

/* Reset default WooCommerce gallery styles */
.woocommerce div.product div.images {
    float: none;
    width: 100%;
}

.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
    display: block;
}

/* Ensure gallery fits in typical WooCommerce layouts */
.woocommerce div.product div.images.woocommerce-product-gallery {
    position: relative;
    margin-bottom: 2em;
}