

.hdr-m { display: none; }

@media (max-width: 991px) {
    /* Reset body margin mặc định 8px của trình duyệt */
    body { margin: 0 !important; }

    .hdr-m {
        display: block;
        background: var(--header-bg-main, #1ba4f1);
        color: #fff;
        position: relative;
        z-index: 100;
    }
    /* Ẩn header desktop trên mobile */
    .header > .header-top,
    .header > .header-middle,
    .header > .header-bottom { display: none !important; }
}

/* ----- Mobile topbar (cart + logo + hamburger) ----- */
.hdr-m__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
}

.hdr-m__action {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    position: relative;
    text-decoration: none;
}
.hdr-m__action svg { width: 24px; height: 24px; }

.hdr-m__cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4d4f;
    color: #fff;
    font-size: 10px;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.hdr-m__logo {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
.hdr-m__logo img {
    max-height: 36px;
    max-width: 160px;
    width: auto;
    height: auto;
}

/* ----- Mobile search bar ----- */
.hdr-m__search {
    padding: 0 12px 10px;
    display: flex;
    align-items: stretch;
    background: var(--header-bg-main, #1ba4f1);
}

.hdr-m__search-input {
    flex: 1;
    background: #fff;
    border: 0;
    border-radius: 4px 0 0 4px;
    padding: 0 12px;
    height: 40px;
    font-size: 14px;
    color: #333;
    outline: 0;
    min-width: 0;
}

.hdr-m__search-btn {
    flex: 0 0 48px;
    background: #52c41a;
    border: 0;
    border-radius: 0 4px 4px 0;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hdr-m__search-btn svg { width: 20px; height: 20px; }

/* ----- Drawer overlay ----- */
.hdr-m__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}
.hdr-m__overlay.is-open { opacity: 1; visibility: visible; }

/* ----- Drawer ----- */
.hdr-m__drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 360px;
    background: #fff;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.hdr-m__drawer.is-open { transform: translateX(0); }

/* Drawer head: title + close */
.hdr-m__drawer-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.hdr-m__drawer-title {
    flex: 1;
    padding: 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--shop-color-main, #002d3a);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hdr-m__close {
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #333;
    cursor: pointer;
}
.hdr-m__close svg { width: 22px; height: 22px; }

/* Drawer body — scrollable, holds panes + subdrawers */
.hdr-m__drawer-body {
    flex: 1;
    overflow: hidden;
    background: #fff;
    position: relative;
}

.hdr-m__pane {
    display: none;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.hdr-m__pane.is-active { display: block; }

/* Menu list */
.hdr-m__menu { list-style: none; margin: 0; padding: 0; }
.hdr-m__menu-item { border-bottom: 1px solid #f0f0f0; }

.hdr-m__menu-row {
    display: flex;
    align-items: center;
    padding: 0 8px 0 0;
}

.hdr-m__menu-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    min-width: 0;
}

.hdr-m__menu-icon {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hdr-m__menu-icon img { max-width: 100%; max-height: 100%; object-fit: contain; }

.hdr-m__menu-name {
    flex: 1;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hdr-m__menu-arrow {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7f7;
    border: 0;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    transition: background .2s, color .2s;
}
.hdr-m__menu-arrow:hover,
.hdr-m__menu-arrow:active {
    background: var(--shop-color-main, #e26f09);
    color: #fff;
}
.hdr-m__menu-arrow svg { width: 14px; height: 14px; }

/* Section title trong drawer (Tiện ích, Tài khoản...) */
.hdr-m__section-title {
    padding: 14px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.hdr-m__menu--utility .hdr-m__menu-link {
    padding: 12px 16px;
}

/* Drawer footer */
.hdr-m__drawer-foot {
    flex: 0 0 auto;
    padding: 16px;
    border-top: 1px solid #eee;
    background: #fff;
}

.hdr-m__social {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}
.hdr-m__social a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
}
.hdr-m__social a.fb { background: #1877f2; }
.hdr-m__social a.ig { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.hdr-m__social a.tt { background: #000; }
.hdr-m__social a.yt { background: #ff0000; }
.hdr-m__social a.zl { background: #0068ff; }
.hdr-m__social svg { width: 18px; height: 18px; }

/* ----- Sub-drawer (slide từ phải, đè lên drawer body) ----- */
.hdr-m__subdrawer {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 2;
    transform: translateX(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    visibility: hidden;
}
.hdr-m__subdrawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.hdr-m__subdrawer-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.hdr-m__back {
    flex: 0 0 44px;
    height: 52px;
    background: transparent;
    border: 0;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.hdr-m__back svg { width: 18px; height: 18px; }

.hdr-m__subdrawer-title {
    flex: 1;
    padding: 16px 8px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--shop-color-main, #002d3a);
    letter-spacing: 0.3px;
}

.hdr-m__subdrawer-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.hdr-m__submenu { list-style: none; margin: 0; padding: 0; }
.hdr-m__submenu-item { border-bottom: 1px solid #f0f0f0; }

.hdr-m__submenu-row {
    display: flex;
    align-items: center;
    padding: 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    gap: 8px;
}
.hdr-m__submenu-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hdr-m__submenu-arrow { flex: 0 0 18px; color: #999; }
.hdr-m__submenu-arrow svg { width: 14px; height: 14px; }

/* Lock body scroll when drawer open */
body.hdr-m-lock { overflow: hidden; }
