.cat-hot-products {
    --hot-purple: #662d91;
    --hot-purple-dark: #4f008c;
    --hot-purple-light: #7b36a6;
    --hot-yellow: #efff00;
    margin: 34px 0 44px;
    overflow: visible;
}

.cat-hot-products *,
.cat-hot-products *::before,
.cat-hot-products *::after {
    box-sizing: border-box;
}

.cat-hot-products__container,
.cat-hot-products__slider {
    position: relative;
}

.cat-hot-products__heading {
    display: flex;
    justify-content: center;
    margin-bottom: 34px;
    text-align: center;
}

.cat-hot-products__heading h2 {
    position: relative;
    margin: 0;
    padding: 0 0 6px;
    color: #111;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .1px;
}

.cat-hot-products__heading h2::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--hot-purple);
}

/*
 * PRE-LAYOUT: HTML/CSS phải đúng form trước khi Owl chạy.
 * Owl mặc định thường display:none rồi mới dựng width -> dễ gây flash/vỡ khung.
 * Block này luôn display:block và tự chia đúng số item bằng CSS.
 * Khi Owl đã loaded, Owl chỉ tiếp quản phần chuyển động, không làm đổi form ban đầu.
 */
.cat-hot-products__viewport.owl-carousel {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Desktop mặc định: 4 item, gap 18px - khớp responsive Owl bên JS. */
.cat-hot-products__viewport:not(.owl-loaded) {
    display: flex;
    flex-wrap: nowrap;
    gap: 18px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

.cat-hot-products__viewport:not(.owl-loaded) > .cat-hot-products__item {
    flex: 0 0 calc((100% - 54px) / 4);
    width: calc((100% - 54px) / 4);
    max-width: calc((100% - 54px) / 4);
}

/* Owl đã dựng xong: bỏ toàn bộ layout giả lập để không can thiệp stage của Owl. */
.cat-hot-products__viewport.owl-loaded {
    display: block;
    padding: 0;
    overflow: visible;
}

.cat-hot-products__viewport .owl-stage-outer {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.cat-hot-products__viewport .owl-stage {
    display: flex;
}

.cat-hot-products__viewport .owl-item {
    display: flex;
    min-width: 0;
}

.cat-hot-products__viewport .owl-item > .cat-hot-products__item {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.cat-hot-products__item {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border-radius: 9px;
    background: linear-gradient(180deg, #f2f2f2 0%, #ececec 73%, #d8d8d8 100%);
}

.cat-hot-products__image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 305px;
    padding: 16px 18px 0;
    text-decoration: none;
}

.cat-hot-products__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform .45s ease;
}

.cat-hot-products__item:hover .cat-hot-products__image img {
    transform: scale(1.025);
}

.cat-hot-products__info {
    position: relative;
    z-index: 2;
    min-height: 136px;
    margin: 0 18px 20px;
    padding: 13px 20px 12px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(110deg, var(--hot-purple-light) 0%, var(--hot-purple-dark) 100%);
    box-shadow: 0 8px 18px rgba(65, 0, 108, .08);
}

.cat-hot-products__name {
    min-height: 49px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.24;
    text-transform: uppercase;
}

.cat-hot-products__name a {
    display: block;
    color: #fff;
    text-decoration: none;
}

.cat-hot-products__name span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cat-hot-products__name strong {
    display: block;
    margin-top: 1px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cat-hot-products__divider {
    width: 100%;
    height: 1px;
    margin: 4px 0 8px;
    background: rgba(255, 255, 255, .62);
}

.cat-hot-products__price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    min-height: 39px;
}

.cat-hot-products__prices {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-end;
}

.cat-hot-products__prices--no-old {
    padding-top: 14px;
}

.cat-hot-products__old-price {
    margin-bottom: 2px;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.15;
    text-decoration: line-through;
    white-space: nowrap;
}

.cat-hot-products__price {
    color: var(--hot-yellow);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
}

.cat-hot-products__cart {
    display: flex;
    flex: 0 0 22px;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-bottom: 1px;
    border-radius: 50%;
    color: #fff;
    background: #aaa;
    text-decoration: none;
    transition: background-color .25s ease, transform .25s ease;
}

.cat-hot-products__cart:hover {
    color: #fff;
    background: #8f8f8f;
    transform: translateY(-1px);
}

.cat-hot-products__cart svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cat-hot-products__cart svg circle {
    fill: currentColor;
    stroke: none;
}

.cat-hot-products__nav {
    position: absolute;
    z-index: 5;
    top: 43%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--hot-purple);
    cursor: pointer;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: background-color .25s ease, opacity .25s ease, transform .25s ease;
}

/* Chỉ bật nút sau khi Owl init hoàn tất. Tắt JS thì card vẫn đúng form và không có nút chết. */
.cat-hot-products.is-owl-ready .cat-hot-products__nav {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.cat-hot-products__nav:hover:not(:disabled) {
    background: var(--hot-purple-dark);
    transform: translateY(-50%) scale(1.04);
}

.cat-hot-products__nav svg {
    width: 11px;
    height: 18px;
}

.cat-hot-products__nav--prev {
    left: -54px;
}

.cat-hot-products__nav--next {
    right: -54px;
}

.cat-hot-products__nav:disabled {
    color: #fff;
    background: #ddd;
    cursor: default;
    opacity: 1;
}

@media (max-width: 1450px) {
    .cat-hot-products__nav--prev { left: 8px; }
    .cat-hot-products__nav--next { right: 8px; }
    .cat-hot-products__nav { box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
}

@media (max-width: 1199px) {
    .cat-hot-products { margin: 30px 0 38px; }
    .cat-hot-products__heading { margin-bottom: 28px; }
    .cat-hot-products__heading h2 { font-size: 22px; }

    /* Tablet: 2 item, gap 16px - đúng với Owl 768..1199. */
    .cat-hot-products__viewport:not(.owl-loaded) { gap: 16px; }
    .cat-hot-products__viewport:not(.owl-loaded) > .cat-hot-products__item {
        flex-basis: calc((100% - 16px) / 2);
        width: calc((100% - 16px) / 2);
        max-width: calc((100% - 16px) / 2);
    }

    .cat-hot-products__image { height: 285px; padding: 14px 16px 0; }
    .cat-hot-products__info { min-height: 132px; margin: 0 16px 18px; padding: 12px 18px 11px; }
}

@media (max-width: 767px) {
    .cat-hot-products {
        margin: 24px 0 30px;
        overflow: hidden;
    }

    .cat-hot-products__heading { margin-bottom: 20px; }
    .cat-hot-products__heading h2 { padding-bottom: 5px; font-size: 19px; }

    /*
     * Mobile 480..767: mô phỏng stagePadding:54 + margin:12 của Owl.
     * Padding nằm ngay từ CSS nên trước/sau khi JS chạy card không đổi width.
     */
    .cat-hot-products__viewport:not(.owl-loaded) {
        gap: 12px;
        padding-left: 54px;
        padding-right: 54px;
    }
    .cat-hot-products__viewport:not(.owl-loaded) > .cat-hot-products__item {
        flex-basis: 100%;
        width: 100%;
        max-width: 100%;
    }

    /* Mobile dùng touch-drag; nút PC luôn ẩn. */
    .cat-hot-products__nav,
    .cat-hot-products.is-owl-ready .cat-hot-products__nav { display: none; }

    .cat-hot-products__image { height: 255px; padding: 12px 14px 0; }
    .cat-hot-products__info { min-height: 124px; margin: 0 13px 15px; padding: 11px 15px 10px; border-radius: 10px; }
    .cat-hot-products__name,
    .cat-hot-products__name strong { font-size: 12px; }
    .cat-hot-products__name { min-height: 45px; }
    .cat-hot-products__price { font-size: 18px; }
    .cat-hot-products__old-price { font-size: 11px; }
    .cat-hot-products__cart { flex-basis: 20px; width: 20px; height: 20px; }
    .cat-hot-products__cart svg { width: 13px; height: 13px; }
}

@media (max-width: 479px) {
    /* Mobile nhỏ: khớp stagePadding:28 + margin:12 của Owl. */
    .cat-hot-products__viewport:not(.owl-loaded) {
        padding-left: 28px;
        padding-right: 28px;
    }

    .cat-hot-products__image { height: 245px; }
}
