﻿/* ============================================================================
   1. BIEN DUNG CHUNG + RESET
   ============================================================================ */
:root {
    --hp-primary: #0d3b66;
    --hp-primary-dark: #082a4a;
    --hp-accent: #ffd23f;
    --hp-danger: #ee4d2d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f6f8;
    color: #222;
}

/* ============================================================================
   2. HEADER / MENU
   ============================================================================ */
.hp-header {
    background: linear-gradient(180deg, var(--hp-primary) 0%, var(--hp-primary-dark) 100%);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.hp-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .6rem 1rem;
}

.hp-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    flex-shrink: 0;
}

    .hp-brand img {
        height: 40px;
        width: 40px;
        object-fit: contain;
        border-radius: 50%;
        background: #fff;
    }

.hp-brand-name {
    color: var(--hp-accent);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: .3px;
    white-space: nowrap;
}

.hp-nav {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    flex-wrap: wrap;
}

    .hp-nav > a, .hp-nav-dropdown-toggle {
        color: #fff;
        text-decoration: none;
        font-size: .92rem;
        font-weight: 500;
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        white-space: nowrap;
        opacity: .92;
        transition: opacity .15s, color .15s;
    }

        .hp-nav > a:hover, .hp-nav-dropdown-toggle:hover {
            opacity: 1;
            color: var(--hp-accent);
        }

.hp-nav-dropdown {
    position: relative;
}

.hp-nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 200px;
    border-radius: .4rem;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
    padding: .4rem 0;
    margin-top: .5rem;
    z-index: 1001;
}

    .hp-nav-dropdown-menu a {
        display: block;
        padding: .5rem 1rem;
        color: #222;
        text-decoration: none;
        font-size: .9rem;
    }

        .hp-nav-dropdown-menu a:hover {
            background: #f0f4f8;
            color: var(--hp-primary);
        }

.hp-nav-dropdown:hover .hp-nav-dropdown-menu {
    display: block;
}

.hp-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}


/* ============================================================================
   3. O TIM KIEM (SearchBox tren header)
   ============================================================================ */
.hp-search-wrap {
    position: relative;
    flex: 1 1 380px;
    max-width: 480px;
    margin: 0 .5rem;
}

.hp-search-box {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    border-radius: 999px;
    padding: .5rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.hp-search-icon {
    color: #8a8a8a;
    font-size: .9rem;
}

.hp-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: .9rem;
    color: #222;
    min-width: 0;
}

.hp-search-clear {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: .1rem .3rem;
}

    .hp-search-clear:hover {
        color: #666;
    }

.hp-search-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.15);
    z-index: 1090;
}

.hp-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: .6rem;
    box-shadow: 0 12px 32px rgba(0,0,0,.2);
    z-index: 1100;
    max-height: 72vh;
    overflow-y: auto;
}

.hp-search-wrap.open .hp-search-dropdown {
    display: block;
}

.hp-search-wrap.open .hp-search-backdrop {
    display: block;
}

.hp-search-panel {
    padding: 1rem 1.1rem;
}

.hp-search-section {
    margin-bottom: 1.1rem;
}

    .hp-search-section:last-child {
        margin-bottom: 0;
    }

.hp-search-heading {
    font-weight: 700;
    font-size: .92rem;
    color: #222;
    margin-bottom: .55rem;
}

/* -- Da tim gan day (localStorage) -- */
.hp-recent-list {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.hp-recent-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .4rem .35rem;
    border-radius: .35rem;
    cursor: pointer;
    color: #444;
    font-size: .87rem;
}

    .hp-recent-item:hover {
        background: #f5f6f8;
    }

    .hp-recent-item i.fa-clock {
        color: #999;
        font-size: .82rem;
    }

    .hp-recent-item .hp-recent-remove {
        margin-left: auto;
        color: #bbb;
        padding: .1rem .35rem;
    }

        .hp-recent-item .hp-recent-remove:hover {
            color: var(--hp-danger);
        }

/* -- Tim theo nhom san pham (the pill) -- */
.hp-top-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.hp-keyword-tag, .hp-group-tag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #eafaf0;
    color: #1a7d3a;
    border: 1px solid #bdeccb;
    border-radius: 999px;
    padding: .35rem .85rem;
    font-size: .84rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}

    .hp-keyword-tag:hover, .hp-group-tag:hover {
        background: #d7f5e0;
        color: #1a7d3a;
    }

    .hp-keyword-tag i, .hp-group-tag i {
        font-size: .72rem;
    }

.hp-search-loading, .hp-search-empty {
    text-align: center;
    color: #888;
    padding: 1.4rem 0;
    font-size: .88rem;
}

/* -- Danh sach ket qua tim kiem (dang list, moi san pham 1 dong) -- */
.hp-search-results-grid {
    display: flex;
    flex-direction: column;
    max-height: 460px;
    overflow-y: auto;
}

.hp-search-result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee; /* gach ngang phan cach */
    transition: background .15s;
}

    .hp-search-result-card:last-child {
        border-bottom: none;
    }

    .hp-search-result-card:hover {
        background: #f7f7f7;
    }

.hp-search-result-thumb {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .hp-search-result-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.hp-search-result-info {
    flex: 1 1 auto;
    min-width: 0;
}

.hp-search-result-name {
    font-size: 14px;
    color: #222;
    white-space: normal; /* cho phep xuong dong, khong cat 1 dong */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* toi da 2 dong */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hp-search-result-price {
    font-size: 13px;
    margin-top: 2px;
}

    .hp-search-result-price .price-now {
        color: #d70018;
        font-weight: 700;
    }

    .hp-search-result-price .price-old {
        color: #999;
        text-decoration: line-through;
        margin-left: 6px;
        font-weight: 400;
    }

    .hp-search-result-price .price-badge {
        background: #fff0ee;
        color: #d70018;
        font-size: 11px;
        font-weight: 700;
        padding: 1px 5px;
        border-radius: 3px;
        margin-left: 6px;
    }
    /* ➜ Thêm vào cuối file CSS của ô tìm kiếm (file đang chứa .hp-search-result-price) */
    .hp-search-result-price .price-unit {
        font-size: 12px;
        font-weight: 500;
        color: #6c757d;
        margin-left: 1px;
    }

.hp-search-result-seller {
    margin-top: 2px;
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .hp-search-result-seller i {
        font-size: 11px;
        margin-right: 3px;
        color: #1f7a34;
    }

/* ============================================================================
   4. BANNER - crossfade muot, ho tro GIF/PNG/JPG
   ============================================================================ */
.hp-banner {
    position: relative;
    width: 100%;
    aspect-ratio: 21 / 7;
    max-height: 480px;
    overflow: hidden;
    background: #e9edf2;
}

.hp-banner-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.hp-banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .9s ease-in-out;
    pointer-events: none;
}

    .hp-banner-slide.active {
        opacity: 1;
        pointer-events: auto;
    }

    .hp-banner-slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.hp-banner-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: .8rem 1.2rem;
    background: linear-gradient(0deg, rgba(0,0,0,.55), transparent);
    color: #fff;
    font-size: .95rem;
}

.hp-banner-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.35);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 5;
}

    .hp-banner-nav:hover {
        background: rgba(0,0,0,.6);
    }

.hp-banner-prev {
    left: 12px;
}

.hp-banner-next {
    right: 12px;
}

.hp-banner-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    display: flex;
    justify-content: center;
    gap: .4rem;
    z-index: 5;
}

.hp-banner-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255,255,255,.55);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background .15s, transform .15s;
}

    .hp-banner-dot.active {
        background: #fff;
        transform: scale(1.25);
    }


/* ============================================================================
   5. DAI LY - marquee truot ngang lien mach
   ============================================================================ */
.hp-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hp-primary);
    padding: 1.1rem 1rem .6rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.hp-agency-strip {
    background: #fff;
    border-bottom: 6px solid #f5f6f8;
}

    .hp-agency-strip .hp-section-title {
        max-width: 1200px;
        margin: 0 auto;
    }

.hp-marquee {
    overflow: hidden;
    position: relative;
    padding: .5rem 0 1.2rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}

.hp-marquee-track {
    display: flex;
    gap: 1.6rem;
    width: max-content;
    animation: hp-marquee-scroll 35s linear infinite;
}

.hp-marquee:hover .hp-marquee-track,
.hp-marquee.paused .hp-marquee-track {
    animation-play-state: paused;
}

@keyframes hp-marquee-scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
        /* JS clone noi dung x2 nen chi can chay -50% la lap lien mach */
    }
}

.hp-agency-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    width: 84px;
    flex-shrink: 0;
    text-align: center;
}

    .hp-agency-item img {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #eef2f6;
        box-shadow: 0 2px 6px rgba(0,0,0,.08);
    }

    .hp-agency-item span {
        font-size: .78rem;
        color: #444;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 84px;
    }


/* ============================================================================
   6. SAN PHAM NOI BAT (trang chu, kieu Shopee)
   ============================================================================ */
.hp-container {
    max-width: 1200px;
    padding-top: .5rem;
    padding-bottom: 2rem;
}

.hp-product-section {
    background: #fff;
    border-radius: .6rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}

.hp-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #eee;
}

.hp-product-card {
    background: #fff;
    padding: .7rem;
    transition: box-shadow .15s, transform .15s;
    cursor: pointer;
}

    .hp-product-card:hover {
        box-shadow: 0 6px 16px rgba(0,0,0,.1);
        transform: translateY(-2px);
        position: relative;
        z-index: 2;
    }

.hp-product-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: .4rem;
    overflow: hidden;
    background: #f5f6f8;
}

    .hp-product-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.hp-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: .68rem;
    font-weight: 700;
    padding: .15rem .45rem;
    border-radius: .3rem;
    color: #fff;
}

.hp-badge-promo {
    background: var(--hp-danger);
}

.hp-badge-hot {
    background: #ff8c00;
}

.hp-product-info {
    padding-top: .5rem;
}

.hp-product-name {
    font-size: .85rem;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

.hp-product-price {
    color: var(--hp-danger);
    font-weight: 700;
    font-size: .95rem;
    margin-top: .3rem;
}


/* ============================================================================
   7. TRANG DANH SACH SAN PHAM THEO NHOM (Views/Product/Index.cshtml, /Product)
   ============================================================================ */
.hp-group-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.hp-group-chip {
    padding: .4rem .95rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #ddd;
    color: #444;
    font-size: .85rem;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}

    .hp-group-chip:hover {
        background: #f5f6f8;
        color: #222;
    }

    .hp-group-chip.active {
        background: var(--hp-primary);
        color: #fff;
        border-color: var(--hp-primary);
    }

.hp-product-grid-page {
    background: #fff;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    grid-template-columns: repeat(5, 1fr);
}


/* ============================================================================
   8. TRANG KET QUA TIM KIEM DA DAI LY (Views/SearchAcrossAgency1/Index.cshtml, /tim-kiem)
   ============================================================================ */
.hp-agency-result-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-top: 8px;
}

.hp-agency-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}

    .hp-agency-card:hover {
        box-shadow: 0 4px 14px rgba(0,0,0,.10);
        transform: translateY(-2px);
    }

.hp-agency-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f7f7f7;
}

    .hp-agency-card-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.hp-agency-card-promo {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #d70018;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.hp-agency-card-body {
    padding: 10px 12px 4px;
    flex: 1 1 auto;
}

.hp-agency-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 38px;
}

.hp-agency-card-price {
    color: #d70018;
    font-weight: 700;
    font-size: 15px;
    margin-top: 4px;
}

.hp-agency-card-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

    .hp-agency-card-footer img {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        object-fit: cover;
        flex: 0 0 auto;
    }

    .hp-agency-card-footer span {
        font-size: 12px;
        color: #555;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Hang nut "Xem chi tiet" / "Them gio hang" duoi moi card san pham
   (dung chung cho card /tim-kiem va co the tai su dung o cac trang khac) */
.hp-card-actions {
    display: flex;
    flex-direction: column; /* moi nut 1 dong, do card hep khi 5 cot */
    gap: 6px;
    padding: 8px;
}

    .hp-card-actions a, .hp-card-actions button {
        width: 100%;
        text-align: center;
        font-size: .78rem;
        padding: .4rem 0;
        border-radius: 5px;
        text-decoration: none;
        border: 1px solid #ddd;
        cursor: pointer;
        background: #fff;
        color: #444;
    }

    .hp-card-actions .btn-primary-mini {
        background: #1a7d3a;
        color: #fff;
        border-color: #1a7d3a;
    }


/* ============================================================================
   8b. TRANG CHI TIET SAN PHAM (Views/ProductDetail/Index.cshtml, /san-pham/{id})
   ============================================================================ */
.hp-breadcrumb a {
    color: #1a7d3a;
    text-decoration: none;
    font-size: .85rem;
}

.hp-breadcrumb span {
    margin: 0 4px;
    color: #999;
}

.hp-detail-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    background: #fff;
    padding: 20px;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.hp-detail-main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

    .hp-detail-main-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.hp-detail-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.hp-detail-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
}

    .hp-detail-thumb.active {
        border-color: var(--hp-primary);
    }

.hp-detail-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hp-detail-price {
    color: #d70018;
    font-weight: 800;
    font-size: 1.6rem;
    margin-bottom: 16px;
}

.hp-detail-promo {
    background: #fff0ee;
    color: #d70018;
    font-size: .8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 10px;
    vertical-align: middle;
}

.hp-detail-units {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.hp-detail-unit-chip {
    padding: .45rem 1rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    color: #444;
    font-size: .85rem;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

    .hp-detail-unit-chip.active {
        border-color: #1a7d3a;
        color: #1a7d3a;
        font-weight: 600;
        background: #eafaf0;
    }

.hp-detail-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-add-cart, .btn-buy-now {
    padding: .7rem 1.4rem;
    border-radius: .4rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
}

.btn-add-cart {
    background: #e8f5ee;
    color: #1a7d3a;
    border: 1px solid #1a7d3a;
}

.btn-buy-now {
    background: #1a7d3a;
    color: #fff;
}

.hp-detail-agency {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f7f9fc;
    border-radius: 8px;
    border: 1px solid #eef2f6;
    max-width: 320px;
}

    .hp-detail-agency img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
    }

.hp-detail-agency-label {
    font-size: .72rem;
    color: #888;
}

.hp-detail-agency-name {
    font-size: .9rem;
    font-weight: 600;
    color: #222;
}

.hp-detail-characteristics {
    background: #fff;
    margin-top: 20px;
    padding: 20px;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.hp-detail-characteristics-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    margin-bottom: 12px;
}

    .hp-detail-characteristics-heading a {
        color: #1a7d3a;
        font-size: .85rem;
        text-decoration: none;
    }

.hp-detail-characteristics-preview {
    max-height: 220px;
    overflow: hidden;
    position: relative;
}

    .hp-detail-characteristics-preview::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 50px;
        background: linear-gradient(180deg, transparent, #fff);
    }

.hp-detail-related {
    background: #fff;
    margin-top: 20px;
    padding: 20px;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.hp-detail-related-heading {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 12px;
    color: var(--hp-primary);
}

/* .hp-product-card duoc tai su dung o day nhung la the <a>, can bo gach chan/mau link */
.hp-detail-related .hp-product-card {
    display: block;
    text-decoration: none;
    color: inherit;
}


/* ============================================================================
   9. FOOTER
   ============================================================================ */
.hp-footer {
    background: var(--hp-primary-dark);
    color: #cfd8e3;
    text-align: center;
    padding: 1.2rem 0;
    font-size: .85rem;
}


/* ============================================================================
   10. RESPONSIVE - TAT CA @media GOM CHUNG TAI DAY
       Sap xep tu man hinh LON -> NHO. Moi khoi ghi ro dang sua component nao
       (so muc tuong ung voi cac phan o tren) de de doi chieu.
   ============================================================================ */

/* ---- <= 1199.98px (tablet ngang) ---- */
@media (max-width: 1199.98px) {
    /* 7. Danh sach san pham theo nhom: 6 cot -> 4 cot */
    .hp-product-grid-page {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---- <= 991.98px (tablet dung / mobile ngang) ---- */
@media (max-width: 991.98px) {
    /* 2. Header/menu: bat nut hamburger, menu xep doc, an theo mac dinh */
    .hp-nav-toggle {
        display: block;
    }

    .hp-nav {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: .2rem;
        padding-top: .6rem;
    }

        .hp-nav.open {
            display: flex;
        }

        .hp-nav > a, .hp-nav-dropdown {
            width: 100%;
            padding: .5rem 0;
            border-top: 1px solid rgba(255,255,255,.1);
        }

    .hp-nav-dropdown-menu {
        position: static;
        box-shadow: none;
        margin-top: 0;
        padding-left: 1rem;
        display: none;
        background: rgba(255,255,255,.06);
    }

        .hp-nav-dropdown-menu.open {
            display: block;
        }

        .hp-nav-dropdown-menu a {
            color: #fff;
        }

    .hp-header-inner {
        flex-wrap: wrap;
    }

    /* 3. O tim kiem: xuong hang rieng duoi logo/hamburger */
    .hp-search-wrap {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        margin: .6rem 0 0;
    }

    .hp-nav-toggle {
        order: 2;
    }

    .hp-nav {
        order: 4;
    }

    /* 6. San pham noi bat: 4 cot -> 3 cot */
    .hp-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* 8. Trang ket qua tim kiem da dai ly: 5 cot -> 3 cot */
    .hp-agency-result-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---- <= 767.98px (mobile lon) ---- */
@media (max-width: 767.98px) {
    /* 4. Banner: doi ty le cho hop mobile */
    .hp-banner {
        aspect-ratio: 4 / 3;
        max-height: 320px;
    }

    /* 7. Danh sach san pham theo nhom: 4 cot -> 3 cot */
    .hp-product-grid-page {
        grid-template-columns: repeat(3, 1fr);
    }

    /* 8b. Trang chi tiet san pham: 2 cot -> xep doc 1 cot */
    .hp-detail-layout {
        grid-template-columns: 1fr;
    }
}

/* ---- <= 575.98px (mobile nho) ---- */
@media (max-width: 575.98px) {
    /* 3. O tim kiem: dropdown chiem full chieu rong man hinh */
    .hp-search-dropdown {
        max-width: 100%;
    }

    /* 4. Banner: thu nho nut prev/next */
    .hp-banner-nav {
        width: 32px;
        height: 32px;
        font-size: .8rem;
    }

    /* 5. Marquee dai ly: icon nho lai, chay nhanh hon cho hop man hinh hep */
    .hp-agency-item {
        width: 68px;
    }

        .hp-agency-item img {
            width: 52px;
            height: 52px;
        }

        .hp-agency-item span {
            max-width: 68px;
            font-size: .72rem;
        }

    .hp-marquee-track {
        animation-duration: 22s;
    }

    /* 6. San pham noi bat: 3 cot -> 2 cot */
    .hp-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 7. Danh sach san pham theo nhom: 3 cot -> 2 cot */
    .hp-product-grid-page {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 8. Trang ket qua tim kiem da dai ly: 3 cot -> 2 cot */
    .hp-agency-result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ==========================================================================
   ➜ DÁN VÀO CUỐI wwwroot/css/home/home.css (sau mục 10. RESPONSIVE)
   Giữ thẻ sản phẩm (trang chủ, trang nhóm) đúng khuôn: ảnh vuông, ảnh co vừa khung,
   tên / giá / nút luôn nằm dưới ảnh — kể cả khi CSS khác ghi đè chiều cao thẻ/ảnh.
   ========================================================================== */
.hp-product-grid {
    align-items: stretch;
    grid-auto-rows: auto !important;
}

    .hp-product-grid .hp-product-card {
        display: flex !important;
        flex-direction: column;
        height: auto !important;
        max-height: none !important;
        overflow: visible;
    }

    .hp-product-grid .hp-product-thumb {
        position: relative;
        display: block;
        width: 100%;
        height: auto !important;
        aspect-ratio: 1 / 1;
        overflow: hidden;
        flex: 0 0 auto;
    }

        .hp-product-grid .hp-product-thumb img {
            display: block;
            width: 100% !important;
            height: 100% !important;
            object-fit: contain;
        }

    .hp-product-grid .hp-card-actions {
        margin-top: auto; /* nút luôn dồn xuống đáy thẻ, các thẻ cùng hàng thẳng nhau */
        padding: 8px 0 0;
    }

        .hp-product-grid .hp-card-actions .fa {
            font-size: .95em;
        }

