/*
 * Victor Scientific — canonical Product Details layout.
 * Loaded last on the product route to replace the old overlapping width/flex
 * overrides. Grid tracks use minmax(0, ...) and every grid item is border-box.
 */
body.product-refresh-page .main-details-page,
body.product-refresh-page .main-details-page *,
body.product-refresh-page .main-details-page *::before,
body.product-refresh-page .main-details-page *::after {
    box-sizing: border-box;
}

/* Product route gets a predictable full-width container instead of the
   generic 540/720px utility container at tablet breakpoints. */
body.product-refresh-page .main-details-page > .container {
    width: 100% !important;
    max-width: 1440px !important;
    margin-inline: auto !important;
    padding: 0 clamp(12px, 2vw, 24px) !important;
    box-sizing: border-box !important;
}
body.product-refresh-page .main-details-page > .container > .row {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.product-refresh-page .main-details-page > .container > .row > .col-sm-12 {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}
body.product-refresh-page .main-details-page .product-section > .container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}
body.product-refresh-page .main-details-page .product-section > .container > .row {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.product-refresh-page #vsc-product-main-row {
    display: grid !important;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr) !important;
    align-items: start;
    column-gap: clamp(18px, 2.2vw, 30px);
    row-gap: 22px;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.product-refresh-page #vsc-product-main-row > .product-gallery-column,
body.product-refresh-page #vsc-product-main-row > .col-sm-6:not(.product-gallery-column) {
    display: block;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
    box-sizing: border-box !important;
}

body.product-refresh-page #vsc-product-main-row > .product-gallery-column {
    display: grid !important;
    grid-template-columns: 86px minmax(0, 1fr);
    grid-template-areas: "thumbs main";
    align-items: start;
    gap: 10px;
    overflow: visible;
}

body.product-refresh-page .product-gallery-column > .details_slider.vsc-product-gallery {
    grid-area: main;
    width: 100% !important;
    min-width: 0 !important;
    height: clamp(360px, 39vw, 540px) !important;
    min-height: 340px !important;
    max-height: 540px;
    margin: 0 !important;
    border: 1px solid var(--site-border, #dce7f5);
    border-radius: 14px !important;
    background: #fff;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

body.product-refresh-page .product-gallery-column .vsc-product-gallery > .dimage_item {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 100% !important;
    min-height: 0;
}

body.product-refresh-page #vsc-product-main-row .product-gallery-column .dimage_item img.block__pic {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0;
    object-fit: contain;
    background: #fff;
}

body.product-refresh-page .product-gallery-column > .indicator_thumb {
    grid-area: thumbs;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    width: 86px !important;
    min-width: 0;
    max-width: 86px;
    max-height: 540px;
    margin: 0 !important;
    padding: 1px 2px 1px 1px !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

body.product-refresh-page .product-gallery-column .indicator-item {
    flex: 0 0 76px !important;
    width: 76px !important;
    height: 76px !important;
    min-width: 0;
    margin: 0;
    border: 1px solid var(--site-border, #dce7f5);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

body.product-refresh-page .product-gallery-column .indicator-item img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

body.product-refresh-page #vsc-product-main-row > .col-sm-6:not(.product-gallery-column) {
    min-width: 0 !important;
}

body.product-refresh-page #vsc-product-main-row .details_right {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto;
    margin: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    border: 1px solid var(--site-border, #dce7f5);
    border-radius: 14px !important;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .045);
}

body.product-refresh-page #vsc-product-main-row .details_right :where(img, video, iframe, table, input, select, textarea) {
    max-width: 100%;
}

body.product-refresh-page #vsc-product-main-row .details_right :where(.product, .product-cart, form, .product-purchase-controls) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

body.product-refresh-page #vsc-product-main-row .details_right .single_product {
    display: flex;
    flex-wrap: wrap;
    width: 100% !important;
    min-width: 0;
    gap: 8px;
    margin: 0 !important;
    padding: 0 !important;
}

body.product-refresh-page #vsc-product-main-row .details_right .single_product > .btn,
body.product-refresh-page #vsc-product-main-row .details_right .single_product > input[type="submit"] {
    flex: 1 1 150px;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

body.product-refresh-page #vsc-product-main-row .details_right .product-contact-btn {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Tablet and mobile: stack the gallery and product information.
   This avoids cramped half-width columns on 576–991px screens. */
@media (max-width: 991.98px) {
    body.product-refresh-page #vsc-product-main-row {
        grid-template-columns: minmax(0, 1fr) !important;
        row-gap: 20px;
    }

    body.product-refresh-page #vsc-product-main-row > .product-gallery-column,
    body.product-refresh-page #vsc-product-main-row > .col-sm-6:not(.product-gallery-column) {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.product-refresh-page #vsc-product-main-row > .product-gallery-column {
        grid-template-columns: 86px minmax(0, 1fr);
    }

    body.product-refresh-page .product-gallery-column > .details_slider.vsc-product-gallery {
        height: clamp(340px, 52vw, 500px) !important;
        min-height: 320px !important;
    }
}

/* Phone: large main image, horizontal thumbnail rail, details fully in viewport. */
@media (max-width: 767.98px) {
    body.product-refresh-page #content {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    body.product-refresh-page .homeproduct.main-details-page,
    body.product-refresh-page .main-details-page .product-section,
    body.product-refresh-page #vsc-product-main-row {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.product-refresh-page #vsc-product-main-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 17px;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.product-refresh-page #vsc-product-main-row > .product-gallery-column {
        display: flex !important;
        flex-direction: column;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        gap: 9px;
    }

    body.product-refresh-page .product-gallery-column > .details_slider.vsc-product-gallery {
        order: 1;
        width: 100% !important;
        height: min(82vw, 390px) !important;
        min-height: 250px !important;
        max-height: 390px;
        border-radius: 12px !important;
    }

    body.product-refresh-page .product-gallery-column > .indicator_thumb {
        order: 2;
        display: flex !important;
        flex-direction: row;
        align-items: center;
        width: 100% !important;
        max-width: 100%;
        max-height: none;
        gap: 8px;
        padding: 1px 1px 5px !important;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    body.product-refresh-page .product-gallery-column .indicator-item {
        flex: 0 0 66px !important;
        width: 66px !important;
        height: 66px !important;
    }

    body.product-refresh-page #vsc-product-main-row > .col-sm-6:not(.product-gallery-column) {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.product-refresh-page #vsc-product-main-row .details_right {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 14px !important;
        border-radius: 12px !important;
    }

    body.product-refresh-page #vsc-product-main-row .details_right .product-page-title {
        font-size: clamp(19px, 5vw, 23px) !important;
        line-height: 1.3 !important;
        overflow-wrap: anywhere;
    }

    body.product-refresh-page #vsc-product-main-row .details_right .details-price {
        font-size: 22px !important;
    }

    body.product-refresh-page #vsc-product-main-row .details_right .product-purchase-controls {
        width: 100%;
        min-width: 0;
    }

    body.product-refresh-page #vsc-product-main-row .details_right .single_product {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    body.product-refresh-page #vsc-product-main-row .details_right .single_product > .btn,
    body.product-refresh-page #vsc-product-main-row .details_right .single_product > input[type="submit"] {
        flex: 1 1 135px;
        min-width: 0;
        min-height: 42px !important;
        padding-inline: 9px !important;
        font-size: 13px !important;
    }
}

/* Narrow phones: prevent buttons and specification values from forcing overflow. */
@media (max-width: 359.98px) {
    body.product-refresh-page #vsc-product-main-row .details_right {
        padding: 11px !important;
    }

    body.product-refresh-page #vsc-product-main-row .details_right .single_product > .btn,
    body.product-refresh-page #vsc-product-main-row .details_right .single_product > input[type="submit"] {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.product-refresh-page #vsc-product-main-row *,
    body.product-refresh-page #vsc-product-main-row *::before,
    body.product-refresh-page #vsc-product-main-row *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
