/* =====================================================
   HatLand — Header: topbar, main bar, search, mega menu, drawer
   ===================================================== */

/* ---------- Top bar ---------- */
.hl-topbar { background: var(--hl-ink); color: rgba(255,255,255,.92); font-size: 13px; position: relative; z-index: 60; transition: margin-top .3s ease; }
.hl-topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.hl-topbar__text { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.hl-topbar__text .hl-icon { width: 15px; height: 15px; color: var(--hl-accent); }
.hl-topbar__side { display: flex; align-items: center; gap: 18px; }
.hl-topbar__phone { display: inline-flex; align-items: center; gap: 7px; direction: ltr; font-weight: 700; font-size: 12.5px; }
.hl-topbar__phone .hl-icon { width: 14px; height: 14px; }
.hl-topbar__social { display: flex; align-items: center; gap: 4px; }
.hl-topbar__social a {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px;
  color: rgba(255,255,255,.8); transition: all .2s ease;
}
.hl-topbar__social a:hover { background: rgba(255,255,255,.12); color: #fff; }
.hl-topbar__social .hl-icon { width: 16px; height: 16px; }

/* ---------- Header main ---------- */
.hl-header { background: var(--hl-surface); position: sticky; top: 0; z-index: 70; transition: box-shadow .3s ease; }
.hl-header.is-stuck { box-shadow: 0 12px 40px -18px rgba(33,29,25,.25); }
.hl-header__main-in {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: clamp(16px, 3vw, 44px); height: var(--hl-header-h);
}

/* Brand / logo */
.hl-brand a { display: inline-flex; align-items: center; gap: 12px; }
.hl-brand img { max-height: 68px; width: auto; }
.hl-brand__mark {
  width: 50px; height: 50px; border-radius: 16px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--hl-primary), var(--hl-primary-dark));
  display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px -8px rgba(194,89,59,.6);
}
.hl-brand__mark .hl-icon { width: 27px; height: 27px; }
.hl-brand__name { font-size: 23px; font-weight: 800; letter-spacing: -.2px; line-height: 1.3; }
.hl-brand__tag { font-size: 11px; color: var(--hl-ink-soft); font-weight: 500; letter-spacing: .5px; }

/* Search */
.hl-search { position: relative; width: 100%; max-width: 560px; }
.hl-search__box {
  display: flex; align-items: center; background: var(--hl-bg);
  border: 1.5px solid var(--hl-line); border-radius: 999px; overflow: hidden; transition: all .25s ease;
}
.hl-search__box:focus-within { border-color: var(--hl-primary); background: #fff; box-shadow: 0 0 0 4px var(--hl-primary-soft); }
.hl-search__box input { flex: 1; border: 0; background: none; padding: 12px 20px; font-size: 14px; min-width: 0; }
.hl-search__box input:focus { outline: none; box-shadow: none; }
.hl-search__box button {
  width: 50px; align-self: stretch; display: grid; place-items: center;
  color: var(--hl-ink-soft); transition: color .2s;
}
.hl-search__box button:hover { color: var(--hl-primary); }
.hl-search__box button .hl-icon { width: 18px; height: 18px; }
.hl-search__results {
  position: absolute; top: calc(100% + 10px); inset-inline-start: 0; width: 100%; z-index: 90;
  background: #fff; border-radius: var(--hl-radius-lg); box-shadow: var(--hl-shadow-lg);
  border: 1px solid var(--hl-line); padding: 10px; display: none; max-height: 420px; overflow-y: auto;
}
.hl-search__results.is-open { display: block; }
.hl-search__item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--hl-radius-sm); transition: background .15s; }
.hl-search__item:hover { background: var(--hl-bg); }
.hl-search__item img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.hl-search__item-t { font-weight: 600; font-size: 14px; line-height: 1.6; }
.hl-search__item-p { color: var(--hl-primary); font-weight: 700; font-size: 13px; margin-top: 2px; }
.hl-search__empty { padding: 26px 12px; text-align: center; color: var(--hl-ink-soft); font-size: 14px; }
.hl-search__more { display: block; text-align: center; padding: 12px; font-size: 13.5px; font-weight: 700; color: var(--hl-primary); border-top: 1px solid var(--hl-line); margin-top: 6px; }

/* Actions */
.hl-header__actions { display: flex; align-items: center; gap: 8px; }
.hl-action-wrap { position: relative; }
.hl-action {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-radius: 14px; color: var(--hl-ink); transition: all .2s ease;
}
.hl-action:hover { background: var(--hl-primary-soft); color: var(--hl-primary); }
.hl-action .hl-icon { width: 21px; height: 21px; }
.hl-action__label { font-weight: 800; font-size: 13.5px; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-cart-count {
  position: absolute; top: 1px; inset-inline-end: 4px; min-width: 19px; height: 19px;
  padding-inline: 5px; border-radius: 999px; background: var(--hl-primary); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 1;
}

/* پنل هاور آیکون‌ها (حساب کاربری / سبد خرید) */
.hl-action-pop {
  position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 95;
  width: 300px; background: #fff; border: 1px solid var(--hl-line);
  border-radius: var(--hl-radius-lg); box-shadow: var(--hl-shadow-lg); padding: 18px;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all .25s cubic-bezier(.22,1,.36,1);
}
.hl-action-wrap:hover .hl-action-pop, .hl-action-wrap.is-open .hl-action-pop {
  opacity: 1; visibility: visible; transform: translateY(2px);
}
.hl-action-pop::before { content: ''; position: absolute; top: -6px; inset-inline-start: 26px; width: 12px; height: 12px; background: #fff; border-inline-start: 1px solid var(--hl-line); border-top: 1px solid var(--hl-line); transform: rotate(45deg); }
.hl-action-wrap--cart .hl-action-pop { inset-inline-start: auto; inset-inline-end: 0; }
.hl-action-wrap--cart .hl-action-pop::before { inset-inline-start: auto; inset-inline-end: 26px; }
.hl-action-pop__user { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px dashed var(--hl-line); }
.hl-action-pop__user img { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; background: var(--hl-bg); }
.hl-action-pop__name { font-weight: 800; font-size: 14.5px; }
.hl-action-pop__sub { font-size: 12px; color: var(--hl-ink-soft); margin-top: 4px; line-height: 1.8; }
.hl-action-pop__links { display: flex; flex-direction: column; padding-top: 10px; }
.hl-action-pop__links a { padding: 9px 10px; margin-inline: -10px; border-radius: 10px; font-size: 13.5px; font-weight: 600; }
.hl-action-pop__links a:hover { background: var(--hl-bg); color: var(--hl-primary); }
.hl-action-pop__links .hl-logout { color: var(--hl-danger); }
.hl-action-pop__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 7px 0; color: var(--hl-ink-soft); }
.hl-action-pop__row strong { color: var(--hl-ink); font-weight: 800; }
.hl-action-pop__btns { display: flex; gap: 8px; margin-top: 12px; }
.hl-action-pop__btns .hl-btn { flex: 1; }

/* Hamburger (mobile) */
.hl-hamburger { display: none; width: 46px; height: 46px; place-items: center; border-radius: 14px; }
.hl-hamburger .hl-icon { width: 24px; height: 24px; }

/* ---------- Navbar ---------- */
.hl-navbar { border-top: 1px solid var(--hl-line); background: var(--hl-surface); }
.hl-navbar__in { display: flex; align-items: center; gap: 22px; }

/* سوشال منوی هدر — با لیبل و پس‌زمینه واضح */
.hl-navbar__social { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hl-navbar__social a {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--hl-bg); border: 1px solid var(--hl-line); border-radius: 999px;
  padding: 8px 15px; font-weight: 700; font-size: 12.5px; color: var(--hl-ink);
  transition: all .25s ease;
}
.hl-navbar__social a:hover { background: var(--hl-primary); border-color: var(--hl-primary); color: #fff; transform: translateY(-2px); }
.hl-navbar__social .hl-icon { width: 16px; height: 16px; }

/* همه دسته‌بندی‌ها button */
.hl-cats-btn-wrap { position: relative; flex-shrink: 0; }
.hl-cats-btn {
  display: inline-flex; align-items: center; gap: 10px; position: relative;
  background: var(--hl-primary); color: #fff; font-weight: 700; font-size: 14px;
  padding: 13px 22px; margin-block: 10px; border-radius: var(--hl-radius);
  transition: background .2s ease;
}
.hl-cats-btn:hover { background: var(--hl-primary-dark); color: #fff; }
.hl-cats-btn .hl-icon { width: 18px; height: 18px; }
.hl-cats-btn-wrap .hl-mega { inset-inline-start: 0; top: 100%; }
.hl-cats-btn-wrap:hover .hl-mega, .hl-cats-btn.is-open + .hl-mega, .hl-cats-btn:focus-within + .hl-mega { opacity: 1; visibility: visible; transform: translateY(4px); }

/* Menu */
.hl-menu { display: flex; align-items: center; gap: 4px; flex: 1; }
.hl-menu--fallback { justify-content: center; gap: 10px; }
.hl-menu--fallback > li > a { padding: 22px 22px; font-weight: 700; }
.hl-menu > li { position: relative; }
.hl-menu > li > a {
  display: inline-flex; align-items: center; gap: 6px; padding: 22px 14px;
  font-weight: 600; font-size: 14.5px; position: relative; color: var(--hl-ink);
}
.hl-menu > li > a::after {
  content: ''; position: absolute; bottom: 14px; inset-inline: 14px; height: 2px;
  background: var(--hl-primary); border-radius: 2px;
  transform: scaleX(0); transform-origin: center; transition: transform .25s ease;
}
.hl-menu > li:hover > a { color: var(--hl-primary); }
.hl-menu > li:hover > a::after { transform: scaleX(1); }
.hl-menu .sub-arrow { width: 12px; height: 12px; opacity: .55; transition: transform .25s; }
.hl-menu > li:hover .sub-arrow { transform: rotate(180deg); }
.hl-menu > li > a .hl-icon:not(.sub-arrow) { width: 17px; height: 17px; }

/* Dropdown ساده */
.hl-menu .sub-menu {
  position: absolute; top: 100%; inset-inline-start: 0; min-width: 230px; z-index: 80;
  background: #fff; border-radius: var(--hl-radius-lg); box-shadow: var(--hl-shadow-lg);
  border: 1px solid var(--hl-line); padding: 10px; opacity: 0; visibility: hidden;
  transform: translateY(12px); transition: all .25s ease;
}
.hl-menu li:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateY(4px); }
.hl-menu .sub-menu li a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-radius: var(--hl-radius-sm); font-size: 14px; font-weight: 500;
}
.hl-menu .sub-menu li a:hover { background: var(--hl-bg); color: var(--hl-primary); }

/* ---------- Mega menu ---------- */
.hl-mega {
  position: absolute; top: 100%; inset-inline-start: 0; z-index: 85;
  width: min(980px, calc(100vw - 40px));
  background: #fff; border-radius: var(--hl-radius-lg); box-shadow: var(--hl-shadow-lg);
  border: 1px solid var(--hl-line); padding: 26px;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all .28s cubic-bezier(.22,1,.36,1);
}
.hl-menu > li:hover .hl-mega, .hl-cats-btn:hover .hl-mega { opacity: 1; visibility: visible; transform: translateY(4px); }

/* مگا‌منوی دسته‌بندی‌ها (داینامیک) */
.hl-mega--cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px 22px; align-content: start; }
.hl-mega__group-head {
  display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 14.5px;
  padding-bottom: 12px; margin-bottom: 4px; border-bottom: 2px solid var(--hl-bg); grid-column: span 1;
}
.hl-mega__group-head .hl-icon { width: 17px; height: 17px; color: var(--hl-primary); }
.hl-mega__cat { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: var(--hl-radius); transition: background .18s; }
.hl-mega__cat:hover { background: var(--hl-bg); }
.hl-mega__cat img { width: 46px; height: 46px; object-fit: cover; border-radius: 12px; flex-shrink: 0; background: var(--hl-bg); }
.hl-mega__cat-name { font-weight: 600; font-size: 13.5px; line-height: 1.6; }
.hl-mega__cat:hover .hl-mega__cat-name { color: var(--hl-primary); }
.hl-mega__cat-count { font-size: 11.5px; color: var(--hl-ink-soft); }
.hl-mega__promo { grid-column: span 4; display: none; }

/* promo داخل مگا‌منو (اگر تنظیم شود) */
.hl-mega.has-promo { display: grid; grid-template-columns: 1fr 300px; gap: 26px; }
.hl-mega.has-promo .hl-mega__promo { display: block; grid-column: auto; position: relative; border-radius: var(--hl-radius); overflow: hidden; min-height: 220px; }
.hl-mega__promo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hl-mega__promo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(33,29,25,.55), transparent 60%); }
.hl-mega__promo-t { position: absolute; bottom: 16px; inset-inline: 16px; color: #fff; font-weight: 800; font-size: 16px; z-index: 2; }

/* مگا‌منوی ستونی (فرزندان آیتم منو) */
.hl-mega--cols .hl-mega__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 30px; }
.hl-mega--cols .hl-mega__list > li > a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--hl-radius-sm); font-weight: 600; font-size: 14px;
}
.hl-mega--cols .hl-mega__list > li > a:hover { background: var(--hl-bg); color: var(--hl-primary); }
.hl-mega--cols .hl-mega__list > li > a::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--hl-primary); opacity: .5; flex-shrink: 0; }
.hl-mega--cols .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 4px 0 4px 0; min-width: 0; background: none; display: block; }
.hl-mega--cols .sub-menu li a { font-weight: 400; font-size: 13.5px; color: var(--hl-ink-soft); padding: 8px 12px 8px 28px; }

/* ---------- Mobile drawer ---------- */
.hl-drawer-overlay {
  position: fixed; inset: 0; z-index: 95; background: rgba(33,29,25,.55);
  backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: all .3s ease;
}
.hl-drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 96;
  width: min(400px, 88vw); background: var(--hl-surface);
  transform: translateX(100%); transition: transform .35s cubic-bezier(.22,1,.36,1);
  display: flex; flex-direction: column;
}
[dir="rtl"] .hl-drawer { transform: translateX(100%); }
html[dir="ltr"] .hl-drawer { transform: translateX(-100%); }
body.hl-drawer-open .hl-drawer-overlay { opacity: 1; visibility: visible; }
body.hl-drawer-open .hl-drawer { transform: translateX(0) !important; }
body.hl-drawer-open { overflow: hidden; }

.hl-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--hl-line); }
.hl-drawer__head .hl-brand__name { font-size: 18px; }
.hl-drawer__close { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--hl-bg); }
.hl-drawer__close:hover { background: var(--hl-primary-soft); color: var(--hl-primary); }
.hl-drawer__body { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 22px; }
.hl-drawer .hl-search__results { position: static; max-height: 260px; box-shadow: none; border: 1px solid var(--hl-line); margin-top: 8px; }
.hl-drawer__nav > ul > li > a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 4px; font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--hl-bg);
}
.hl-drawer__nav > ul > li > a + .sub-menu { display: none; padding-bottom: 8px; }
.hl-drawer__nav .sub-menu li a { display: block; padding: 9px 18px; font-size: 14px; color: var(--hl-ink-soft); font-weight: 500; }
.hl-drawer__nav .sub-arrow { transition: transform .25s; }
.hl-drawer__nav > ul > li.is-open > a .sub-arrow { transform: rotate(180deg); }
.hl-drawer__cats { background: var(--hl-bg); border-radius: var(--hl-radius); padding: 16px; }
.hl-drawer__cats-title { font-weight: 800; font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.hl-drawer__cats-title .hl-icon { width: 16px; height: 16px; color: var(--hl-primary); }
.hl-drawer__cats a { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; font-weight: 500; color: var(--hl-ink-soft); }
.hl-drawer__cats a:hover { color: var(--hl-primary); }
.hl-drawer__social { display: flex; gap: 10px; }
.hl-drawer__social a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: var(--hl-radius); background: var(--hl-bg); font-weight: 700; font-size: 13px;
}
.hl-drawer__social a:hover { background: var(--hl-primary); color: #fff; }
.hl-drawer__social .hl-icon { width: 17px; height: 17px; }

/* ---------- Sticky adjustments ---------- */
body.admin-bar .hl-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .hl-header { top: 46px; } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .hl-navbar, .hl-topbar { display: none; }
  .hl-header__main-in { grid-template-columns: auto 1fr auto; height: 64px; }
  .hl-search { display: none; }
  .hl-hamburger { display: grid; order: -1; }
  .hl-brand__tag { display: none; }
  .hl-header__actions { gap: 2px; }
  .hl-action { padding: 10px; }
  .hl-action__label { display: none; }
  .hl-action-pop { display: none; }
  .hl-search--drawer { display: block; }
}
@media (min-width: 1081px) {
  .hl-hamburger { display: none; }
}
