/*
 * Trang trí Shop (EC-7694) — CSS của bộ vẽ khối dùng chung (renderer.js).
 * Mọi lớp có tiền tố sd-. Màu theo bộ màu của Shop qua biến:
 *   --sd-page-bg (nền vùng khối), --sd-frame (khung quanh khối), --sd-title (chữ tiêu đề).
 * Không có bộ màu (theme null) = nền trắng, không khung.
 */
.sd-root {
    background: var(--sd-page-bg, #fff);
}
/* Chữ/box-sizing chỉ cho khối do renderer vẽ — KHÔNG áp vào khu sẵn có của trang được chuyển vào
   chỗ giữ (.sd-slot: voucher, flash sale, danh sách SP) để CSS của site giữ nguyên. */
.sd-block:not(.sd-slot) {
    color: #222;
    font-size: 14px;
    line-height: 1.4;
}
.sd-block:not(.sd-slot),
.sd-block:not(.sd-slot) *,
.sd-block:not(.sd-slot) *::before,
.sd-block:not(.sd-slot) *::after {
    box-sizing: border-box;
}
.sd-root[hidden],
.sd-root [hidden] {
    display: none !important;
}
.sd-root.sd-themed {
    padding: 8px;
}
.sd-root.sd-desktop.sd-themed {
    padding: 12px;
    border-radius: 8px;
}

/* ---------- khối ---------- */
.sd-block {
    position: relative;
    margin: 0 0 8px;
    background: #fff;
}
.sd-block:last-child {
    margin-bottom: 0;
}
.sd-desktop .sd-block {
    margin-bottom: 16px;
}
.sd-themed .sd-block {
    border: 2px solid var(--sd-frame, #e5e5e5);
    border-radius: 12px;
}
/* Cắt theo góc bo chỉ ở khối của renderer; khu sẵn có (tooltip mã giảm giá, dropdown lọc) không bị cắt. */
.sd-themed .sd-block:not(.sd-slot) {
    overflow: hidden;
}
.sd-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
}
.sd-desktop .sd-head {
    padding: 14px 16px 10px;
}
.sd-title {
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--sd-title, #222);
    text-transform: none;
    border: 0;
}
.sd-desktop .sd-title {
    font-size: 18px;
}
.sd-sub {
    flex: 0 0 100%;
    margin-top: 2px;
    font-size: 12px;
    color: #d0011b;
}
.sd-more {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    font-size: 13px;
    color: var(--sd-title, #555);
    text-decoration: none;
}
.sd-more::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: 4px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
}

/* ---------- ảnh ---------- */
.sd-banner,
.sd-cover,
.sd-video {
    position: relative;
    display: block;
    height: 0;
    overflow: hidden;
    background: #f2f2f2;
}
.sd-cover {
    background: var(--sd-frame, #eee);
}
.sd-img {
    display: block;
    max-width: 100%;
    border: 0;
}
.sd-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sd-contain {
    object-fit: contain;
}
.sd-natural {
    width: 100%;
    height: auto;
}
.sd-img-empty {
    visibility: hidden;
}

.sd-multi {
    display: grid;
    grid-gap: 4px;
}
.sd-multi-2 {
    grid-template-columns: repeat(2, 1fr);
}
.sd-multi-3 {
    grid-template-columns: repeat(3, 1fr);
}
.sd-multi-4 {
    grid-template-columns: repeat(2, 1fr);
}
.sd-desktop .sd-multi-4 {
    grid-template-columns: repeat(4, 1fr);
}
.sd-desktop .sd-multi {
    grid-gap: 8px;
}

/* ---------- quay vòng ---------- */
.sd-carousel {
    position: relative;
}
.sd-track {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sd-track::-webkit-scrollbar {
    display: none;
}
.sd-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}
.sd-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.sd-dot-nav {
    position: relative;
    width: 32px;
    height: 32px;
    margin: 0 -6px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
}
.sd-dot-nav::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .7);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
    transition: width .2s, margin .2s;
}
.sd-dot-nav.sd-active::before {
    width: 14px;
    margin-left: -7px;
    background: #fff;
}
.sd-carousel-text .sd-ctext {
    padding: 12px;
}
.sd-carousel-text .sd-title {
    margin-bottom: 6px;
}
.sd-desktop .sd-carousel-text {
    display: flex;
    align-items: center;
}
.sd-desktop .sd-carousel-text .sd-carousel {
    flex: 0 0 60%;
    max-width: 60%;
}
.sd-desktop .sd-carousel-text .sd-ctext {
    flex: 1 1 auto;
    min-width: 0;
    padding: 16px 24px;
}

/* ---------- gắn thẻ / vùng bấm ---------- */
.sd-hotspot,
.sd-mapping {
    position: relative;
    background: #f2f2f2;
}
/* Máy tính: ảnh gắn thẻ / tổng hợp không cao quá 720px; khung co theo ảnh để chấm và vùng bấm vẫn đúng chỗ. */
.sd-desktop .sd-hotspot,
.sd-desktop .sd-mapping {
    display: table;
    max-width: 100%;
    margin: 0 auto;
}
.sd-desktop .sd-hotspot .sd-natural,
.sd-desktop .sd-mapping .sd-natural {
    width: auto;
    max-width: 100%;
    max-height: 720px;
}
.sd-tag {
    position: absolute;
    z-index: 2;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.sd-tag::before,
.sd-tag::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
}
.sd-tag::before {
    z-index: 1;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    background: #fff;
    border: 3px solid rgba(0, 0, 0, .45);
    background-clip: padding-box;
}
.sd-tag::after {
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    background: rgba(255, 255, 255, .55);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
    animation: sd-pulse 1.8s ease-out infinite;
}
.sd-tag.sd-open::before {
    border-color: var(--sd-title, #d0011b);
}
@keyframes sd-pulse {
    0% { transform: scale(.55); opacity: .9; }
    70% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(1.15); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .sd-tag::after {
        animation: none;
    }
    .sd-dot-nav::before {
        transition: none;
    }
}
.sd-pop {
    position: absolute;
    z-index: 3;
    width: 230px;
    max-width: calc(100% - 16px);
    margin: 0 8px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.sd-pop-card {
    display: flex;
    align-items: center;
    padding: 8px 30px 8px 8px;
    color: #222;
    text-decoration: none;
}
.sd-pop-card .sd-card-img {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    padding-top: 0;
    border-radius: 6px;
}
.sd-pop-card .sd-card-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0 0 8px;
}
.sd-pop-card .sd-off {
    display: none;
}
.sd-pop-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #888;
    font-size: 20px;
    line-height: 32px;
    cursor: pointer;
}
.sd-area {
    position: absolute;
    z-index: 1;
    display: block;
    background: transparent;
    border: 0;
    outline: 0;
}
.sd-area:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .8);
    outline-offset: -2px;
}

/* ---------- video ---------- */
.sd-video {
    background: #000;
}
.sd-mute {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 1;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    cursor: pointer;
}
.sd-mute svg {
    display: block;
    margin: 7px auto;
}

/* ---------- văn bản ---------- */
.sd-text-content {
    padding: 0 12px 12px;
    font-size: 14px;
    line-height: 1.55;
    color: #444;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.sd-block-text > .sd-text-content:first-child {
    padding-top: 12px;
}
.sd-carousel-text .sd-ctext .sd-text-content {
    padding: 0;
}
.sd-desktop .sd-text-content {
    padding: 0 16px 16px;
}

/* ---------- thẻ sản phẩm ---------- */
.sd-products {
    display: flex;
    overflow-x: auto;
    padding: 0 12px 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sd-products::-webkit-scrollbar {
    display: none;
}
.sd-products > .sd-card {
    flex: 0 0 37%;
    margin-right: 8px;
    scroll-snap-align: start;
}
.sd-products > .sd-card:last-child {
    margin-right: 0;
}
.sd-card {
    position: relative;
    display: block;
    min-width: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    color: #222;
    text-decoration: none;
}
.sd-card:hover {
    color: #222;
    text-decoration: none;
}
.sd-card-img {
    position: relative;
    padding-top: 100%;
    background: #f7f7f7;
    overflow: hidden;
}
.sd-off {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
    padding: 1px 6px;
    border-radius: 4px;
    background: #d0011b;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
}
.sd-card-body {
    padding: 6px 8px 8px;
}
.sd-rank {
    display: inline-block;
    margin-bottom: 3px;
    padding: 0 5px;
    border-radius: 3px;
    background: #fff4e5;
    color: #e65100;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
}
.sd-rank-1 {
    background: #ffe9d6;
    color: #d84315;
}
.sd-card-name {
    display: -webkit-box;
    height: 36px;
    overflow: hidden;
    font-size: 13px;
    line-height: 18px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.sd-card-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin-top: 4px;
}
.sd-price {
    margin-right: 4px;
    color: #d0011b;
    font-size: 14px;
    font-weight: 700;
}
.sd-price-old {
    color: #999;
    font-size: 12px;
}
.sd-desktop .sd-products {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-gap: 12px;
    overflow: visible;
    padding: 0 16px 16px;
}
.sd-desktop .sd-products > .sd-card {
    margin-right: 0;
}
.sd-desktop .sd-products > .sd-card:nth-child(n+11) {
    display: none; /* máy tính: tối đa 2 hàng */
}
.sd-desktop .sd-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.sd-desktop .sd-card-name {
    font-size: 14px;
    line-height: 20px;
    height: 40px;
}
.sd-desktop .sd-price {
    font-size: 16px;
}

/* ---------- danh mục nổi bật ---------- */
.sd-cats {
    display: flex;
    overflow-x: auto;
    padding: 0 12px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sd-cats::-webkit-scrollbar {
    display: none;
}
.sd-cat {
    display: block;
    flex: 0 0 23%;
    min-width: 0;
    margin-right: 8px;
    color: #222;
    text-align: center;
    text-decoration: none;
}
.sd-cat:last-child {
    margin-right: 0;
}
.sd-cat:hover {
    color: #222;
    text-decoration: none;
}
.sd-cat-img {
    position: relative;
    padding-top: 100%;
    border-radius: 8px;
    background: #f7f7f7;
    overflow: hidden;
}
.sd-cat-name {
    display: -webkit-box;
    margin-top: 4px;
    overflow: hidden;
    font-size: 12px;
    line-height: 16px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sd-cat-count {
    font-size: 12px;
    color: #888;
}
.sd-desktop .sd-cats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-gap: 16px 12px;
    overflow: visible;
    padding: 0 16px 16px;
}
.sd-desktop .sd-cat {
    margin-right: 0;
}
.sd-desktop .sd-cat-name {
    font-size: 14px;
    line-height: 20px;
}

/* Bản điện thoại trên màn rộng (máy tính bảng): nhiều thẻ hơn mỗi hàng. */
@media (min-width: 600px) {
    .sd-mobile .sd-products > .sd-card {
        flex-basis: 22%;
    }
    .sd-mobile .sd-cats > .sd-cat {
        flex-basis: 15%;
    }
}

/* ---------- khu sẵn có của trang (voucher, flash sale, danh sách SP) ---------- */
.sd-slot {
    background: transparent;
}
.sd-themed .sd-slot {
    background: #fff;
}
/* Khu sẵn có được thiết kế để tràn ra ngoài padding của .container trang (vd. voucher mobile:
   width calc(100% + 28px); margin-left -14px) -> trong chỗ giữ thì vừa khít, không tràn ngang. */
.sd-slot > * {
    width: auto !important;
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.sd-slot .container {
    width: auto !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.sd-slot-placeholder {
    padding: 20px 12px;
    color: #888;
    font-size: 14px;
    text-align: center;
    background: repeating-linear-gradient(135deg, #fafafa, #fafafa 8px, #f2f2f2 8px, #f2f2f2 16px);
}

/* ---------- gắn vào trang Shop (store-page.js) ---------- */
.sd-tabs {
    display: flex;
    margin: 0 0 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
}
.sd-tab {
    min-height: 44px;
    padding: 10px 24px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #333;
    font-size: 15px;
    cursor: pointer;
}
.sd-tab.sd-active {
    border-bottom-color: currentColor;
    color: #ee4d2d;
    font-weight: 600;
}
.sd-mode-shop .sd-legacy {
    display: none !important;
}
.sd-mode-shop .sd-hide-in-shop {
    display: none !important;
}
.sd-cover-plain::before {
    background: rgba(0, 0, 0, .2) !important;
}
.sd-page-cover img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 750 / 300;
    object-fit: cover;
}
.sd-cover-color {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
