/* ==========================================================
   HV Category Cards – Danh mục sản phẩm
   ========================================================== */
.hv-cats {
    --hv-c-primary: var(--e-global-color-primary, #6F5E4B);
    --hv-c-accent: var(--e-global-color-secondary, #922B2A);
    --hv-c-text: #1d2733;
    --hv-c-muted: #5b6672;
    --hv-c-media-bg: #f2f0ec;
    --hv-c-cols: 3;
    --hv-c-gap: 24px;
    --hv-c-radius: 18px;
    --hv-c-ratio: 4 / 3;
    display: grid;
    grid-template-columns: repeat(var(--hv-c-cols), minmax(0, 1fr));
    gap: var(--hv-c-gap);
    font-family: var(--e-global-typography-primary-font-family, "Roboto Flex"), sans-serif;
}

.hv-cats__card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--hv-c-text) !important;
    text-decoration: none !important;
    border-radius: var(--hv-c-radius);
    transition: transform .35s ease;
}

/* ---------- Ảnh ---------- */
.hv-cats__media {
    position: relative;
    display: block;
    aspect-ratio: var(--hv-c-ratio);
    overflow: hidden;
    border-radius: var(--hv-c-radius);
    background: var(--hv-c-media-bg);
    isolation: isolate;
}

.hv-cats__img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}

/* Ảnh sản phẩm nền trắng: đặt gọn giữa khung, hòa vào nền */
.hv-cats__card.is-product-image .hv-cats__img {
    inset: 10%;
    width: 80% !important;
    height: 80% !important;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.hv-cats__card:hover .hv-cats__img {
    transform: scale(1.06);
}

/* ---------- Nội dung ---------- */
.hv-cats__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hv-cats__count {
    color: var(--hv-c-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.hv-cats__title {
    color: var(--hv-c-primary);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}

.hv-cats__desc {
    color: var(--hv-c-muted);
    font-size: 14.5px;
    line-height: 1.55;
}

.hv-cats__cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    color: var(--hv-c-primary);
    font-size: 14px;
    font-weight: 600;
}

.hv-cats__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid currentColor;
    border-radius: 50%;
    transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}

.hv-cats__card:hover .hv-cats__arrow {
    background: var(--hv-c-primary);
    border-color: var(--hv-c-primary);
    color: #fff;
    transform: translateX(4px);
}

/* Kiểu "Ảnh trên – chữ dưới" */
.hv-cats--below .hv-cats__body {
    padding: 18px 4px 0;
}

.hv-cats--below .hv-cats__card:hover {
    transform: translateY(-4px);
}

/* Kiểu "Chữ phủ trên ảnh" */
.hv-cats--overlay .hv-cats__card {
    overflow: hidden;
}

.hv-cats--overlay .hv-cats__media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(10, 20, 35, 0) 35%, rgba(10, 20, 35, .55) 65%, rgba(10, 20, 35, .88) 100%);
    transition: opacity .35s ease;
}

.hv-cats--overlay .hv-cats__body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 26px;
}

.hv-cats--overlay .hv-cats__title,
.hv-cats--overlay .hv-cats__cta {
    color: #fff;
}

.hv-cats--overlay .hv-cats__desc {
    color: rgba(255, 255, 255, .82);
}

.hv-cats--overlay .hv-cats__count {
    color: #e2c79f;
}

.hv-cats--overlay .hv-cats__card:hover .hv-cats__arrow {
    background: #fff;
    border-color: #fff;
    color: var(--hv-c-primary);
}

/* Ảnh sản phẩm ở kiểu overlay: giảm lớp phủ để vẫn đọc được */
.hv-cats--overlay .hv-cats__card.is-product-image .hv-cats__img {
    inset: 6% 14% 30%;
    width: 72% !important;
    height: 64% !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .hv-cats__title {
        font-size: 18px;
    }

    .hv-cats__desc {
        font-size: 13.5px;
    }
}

@media (max-width: 767px) {
    .hv-cats {
        --hv-c-cols: 1;
        --hv-c-gap: 16px;
    }

    /* Mobile: thẻ ngang gọn (ảnh trái – chữ phải) */
    .hv-cats--below .hv-cats__card {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    .hv-cats--below .hv-cats__media {
        flex: 0 0 38%;
        aspect-ratio: 1 / 1;
        border-radius: 14px;
    }

    .hv-cats--below .hv-cats__body {
        padding: 0;
        gap: 4px;
    }

    .hv-cats--below .hv-cats__title {
        font-size: 17px;
    }

    .hv-cats--below .hv-cats__desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 13px;
    }

    .hv-cats__cta {
        margin-top: 2px;
        font-size: 13px;
    }

    .hv-cats__arrow {
        width: 28px;
        height: 28px;
    }

    .hv-cats--overlay .hv-cats__body {
        padding: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hv-cats *,
    .hv-cats__card {
        transition: none !important;
    }
}

/* Số thứ tự chỉ dùng cho kiểu Panel */
.hv-cats__num {
    display: none;
}

/* ==========================================================
   Kiểu "Panel mở rộng" – rê chuột panel nào thì panel đó mở
   ========================================================== */
/* Nội dung panel đều là absolute: ép widget luôn rộng hết khung */
.elementor-widget-hv_category_cards {
    width: 100%;
}

.hv-cats--accordion {
    --hv-c-panel-h: 520px;
    width: 100%;
    display: flex;
    gap: 16px;
    height: var(--hv-c-panel-h);
}

.hv-cats--accordion .hv-cats__card {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    border-radius: 24px;
    background: var(--hv-c-tint, #6F5E4B);
    color: #fff !important;
    isolation: isolate;
    transition: flex-grow .7s cubic-bezier(.2, .7, .2, 1), box-shadow .4s ease;
}

.hv-cats--accordion .hv-cats__card.is-active {
    flex-grow: 2.3;
    box-shadow: 0 24px 50px rgba(16, 24, 40, .18);
}

/* Họa tiết vòng tròn mờ trên nền màu */
.hv-cats--accordion .hv-cats__card::before {
    content: "";
    position: absolute;
    z-index: 0;
    right: -30%;
    top: -25%;
    width: 120%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    box-shadow: 0 0 0 60px rgba(255, 255, 255, .03), 0 0 0 120px rgba(255, 255, 255, .025);
    pointer-events: none;
}

/* Số thứ tự viền chữ */
.hv-cats--accordion .hv-cats__num {
    position: absolute;
    z-index: 3;
    top: 22px;
    left: 26px;
    display: block;
    color: transparent;
    font-size: 58px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .02em;
    -webkit-text-stroke: 1px rgba(255, 255, 255, .45);
    transition: color .5s ease, -webkit-text-stroke-color .5s ease;
}

.hv-cats--accordion .hv-cats__card.is-active .hv-cats__num {
    color: rgba(255, 255, 255, .14);
    -webkit-text-stroke-color: rgba(255, 255, 255, .7);
}

/* Ảnh */
.hv-cats--accordion .hv-cats__media {
    position: absolute;
    inset: 0;
    z-index: 1;
    aspect-ratio: auto;
    border-radius: 0;
    background: transparent;
}

/* Ảnh lifestyle: phủ kín + lớp tối dưới để đọc chữ */
.hv-cats--accordion .hv-cats__card:not(.is-product-image) .hv-cats__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 20, 35, .1) 30%, rgba(10, 20, 35, .82) 100%);
}

/* Ảnh sản phẩm nền trắng: đặt trên "đĩa" tròn sáng màu */
.hv-cats--accordion .hv-cats__card.is-product-image .hv-cats__media::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 40%;
    width: min(74%, 300px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #f4f1ea;
    box-shadow: 0 30px 60px rgba(0, 0, 0, .25), inset 0 -10px 30px rgba(0, 0, 0, .05);
    transform: translate(-50%, -50%) scale(.92);
    transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}

.hv-cats--accordion .hv-cats__card.is-product-image .hv-cats__img {
    inset: auto;
    left: 50%;
    top: 40%;
    width: min(64%, 260px) !important;
    height: auto !important;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 50%;
    clip-path: circle(50%);
    mix-blend-mode: multiply;
    transform: translate(-50%, -50%) scale(.92);
    transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}

.hv-cats--accordion .hv-cats__card.is-product-image.is-active .hv-cats__media::before {
    transform: translate(-50%, -50%) scale(1);
}

.hv-cats--accordion .hv-cats__card.is-product-image.is-active .hv-cats__img {
    transform: translate(-50%, -50%) scale(1.04);
}

.hv-cats--accordion .hv-cats__card:not(.is-product-image).is-active .hv-cats__img {
    transform: scale(1.05);
}

/* Nội dung */
.hv-cats--accordion .hv-cats__body {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 0;
    gap: 8px;
    padding: 26px 28px 28px;
}

.hv-cats--accordion .hv-cats__count {
    color: rgba(255, 255, 255, .7);
}

.hv-cats--accordion .hv-cats__title {
    color: #fff;
    font-size: 22px;
    line-height: 1.25;
}

.hv-cats--accordion .hv-cats__desc,
.hv-cats--accordion .hv-cats__cta {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(10px);
    transition: max-height .6s ease, opacity .4s ease, transform .5s ease, margin .4s ease;
}

.hv-cats--accordion .hv-cats__desc {
    max-width: 420px;
    color: rgba(255, 255, 255, .82);
}

.hv-cats--accordion .hv-cats__cta {
    margin-top: 0;
    color: #fff;
}

.hv-cats--accordion .hv-cats__card.is-active .hv-cats__desc,
.hv-cats--accordion .hv-cats__card.is-active .hv-cats__cta {
    max-height: 90px;
    opacity: 1;
    transform: none;
    transition-delay: .15s;
}

.hv-cats--accordion .hv-cats__card.is-active .hv-cats__cta {
    margin-top: 8px;
}

.hv-cats--accordion .hv-cats__arrow {
    border-color: rgba(255, 255, 255, .6);
}

.hv-cats--accordion .hv-cats__card:hover .hv-cats__arrow {
    background: #fff;
    border-color: #fff;
    color: var(--hv-c-tint, #6F5E4B);
}

.hv-cats--accordion .hv-cats__card.is-active .hv-cats__title {
    font-size: 26px;
}

/* Tablet */
@media (max-width: 1024px) {
    .hv-cats--accordion {
        --hv-c-panel-h: 440px;
        gap: 12px;
    }

    .hv-cats--accordion .hv-cats__num {
        font-size: 44px;
    }

    .hv-cats--accordion .hv-cats__card.is-active .hv-cats__title {
        font-size: 22px;
    }
}

/* Mobile: 3 panel xếp dọc, mỗi panel ảnh phải – chữ trái, luôn hiện nút */
@media (max-width: 767px) {
    .hv-cats--accordion {
        flex-direction: column;
        height: auto;
        gap: 12px;
    }

    .hv-cats--accordion .hv-cats__card,
    .hv-cats--accordion .hv-cats__card.is-active {
        flex: 0 0 auto;
        height: 190px;
        border-radius: 20px;
        box-shadow: none;
    }

    .hv-cats--accordion .hv-cats__num {
        top: 16px;
        left: 18px;
        font-size: 36px;
    }

    .hv-cats--accordion .hv-cats__card.is-product-image .hv-cats__media::before,
    .hv-cats--accordion .hv-cats__card.is-product-image .hv-cats__img {
        left: 76%;
        top: 50%;
    }

    .hv-cats--accordion .hv-cats__card.is-product-image .hv-cats__media::before {
        width: 150px;
        transform: translate(-50%, -50%);
    }

    .hv-cats--accordion .hv-cats__card.is-product-image .hv-cats__img {
        width: 128px !important;
        transform: translate(-50%, -50%);
    }

    .hv-cats--accordion .hv-cats__body {
        right: 42%;
        padding: 18px;
        gap: 4px;
    }

    .hv-cats--accordion .hv-cats__card:not(.is-product-image) .hv-cats__body {
        right: 0;
    }

    .hv-cats--accordion .hv-cats__title,
    .hv-cats--accordion .hv-cats__card.is-active .hv-cats__title {
        font-size: 17px;
    }

    .hv-cats--accordion .hv-cats__desc,
    .hv-cats--accordion .hv-cats__card.is-active .hv-cats__desc {
        display: none;
    }

    .hv-cats--accordion .hv-cats__cta,
    .hv-cats--accordion .hv-cats__card.is-active .hv-cats__cta {
        max-height: none;
        margin-top: 6px;
        opacity: 1;
        transform: none;
    }
}
