/* ════════════════════════════════════════════
   BARIBAR HEADER v4.0
   #4d5d9a | Forbes scroll | Lang | Admin bar fix
════════════════════════════════════════════ */
:root {
  --hdr-bg:    #4d5d9a;
  --hdr-dark:  #3d4d8a;
  --hdr-text:  rgba(255,255,255,.92);
  --hdr-dim:   rgba(255,255,255,.60);
  --hdr-line:  rgba(255,255,255,.20);
  --hdr-hover: rgba(255,255,255,.13);
  --hdr-h:     72px;
}

/* ── WordPress Admin Bar fix ──────────── */
/* Admin bar is 32px desktop, 46px mobile */
.admin-bar .site-header     { top: 32px; }
.admin-bar body             { padding-top: calc(var(--hdr-h) + 32px) !important; }
.admin-bar .mega            { top: calc(var(--hdr-h) + 32px); }
.admin-bar .mega__backdrop  { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar .site-header   { top: 46px; }
  .admin-bar body           { padding-top: calc(var(--hdr-h) + 46px) !important; }
  .admin-bar .mega          { top: calc(var(--hdr-h) + 46px); }
  .admin-bar .mega__backdrop{ top: 46px; }
}

/* ── Base ────────────────────────────── */
.site-header {
  background: var(--hdr-bg);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  height: var(--hdr-h);
  transform: translateY(0);
  transition: transform .32s cubic-bezier(.4,0,.2,1), box-shadow .2s;
  will-change: transform;
}
.site-header.is-scrolled { box-shadow: 0 3px 18px rgba(0,0,0,.28); }
.site-header.is-hidden   { transform: translateY(-100%); }

/* ── Inner ───────────────────────────── */
.hdr-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: var(--hdr-h);
}

/* ── ① LOGO ─────────────────────────── */
.hdr-logo { padding-right: 20px; flex-shrink: 0; }
.hdr-logo a, .hdr-logo__text {
  font-size: 1.1rem; font-weight: 800;
  letter-spacing: -.03em; color: #fff;
  text-decoration: none; line-height: 1;
  white-space: nowrap; display: block;
}
.hdr-logo a:hover { opacity: .85; }
.hdr-logo .custom-logo {
  height: 28px; width: auto; display: block;
  filter: brightness(0) invert(1);
}

/* ── ② NAV ──────────────────────────── */
.hdr-nav { overflow: hidden; min-width: 0; }
.hdr-nav ul {
  display: flex; align-items: center;
  list-style: none; margin: 0; padding: 0;
  overflow-x: auto; scrollbar-width: none;
}
.hdr-nav ul::-webkit-scrollbar { display: none; }
.hdr-nav li { position: relative; flex-shrink: 0; }
.hdr-nav > ul > li > a {
  display: flex; align-items: center;
  padding: 0 12px; height: var(--hdr-h);
  font-size: 13.5px; font-weight: 500;
  color: var(--hdr-text);
  white-space: nowrap;
  transition: background .15s, color .15s;
  position: relative; gap: 4px;
}
.hdr-nav > ul > li > a::after {
  content: ''; position: absolute; bottom: 0;
  left: 12px; right: 12px; height: 2px;
  background: rgba(255,255,255,.8);
  transform: scaleX(0); transform-origin: left;
  transition: transform .2s;
}
.hdr-nav > ul > li > a:hover,
.hdr-nav > ul > li.current-menu-item > a {
  color: #fff; background: var(--hdr-hover);
}
.hdr-nav > ul > li > a:hover::after,
.hdr-nav > ul > li.current-menu-item > a::after { transform: scaleX(1); }

/* Dropdown arrow */
.hdr-nav > ul > li.menu-item-has-children > a::before {
  content: ''; display: inline-block; margin-left: 3px; flex-shrink: 0;
  width: 0; height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid rgba(255,255,255,.55);
  transition: transform .15s;
}
.hdr-nav > ul > li.menu-item-has-children:hover > a::before { transform: rotate(180deg); }

/* Sub-menu */
.hdr-nav .sub-menu {
  position: absolute; top: 100%; left: 0;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-top: 3px solid var(--hdr-bg);
  border-radius: 0 0 8px 8px;
  min-width: 210px; padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  opacity: 0; visibility: hidden;
  transform: translateY(4px);
  transition: all .16s; z-index: 600;
}
.hdr-nav li:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.hdr-nav .sub-menu a {
  display: block; padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  color: #444; height: auto; line-height: 1.4;
  transition: background .12s, color .12s;
}
.hdr-nav .sub-menu a:hover { background: #f4f4f4; color: #111; }
.hdr-nav .sub-menu a::after { display: none !important; }

/* ── ③ ACTIONS ──────────────────────── */
.hdr-actions {
  display: flex; align-items: center;
  gap: 2px; padding-left: 8px; flex-shrink: 0;
}

/* Icon button */
.hdr-search-btn {
  width: 36px; height: 36px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--hdr-text);
  border: none; background: none; cursor: pointer;
  transition: background .15s; flex-shrink: 0;
}
.hdr-search-btn:hover { background: var(--hdr-hover); }
.hdr-search-btn svg { width: 18px; height: 18px; }

/* ── LANGUAGE SWITCHER — қарапайым ── */
.lang-sw {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 6px;
}
.lang-sw__btn {
  display: block;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--hdr-dim);
  text-decoration: none;
  transition: color .15s, background .15s;
  line-height: 1;
}
.lang-sw__btn:hover {
  color: #fff;
  background: var(--hdr-hover);
}
.lang-sw__btn.is-active {
  color: #fff;
  background: rgba(255,255,255,.18);
}
.lang-sw__sep {
  color: var(--hdr-line);
  font-size: 12px;
  user-select: none;
  line-height: 1;
}

/* ── BURGER ─────────────────────────── */
.hdr-burger {
  width: 36px; height: 36px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  position: relative; border: none; background: none;
  cursor: pointer; transition: background .15s; flex-shrink: 0;
}
.hdr-burger:hover { background: var(--hdr-hover); }
.hdr-burger__bars {
  display: flex; flex-direction: column; gap: 4.5px;
  transition: opacity .18s, transform .18s;
}
.hdr-burger__bars span {
  display: block; width: 18px; height: 1.6px;
  background: rgba(255,255,255,.92); border-radius: 2px;
}
.hdr-burger__x {
  position: absolute; opacity: 0;
  transform: rotate(-45deg) scale(.5);
  transition: opacity .18s, transform .18s;
  color: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
}
.hdr-burger.is-open .hdr-burger__bars { opacity: 0; transform: scale(.5); }
.hdr-burger.is-open .hdr-burger__x    { opacity: 1; transform: rotate(0) scale(1); }

/* ── SEARCH OVERLAY ─────────────────── */
.srch-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 15, 18, 0.94); /* қараңғы фон */
  z-index: 800;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity .22s, visibility .22s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.srch-overlay.is-open { opacity: 1; visibility: visible; }

/* Жабу батырмасы */
.srch-overlay__close {
  position: absolute; top: 20px; right: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, color .15s;
}
.srch-overlay__close:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* Форма */
.srch-overlay__form {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 640px;
  border-bottom: 2px solid rgba(255,255,255,.25);
  padding-bottom: 6px;
  transition: border-color .2s;
}
.srch-overlay__form:focus-within {
  border-bottom-color: rgba(255,255,255,.6);
}
.srch-overlay__form svg { color: rgba(255,255,255,.35); flex-shrink: 0; }

/* Input */
.srch-overlay__form input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 1.6rem; font-weight: 400; color: #fff;
  padding: 10px 0; font-family: var(--font);
  caret-color: #fff;
}
.srch-overlay__form input::placeholder { color: rgba(255,255,255,.3); }

/* Hint */
.srch-overlay__hint {
  margin-top: 16px;
  font-size: 12.5px;
  color: rgba(255,255,255,.3);
  letter-spacing: .02em;
}


/* ── MEGA MENU — tab layout ─────────────── */
.mega {
  position: fixed;
  top: var(--hdr-h); left: 0; right: 0;
  background: #fff;
  border-top: 3px solid var(--hdr-bg);
  z-index: 490;
  overflow-y: auto;
  max-height: calc(100vh - var(--hdr-h));
  opacity: 0; visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .22s, visibility .22s, transform .22s;
  box-shadow: 0 16px 40px rgba(0,0,0,.14);
}
.mega.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

.mega-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 360px;
  max-height: calc(100vh - var(--hdr-h) - 20px);
}

/* LEFT: tab buttons */
.mega-tabs {
  background: var(--hdr-bg);
  border-right: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column;
  padding: 16px 0 0;
  overflow-y: auto;
}
.mega-tab {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px;
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,.55);
  background: none; border: none; cursor: pointer;
  text-align: left; gap: 8px;
  transition: background .12s, color .12s;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.mega-tab:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.mega-tab.is-active {
  background: rgba(255,255,255,.1); color: #fff;
  font-weight: 700; border-left-color: var(--hdr-bg);
}
.mega-tab__arrow {
  flex-shrink: 0; opacity: 0;
  transition: opacity .12s; color: rgba(255,255,255,.5);
}
.mega-tab.is-active .mega-tab__arrow,
.mega-tab:hover .mega-tab__arrow { opacity: 1; }

.mega-tabs__social {
  margin-top: auto; padding: 16px 20px;
  display: flex; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.1);
  background: var(--hdr-dark, #3d4d8a);
  border-radius: 0 0 0 12px;
}
.mega-tabs__soc {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.65);
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}
.mega-tabs__soc:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.35);
  color: #fff;
}

/* RIGHT: panels */
.mega-panels { padding: 28px 32px; overflow-y: auto; }
.mega-panel { display: none; }
.mega-panel.is-active { display: block; }


/* type=menu */
.mega-menu-list { list-style: none; }
.mega-menu-list li { border-bottom: 1px solid #f0f0f0; }
.mega-menu-list li:last-child { border-bottom: none; }
.mega-menu-list > li > a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; font-size: 15px; font-weight: 500; color: #333;
  transition: color .12s, padding-left .12s; gap: 8px;
}
.mega-menu-list > li > a:hover { color: var(--hdr-bg); padding-left: 6px; }
.mega-menu-list .sub-menu { list-style: none; padding: 2px 0 8px 16px; }
.mega-menu-list .sub-menu a { font-size: 13px; font-weight: 400; color: #666; padding: 6px 0; display: block; transition: color .12s, padding-left .12s; }
.mega-menu-list .sub-menu a:hover { color: var(--hdr-bg); padding-left: 4px; }

/* type=text */
.mega-text-block { font-size: 14px; line-height: 1.7; color: #444; max-width: 560px; }
.mega-text-block p { margin-bottom: .9rem; }
.mega-text-block p:last-child { margin-bottom: 0; }
.mega-text-block a { color: var(--hdr-bg); text-decoration: underline; text-underline-offset: 2px; }
.mega-text-block strong { font-weight: 700; color: #111; }
.mega-text-block ul { padding-left: 1.2rem; list-style: disc; }
.mega-text-block li { margin-bottom: .4rem; }
.mega-empty { font-size: 13px; color: #bbb; font-style: italic; }

/* type=posts */
.mega-posts { display: flex; flex-direction: column; }
.mega-post-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f0f0f0; text-decoration: none; }
.mega-post-item:last-child { border-bottom: none; }
.mega-post-item:hover h4 { color: var(--hdr-bg); }
.mega-post-item__img { width: 72px; height: 54px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #f4f4f4; }
.mega-post-item__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.mega-post-item:hover .mega-post-item__img img { transform: scale(1.05); }
.mega-post-item__body { flex: 1; min-width: 0; }
.mega-post-item__cat { font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--hdr-bg); display: block; margin-bottom: 3px; }
.mega-post-item__body h4 { font-size: 13px; font-weight: 600; color: #111; line-height: 1.35; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color .12s; }
.mega-post-item__body p { font-size: 11px; color: #aaa; margin: 0; }

/* Backdrop */
.mega__backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 480; opacity: 0; visibility: hidden; transition: opacity .22s, visibility .22s; }
.mega__backdrop.is-visible { opacity: 1; visibility: visible; }

/* ════ MOBILE HEADER ════ */

/* ── 960px: desktop nav жасырылады ── */
@media (max-width: 960px) {
  .hdr-nav { display: none; }
  .hdr-logo { padding-right: 0; }
}

/* ── 768px ── */
@media (max-width: 768px) {
  :root { --hdr-h: 60px; }

  /* Grid: [LOGO] [1fr bos] [ACTIONS] */
  .hdr-inner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0;
  }

  /* Logo — сол жақта, nav жоқ, padding алынды */
  .hdr-logo { padding-right: 0; }

  /* Actions — оң жақта: lang + search + burger */
  .hdr-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 8px;
    justify-content: flex-end;
  }

  /* Lang */
  .lang-sw { margin: 0 3px; }
  .lang-sw__btn { font-size: 13px; padding: 6px 10px; font-weight: 700; }
  .lang-sw__sep { font-size: 13px; }

  /* Search + burger */
  .hdr-search-btn,
  .hdr-burger { width: 38px; height: 38px; border-radius: 8px; }
  .hdr-search-btn svg { width: 20px; height: 20px; }
  .hdr-burger__bars span { width: 20px; }

  /* Mega: бір баған */
  .mega-layout { grid-template-columns: 1fr; min-height: auto; background: var(--hdr-bg); max-width: 100% !important; padding: 0 !important; }
  .mega-tabs {
    flex-direction: row; overflow-x: auto;
    scrollbar-width: none; padding: 0;
    border-right: none; border-bottom: 1px solid rgba(255,255,255,.15);
    background: var(--hdr-bg);
  }
  .mega-tabs::-webkit-scrollbar { display: none; }
  .mega-tab {
    padding: 11px 20px 11px 20px; border-left: none;
    border-bottom: 2px solid transparent;
    font-size: 13px; white-space: nowrap;
  }
  .mega-tab.is-active {
    border-bottom-color: #fff; border-left: none; background: rgba(255,255,255,.1);
  }
  .mega-tab__arrow { display: none; }
  .mega-tabs__social { display: none; }
  .mega-panels { padding: 10px 18px; }

  /* Мобильді мәзір мәтін түстері — ақсұр */
  .mega-menu-list > li > a {
    color: rgba(255,255,255,.55);
    border-bottom-color: rgba(255,255,255,.1);
  }
  .mega-menu-list > li > a:hover { color: #fff; padding-left: 0; }
  .mega-menu-list li { border-bottom-color: rgba(255,255,255,.1); }
  .mega-menu-list .sub-menu a { color: rgba(255,255,255,.45); }
  .mega-menu-list .sub-menu a:hover { color: #fff; }
  .mega-text-block { color: rgba(255,255,255,.55); }
  .mega-text-block strong { color: #fff; }
  .mega-text-block a { color: rgba(255,255,255,.8); }
  .mega-empty { color: rgba(255,255,255,.35); }
  .mega-post-item { border-bottom-color: rgba(255,255,255,.1); }
  .mega-post-item__body h4 { color: rgba(255,255,255,.9); }
  .mega-post-item__body p { color: rgba(255,255,255,.45); }
  .mega-post-item__cat { color: rgba(255,255,255,.6); }
  .mega-post-item__img { background: rgba(255,255,255,.1); }
  .mega-post-item:hover h4 { color: #fff; }
}

/* ── 480px ── */
@media (max-width: 480px) {
  :root { --hdr-h: 60px; }

  .hdr-logo a, .hdr-logo__text { font-size: 1rem; }
  .hdr-logo .custom-logo { height: 22px; }

  .lang-sw__btn { font-size: 12px; padding: 5px 8px; font-weight: 700; }
  .lang-sw__sep { margin: 0 1px; }

  .hdr-search-btn,
  .hdr-burger { width: 36px; height: 36px; }
  .hdr-search-btn svg { width: 18px; height: 18px; }

  .mega-panels { padding: 10px 18px; }
  .mega-menu-list > li > a { font-size: 14px; }
  .srch-overlay__form input { font-size: 1.15rem; }
}

/* Mobile: mega-layout wrap padding жоқ */
@media (max-width: 768px) {
  .mega > .mega-layout.wrap {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}
