.qs-gal {
    width: 100%;
    max-width: var(--qs-gal-max-w, 480px);
    margin: 0 auto 18px;
    user-select: none;
}
.qs-gal-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: zoom-in;
}
.qs-gal-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.22s ease-out;
    will-change: transform;
}
@media (hover: hover) {
    .qs-gal[data-zoom="1"] .qs-gal-stage:hover .qs-gal-main {
        transform: scale(1.75);
    }
}
.qs-gal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.55);
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 2;
    padding: 0;
}
.qs-gal-stage:hover .qs-gal-nav,
.qs-gal-stage:focus-within .qs-gal-nav {
    opacity: 1;
}
.qs-gal-nav:hover {
    background: rgba(220, 38, 38, 0.9);
}
.qs-gal-prev {
    left: 10px;
}
.qs-gal-next {
    right: 10px;
}
.qs-gal-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    pointer-events: none;
    z-index: 2;
}
.qs-gal-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.qs-gal-thumb {
    flex: 0 0 68px;
    width: 68px;
    height: 68px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    cursor: pointer;
    opacity: 0.72;
    transition: border-color 0.15s ease, opacity 0.15s ease;
}
.qs-gal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qs-gal-thumb:hover,
.qs-gal-thumb.is-active {
    opacity: 1;
    border-color: #dc2626;
}

/* Bố cục 2 cột chuẩn TMĐT cho thẻ {quickshop_product} */
.qs-product-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 24px;
    align-items: start;
    margin: 18px 0 24px;
}
.qs-product-hero .qs-gal {
    max-width: 100%;
    margin-bottom: 0;
}
.qs-product-hero .qs-buybar {
    margin-top: 0;
    margin-bottom: 0;
}
.qs-product-hero-buy {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
@media (max-width: 820px) {
    .qs-product-hero {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Lightbox toàn màn hình chuẩn HTML5 <dialog> */
html:has(dialog.qs-gal-lightbox[open]) {
    overflow: hidden;
}
.qs-gal-lightbox {
    padding: 0;
    border: 0;
    background: transparent;
    max-width: 94vw;
    max-height: 94vh;
    overflow: visible;
}
.qs-gal-lightbox::backdrop {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(3px);
}
.qs-lb-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qs-lb-img {
    max-width: 90vw;
    max-height: 86vh;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    user-select: none;
}
.qs-lb-close,
.qs-lb-nav {
    position: fixed;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    transition: background-color 0.2s ease;
    z-index: 10;
}
.qs-lb-close:hover,
.qs-lb-nav:hover {
    background: rgba(255, 255, 255, 0.34);
}
.qs-lb-close {
    top: 18px;
    right: 20px;
    width: 42px;
    height: 42px;
    font-size: 28px;
    line-height: 1;
}
.qs-lb-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    font-size: 20px;
    line-height: 1;
}
.qs-lb-prev {
    left: 18px;
}
.qs-lb-next {
    right: 18px;
}
.qs-lb-counter {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.55);
    padding: 4px 14px;
    border-radius: 999px;
}
@media (max-width: 767.98px) {
    .qs-gal {
        max-width: 100%;
    }
    .qs-gal-nav {
        opacity: 1;
        width: 30px;
        height: 30px;
    }
    .qs-gal-thumb {
        flex-basis: 60px;
        width: 60px;
        height: 60px;
    }
    .qs-lb-prev {
        left: 10px;
    }
    .qs-lb-next {
        right: 10px;
    }
}
