/* =====================================================================
   POG.VN – B2 HEADER CHÍNH (Phương án A + M1)
   Markup: template-parts/header-main.php · JS: assets/js/header.js
   ≥ 993px: header máy tính (.pog-hd) · ≤ 992px: header điện thoại (.pog-mhd) + menu ☰ (.pog-drawer)
   Cập nhật: 2026-11-17 (B2). Chỉ dùng biến --pog-*.
   ===================================================================== */

/* ---------- Dùng chung ---------- */
.pog-hd svg,
.pog-mhd svg,
.pog-drawer svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pog-hd__badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: var(--pog-radius-full);
  background: var(--pog-primary);
  color: var(--pog-white);
  border: 2px solid var(--pog-white);
  font: var(--pog-fw-black) 10px/14px var(--pog-font);
  text-align: center;
}
/* Ẩn huy hiệu khi giỏ trống (kể cả ở thanh điều hướng dưới) */
.pog-badge.pog-cart-count[data-count="0"] {
  display: none !important;
}

/* =====================================================================
   MÁY TÍNH
   ===================================================================== */
.pog-hd {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: var(--pog-z-sticky);
  background: var(--pog-white);
  border-bottom: 1px solid var(--pog-border);
  font-family: var(--pog-font);
  transition: box-shadow var(--pog-transition-base);
}
.pog-hd.is-stuck {
  box-shadow: 0 6px 20px rgba(var(--pog-dark-rgb), 0.08);
}

.pog-hd__inner {
  max-width: var(--pog-container);
  margin: 0 auto;
  padding: 0 var(--pog-gutter);
  box-sizing: border-box;
  height: 76px;
  display: flex;
  align-items: center;
  gap: var(--pog-space-5);
  transition: height var(--pog-transition-base);
}
.pog-hd.is-stuck .pog-hd__inner {
  height: 64px;
}

.pog-hd__logo {
  flex: none;
  display: flex;
  align-items: center;
}
.pog-hd__logo img {
  display: block;
  width: auto;
  height: 34px;
}

/* Nút Danh mục */
.pog-hd__cat {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 16px;
  border-radius: var(--pog-radius-full);
  background: var(--pog-navy);
  color: var(--pog-white);
  font: var(--pog-fw-bold) 14px/1 var(--pog-font);
  text-decoration: none;
  transition: background var(--pog-transition-fast);
}
.pog-hd__cat:hover,
.pog-hd__cat:focus-visible {
  background: var(--pog-navy-hover);
  color: var(--pog-white);
}
.pog-hd__cat svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* Ô tìm kiếm */
.pog-hd__search {
  position: relative;
  flex: 1;
  min-width: 0;
}
.pog-hd__search form {
  display: flex;
  align-items: center;
  height: 48px;
  margin: 0;
  padding: 0 5px 0 18px;
  box-sizing: border-box;
  background: var(--pog-bg-soft);
  border: 1.5px solid var(--pog-border);
  border-radius: var(--pog-radius-full);
  transition: border-color var(--pog-transition-fast), background var(--pog-transition-fast), box-shadow var(--pog-transition-fast);
}
.pog-hd__search form:focus-within {
  background: var(--pog-white);
  border-color: var(--pog-primary);
  box-shadow: var(--pog-focus-ring);
}
.pog-hd__search form > svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--pog-gray);
  stroke-width: 2;
}
.pog-hd__search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--pog-dark);
  font: var(--pog-fw-medium) 14.5px/1 var(--pog-font);
  -webkit-appearance: none;
  appearance: none;
}
.pog-hd__search input[type="search"]::placeholder {
  color: var(--pog-gray);
  opacity: 1;
}
.pog-hd__search button {
  flex: none;
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--pog-radius-full);
  background: var(--pog-primary);
  color: var(--pog-white);
  font: var(--pog-fw-bold) 14px/1 var(--pog-font);
  cursor: pointer;
  transition: background var(--pog-transition-fast);
}
.pog-hd__search button:hover {
  background: var(--pog-primary-hover);
}

/* Gợi ý tìm kiếm phổ biến */
.pog-hd__suggest {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: var(--pog-z-dropdown);
  padding: var(--pog-space-4);
  background: var(--pog-white);
  border: 1px solid var(--pog-border);
  border-radius: var(--pog-radius-lg);
  box-shadow: var(--pog-shadow-lg);
}
.pog-hd__search:focus-within .pog-hd__suggest {
  display: block;
}
.pog-hd__search.is-closed .pog-hd__suggest {
  display: none;
}
.pog-hd__suggest-title {
  margin: 0 0 var(--pog-space-2);
  color: var(--pog-gray);
  font-size: var(--pog-fs-xs);
  font-weight: var(--pog-fw-bold);
  letter-spacing: var(--pog-ls-caps);
  text-transform: uppercase;
}
.pog-hd__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pog-hd__chips a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--pog-border);
  border-radius: var(--pog-radius-full);
  background: var(--pog-bg-soft);
  color: var(--pog-dark);
  font-size: 13px;
  font-weight: var(--pog-fw-semibold);
  text-decoration: none;
  transition: all var(--pog-transition-fast);
}
.pog-hd__chips a:hover,
.pog-hd__chips a:focus-visible {
  border-color: var(--pog-primary);
  background: var(--pog-primary-light);
  color: var(--pog-primary);
}

/* Tài khoản + Giỏ hàng */
.pog-hd__actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--pog-space-2);
}
.pog-hd__act {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 10px;
  border-radius: var(--pog-radius-md);
  color: var(--pog-dark);
  text-decoration: none;
  transition: background var(--pog-transition-fast);
}
.pog-hd__act:hover {
  background: var(--pog-bg-soft);
  color: var(--pog-dark);
}
.pog-hd__act-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
}
.pog-hd__act-icon svg {
  width: 24px;
  height: 24px;
  color: var(--pog-dark);
  stroke-width: 1.8;
}
.pog-hd__act-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  white-space: nowrap;
}
.pog-hd__act-text small {
  color: var(--pog-gray);
  font-size: 12px;
  font-weight: var(--pog-fw-medium);
}
.pog-hd__act-text b {
  color: var(--pog-dark);
  font-size: 14px;
  font-weight: var(--pog-fw-bold);
}
.pog-hd__act-text b .amount,
.pog-hd__act-text b bdi {
  color: inherit;
  font-weight: inherit;
}

.pog-hd a:focus-visible,
.pog-hd button:focus-visible {
  outline: none;
  box-shadow: var(--pog-focus-ring);
}

/* =====================================================================
   ĐIỆN THOẠI & TABLET
   ===================================================================== */
.pog-mhd {
  display: none;
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: var(--pog-z-sticky);
  background: var(--pog-white);
  border-bottom: 1px solid var(--pog-border);
  font-family: var(--pog-font);
  transition: box-shadow var(--pog-transition-base);
}
.pog-mhd.is-stuck {
  box-shadow: 0 6px 16px rgba(var(--pog-dark-rgb), 0.08);
}
.pog-mhd__row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 0 8px;
}
.pog-mhd__btn {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--pog-radius-md);
  background: none;
  color: var(--pog-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pog-mhd__btn:active {
  background: var(--pog-bg-soft);
}
.pog-mhd__btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.9;
}
.pog-mhd__btn .pog-hd__badge {
  top: 4px;
  right: 2px;
}
.pog-mhd__logo {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pog-mhd__logo img {
  display: block;
  width: auto;
  height: 28px;
}
.pog-mhd__search {
  padding: 0 12px 10px;
}
.pog-mhd__search form {
  display: flex;
  align-items: center;
  height: 42px;
  margin: 0;
  padding: 0 4px 0 14px;
  box-sizing: border-box;
  background: var(--pog-bg-soft);
  border: 1.5px solid var(--pog-border);
  border-radius: var(--pog-radius-full);
}
.pog-mhd__search form:focus-within {
  background: var(--pog-white);
  border-color: var(--pog-primary);
}
.pog-mhd__search form > svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--pog-gray);
  stroke-width: 2;
}
.pog-mhd__search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--pog-dark);
  font: var(--pog-fw-medium) 16px/1 var(--pog-font); /* 16px: iOS không tự phóng to */
  -webkit-appearance: none;
  appearance: none;
}
.pog-mhd__search input[type="search"]::placeholder {
  color: var(--pog-gray);
  opacity: 1;
}
.pog-mhd__search button {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--pog-radius-full);
  background: var(--pog-primary);
  color: var(--pog-white);
  font: var(--pog-fw-bold) 13.5px/1 var(--pog-font);
}

/* =====================================================================
   MENU ☰ (ngăn kéo trượt từ trái)
   ===================================================================== */
.pog-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--pog-z-modal);
  visibility: hidden;
  pointer-events: none;
  font-family: var(--pog-font);
}
.pog-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}
.pog-drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(var(--pog-dark-rgb), 0.5);
  opacity: 0;
  transition: opacity var(--pog-transition-base);
}
.pog-drawer.is-open .pog-drawer__overlay {
  opacity: 1;
}
.pog-drawer__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 86%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  background: var(--pog-white);
  box-shadow: var(--pog-shadow-lg);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pog-drawer.is-open .pog-drawer__panel {
  transform: none;
}
.pog-drawer__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--pog-border);
}
.pog-drawer__head img {
  display: block;
  width: auto;
  height: 26px;
}
.pog-drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--pog-space-3) 0;
}
.pog-drawer__account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 var(--pog-space-4) var(--pog-space-3);
  padding: 12px 14px;
  border-radius: var(--pog-radius-lg);
  background: var(--pog-primary-light);
  color: var(--pog-dark);
  text-decoration: none;
}
.pog-drawer__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--pog-primary);
  color: var(--pog-white);
}
.pog-drawer__avatar svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}
.pog-drawer__account b {
  display: block;
  font-size: 14.5px;
  line-height: 1.3;
}
.pog-drawer__account small {
  color: var(--pog-gray);
  font-size: 12.5px;
}
.pog-drawer__title {
  margin: 0;
  padding: var(--pog-space-3) var(--pog-space-4) var(--pog-space-2);
  color: var(--pog-gray);
  font-size: var(--pog-fs-xs);
  font-weight: var(--pog-fw-bold);
  letter-spacing: var(--pog-ls-caps);
  text-transform: uppercase;
}
.pog-drawer__menu {
  margin: 0;
  padding: 0;
  list-style: none;
}
.pog-drawer__menu li {
  margin: 0;
}
.pog-drawer__menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 var(--pog-space-4);
  border-bottom: 1px solid var(--pog-bg-soft);
  color: var(--pog-dark);
  font-size: 15px;
  font-weight: var(--pog-fw-semibold);
  text-decoration: none;
}
.pog-drawer__menu a:hover,
.pog-drawer__menu a:active {
  background: var(--pog-bg-soft);
}
.pog-drawer__menu a.is-current,
.pog-drawer__menu a.is-hot {
  color: var(--pog-primary);
}
.pog-drawer__menu svg {
  width: 16px;
  height: 16px;
  color: var(--pog-gray-light);
  stroke-width: 2;
}
.pog-drawer__foot {
  flex: none;
  display: grid;
  gap: 8px;
  padding: var(--pog-space-3) var(--pog-space-4) calc(var(--pog-space-4) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--pog-border);
}
.pog-drawer__foot a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--pog-dark);
  font-size: 14px;
  font-weight: var(--pog-fw-semibold);
  text-decoration: none;
}
.pog-drawer__foot svg {
  width: 18px;
  height: 18px;
  color: var(--pog-primary);
  stroke-width: 2;
}
.pog-drawer__foot .pog-drawer__call {
  justify-content: center;
  min-height: 44px;
  border-radius: var(--pog-radius-full);
  background: var(--pog-dark);
  color: var(--pog-white);
}
html.pog-drawer-lock,
html.pog-drawer-lock body {
  overflow: hidden !important;
}

/* =====================================================================
   CHUYỂN ĐỔI MÁY TÍNH ↔ ĐIỆN THOẠI (mốc 992px, đồng bộ topbar & bottom nav)
   ===================================================================== */
@media (max-width: 992px) {
  .pog-hd {
    display: none;
  }
  .pog-mhd {
    display: block;
  }
}
@media (min-width: 993px) {
  .pog-drawer {
    display: none;
  }
}
@media (min-width: 993px) and (max-width: 1100px) {
  .pog-hd__inner {
    gap: var(--pog-space-4);
  }
  .pog-hd__act-text small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pog-hd,
  .pog-hd__inner,
  .pog-drawer__panel,
  .pog-drawer__overlay {
    transition: none;
  }
}
