/* ============================================================
   HEADER — referans /header/style.css bilan 1:1 identik
   Container: 1280px (referans), padding 20px
============================================================ */

/* === HEADER === */
.header {
  background: #fff !important;
  border-bottom: 1px solid #f0f0f0 !important;
}

/* Header ichidagi .container — referans 1280px (sayt qolgan qismi 1600px,
   shu sababli specifically header uchun override qilamiz) */
.header .container,
.header .header-inner,
.header .nav-inner {
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.header-inner {
  display: flex !important;
  align-items: center !important;
  gap: 24px !important;
  padding: 14px 20px !important;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.logo-a { color: #f60; }
.logo-e { color: #111; }
.logo-img {
  display: block;
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  /* yuklangan logo oq (eski ko'k header uchun) — qora qilamiz */
  filter: brightness(0);
  opacity: 0.95;
}

/* === SEARCH BOX === */
.search-box {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  border: 2px solid #111 !important;
  border-radius: 30px !important;
  padding: 2px 4px 2px 18px !important;
  height: 42px !important;
  max-width: 520px !important;
  background: #fff !important;
  position: relative; /* dropdown anchor */
}

/* === SEARCH SUGGEST DROPDOWN === */
.search-suggest {
  position: absolute;
  top: calc(100% + 8px); left: 0; right: 0;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(2, 62, 138, 0.18);
  max-height: 480px;
  overflow-y: auto;
  z-index: 1000;
  padding: 6px;
}
.search-suggest[hidden] { display: none !important; }
.search-suggest__item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #1A2332;
  transition: background 0.12s;
}
.search-suggest__item:hover,
.search-suggest__item.is-active {
  background: #F2F5FA;
}
.search-suggest__img {
  flex: 0 0 48px; width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #F7F9FC;
  border: 1px solid #E2E8F0;
}
.search-suggest__img--placeholder {
  background: linear-gradient(135deg, #E5EBF5, #F7F9FC);
}
.search-suggest__body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.search-suggest__name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-suggest__meta {
  display: flex; gap: 8px; align-items: center;
  font-size: 12px;
}
.search-suggest__cat { color: #718096; }
.search-suggest__price { color: #023E8A; font-weight: 700; }
.search-suggest__ask { color: #92400E; font-weight: 600; }
.search-suggest__empty {
  padding: 24px;
  text-align: center;
  color: #718096;
  font-size: 14px;
}
.search-suggest__all {
  display: block;
  text-align: center;
  padding: 12px;
  margin-top: 4px;
  border-top: 1px solid #E2E8F0;
  font-size: 13px; font-weight: 700;
  color: #023E8A;
  text-decoration: none;
  border-radius: 0 0 10px 10px;
}
.search-suggest__all:hover { background: #F2F5FA; }
@media (max-width: 640px) {
  .search-suggest {
    border-radius: 12px;
    max-height: 60vh;
  }
  .search-suggest__img { width: 40px; height: 40px; flex-basis: 40px; }
  .search-suggest__name { font-size: 13px; }
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  color: #666;
  background: transparent;
  height: 100%;
  padding: 0;
  min-width: 0;
}
.search-box input::placeholder { color: #999; }
.search-box input:focus { outline: none; }

.cam-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  color: #222;
  flex-shrink: 0;
}
.cam-btn svg { display: block; stroke: #222; }

.search-btn {
  background: #111 !important;
  border: none !important;
  border-radius: 50% !important;
  width: 34px !important;
  height: 34px !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  padding: 0 !important;
  color: #fff !important;
}
.search-btn svg { display: block !important; stroke: #fff !important; }
.search-btn:hover { background: #000 !important; }

/* === HEADER ITEMS (right side) === */
.header-item {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer;
  font-size: 13px;
  color: #222 !important;
  text-decoration: none !important;
  flex-shrink: 0;
  background: transparent !important;
  border: none;
  font-family: inherit;
  padding: 0;
}
.header-item:hover { color: #000 !important; }
.header-item > svg { display: block; stroke: #222; flex-shrink: 0; }

.flag {
  font-size: 22px;
  display: inline-flex;
  align-items: center;
}
.flag .lang-flag-img {
  width: 24px;
  height: 18px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  object-fit: cover;
  display: block;
}

.hi-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  text-align: left;
}
.hi-top {
  font-size: 11px;
  color: #999;
}
.hi-bottom {
  font-size: 13px;
  color: #222;
  font-weight: 500;
  white-space: nowrap;
}
.hi-bottom b { font-weight: 700; }
.arrow { font-size: 11px; }

/* === CART === */
.cart {
  position: relative;
  flex-direction: column !important;
  gap: 0 !important;
  align-items: center !important;
}
.cart-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.cart-icon svg { display: block; stroke: #222; }

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: #f60 !important;
  color: #fff !important;
  border-radius: 50% !important;
  font-size: 11px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1;
  padding: 0;
  border: none;
  box-sizing: border-box;
}
.cart-badge.is-empty { background: #c0c4c9 !important; }

.cart-text {
  font-size: 12px;
  color: #666 !important;
  margin-top: 2px;
}

/* === NAV (subheader o'rnida) === */
.header .nav,
.nav {
  border-bottom: 1px solid #f0f0f0 !important;
  background: #fff !important;
}

.nav-inner {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 10px 20px !important;
  min-width: 0;
}

.cats-btn {
  background: #f5f5f5 !important;
  border: none !important;
  padding: 10px 22px !important;
  border-radius: 30px !important;
  font-size: 14px !important;
  cursor: pointer;
  font-weight: 500 !important;
  color: #222 !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}
.cats-btn:hover { background: #ececec !important; color: #000 !important; }
.burger { margin-right: 6px; }

.nav-list {
  display: flex !important;
  align-items: center !important;
  gap: 22px !important;
  list-style: none;
  font-size: 14px;
  color: #222;
  margin: 0;
  padding: 0;
}
.nav-list li {
  cursor: pointer;
  margin: 0;
  padding: 0;
}
.nav-list li a {
  color: #222 !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 400;
  display: inline-block;
}
.nav-list li a:hover { color: #f43f5e !important; }
.nav-list .active a,
.nav-list li.active a,
.nav-list .active {
  color: #f43f5e !important;
  font-weight: 700 !important;
}

/* === Chegirmalar (Sale) link — qizil aksent === */
.nav-list .nav-list__sale a,
.nav-list__sale .nav-sale-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #DC2626 !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}
.nav-list .nav-list__sale a:hover {
  color: #B91C1C !important;
}
.nav-list .nav-list__sale.active a {
  color: #DC2626 !important;
  font-weight: 800 !important;
}
.nav-sale-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #DC2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}
.nav-list__sale .nav-sale-link > span:last-child {
  display: inline-block;
  white-space: nowrap;
}

/* === Nav contacts (o'ng tomon) === */
.nav-contacts {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  /* Qisqarishi mumkin — aks holda uzun ish vaqti matni (tilga qarab har xil)
     qatorni ekrandan chiqarib, email kesilib qoladi. */
  flex-shrink: 1;
  min-width: 0;
}
.nav-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #555 !important;
  text-decoration: none !important;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 150ms ease;
}
/* Ish vaqti, telefon, email — qisqarmasin va to'liq ko'rinsin.
   (Qiymat qisqa: "24/7". Agar admin uzun matn kiritsa, qator zichroq bo'ladi,
   lekin elementlar yo'qolmaydi.) */
.nav-contact--hours,
.nav-contact--phone,
.nav-contact--email { flex-shrink: 0; white-space: nowrap; }
.nav-contact:hover { color: #111 !important; }
.nav-contact svg { stroke: #888; flex-shrink: 0; }
.nav-contact:hover svg { stroke: #111; }
.nav-contact--online strong { color: #111; font-weight: 700; }

/* === ESKI SUBHEADER (Django'dagi) — yashiriladi, chunki yangi nav.header ichida === */
.subheader { display: none !important; }
.alibar__utility { display: none !important; }

/* === ESKI ALIBAR CLASSLARNI NEUTRALIZE QILISH ===
   Header.alibar wrapper saqlangan, lekin barcha eski stillarni o'chiramiz. */
.alibar { padding: 0 !important; background: #fff !important; }
.alibar__inner { display: none !important; }
.alibar__catalog { display: none !important; }

/* === Hamburger faqat mobile === */
.hamburger { display: none; }

/* === SCROLL HOLAT — har doim oq === */
body.is-scrolled .header,
body.layout-body.is-scrolled .header {
  background: #fff !important;
}

/* === LANG SWITCHER DROPDOWN === */
.lang-switcher { position: relative; }
.lang-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  color: inherit;
  font-size: 13px;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  list-style: none;
  margin: 0;
  padding: 6px;
  min-width: 220px;
  z-index: 1000;
}
.lang-menu[hidden] { display: none; }
.lang-option-item { margin: 0; padding: 0; }
.lang-option-item form { margin: 0; }
.lang-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #222;
  text-align: left;
  font-family: inherit;
}
.lang-option-btn:hover { background: #f5f5f5; }
.lang-option-item.is-active .lang-option-btn { background: #fff5ec; color: #f60; font-weight: 600; }
.lang-option-flag { display: inline-flex; align-items: center; flex-shrink: 0; }
.lang-option-flag .lang-flag-img { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.12); display: block; object-fit: cover; }
.lang-option-code { font-weight: 700; min-width: 24px; }
.lang-option-name { flex: 1; color: #444; }
.lang-option-check { color: #f60; font-weight: 700; }

/* === CATALOG DROPDOWN (hover desktop) === */
.cats-wrap { position: relative; flex-shrink: 0; }
.cats-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  min-width: 320px;
  max-width: 360px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
  z-index: 1000;
}
.cats-wrap:hover .cats-dropdown,
.cats-wrap:focus-within .cats-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cats-dropdown__list { list-style: none; margin: 0; padding: 0; }
.cats-dropdown__item { margin: 0; padding: 0; }
.cats-dropdown__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: #222 !important;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
}
.cats-dropdown__link:hover { background: #f5f5f5; color: #f60 !important; }

/* === Dropdown ichida "Chegirmadagi mahsulotlar" — qizil aksentli === */
.cats-dropdown__item--sale {
  margin-bottom: 6px !important;
  padding-bottom: 6px !important;
  border-bottom: 1px solid #f3f4f6 !important;
}
.cats-dropdown__link--sale {
  color: #DC2626 !important;
  font-weight: 700 !important;
  background: #FEF2F2;
}
.cats-dropdown__link--sale:hover {
  background: #FEE2E2 !important;
  color: #B91C1C !important;
}
.cats-dropdown__sale-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #DC2626;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}
.cats-dropdown__icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.cats-dropdown__sublist { list-style: none; margin: 0 0 4px 32px; padding: 0; }
.cats-dropdown__sublink {
  display: block;
  padding: 6px 12px;
  text-decoration: none;
  color: #555 !important;
  font-size: 13px;
  border-radius: 4px;
}
.cats-dropdown__sublink:hover { background: #fafafa; color: #f60 !important; }

/* === MOBILE OVERRIDE — eski header-mobile.css ko'k forcer'larni bekor qilish === */
@media (max-width: 1049.98px) {
  /* Asosiy header har doim oq (header-mobile.css'dagi blue forcer override) */
  body .alibar,
  body:not(.is-scrolled) .alibar,
  body.is-scrolled .alibar,
  body.layout-body .alibar,
  body.layout-body:not(.is-scrolled) .alibar,
  body.layout-body.is-scrolled .alibar,
  body .header.alibar,
  body.layout-body .header.alibar,
  body.layout-body.is-scrolled .header.alibar {
    background: #ffffff !important;
    border-bottom: 1px solid #f0f0f0 !important;
  }
  /* Logo matni qora bo'lsin (header-mobile oq qilgan) */
  body:not(.is-scrolled) .logo,
  body:not(.is-scrolled) .logo-a,
  body:not(.is-scrolled) .logo-e { color: #111 !important; }
  body:not(.is-scrolled) .logo-e { color: #111 !important; }
  /* Logo rasm — yangi oq fonda invert kerak emas, brightness(0) saqlanadi */
  body:not(.is-scrolled) .alibar__logo-img--default,
  body:not(.is-scrolled) .alibar__logo-img--scrolled { opacity: 1 !important; }
  /* Hamburger qora */
  body:not(.is-scrolled) .hamburger { color: #222 !important; }
  body:not(.is-scrolled) .hamburger span { background: #222 !important; }
  /* Eski mobile chrome (alibar__utility/mobile/msearch) butunlay yashirin */
  .alibar__utility,
  .alibar__mobile,
  .alibar__msearch { display: none !important; }
}

/* === Responsive === */
@media (max-width: 1280px) {
  .header-item:nth-of-type(2) .hi-text { display: none; } /* "Bepul konsultatsiya" matni yashiriladi */
}
@media (max-width: 1440px) {
  .nav-contact--email { display: none; }
}
@media (max-width: 1280px) {
  .nav-contact--hours { display: none; }
}
@media (max-width: 1024px) {
  .header-inner { gap: 14px !important; padding: 12px 16px !important; }
  .hi-text { display: none; }
  .cart-text { display: none; }
  .search-box { max-width: none !important; }
  .lang-trigger .hi-text { display: none; }
  .nav-contact--online { display: none; }
  .nav-contacts { gap: 12px; }
}
@media (max-width: 768px) {
  /* === MOBILE HEADER — 2 row clean layout (overlap fix 2026-05-17) ===
     Row 1: logo (chap) + (search) + lang + cart + hamburger (o'ng)
     - Search'ni alohida row'ga olib tushiramiz (order trick bilan)
     - Lang + Cart + Hamburger — bitta natural flex satr, overlap yo'q
     - Pastki nav row to'liq yashirin (hamburger drawer'da bor)
  */
  .header-inner {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    column-gap: 6px !important;
    row-gap: 10px !important;
    padding: 10px 14px 14px !important;
  }
  .logo {
    flex-shrink: 0;
    order: 1;
  }
  /* ETAP 2026-05-17: logo kattaroq (avval 36px/120px juda kichik edi) */
  .logo-img { height: 44px !important; max-width: 150px !important; }

  /* Search input 2-qatorga tushadi (order: 99 + flex-basis: 100%).
     ETAP 2026-05-17: pill/dumaloq emas, 4-burchak (rounded rectangle).
     Search-btn to'liq o'ng chekkaga yopishadi (right-padding 0,
     button height va right radius search-box bilan mos). */
  .search-box {
    order: 99 !important;
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 0 0 14px !important;
    height: 44px !important;
    border-width: 1px !important;
    border-color: #E2E8F0 !important;
    border-radius: 10px !important;
    background: #F8FAFC !important;
    overflow: hidden !important;
  }
  .search-box input {
    font-size: 14px !important;
  }
  .search-btn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: var(--color-primary, #023E8A) !important;
    flex-shrink: 0 !important;
  }
  .search-btn:hover { background: var(--color-primary-hover, #03306E) !important; }

  /* O'ng cluster (lang + hamburger) — chapdan keyin, search'dan oldin.
     Savatcha mobile header'dan olib tashlandi — pastki sticky bar (.mobile-cta-bar)
     ichida bor (Katalog + Savatcha). Takror bo'lmasligi uchun yashirin. */
  .header-inner > .header-item.lang-switcher { order: 10; margin-left: auto; }
  .header-inner > .hamburger { order: 12; }

  /* Header items: faqat lang-switcher qoladi.
     "Bepul konsultatsiya", profile/login, savatcha — barchasi yashirin. */
  .header-item:not(.lang-switcher) { display: none !important; }

  /* Mobile: bayroq + "UZ/RU/EN/O'Z" matn yonma-yon.
     "O'zbekiston" matni yashirin — ixcham trigger.
     ETAP fix: 1024px @media .hi-text { display: none } global rule
     bizning hi-bottom'ni ham yashirgan edi → explicit show qilamiz. */
  .lang-switcher .flag {
    display: inline-flex !important;
    align-items: center;
    flex-shrink: 0;
  }
  .lang-switcher .flag .lang-flag-img {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
    object-fit: cover;
    display: block;
  }
  .lang-switcher .hi-text,
  .lang-trigger .hi-text {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 4px;
  }
  .lang-switcher .hi-top { display: none !important; }
  .lang-switcher .hi-bottom {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 700;
    color: #222;
    letter-spacing: 0.3px;
  }
  .lang-switcher .hi-bottom b { font-weight: 700; color: #222; }
  .lang-switcher .arrow { display: inline; font-size: 10px; opacity: 0.6; }
  .lang-switcher .arrow { font-size: 10px; opacity: 0.6; margin-left: 2px; }
  .lang-switcher .lang-trigger {
    gap: 4px;
    padding: 8px 12px;
    min-height: 44px;
    min-width: 56px;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    background: #F8FAFC;
  }
  .lang-switcher .lang-trigger:hover,
  .lang-switcher .lang-trigger:focus-visible {
    background: #F1F5F9;
    border-color: #CBD5E1;
  }

  /* Cart — kompakt, touch target 44px */
  .cart {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 8px;
  }
  .cart-text { display: none; }
  .lang-menu { right: 0; min-width: 200px; }

  /* === Hamburger ko'rinsin — drawer (mobileMenu) uchun === */
  .hamburger,
  body.is-scrolled .hamburger,
  body:not(.is-scrolled) .hamburger,
  body.layout-body .hamburger,
  body.layout-body.is-scrolled .hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    margin-left: 4px;
    background: transparent !important;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    color: #222 !important;
  }
  .hamburger:hover,
  .hamburger:focus-visible {
    background: rgba(0,0,0,0.05) !important;
    outline: none;
  }
  /* Chiziqlar har doim qora — header oq fon + chiziqlar oq bo'lishini oldini olamiz */
  .hamburger span,
  body.is-scrolled .hamburger span,
  body:not(.is-scrolled) .hamburger span,
  body.layout-body .hamburger span,
  body.layout-body.is-scrolled .hamburger span {
    display: block !important;
    width: 22px !important;
    height: 2px !important;
    background: #222 !important;
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 1 !important;
  }
  .hamburger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg) !important; }
  .hamburger.is-open span:nth-child(2) { opacity: 0 !important; }
  .hamburger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg) !important; }

  /* === Pastki nav row mobile'da to'liq yashirin — hamburger drawer ichida bor ===
     Avval gorizontal scroll bilan ko'rsatilardi → header overlap'ga sabab bo'lardi.
  */
  .header .nav {
    display: none !important;
  }
  .header .nav-inner,
  .cats-wrap,
  .cats-btn,
  .nav-list,
  .nav-contacts {
    display: none !important;
  }
}
