/*
 * Header Flatsome trình bày giống header của theme noithat cũ:
 * logo bên trái cao hết 2 tầng; tầng trên là ô tìm kiếm nền xám + email | hotline,
 * tầng dưới là menu chữ in hoa dàn đều. Phần tử header vẫn chỉnh trong Customizer (Flatsome → Header).
 */
#header {
	--nth-primary: #2e2a21;
	--nth-accent: #f5c11e;
	--nth-accent-ink: color-mix(in srgb, var(--nth-accent) 55%, #000);
	--nth-line: #eee3c0;
	--nth-logo-w: 134px;
	--nth-gap: 41px;
	box-shadow: 0 1px 0 var(--nth-line);
}
#header .header-main .top-divider { display: none; }

/* ---------- Máy tính ---------- */
@media (min-width: 850px) {
	#header .header-main { height: 65px; }
	#header .header-bottom { min-height: 56px; }
	#header #wide-nav > .flex-row { min-height: 56px; }

	/* Logo nằm ở tầng trên nhưng tràn xuống tầng menu, như header cũ (cao 84px, cách mép trên 18px). */
	#header #logo { width: var(--nth-logo-w); margin-right: var(--nth-gap); align-self: flex-start; height: 65px; position: relative; z-index: 3; }
	#header #logo a { display: block; height: 65px; overflow: visible; }
	#header #logo img.header_logo { max-height: 84px !important; height: 84px; width: auto; margin-top: 18px; }

	/* Tầng trên: ô tìm kiếm giãn ra, email + hotline bên phải. */
	#masthead .flex-col.flex-left.hide-for-medium { display: none; }
	#masthead .flex-col.flex-right.hide-for-medium { flex: 1; min-width: 0; margin-left: 0; padding-top: 14px; padding-bottom: 4px; align-self: stretch; display: flex; align-items: center; }
	#masthead .nav-right { width: 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 28px; }
	#masthead .nav-right > li { margin: 0; }
	#masthead .nav-right > li.header-search-form { flex: 1; max-width: 560px; min-width: 0; }
	#masthead .header-search-form-wrapper,
	#masthead .header-search-form .searchform-wrapper { width: 100%; max-width: none; }
	#masthead .header-contact-wrapper { margin-left: auto !important; }

	/* Ô tìm kiếm nền xám, nút kính lúp không nền. */
	#masthead .searchform { background: #f2f2f2; border-radius: 4px; }
	#masthead .searchform .search-field { height: 47px; background: transparent; border: 0; box-shadow: none; padding: 11px 16px; font-size: 15px; color: #2b2b2b; }
	#masthead .searchform .search-field::placeholder { color: #8a8a8a; }
	#masthead .searchform .ux-search-submit { height: 47px; min-height: 47px; background: transparent !important; border: 0; box-shadow: none; color: var(--nth-accent-ink); padding: 0 16px; }
	#masthead .searchform .ux-search-submit i { font-size: 20px; }

	/* Email | hotline: chữ đậm, không in hoa, biểu tượng màu vàng đậm. */
	#header .header-contact { flex-wrap: nowrap; }
	#header .header-contact > li { margin: 0; }
	#header .header-contact > li + li { border-left: 1px solid var(--nth-line); margin-left: 22px; padding-left: 22px; }
	#header .header-contact > li + li::before,
	#header .nav-divided.header-contact > li + li > a::after { display: none; }
	#header .header-contact a { display: inline-flex; align-items: center; gap: 10px; padding: 0; font-size: 17px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--nth-primary); white-space: nowrap; }
	#header .header-contact a:hover { color: var(--nth-accent-ink); }
	#header .header-contact a i { color: var(--nth-accent-ink); font-size: 18px !important; margin: 0; }
	#header .header-contact a span { margin: 0; }

	/* Tầng dưới: menu bắt đầu thẳng hàng với ô tìm kiếm và dàn đều hết chiều ngang. */
	#wide-nav > .flex-row { padding-left: calc(var(--nth-logo-w) + var(--nth-gap) + 15px); }
	#wide-nav .flex-col.flex-right { display: none; }
	#wide-nav .flex-col.flex-left { flex: 1; min-width: 0; }
	#wide-nav .header-bottom-nav { width: 100%; justify-content: space-between; flex-wrap: nowrap; gap: 4px; }
	#wide-nav .header-bottom-nav > li { margin: 0; }
	#wide-nav .header-bottom-nav > li > a { padding: 14px 4px 16px; font-size: 15.5px; font-weight: 600; letter-spacing: .2px; color: #222; white-space: nowrap; }
	#wide-nav .header-bottom-nav > li.active > a,
	#wide-nav .header-bottom-nav > li.current-menu-ancestor > a,
	#wide-nav .header-bottom-nav > li > a:hover { color: var(--nth-accent-ink); }
	#wide-nav .header-bottom-nav > li > a .icon-angle-down { margin-left: 4px; font-size: 12px; opacity: 1; }

	/* Menu xổ xuống: nền trắng, viền vàng phía trên, bo góc dưới. */
	#wide-nav .nav-dropdown { min-width: 230px; padding: 8px 0; border: 0; border-top: 3px solid var(--nth-accent); border-radius: 0 0 10px 10px; box-shadow: 0 6px 24px rgba(20, 30, 25, .08); }
	#wide-nav .nav-dropdown > li > a { padding: 9px 20px; margin: 0; border: 0; font-size: 15.5px; font-weight: 500; text-transform: none; color: #222; }
	#wide-nav .nav-dropdown > li > a:hover,
	#wide-nav .nav-dropdown > li.active > a { color: var(--nth-accent-ink); background: none; }

	/* Mục menu có class CSS "nt-mega": bảng rộng, 2 cột, chữ đậm in hoa (như theme cũ). */
	#wide-nav .header-bottom-nav > li.nt-mega { position: static; }
	#wide-nav .header-bottom-nav { position: relative; }
	#wide-nav li.nt-mega > .nav-dropdown { left: 0 !important; right: auto; width: min(780px, 100%); padding: 22px 36px; border-top: 0; border-radius: 0; box-shadow: 0 8px 28px rgba(0, 0, 0, .12); display: grid; grid-template-rows: repeat(3, auto); grid-auto-flow: column; grid-auto-columns: 1fr; column-gap: 32px; }
	#wide-nav li.nt-mega > .nav-dropdown > li > a { padding: 9px 0; font-weight: 700; text-transform: uppercase; color: var(--nth-primary); white-space: normal; }
	#wide-nav li.nt-mega > .nav-dropdown::before,
	#wide-nav li.nt-mega > .nav-dropdown::after { display: none; }

	/* Khi cuộn (header dính): ẩn tầng trên (ô tìm kiếm + email | hotline), chỉ còn tầng menu,
	   logo thu nhỏ nằm gọn trong tầng menu. */
	#header .header-wrapper.stuck #masthead { height: 0 !important; min-height: 0; }
	#header .header-wrapper.stuck #masthead .flex-col.flex-right.hide-for-medium { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-8px); transition-duration: .15s; }

	/* Chuyển đổi mượt giữa 2 trạng thái (nhất là khi cuộn về đầu trang): tầng trên giãn ra,
	   logo lớn dần và ô tìm kiếm + liên hệ hiện dần, cùng một nhịp thay vì bật ra tức thì. */
	#header #masthead { transition: height .35s ease !important; }
	#header #logo img.header_logo { transition: height .35s ease, max-height .35s ease, margin-top .35s ease !important; }
	#header #masthead .flex-col.flex-right.hide-for-medium { transition: opacity .3s ease .1s, transform .3s ease .1s, visibility 0s; }
	#header .header-wrapper.stuck #logo,
	#header .header-wrapper.stuck #logo a { height: 0; }
	#header .header-wrapper.stuck #logo img.header_logo { height: 48px; max-height: 48px !important; margin-top: 4px; }
}

@media (min-width: 850px) and (max-width: 1360px) {
	#header { --nth-gap: 24px; }
	#wide-nav .header-bottom-nav > li > a { font-size: 14px; }
	#masthead .nav-right { gap: 18px; }
	#header .header-contact a { font-size: 15px; }
	#header .header-contact > li + li { margin-left: 16px; padding-left: 16px; }
}

/* Màn hình hẹp (máy tính bảng ngang): logo nhỏ hơn, chữ menu nhỏ hơn để đủ 1 dòng, ẩn email (giữ hotline). */
@media (min-width: 850px) and (max-width: 1100px) {
	#header { --nth-logo-w: 100px; --nth-gap: 16px; }
	#header #logo img.header_logo { height: 64px; max-height: 64px !important; margin-top: 22px; }
	#wide-nav .header-bottom-nav { gap: 0; }
	#wide-nav .header-bottom-nav > li > a { font-size: 12.5px; letter-spacing: 0; padding-left: 2px; padding-right: 2px; }
	#header .header-contact > li:first-child { display: none; }
	#header .header-contact > li + li { border-left: 0; margin-left: 0; padding-left: 0; }
}

/* ---------- Điện thoại / máy tính bảng ---------- */
/* Logo bên trái; nút tìm kiếm và nút menu bên phải (nút menu nền be, bo góc). */
@media (max-width: 849px) {
	#header .header-main { height: 66px; }
	#header .header-inner.medium-logo-center { justify-content: space-between; }
	#header .medium-logo-center .logo { order: 1; margin: 0; text-align: left; width: auto !important; }
	#header #logo img.header_logo { margin: 0; max-height: 52px !important; width: auto; }
	#header #logo { width: auto !important; margin: 0; }
	#header .medium-logo-center .flex-left.show-for-medium { order: 3; flex: none; }
	#header .medium-logo-center .flex-right.show-for-medium { order: 2; flex: 1; justify-content: flex-end; }
	#header .mobile-nav { gap: 10px; }
	#header .mobile-nav > li { margin: 0; }
	#header .mobile-nav .header-search > a,
	#header .mobile-nav .nav-icon > a { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; color: #222; }
	#header .mobile-nav .nav-icon > a { width: 42px; height: 42px; background: #f5ecd0; border-radius: 8px; }
	#header .mobile-nav .header-search > a i { font-size: 18px; }
	#header .mobile-nav .nav-icon > a i { font-size: 22px; }
}
