/* Product detail gallery - standalone carousel, no Flickity dependency. */ #product-product .product-gallery {
    position: relative;
    width: 100%;
}
#product-product .product-image {
    position: relative;
    overflow: visible;
}
#product-product .product-image__viewport {
    overflow: hidden;
    border-radius: 10px;
}
#product-product .product-image__list {
    position: relative;
    display: block;
    width: 100%;
    white-space: normal;
}
/* style.css của template gốc đặt opacity:0 để chờ Flickity.
   Gallery local tự quản lý trạng thái nên phải override rule đó. */ #product-product .product-image__item, #product-product .product-image__list.flickity-loaded .product-image__item {
    display: none;
    width: 100%;
    min-width: 100%;
    opacity: 1;
    visibility: visible;
    background: #fff;
}
#product-product .product-image__item.is-active {
    display: block;
    animation: productGalleryFade .22s ease;
}
#product-product .product-image__item {
    position: relative;
}
#product-product .product-image__item .product-image__qr {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    width: 110px;
    height: 110px;
    margin: 0;
    padding: 0;
    line-height: 0;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    pointer-events: none;
}
#product-product .product-image__item .product-image__qr img {
    display: block;
    width: 110px;
    height: 110px;
    max-width: none;
    margin: 0;
    object-fit: contain;
}
#product-product .product-image__item .thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 4px;
    border: 0;
    box-shadow: none;
    background: #fff;
}
#product-product .product-image__item img {
    display: block;
    width: 100%;
    max-width: 545px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}
#product-product .product-gallery__arrow {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    color: #555;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color .2s ease, box-shadow .2s ease, transform .2s ease;
}
#product-product .product-gallery__arrow:hover, #product-product .product-gallery__arrow:focus {
    color: #d4a30f;
    box-shadow: 0 3px 14px rgba(0, 0, 0, .28);
    outline: none;
}
#product-product .product-gallery__arrow:active {
    transform: translateY(-50%) scale(.94);
}
#product-product .product-gallery__arrow--prev {
    left: 12px;
}
#product-product .product-gallery__arrow--next {
    right: 12px;
}
#product-product .product-thumbs {
    display: flex;
    gap: 12px;
    margin: 12px 0 30px;
    padding: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    list-style: none;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
#product-product .product-thumbs::before, #product-product .product-thumbs::after {
    display: none;
}
#product-product .product-thumbs__item {
    float: none;
    flex: 0 0 74px;
    width: 74px;
    height: 74px;
    margin: 0;
    padding: 4px;
    overflow: hidden;
    border: 2px solid #e5e5e5;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
}
#product-product .product-thumbs__item:hover, #product-product .product-thumbs__item:focus, #product-product .product-thumbs__item.is-active, #product-product .product-thumbs__item.is-nav-selected {
    border-color: #d4a30f;
    outline: none;
}
#product-product .product-thumbs__item.is-active {
    box-shadow: 0 0 0 1px #d4a30f;
}
#product-product .product-thumbs__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#product-product .manufacturers_img img {
    max-width: 150px;
    height: auto;
}
#product-product .product-contact ul {
    padding-left: 0;
    list-style: none;
}
#product-product .product-contact li {
    margin-bottom: 8px;
}
#product-product .product-detail-content {
    clear: both;
    margin-top: 30px;
    background-color: #fff;
    line-height: 28px;
}
#product-product .product-detail-info__short-description {
    margin-top: 18px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #d4a30f;
    border-radius: 10px;
    line-height: 28px;
}
#product-product .product-detail-info__short-description p:last-child,
#product-product .product-detail-info__short-description ul:last-child,
#product-product .product-detail-info__short-description ol:last-child {
    margin-bottom: 0;
}
@media (max-width: 767px) {
    #product-product .product-detail-info__short-description {
        padding: 14px 16px;
        border-radius: 8px;
    }
}
#product-product .product-detail-content img {
    max-width: 100%;
    height: auto;
}
#product-product .product-carousel .product-layout {
    margin-bottom: 20px;
}
@keyframes productGalleryFade {
    from {
        opacity: .25;
    }
    to {
        opacity: 1;
    }
}
@media (max-width: 767px) {
    #product-product .product-gallery__arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    #product-product .product-gallery__arrow--prev {
        left: 8px;
    }
    #product-product .product-gallery__arrow--next {
        right: 8px;
    }
    #product-product .product-thumbs {
        gap: 8px;
        margin-bottom: 20px;
    }
    #product-product .product-thumbs__item {
        flex-basis: 64px;
        width: 64px;
        height: 64px;
    }
    #product-product .product-detail-info {
        margin-top: 20px;
    }
    #product-product .product-detail-info__action .col-xs-12 {
        margin-bottom: 10px;
    }
}
/* Custom image lightbox - replaces the template's default image zoom/open behavior. */ #product-product .product-image__item .thumbnail.product-gallery__open {
    appearance: none;
    -webkit-appearance: none;
    cursor: zoom-in;
    text-align: inherit;
    outline: 0;
}
#product-product .product-image__item .thumbnail.product-gallery__open:hover, #product-product .product-image__item .thumbnail.product-gallery__open:focus {
    border: 0;
    box-shadow: none;
    transform: none;
}
body.product-lightbox-open {
    overflow: hidden;
}
.product-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease, visibility .24s ease;
}
.product-lightbox.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.product-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.product-lightbox__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(1200px, 100%);
    height: min(90vh, 900px);
    transform: scale(.94) translateY(8px);
    opacity: 0;
    transition: transform .28s cubic-bezier(.2, .7, .2, 1), opacity .22s ease;
}
.product-lightbox.is-open .product-lightbox__dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.product-lightbox__stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.product-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transform: scale(.985);
    opacity: .25;
    transition: opacity .2s ease, transform .25s ease;
}
.product-lightbox__image.is-loaded {
    transform: scale(1);
    opacity: 1;
}
.product-lightbox__close, .product-lightbox__arrow {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    color: #fff;
    background: rgba(0, 0, 0, .42);
    cursor: pointer;
    outline: 0;
    transition: background .2s ease, transform .2s ease;
}
.product-lightbox__close:hover, .product-lightbox__close:focus, .product-lightbox__arrow:hover, .product-lightbox__arrow:focus {
    background: rgba(0, 0, 0, .7);
}
.product-lightbox__close {
    top: 0;
    right: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 18px;
}
.product-lightbox__close:active {
    transform: scale(.9);
}
.product-lightbox__arrow {
    top: 50%;
    width: 50px;
    height: 64px;
    border-radius: 8px;
    font-size: 18px;
    transform: translateY(-50%);
}
.product-lightbox__arrow:active {
    transform: translateY(-50%) scale(.93);
}
.product-lightbox__arrow--prev {
    left: 0;
}
.product-lightbox__arrow--next {
    right: 0;
}
.product-lightbox__counter {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .48);
    color: #fff;
    font-size: 14px;
    line-height: 1.3;
}
@media (max-width: 767px) {
    .product-lightbox {
        padding: 12px;
    }
    .product-lightbox__dialog {
        height: 92vh;
    }
    .product-lightbox__close {
        top: 6px;
        right: 6px;
        width: 42px;
        height: 42px;
    }
    .product-lightbox__arrow {
        width: 42px;
        height: 56px;
        font-size: 18px;
    }
    .product-lightbox__arrow--prev {
        left: 4px;
    }
    .product-lightbox__arrow--next {
        right: 4px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .product-lightbox,     .product-lightbox__dialog,     .product-lightbox__image {
        transition: none;
    }
}


/* Product detail | tablet & smartphone (<=1024px).
   Scope to #product-product so catalog cards and desktop remain unchanged. */
@media (max-width: 1024px) {
    /* Create a clear gap below the mobile/tablet header navigation. */
    body #product-product > ul.site-breadcrumb {
        margin-top: 15px !important;
    }

    /* One purchase row: quantity 30% / add-to-cart 35% / buy-now 35%. */
    body #product-product form.product-detail-info__action .button-group.row {
        display: grid !important;
        grid-template-columns: minmax(0, 30fr) minmax(0, 35fr) minmax(0, 35fr) !important;
        gap: 8px !important;
        align-items: stretch;
        margin: 0 !important;
    }
    body #product-product form.product-detail-info__action .button-group.row::before,
    body #product-product form.product-detail-info__action .button-group.row::after {
        display: none !important;
    }
    body #product-product form.product-detail-info__action .button-group.row > [class*="col-"] {
        grid-column: auto !important;
        float: none !important;
        width: auto !important;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
    }
    body #product-product form.product-detail-info__action .tt-qty-control {
        height: 46px;
        width: 100%;
    }
    body #product-product form.product-detail-info__action #button-cart,
    body #product-product form.product-detail-info__action #button-buy {
        height: 46px;
        min-height: 46px;
        padding: 6px 5px !important;
        margin: 0 !important;
        font-size: 14px;
        line-height: 1.25;
        white-space: normal;
        text-align: center;
    }

    /* Four service features appear as a balanced 2 x 2 grid. */
    body #product-product .product-detail-info__features {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin: 14px 0 0;
        padding: 0;
    }
    body #product-product .product-detail-info__features > li {
        display: block;
        width: auto !important;
        min-width: 0;
        margin: 0;
        padding: 0;
    }
    body #product-product .product-detail-info__features__item {
        display: flex;
        align-items: center;
        width: 100%;
        height: 100%;
        min-height: 56px;
        padding: 10px;
    }
    body #product-product .product-detail-info__features__item .title {
        display: flex;
        align-items: center;
        gap: 9px;
        min-width: 0;
        font-size: 13px;
        line-height: 1.35;
    }
    body #product-product .product-detail-info__features__item img {
        display: block;
        float: none;
        flex: 0 0 25px;
        width: 25px;
        height: 25px;
        margin: 0;
    }

    /* Undo legacy .product-carousel .product-grid {max-width:165px} so
       related/recently viewed cards fill both equal-width columns. */
    body #product-product .product-carousel.row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: auto;
        margin: 0 0 20px !important;
    }
    body #product-product .product-carousel.row > .product-layout.product-grid {
        display: flex !important;
        float: none !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
    }
    body #product-product .product-carousel.row > .product-layout .product-card {
        min-width: 0;
        width: 100%;
    }
}
@media (max-width: 600px) {
    body #product-product form.product-detail-info__action .button-group.row {
        gap: 6px !important;
    }
    body #product-product form.product-detail-info__action .tt-qty-control__button {
        flex-basis: clamp(22px, 6vw, 28px);
    }
    body #product-product form.product-detail-info__action #button-cart,
    body #product-product form.product-detail-info__action #button-buy {
        font-size: 12px !important;
        gap: 4px;
        padding: 5px 3px !important;
    }
    body #product-product .product-detail-info__features {
        gap: 9px;
    }
    body #product-product .product-detail-info__features__item {
        padding: 9px 7px;
    }
    body #product-product .product-detail-info__features__item .title {
        gap: 7px;
        font-size: 12px;
    }
    body #product-product .product-carousel.row {
        gap: 10px;
    }
}
@media (max-width: 420px) {
    /* Preserve button labels legibly even on narrow 320px phones. */
    body #product-product form.product-detail-info__action #button-cart i,
    body #product-product form.product-detail-info__action #button-buy i {
        display: none !important;
    }
    body #product-product .product-carousel.row {
        gap: 8px;
    }
}

/* QR overlay inside the product image lightbox. */
#product-product .product-lightbox__dialog {
    position: relative;
}
#product-product .product-lightbox__qr {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 4;
    width: 110px;
    height: 110px;
    margin: 0;
    padding: 0;
    line-height: 0;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
    pointer-events: none;
}
#product-product .product-lightbox__qr img {
    display: block;
    width: 110px;
    height: 110px;
    max-width: none;
    margin: 0;
    object-fit: contain;
}

/* Responsive QR sizes for product gallery and image lightbox. */
@media (min-width: 768px) and (max-width: 1024px) {
    #product-product .product-image__item .product-image__qr,
    #product-product .product-lightbox__qr {
        width: 90px;
        height: 90px;
    }

    #product-product .product-image__item .product-image__qr img,
    #product-product .product-lightbox__qr img {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 767px) {
    #product-product .product-image__item .product-image__qr,
    #product-product .product-lightbox__qr {
        width: 75px;
        height: 75px;
    }

    #product-product .product-image__item .product-image__qr img,
    #product-product .product-lightbox__qr img {
        width: 75px;
        height: 75px;
    }
}


/* ================================================================
   Các lựa chọn dung tích dưới h2.title-product: tự xuống dòng,
   không cuộn ngang; nội dung dài được ngắt trong từng ô.
   ================================================================ */
#product-product .tt-related-variants {
    width: 100%;
    max-width: 100%;
    margin: 0 0 18px;
    box-sizing: border-box;
}
#product-product .tt-related-variants__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: visible;
}
#product-product .tt-related-variants__item {
    min-width: 0;
}
#product-product .tt-related-variants__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 61px;
    padding: 9px 6px;
    border: 1px solid #cfcfcf;
    border-radius: 11px;
    background: #fff;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
#product-product .tt-related-variants__link:hover,
#product-product .tt-related-variants__link:focus {
    text-decoration: none;
}
#product-product .tt-related-variants__link:focus-visible {
    outline: 2px solid #d4a30f;
    outline-offset: 2px;
}
#product-product .tt-related-variants__item--current .tt-related-variants__link {
    border-color: #d4a30f;
}
#product-product .tt-related-variants__name,
#product-product .tt-related-variants__price {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}
#product-product .tt-related-variants__name {
    font-size: 13px;
    font-weight: 700;
    color: #151515;
}
#product-product .tt-related-variants__item--current .tt-related-variants__name {
    color: #ff653e;
}
#product-product .tt-related-variants__price {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 400;
    color: #141414;
}
@media (max-width: 767px) {
    #product-product .tt-related-variants {
        margin-bottom: 17px;
    }
    #product-product .tt-related-variants__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    #product-product .tt-related-variants__link {
        min-height: 62px;
        border-radius: 10px;
    }
}
@media (max-width: 360px) {
    #product-product .tt-related-variants__name,
    #product-product .tt-related-variants__price {
        font-size: 12px;
    }
}
