/* =========================================================================
   NgoiSaoXanh — Header (dùng chung mọi trang). Markup: Views/Shared/_Header.cshtml, JS: Contents/JS/nsx/site.js
   - Mặc định: nền xanh đậm mờ + blur, cố định trên cùng; <main> tự chừa chỗ (mockup Document\Header_Abouts.jpg).
   - Từ 1024px có thanh trên cùng (.site-topbar, cao --topbar-h); cuộn xuống thì header trượt lên che thanh này.
   - .is-transparent (trang có slideshow đầu trang): đè lên ảnh, nền mờ 0.2; JS gắn .is-scrolled khi cuộn -> nền đặc.
   - < 1024px: menu thành ngăn kéo bên phải (drawer).
   ========================================================================= */
.header-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 8px; pointer-events: none; }

.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: var(--z-header);
    color: var(--text);
}
/* Nền + blur để ở pseudo-element: backdrop-filter trên chính header sẽ làm drawer (position: fixed) bị giới hạn trong header */
.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--bg-1);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--border);
    transition: opacity var(--dur) var(--ease);
}
/* .is-transparent (trang chủ): nằm đè lên slideshow với nền --bg-0 mờ 0.2; cuộn xuống / mở tìm kiếm / mở menu thì nền đặc (1.0) */
.site-header.is-transparent::before { background: rgba(11, 73, 51, .2); transition: background-color var(--dur) var(--ease); }
.site-header.is-transparent.is-scrolled::before,
.site-header.is-transparent.is-search-open::before,
.site-header.is-transparent.is-nav-open::before { background: var(--bg-0); }

/* chừa chỗ cho header cố định (trừ trang có ảnh đầu trang) */
.site-header:not(.is-transparent) ~ main { padding-top: calc(var(--header-h) + var(--topbar-h)); }

/* ---- Thanh trên cùng: slogan | điện thoại, email | mạng xã hội — ĐANG ẨN theo yêu cầu (display: none + --topbar-h = 0 ở mọi khổ,
   SĐT + email đã có ở cụm .header-contact). Muốn hiện lại: bỏ display: none và đặt lại --topbar-h: 36px trong media 1024px ---- */
.site-topbar {
    display: none;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    background: rgba(8, 51, 36, .55);   /* = --bg-3 */
    color: var(--muted);
    font-size: var(--fs-xs);
}
.site-topbar-inner {
    display: flex; align-items: center; gap: var(--sp-6);
    height: 100%;
    max-width: calc(var(--container-wide) + var(--gutter) * 2);
}
.site-topbar-tagline { margin: 0 auto 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-topbar-contact { display: flex; align-items: center; gap: var(--sp-6); margin: 0; padding: 0; list-style: none; }
.site-topbar-contact a { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-2); white-space: nowrap; }
.site-topbar-contact a:hover { color: var(--text); }
.site-topbar-contact .icon { color: var(--text); }
.site-topbar-social { display: flex; align-items: center; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.site-topbar-social-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    border: 1px solid var(--border-bright);
    border-radius: 50%;
    color: var(--text);
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.site-topbar-social-link .icon { width: 13px; height: 13px; }
.site-topbar-social .icon-fill { fill: currentColor; stroke: none; }
.site-topbar-social-link:hover { border-color: var(--text); background: var(--text); color: var(--bg-0); }
.site-topbar-social-link:focus-visible, .site-topbar-contact a:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.site-header-inner {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    height: var(--header-h);
    max-width: calc(var(--container-wide) + var(--gutter) * 2);
}

/* ---- Logo ---- */
.site-logo { display: inline-flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; color: var(--text); }
.site-logo:hover { color: var(--text); }
.site-logo img { width: auto; height: 46px; }
.site-logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.site-logo-name { color: var(--accent); font-size: 1.0625rem; font-weight: var(--fw-bold); letter-spacing: .02em; text-transform: uppercase; }
.site-logo-slogan { margin-top: 2px; color: var(--text); font-size:11px; font-style: italic; white-space: nowrap; text-align:center;}
.site-logo-name { white-space: nowrap; }

/* ---- Nút icon (tìm kiếm, hamburger, đóng) ---- */
.site-header-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.header-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    color: var(--text);
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.header-icon-btn:hover, .header-icon-btn[aria-expanded="true"] { color: var(--accent); }
.header-icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.site-header-actions .btn { margin-left: var(--sp-2); }
/* Cụm liên hệ (SĐT + email dòng đầu HoTro) trong site-header-actions: icon tròn + 2 dòng chữ; chỉ hiện từ 1280px vì menu đã chiếm gần hết hàng */
.header-contact { display: none; align-items: center; gap: var(--sp-2); margin-right: var(--sp-2); }
.header-contact-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: 1px solid var(--accent-line-strong); border-radius: 50%; color: var(--accent); }
.header-contact-text { display: flex; flex-direction: column; line-height: 1.25; }
.header-contact-phone { color: var(--accent); font-size: var(--fs-sm); font-weight: var(--fw-bold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.header-contact-mail { color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; }
.header-contact-phone:hover { color: var(--accent-2); }
.header-contact-mail:hover { color: var(--text); }
.header-contact a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (min-width: 1280px) {
    .header-contact {/* display: flex; */}
}
/* Icon giỏ hàng + số lượng (chỉ hiện khi giỏ có sản phẩm) */
.header-cart { position: relative; }
.header-cart-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }

.nav-toggle-bars { position: relative; display: block; width: 22px; height: 14px; }
.nav-toggle-bars span {
    position: absolute; left: 0; width: 100%; height: 1.5px; border-radius: 2px;
    background: currentColor;
    transition: transform var(--dur) var(--ease), opacity var(--dur-fast) var(--ease), top var(--dur) var(--ease);
}
.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 6px; }
.nav-toggle-bars span:nth-child(3) { top: 12px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ---- Menu ---- */
.nav-menu { list-style: none; margin: 0; padding: 0; }
.nav-sub { list-style: none; margin: 0; padding: 0; }
.nav-link { display: block; color: var(--text-2); font-size: var(--fs-base); font-weight: var(--fw-medium); }
.nav-link:hover, .nav-item.is-active > .nav-link { color: var(--text); }
/* Dòng menu con: tên bên trái, mũi tên › bên phải (mockup Document\menu-con.jpg) */
.nav-sub a {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
    color: var(--text-2); font-size: var(--fs-sm);
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.nav-sub a:hover, .nav-sub a[aria-current="page"] { color: var(--accent); }
.nav-sub-arrow { flex-shrink: 0; color: var(--muted); transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.nav-sub a:hover .nav-sub-arrow, .nav-sub a[aria-current="page"] .nav-sub-arrow { color: var(--accent); }
.nav-sub-toggle { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.nav-sub-toggle .icon { transition: transform var(--dur) var(--ease); }
.nav-item.is-open > .nav-sub-toggle .icon { transform: rotate(180deg); }

/* ---- Ô tìm kiếm (thả xuống dưới thanh header) ---- */
.site-search { position: relative; border-top: 1px solid var(--border); background: var(--bg-1); }
.site-search-form { display: flex; align-items: center; gap: var(--sp-3); height: 76px; max-width: calc(var(--container-narrow) + var(--gutter) * 2); }
.site-search-input {
    flex: 1; min-width: 0;
    height: 48px;
    border: 0; border-bottom: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text);
    font-size: var(--fs-lead);
}
.site-search-input::placeholder { color: var(--muted-2); }
.site-search-input:focus { outline: none; border-bottom-color: var(--accent); }
.site-search-input::-webkit-search-cancel-button { display: none; }

.nav-backdrop {
    position: fixed; inset: 0;
    z-index: calc(var(--z-header) - 1);
    background: rgba(2, 15, 11, .6);
}

/* ============================== DESKTOP ================================ */
@media (min-width: 1024px) {
    :root { --header-h: 80px; --topbar-h: 0px; }   /* thanh trên cùng đang ẩn (.site-topbar display: none) — để 36px sẽ hở dải trắng trên đầu trang */
    /* Cuộn khỏi đầu trang: trượt cả header lên đúng bằng chiều cao thanh trên cùng (chỉ desktop —
       transform trên header sẽ làm drawer position: fixed của mobile bị giới hạn trong header) */
    .site-header { transition: transform var(--dur) var(--ease); }
    .site-header.is-scrolled { transform: translateY(calc(var(--topbar-h) * -1)); }
    .site-header-actions .header-cta { margin-left: var(--sp-3); }
    .site-logo img { height: 70px; }
    .site-logo-name { font-size:22px; }
    .site-logo-slogan{font-size:14px;}
    .site-nav { margin-left: auto; }
    .site-header-actions { margin-left: clamp(var(--sp-4), 2vw, var(--sp-8)); }
    .nav-menu { display: flex; align-items: center; gap: clamp(var(--sp-4), 2.2vw, var(--sp-10)); }
    .nav-item { position: relative; display: flex; align-items: center; gap: 2px; }
    .nav-link { position: relative; padding: var(--sp-2) 0; }

    /* Gạch chân xanh 2px dưới cả mục (chữ + mũi tên), sát đáy header */
    .nav-item::after {
        content: ""; position: absolute; left: 0; right: 0; bottom: calc(var(--sp-3) * -1); height: 2px;
        background: var(--accent);
        transform: scaleX(0); transform-origin: left;
        transition: transform var(--dur) var(--ease);
        pointer-events: none;
    }
    .nav-item:hover::after, .nav-item.is-active::after, .nav-item.is-open::after { transform: scaleX(1); }

    /* Mục cha đang mở / đang ở trang của nó: chữ + mũi tên xanh */
    .nav-item.is-active > .nav-link, .nav-item.is-open > .nav-link,
    .nav-item.has-sub:hover > .nav-link, .nav-item.has-sub:focus-within > .nav-link { color: var(--accent); }
    .nav-item.is-active > .nav-sub-toggle, .nav-item.is-open > .nav-sub-toggle,
    .nav-item.has-sub:hover > .nav-sub-toggle, .nav-item.has-sub:focus-within > .nav-sub-toggle { color: var(--accent); }
    .nav-sub-toggle { width: 20px; height: 28px; }
    .nav-item.has-sub:hover > .nav-sub-toggle .icon { transform: rotate(180deg); }

    /* dropdown: mở khi hover, khi focus bên trong, hoặc bấm nút mũi tên (.is-open) */
    .nav-sub {
        position: absolute;
        top: calc(100% + var(--sp-3) + var(--sp-2));
        left: calc(var(--sp-3) * -1);
        z-index: var(--z-dropdown);
        min-width: 290px;
        padding: 0;
        border: 1px solid var(--cream-line);
        border-radius: var(--radius-lg);
        background: var(--cream);
        box-shadow: var(--shadow-lg);
        opacity: 0; visibility: hidden;
        transform: translateY(6px);
        transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
    }
    /* cầu nối vô hình để chuột đi từ link xuống dropdown không bị đóng */
    .nav-sub::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: calc(var(--sp-3) + var(--sp-2) + 2px); }
    .nav-item.has-sub:hover > .nav-sub,
    .nav-item.has-sub:focus-within > .nav-sub,
    .nav-item.is-open > .nav-sub {
        opacity: 1; visibility: visible; transform: none;
        transition-delay: 0s;
    }
    /* Dropdown nền kem: chữ tông đậm --cream-ink, vạch ngăn --cream-2 */
    .nav-sub li + li { border-top: 1px solid var(--cream-2); }
    .nav-sub li:first-child a { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .nav-sub li:last-child a { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
    .nav-sub a { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-base); color: var(--cream-ink); }
    .nav-sub-arrow { color: var(--cream-ink-2); }
    /* Dòng đang rê chuột / đang ở trang đó: nền --cream-2, chữ --surface, vạch --surface mép trái */
    .nav-sub a:hover, .nav-sub a:focus-visible, .nav-sub a[aria-current="page"] {
        background: var(--cream-2);
        color: var(--surface);
        box-shadow: inset 2px 0 0 var(--surface);
    }
    .nav-sub a:hover .nav-sub-arrow, .nav-sub a[aria-current="page"] .nav-sub-arrow { color: var(--surface); }
    .nav-sub a:hover .nav-sub-arrow { transform: translateX(3px); }

    .nav-cta { display: none; }
    .nav-backdrop { display: none !important; }
}

/* =========================== MOBILE / TABLET =========================== */
@media (max-width: 1023.98px) {
    .site-header-actions { gap: 0; }

    .site-nav {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        z-index: 1;
        display: flex; flex-direction: column;
        width: min(360px, 86vw);
        padding: calc(var(--header-h) + var(--sp-4)) var(--sp-6) var(--sp-8);
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--bg-1);
        border-left: 1px solid var(--border);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
    }
    .site-header.is-nav-open .site-nav { transform: none; visibility: visible; transition-delay: 0s; }
    /* hàng nút trên cùng (logo, đóng) vẫn nằm trên drawer */
    .site-header-inner > .site-logo, .site-header-actions { position: relative; z-index: 2; }

    .nav-item { display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--border); }
    .nav-link { padding: var(--sp-4) 0; font-size: var(--fs-base); color: var(--text); }
    .nav-item.is-active > .nav-link { color: var(--accent); }
    .nav-sub-toggle { width: 44px; height: 44px; margin-right: calc(var(--sp-3) * -1); }
    .nav-sub { grid-column: 1 / -1; display: none; padding: 0 0 var(--sp-3) var(--sp-4); border-left: 1px solid var(--accent-line); margin-bottom: var(--sp-3); }
    .nav-item.is-open > .nav-sub { display: block; }
    .nav-sub a { padding: var(--sp-2) 0; }
    .nav-cta { margin-top: var(--sp-8); }

    body.nav-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .site-nav, .nav-sub { transition: none !important; }
}

/* =========================================================================
   NgoiSaoXanh — Footer (dùng chung mọi trang). Markup: Views/Shared/_Footer.cshtml, mockup: Document\footer.jpg
   - Trên: thông tin công ty + mạng xã hội (trái) | các cột link theo menu (phải), ngăn bằng vạch dọc từ 1024px.
   - Dưới: dòng bản quyền + link chính sách.
   ========================================================================= */
.site-footer { background: var(--bg-3);background:url(/contents/Design/bg-footer.jpg) right;background-size:cover; border-top: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); }

.footer-main { display: grid; gap: var(--sp-8); grid-template-columns: minmax(0, 1fr); padding-block: var(--sp-10) var(--sp-8); }

.footer-company-name {
    margin: 0 0 var(--sp-3);
    color: var(--text);
    font-size: var(--fs-h4);
    font-weight: var(--fw-bold);
    line-height: 1.3;
    text-transform: uppercase;
}
/* nội dung soạn bằng CKEditor: gọn dòng, link đổi màu khi rê */
.footer-info { line-height: 1.7; }
.footer-info p { margin: 0; }
.footer-info a { color: inherit; }
.footer-info a:hover { color: var(--accent); }

.footer-social { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: var(--sp-5) 0 0; padding: 0; list-style: none; }
.footer-social-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--text);
    transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.footer-social-link:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.footer-social-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.footer-social .icon-fill { fill: currentColor; stroke: none; }

.footer-nav { display: grid; gap: var(--sp-8) var(--sp-6); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.footer-col-title { position: relative; margin: 0 0 var(--sp-4); padding-bottom: var(--sp-3); font-size: var(--fs-base); font-weight: var(--fw-semibold); }
.footer-col-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 40px; height: 2px; background: var(--accent); }
.footer-col-title a { color: var(--text); }
.footer-col-title a:hover { color: var(--accent); }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links a {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
    padding: var(--sp-2) 0;
    color: var(--text-2);
    transition: color var(--dur-fast) var(--ease);
}
.footer-links .icon { color: var(--muted); transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.footer-links a:hover, .footer-links a:hover .icon { color: var(--accent); }
.footer-links a:hover .icon { transform: translateX(3px); }

.footer-bottom {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-6);
    padding-block: var(--sp-4);
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: var(--fs-xs);
}
.footer-copy { margin: 0; }
.footer-legal { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.footer-legal li + li { margin-left: var(--sp-4); padding-left: var(--sp-4); border-left: 1px solid var(--border-strong); }
.footer-legal a { color: inherit; }
.footer-legal a:hover { color: var(--accent); }

@media (min-width: 1024px) {
    .footer-main { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--sp-10); padding-block: var(--sp-12) var(--sp-10); }
    .footer-nav { padding-left: var(--sp-10); border-left: 1px solid var(--border); }
    .footer-bottom { font-size: var(--fs-sm); }
}

/* Chữ nhỏ in đậm → Roboto (quy ước ở cuối nsx/components.css) */
.header-contact-phone,
:where(.site-topbar, .site-logo-slogan, .header-contact-mail, .nav-sub, .site-footer) :is(strong, b) { font-family: var(--font-sm-bold); }
