/* ============================================================
   FEATURE: PRODUCT PAGE GALLERY UI (Elementor single product)
   PAGE: WooCommerce single product page only
   PURPOSE:
   1) Keep main product image area at fixed responsive height
   2) Convert thumbnail grid to one-line carousel style
   ============================================================ */

/* Main product image stage: fixed responsive height without cropping */
.single-product .woocommerce-product-gallery .flex-viewport {
    height: clamp(320px, 52vw, 720px) !important;
    max-height: 520px;
    min-height: 320px;
    overflow: hidden;
    background: #fff;
}

.single-product .woocommerce-product-gallery__wrapper,
.single-product .woocommerce-product-gallery__image,
.single-product .woocommerce-product-gallery__image a {
    height: 100%;
}

.single-product .woocommerce-product-gallery__image a {
    display: flex;
    align-items: center;
    justify-content: center;
}

.single-product .woocommerce-product-gallery__image img.wp-post-image,
.single-product .woocommerce-product-gallery__image img:not(.zoomImg) {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    object-position: center;
}

/* ------------------------------------------------------------
   Thumbnail slider (single line) for WooCommerce thumbs
   Works even before JS, JS only adds left/right arrows
   ------------------------------------------------------------ */
.single-product .woocommerce-product-gallery .ms-thumb-row {
    position: relative;
    margin-top: 14px;
    padding: 0 34px;
}

.single-product .woocommerce-product-gallery .flex-control-thumbs {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.single-product .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.single-product .woocommerce-product-gallery .flex-control-thumbs li {
    flex: 0 0 calc((100% - 30px) / 4) !important;
    max-width: calc((100% - 30px) / 4) !important;
    width: calc((100% - 30px) / 4) !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
}

.single-product .woocommerce-product-gallery .flex-control-thumbs img {
    width: 100%;
    height: 96px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dcdcec;
}

.single-product .woocommerce-product-gallery .ms-thumb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #20214d;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    padding: 0 4px;
}

.single-product .woocommerce-product-gallery .ms-thumb-prev {
    left: 0;
}

.single-product .woocommerce-product-gallery .ms-thumb-next {
    right: 0;
}

.single-product .woocommerce-product-gallery .ms-thumb-arrow[disabled] {
    opacity: 0.35;
    cursor: default;
}

@media (max-width: 1024px) {
    .single-product .woocommerce-product-gallery .flex-viewport {
        height: clamp(300px, 60vw, 420px) !important;
        min-height: 300px;
    }

    .single-product .woocommerce-product-gallery .flex-control-thumbs li {
        flex: 0 0 calc((100% - 20px) / 3) !important;
        max-width: calc((100% - 20px) / 3) !important;
        width: calc((100% - 20px) / 3) !important;
    }
}

@media (max-width: 767px) {
    .single-product .woocommerce-product-gallery .flex-viewport {
        height: clamp(260px, 78vw, 400px) !important;
        min-height: 260px;
    }

    .single-product .woocommerce-product-gallery .ms-thumb-row {
        padding: 0 20px;
    }

    .single-product .woocommerce-product-gallery .flex-control-thumbs li {
        flex: 0 0 84px !important;
        max-width: 84px !important;
        width: 84px !important;
    }

    .single-product .woocommerce-product-gallery .flex-control-thumbs img {
        height: 84px;
    }
}
