/*
 * Header — Template 6 "Tạp chí tin tức" (giaiphapwifi, Order T11 #18/#19).
 *
 * Nhân bản từ t3/hf.css (prefix hf-header-t6), bỏ CTA, thêm nút + thanh tìm kiếm.
 * Footer T6 = footer T3 (markup + CSS t3/hf.css) → file này chỉ chứa header.
 * Auto-loaded qua inc/fn-setup-css-js.php (glob assets/css/t6/*.css).
 */

.hf-header-t6 {
  width: 100%;
  background: #ffffff;
  font-family: inherit;
  color: var(--iw-text-primary, #3d3d3d);
  border-bottom: 1px solid #f0f0f0;
}

.hf-header-t6--sticky {
  position: sticky;
  top: 0;
  z-index: 90;
}

.hf-header-t6__inner {
  max-width: var(--iw-container-max, 1488px);
  margin: 0 auto;
  padding: 10px var(--iw-container-pad-x, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ----- Brand --------------------------------------------------------- */
.hf-header-t6__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.hf-header-t6__logo {
  display: block;
  /* Match T1 header logo sizing — switching variant should not jump logo size.
     height/width auto so logo upload (vuông/dọc/ngang) đều không méo. */
  height: auto;
  width: auto;
  max-height: 40px;
  max-width: 200px;
  object-fit: contain;
}
.hf-header-t6__site-title {
  font-weight: 700;
  font-size: 20px;
  color: var(--iw-text-primary, #3d3d3d);
}

/* ----- Desktop nav --------------------------------------------------- */
.hf-header-t6__nav {
  flex: 1 1 auto;
  display: flex;
  /* Default flex-end; Customizer hf_nav_align override qua --hf-nav-align. */
  justify-content: var(--hf-nav-align, flex-end);
}
.hf-header-t6__nav-list {
  display: flex;
  align-items: center;
  gap: 23px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hf-header-t6__nav-item {
  margin: 0;
  padding: 0;
  position: relative;
}
.hf-header-t6__nav-item > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 16px;
  line-height: 22px;
  color: var(--iw-text-primary, #3d3d3d);
  text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
.hf-header-t6__nav-item > a:hover,
.hf-header-t6__nav-item > a:focus-visible {
  background: #f3f3f3;
  color: var(--iw-accent, #2337C6);
}
.hf-header-t6__nav-item.is-current > a {
  background: #f3f3f3;
  color: var(--iw-accent, #2337C6);
}

/* Dropdown chevron */
.hf-header-t6__arrow {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: url("../../img/arrow-down.svg") center / 12px 6px no-repeat;
  flex-shrink: 0;
  transition: transform 0.18s ease-out;
}
.hf-header-t6__nav-item:hover > a .hf-header-t6__arrow,
.hf-header-t6__nav-item:focus-within > a .hf-header-t6__arrow {
  transform: rotate(180deg);
}

/* Sub-menu (level 2) — hover/focus reveal, position absolute under parent. */
.hf-header-t6__sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #ffffff;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0.15s;
  z-index: 100;
}
.hf-header-t6__nav-item:hover > .hf-header-t6__sub-menu,
.hf-header-t6__nav-item:focus-within > .hf-header-t6__sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hf-header-t6__sub-item {
  position: relative;
  margin: 0;
  padding: 0;
}
.hf-header-t6__sub-item > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  color: var(--iw-text-primary, #3d3d3d);
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.hf-header-t6__sub-menu > .hf-header-t6__sub-item:first-child > a {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.hf-header-t6__sub-menu > .hf-header-t6__sub-item:last-child > a {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}
.hf-header-t6__sub-item > a:hover,
.hf-header-t6__sub-item > a:focus-visible {
  background: var(--iw-accent-soft, #eef0fc);
  color: var(--iw-accent, #2337C6);
}
.hf-header-t6__sub-item.is-current > a {
  color: var(--iw-accent, #2337C6);
}

/* Level-3 flyout — bay sang phải item level-2. */
.hf-header-t6__sub-menu--level-3 {
  top: 0;
  left: 100%;
  margin-left: 4px;
}
.hf-header-t6__sub-item--has-children:hover > .hf-header-t6__sub-menu--level-3,
.hf-header-t6__sub-item--has-children:focus-within > .hf-header-t6__sub-menu--level-3 {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hf-header-t6__sub-arrow {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: url("../../img/arrow-down.svg") center / 12px 6px no-repeat;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

/* ----- Mobile menu trigger ------------------------------------------- */
.hf-header-t6__menu-toggle {
  appearance: none;
  margin: 0;
  padding: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hf-header-t6__menu-toggle img {
  display: block;
  width: 24px;
  height: 24px;
}

/* ----- Drawer (mobile) ----------------------------------------------- */
.hf-header-t6__drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.hf-header-t6__drawer-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.hf-header-t6__drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 90vw);
  background: #ffffff;
  z-index: 110;
  transform: translateX(100%);
  transition: transform 0.22s;
  display: flex;
  flex-direction: column;
}
.hf-header-t6__drawer.is-open { transform: translateX(0); }
.hf-header-t6__drawer[hidden] { display: none; }

.hf-header-t6__drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
}
.hf-header-t6__drawer-logo {
  display: block;
  height: 40px;
  width: auto;
}
.hf-header-t6__drawer-close {
  appearance: none;
  margin: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  color: var(--iw-text-primary, #3d3d3d);
}

.hf-header-t6__drawer-nav { flex: 1 1 auto; overflow-y: auto; padding: 8px 0 24px; }
.hf-header-t6__drawer-list,
.hf-header-t6__drawer-sub {
  list-style: none;
  margin: 0;
  padding: 0;
}
.hf-header-t6__drawer-item { margin: 0; }

/* Reset Flatsome button uppercase + chrome on drawer-link buttons. */
.hf-header-t6 .hf-header-t6__drawer-link,
.hf-header-t6 .hf-header-t6__drawer-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 14px 20px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--iw-text-primary, #3d3d3d);
  text-align: left;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  min-height: 0;
  cursor: pointer;
}
.hf-header-t6 .hf-header-t6__drawer-link:hover,
.hf-header-t6 .hf-header-t6__drawer-sub-link:hover {
  background: transparent;
  color: var(--iw-accent, #2337C6);
}

/* Item L1 đang expand → highlight accent. */
.hf-header-t6 .hf-header-t6__drawer-link[aria-expanded="true"] {
  color: var(--iw-accent, #2337C6);
}

.hf-header-t6 .hf-header-t6__drawer-sub-link { padding-left: 36px; }
.hf-header-t6 .hf-header-t6__drawer-sub--l3 .hf-header-t6__drawer-sub-link { padding-left: 56px; }

.hf-header-t6__drawer-chevron {
  width: 16px;
  height: 16px;
  background: url("../../img/arrow-down.svg") center / 12px 6px no-repeat;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
[aria-expanded="true"] > .hf-header-t6__drawer-chevron {
  transform: rotate(180deg);
}


/* ----- Header responsive switches ------------------------------------ */
.hf-header-t6__desktop-only { display: flex; }
.hf-header-t6__mobile-only  { display: none; }

@media (max-width: 1280px) {
  .hf-header-t6__nav-list { gap: 16px; }
  .hf-header-t6__nav-item > a { padding: 8px 6px; }
}
@media (max-width: 991px) {
  .hf-header-t6__desktop-only { display: none !important; }
  .hf-header-t6__mobile-only  { display: inline-flex; }

  .hf-header-t6__inner {
    padding: 8px 16px;
    gap: 12px;
  }
  .hf-header-t6__logo { height: 40px; }

}
/* Sub-menu nhiều cột — bật khi item cấp 1 có nhiều con hơn "Số dòng mỗi cột"
   (Appearance → Menus, xem iw_nav_submenu_rows()). Grid đổ theo cột: mỗi cột
   --iw-sub-rows dòng, cột mới tự sinh. Level-3 flyout giữ nguyên (li relative). */
.hf-header-t6__sub-menu--cols {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--iw-sub-rows, 5), auto);
  column-gap: 8px;
  padding: 8px;
  /* Căn giữa dưới item cha thay vì bám mép trái — nhiều cột rộng, bám trái
     dễ tràn mép phải viewport. Dùng `translate` (tách khỏi `transform` của
     animation reveal). */
  left: 50%;
  translate: -50% 0;
  max-width: calc(100vw - 32px);
}
/* Fallback trình duyệt chưa hỗ trợ `translate` (Chrome <104, Safari <14.1):
   bỏ căn giữa, bám mép trái item cha như dropdown 1 cột cũ. */
@supports not (translate: 0) {
  .hf-header-t6__sub-menu--cols { left: 0; }
}
/* :nth-child(n) để ngang specificity rule bo góc first/last-child ở trên. */
.hf-header-t6__sub-menu--cols > .hf-header-t6__sub-item:nth-child(n) > a {
  border-radius: 6px;
}

/* ----- Đặc thù T6: port bố cục "Main Header" của Magazine Blocks ----- */
.hf-header-t6 { background: #f8f7f7; border-bottom: 0; }
.hf-header-t6__top { border-bottom: 2px solid #c8c7c7; }
.hf-header-t6__inner {
  /* Magazine Blocks: khối nội dung rộng 80% màn hình. */
  width: 80%;
  max-width: var(--iw-container-max, 1488px);
  padding-left: 0;
  padding-right: 0;
}
.hf-header-t6__inner--top { padding-top: 14px; padding-bottom: 14px; }
.hf-header-t6__inner--bottom { padding-top: 4px; padding-bottom: 4px; }
.hf-header-t6__bottom { display: block; }

/* 3 cột 35/30/35 như bản gốc → logo luôn nằm giữa. */
.hf-header-t6__social,
.hf-header-t6__actions { flex: 1 1 35%; min-width: 0; }
.hf-header-t6__actions { justify-content: flex-end; }
.hf-header-t6__brand { flex: 0 1 30%; justify-content: center; }

.hf-header-t6__site-title {
  font-weight: 700;
  font-size: clamp(18px, 4.2vw, 28px);
  line-height: 1.2;
  color: var(--iw-accent, #2337C6);
  white-space: nowrap;
}
.hf-header-t6__drawer-brand .hf-header-t6__site-title { font-size: 18px; }
.hf-header-t6__logo { max-height: 48px; }

/* Mạng xã hội: icon viền tròn, hover tô màu chính (banner-social-icon). */
.hf-header-t6__social .iw-footer-social { margin: 0; gap: 10px; }
.hf-header-t6__social .iw-footer-social__link {
  width: 34px;
  height: 34px;
  color: #000000;
  background: transparent;
  border: 1px solid #000000;
}
.hf-header-t6__social .iw-footer-social__link:hover,
.hf-header-t6__social .iw-footer-social__link:focus-visible {
  color: #ffffff;
  background: var(--iw-accent, #2337C6);
  border-color: var(--iw-accent, #2337C6);
  transform: scale(1.1);
}
.hf-header-t6__social .iw-footer-social__icon { width: 16px; height: 16px; }

/* Menu: chữ đậm 600, cách nhau 40px, căn trái (ul.header-menu). */
.hf-header-t6__nav { justify-content: var(--hf-nav-align, flex-start); }
.hf-header-t6__nav-list { gap: 40px; }
.hf-header-t6__nav-item > a {
  padding: 12px 0;
  border-radius: 0;
  color: #000000;
}
.hf-header-t6__nav-item > a:hover,
.hf-header-t6__nav-item > a:focus-visible,
.hf-header-t6__nav-item.is-current > a { background: transparent; color: var(--iw-accent, #2337C6); }
@media (max-width: 1300px) { .hf-header-t6__nav-list { gap: 30px; } }

.hf-header-t6__actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Nút tìm kiếm (icon kính lúp vẽ bằng mask SVG, đổi màu theo accent). */
.hf-header-t6 .hf-header-t6__search-toggle {
  appearance: none;
  margin: 0;
  padding: 0;
  width: 40px;
  height: 40px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .12s;
}
.hf-header-t6 .hf-header-t6__search-toggle:hover,
.hf-header-t6 .hf-header-t6__search-toggle[aria-expanded="true"] { background: #f3f3f3; }
.hf-header-t6__icon-search {
  display: block;
  width: 20px;
  height: 20px;
  background-color: var(--iw-text-primary, #3d3d3d);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hf-header-t6__search-toggle:hover .hf-header-t6__icon-search,
.hf-header-t6__search-toggle[aria-expanded="true"] .hf-header-t6__icon-search { background-color: var(--iw-accent, #2337C6); }

/* Thanh tìm kiếm thả xuống dưới header. */
.hf-header-t6__search { border-top: 1px solid #e3e2e2; background: #f8f7f7; }
.hf-header-t6__search[hidden] { display: none; }
.hf-header-t6__search-inner {
  max-width: var(--iw-container-max, 1488px);
  margin: 0 auto;
  padding: 12px var(--iw-container-pad-x, 24px);
}
.hf-header-t6__search-form {
  display: flex;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
}
.hf-header-t6 .hf-header-t6__search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid #d9dbe3;
  border-radius: 999px;
  box-shadow: none;
  font-size: 15px;
  background: #ffffff;
}
.hf-header-t6 .hf-header-t6__search-input:focus {
  border-color: var(--iw-accent, #2337C6);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--iw-accent, #2337C6) 15%, transparent);
}
.hf-header-t6 .hf-header-t6__search-submit {
  height: 44px;
  min-height: 0;
  margin: 0;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--iw-accent, #2337C6);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  line-height: 44px;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.hf-header-t6 .hf-header-t6__search-submit:hover { background: var(--iw-accent-strong, #1a2a99); }
.hf-header-t6__drawer-search { padding: 12px 16px 4px; }
.hf-header-t6__drawer-search .hf-header-t6__search-form { max-width: none; }

@media (max-width: 991px) {
  .hf-header-t6__inner { width: auto; padding-left: 16px; padding-right: 16px; }
  .hf-header-t6__bottom { display: none; }
  .hf-header-t6__brand { flex: 0 1 auto; justify-content: flex-start; }
  .hf-header-t6__actions { flex: 0 0 auto; margin-left: auto; }
}

/* Nút chỉ dành cho mobile: rule nút tìm kiếm ở trên có specificity cao hơn .__mobile-only
   → ẩn tường minh trên desktop, hiện lại ≤ 991px. */
.hf-header-t6 .hf-header-t6__mobile-only { display: none; }
@media (max-width: 991px) {
  .hf-header-t6 .hf-header-t6__mobile-only { display: inline-flex; }
}

/* Footer T6 (dùng markup footer T3) — PO 18/11: hàng link ngang luôn xuống dòng riêng dưới logo + dòng
   giới thiệu (kể cả khi ít link, vì đã bỏ link bán hàng) và căn giữa. Chỉ máy tính; điện thoại (≤991px,
   footer xếp dọc căn trái theo t3/hf.css) giữ nguyên. */
@media (min-width: 992px) {
  .hf-footer-t3__nav { flex: 0 0 100%; }
  .hf-footer-t3__nav .hf-footer-t3__nav-list { justify-content: center; }
}
