/* ==========================================================================
   HOÀNG GIA PHÁT - HEADER CSS THUẦN (RESPONSIVE & STICKY NAV)
   ========================================================================== */

:root {
    --hg-primary: #e86014;
    --hg-primary-hover: #cf4f0a;
    --hg-nav-bg: #4f321d;
    --hg-nav-dark: #3f2615;
    --hg-nav-hover: #613e25;
    --hg-border-divider: rgba(255, 255, 255, 0.12);
    --hg-text-dark: #222222;
    --hg-text-muted: #666666;
    --hg-white: #ffffff;
    --hg-shadow-nav: 0 4px 15px rgba(0, 0, 0, 0.25);
    --hg-container: 1290px;
}

/* Base resets for header elements */
.hg-header,
.hg-header * {
    box-sizing: border-box;
}

.hg-header {
    width: 100%;
    position: relative;
    background-color: var(--hg-white);
    font-family: "Google Sans", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.4;
}

.hg-header a {
    text-decoration: none;
    color: #fff;
    transition: all 0.2s ease;
}

.hg-header ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   1. TOP BAR (MÀU CAM ĐẶC TRƯNG)
   ========================================================================== */
.hg-topbar {
    background-color: var(--hg-primary);
    color: var(--hg-white);
    font-size: 13px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.hg-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.hg-topbar__slogan {
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.hg-topbar__right ul {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hg-topbar__right ul li {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.hg-topbar__right ul li:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.4);
    margin-left: 14px;
}

.hg-topbar__right ul li a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--hg-white);
    font-size: 12.5px;
    font-weight: 500;
    padding: 2px 0;
    transition: opacity 0.2s, transform 0.2s;
}

.hg-topbar__right ul li a:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.hg-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ==========================================================================
   2. MIDDLE BAR: LOGO, SEARCH, CONTACT INFO & CART
   ========================================================================== */
.hg-midbar {
    background-color: var(--hg-white);
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.hg-midbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Hamburger (Ẩn trên Desktop) */
.hg-hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 6px;
    flex-direction: column;
    justify-content: space-between;
    width: 36px;
    height: 32px;
    z-index: 10;
}

.hg-hamburger__line {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--hg-nav-bg);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Logo */
.hg-midbar__logo {
    flex-shrink: 0;
}

.hg-logo-img {
    height: 60px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* Search Box */
.hg-midbar__search {
    flex: 1;
    max-width: 420px;
    margin: 0 10px;
}

.hg-search-form {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 40px;
    border: 1px solid #d4d8dd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hg-search-form:focus-within {
    border-color: var(--hg-primary);
    box-shadow: 0 0 0 2px rgba(232, 96, 20, 0.15);
}

.hg-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0 14px;
    font-size: 13.5px;
    color: var(--hg-text-dark);
    background: transparent;
}

.hg-search-input::placeholder {
    color: #999999;
}

.hg-search-btn {
    width: 48px;
    border: none;
    background-color: var(--hg-primary);
    color: var(--hg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.hg-search-btn:hover {
    background-color: var(--hg-primary-hover);
}

/* Contact & Actions Group */
.hg-midbar__actions {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-shrink: 0;
}

.hg-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hg-action-item:hover .hg-action-value--orange {
    color: var(--hg-primary-hover);
}

.hg-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.hg-action-item:hover .hg-action-icon {
    transform: scale(1.08);
}

/* Phone Icon */
.hg-action-icon--hotline {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #d32f2f;
    color: #ffffff;
}

/* Email Icon */
.hg-action-icon--email {
    width: 36px;
    height: 36px;
}

/* Cart Icon */
.hg-action-icon--cart {
    position: relative;
    width: 36px;
    height: 36px;
    color: var(--hg-primary);
}

.hg-cart-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background-color: var(--hg-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
}

.hg-action-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.25;
}

.hg-action-label {
    font-size: 11.5px;
    color: var(--hg-text-muted);
}

.hg-action-value {
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
}

.hg-action-value--orange {
    color: #d32f2f;
    font-size: 14.5px;
}

.hg-action-value--email {
    color: #e86014;
    font-size: 12.5px;
}

.hg-action-value--cart {
    color: #e86014;
    font-size: 14px;
}

/* Mobile Quick Cart (ẩn trên Desktop) */
.hg-mobile-cart {
    display: none;
    position: relative;
    color: var(--hg-primary);
    padding: 5px;
}

/* ==========================================================================
   3. BOTTOM NAV BAR (KHỐI NÂU ĐẬM, 2 HÀNG, STICKY KHI CUỘN)
   ========================================================================== */
.hg-nav {
    background-color: var(--hg-nav-bg);
    position: sticky;
    top: 0;
    z-index: 990;
    width: 100%;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Class active khi cuộn xuống màn hình */
.hg-nav.is-sticky {
    box-shadow: var(--hg-shadow-nav);
    background-color: #462c19;
}

.hg-nav__container {
    display: flex;
    align-items: stretch;
    padding: 0 15px;
}

/* Cột Trái: HOME */
.hg-nav__home {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
}

.hg-nav__home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    color: var(--hg-white) !important;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background-color: var(--hg-nav-dark);
    border-right: 1px solid var(--hg-border-divider);
    height: 100%;
    transition: background-color 0.2s;
}

.hg-nav__home-link:hover {
    background-color: var(--hg-nav-hover);
    color: #ffba7a;
}

/* Khối Giữa: Lưới 2 hàng */
.hg-nav__grid {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hg-nav__row {
    display: flex;
    width: 100%;
}

.hg-nav__row:first-child {
    border-bottom: 1px solid var(--hg-border-divider);
}

/* Từng ô Danh Mục */
.hg-nav__item {
    flex: 1;
    position: relative;
    border-right: 1px solid var(--hg-border-divider);
}

.hg-nav__link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 38px;
    padding: 0 8px;
    color: var(--hg-white);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.hg-nav__arrow {
    display: inline-block;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    opacity: 0.85;
}

.hg-nav__item:hover > .hg-nav__link {
    background-color: var(--hg-nav-dark);
    color: #ffd4b0;
}

.hg-nav__item:hover > .hg-nav__link .hg-nav__arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Cột Phải: VIDEO */
.hg-nav__video {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
}

.hg-nav__video-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    color: var(--hg-white);
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background-color: var(--hg-nav-dark);
    border-left: 1px solid var(--hg-border-divider);
    height: 100%;
    transition: background-color 0.2s;
}

.hg-nav__video-link:hover {
    background-color: var(--hg-nav-hover);
    color: #ffba7a;
}

/* ==========================================================================
   DROPDOWN MENU CON (HOVER TRÊN DESKTOP)
   ========================================================================== */
.hg-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background-color: #ffffff;
    border-top: 3px solid var(--hg-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 4px 4px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 1001;
    pointer-events: none;
}

.hg-nav__item:hover > .hg-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.hg-dropdown li a {
    display: block;
    padding: 8px 18px;
    color: #333333;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    white-space: normal;
    border-bottom: 1px solid #f6f6f6;
    transition: all 0.2s ease;
}

.hg-dropdown li:last-child a {
    border-bottom: none;
}

.hg-dropdown li a:hover {
    background-color: #fef5ee;
    color: var(--hg-primary);
    padding-left: 22px;
}

/* ==========================================================================
   MOBILE DRAWER & OVERLAY (MENU TRƯỢT RESPONSIVE)
   ========================================================================== */
.hg-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.hg-drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.hg-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background-color: #ffffff;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
}

.hg-drawer.is-open {
    transform: translateX(0);
}

/* Drawer Head */
.hg-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #eeeeee;
    background-color: #fafafa;
}

.hg-drawer__logo img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

.hg-drawer__close {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.hg-drawer__close:hover {
    background: #e5e5e5;
    color: #000;
}

/* Drawer Search */
.hg-drawer__search {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.hg-drawer__search-form {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.hg-drawer__search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 12px;
    font-size: 13.5px;
}

.hg-drawer__search-btn {
    border: none;
    background-color: var(--hg-primary);
    color: #fff;
    padding: 0 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drawer Body */
.hg-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 25px 0;
    -webkit-overflow-scrolling: touch;
}

.hg-drawer__menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hg-drawer__link-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f4f4f4;
}

.hg-drawer__link {
    flex: 1;
    display: block;
    padding: 12px 20px;
    color: #222;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.hg-drawer__link:hover {
    color: var(--hg-primary);
}

.hg-drawer__toggle {
    background: none;
    border: none;
    padding: 12px 18px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
}

.hg-drawer__item.is-open > .hg-drawer__link-wrap .hg-drawer__toggle {
    transform: rotate(180deg);
    color: var(--hg-primary);
}

/* Submenu inside Drawer */
.hg-drawer__submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: #fbfbfb;
    display: none;
    border-bottom: 1px solid #eee;
}

.hg-drawer__item.is-open > .hg-drawer__submenu {
    display: block;
}

.hg-drawer__submenu li a {
    display: block;
    padding: 10px 20px 10px 32px;
    font-size: 13.5px;
    color: #555;
    border-bottom: 1px solid #f2f2f2;
}

.hg-drawer__submenu li:last-child a {
    border-bottom: none;
}

.hg-drawer__submenu li a:hover {
    color: var(--hg-primary);
    background-color: #fff;
}

/* Extra links in drawer */
.hg-drawer__divider {
    height: 1px;
    background-color: #eaeaea;
    margin: 15px 20px;
}

.hg-drawer__extra-links {
    list-style: none;
    padding: 0 20px;
    margin: 0 0 15px 0;
}

.hg-drawer__extra-links li a {
    display: block;
    padding: 8px 0;
    color: #444;
    font-size: 13.5px;
    font-weight: 500;
}

.hg-drawer__extra-links li a:hover {
    color: var(--hg-primary);
}

/* Drawer Contact Buttons */
.hg-drawer__contact {
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hg-drawer__contact-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
}

.hg-drawer__contact-btn--phone {
    background-color: #fef0ea;
    color: var(--hg-primary);
    border: 1px solid #ffd4bf;
}

.hg-drawer__contact-btn--email {
    background-color: #f0f7ff;
    color: #0284c7;
    border: 1px solid #c8e4fc;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Màn hình laptop vừa (dưới 1200px) */
@media (max-width: 1200px) {
    .hg-nav__link {
        font-size: 11px;
        padding: 0 5px;
    }

    .hg-nav__home-link,
    .hg-nav__video-link {
        padding: 0 16px;
        font-size: 12.5px;
    }

    .hg-topbar__right ul {
        gap: 12px;
    }

    .hg-midbar__actions {
        gap: 14px;
    }

    .hg-action-value--email {
        font-size: 11.5px;
    }
}

/* Tablet và Mobile (dưới 992px) */
@media (max-width: 991px) {
    /* Ẩn thanh Nav Desktop 2 hàng */
    .hg-nav {
        display: none !important;
    }

    /* Hiển thị nút Hamburger và Cart Mobile */
    .hg-hamburger {
        display: flex;
    }

    .hg-mobile-cart {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Ẩn các action Desktop trên header chính */
    .hg-midbar__actions {
        display: none;
    }

    .hg-topbar__right {
        display: none;
    }

    .hg-topbar__inner {
        justify-content: center;
        text-align: center;
    }

    .hg-topbar__slogan {
        font-size: 12px;
        white-space: normal;
    }

    /* Middle bar trở thành thanh cố định (Sticky) trên mobile */
    .hg-midbar {
        position: sticky;
        top: 0;
        z-index: 990;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        padding: 8px 0;
    }

    .hg-logo-img {
        height: 48px;
    }

    .hg-midbar__search {
        display: none; /* Tìm kiếm đã có sẵn trong Drawer Mobile cực kỳ gọn gàng */
    }
}

/* Điện thoại nhỏ (dưới 576px) */
@media (max-width: 575px) {
    .hg-logo-img {
        height: 42px;
    }

    .hg-topbar {
        padding: 4px 0;
        font-size: 11px;
    }

    .hg-topbar__slogan {
        font-size: 11px;
    }
}
