/* ===================================================
   ХЕДЕР
   =================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

/* ====== ВЕРХНЯЯ ПОЛОСА ====== */
.header__top {
  background: #F5F6F7;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.header__top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 36px;
}

.header__top-left,
.header__top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header__top-link {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  transition: color .15s;
}
.header__top-link:hover { color: var(--accent); }

/* ====== ОСНОВНАЯ СТРОКА ====== */
.header__main { background: #fff; }
.header__main-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
}

/* ====== ЛОГОТИП ====== */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo__mark {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo__mark svg {
  width: 30px;
  height: 30px;
  display: block;
}
.logo__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo__text strong {
  font-size: 14px;
  letter-spacing: .5px;
  white-space: nowrap;
}
.logo__text small {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ====== ПОИСК ====== */
.header-search {
  flex: 1;
  min-width: 200px;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F5F6F7;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 4px 0 14px;
  height: 44px;
  transition: background .15s, border-color .15s;
}
.header-search:focus-within {
  background: #fff;
  border-color: var(--accent);
}
.header-search__icon {
  color: var(--text-muted);
  flex-shrink: 0;
}
.header-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  padding: 0;
  outline: none;
}
.header-search input::placeholder { color: var(--text-muted); }

.header-search__btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.header-search__btn:hover { background: var(--accent-hover); }

/* ====== ДЕЙСТВИЯ ====== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.header-action:hover { background: #F5F6F7; color: var(--accent); }
.header-action.is-active {
  color: var(--accent);
  background: #FFF1E8;
  font-weight: 600;
}

.header-action--primary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}
.header-action--primary:hover {
  border-color: var(--accent);
  background: #FFF1E8;
  color: var(--accent);
}

.header-action__label { line-height: 1; }

/* ====== ГОРОД ====== */
.city-dropdown { position: relative; }
.city-dropdown__toggle {
  background: transparent;
  border: none;
  padding: 4px 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .15s;
}
.city-dropdown__toggle:hover { color: var(--accent); }
.city-dropdown__toggle svg { color: var(--text-muted); flex-shrink: 0; }
.city-dropdown__toggle:hover svg { color: var(--accent); }

.city-dropdown__arrow { transition: transform .15s; }
.city-dropdown.is-open .city-dropdown__arrow { transform: rotate(180deg); }

.city-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  z-index: 300;
  max-height: 320px;
  overflow-y: auto;
}
.city-dropdown.is-open .city-dropdown__menu { display: block; }

.city-dropdown__item {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  transition: background .1s;
}
.city-dropdown__item:hover { background: #F5F6F7; }
.city-dropdown__item.is-active {
  background: #FFF1E8;
  color: var(--accent);
  font-weight: 600;
}

/* ====== БУРГЕР ====== */
.burger {
  display: none;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  position: relative;
  flex-shrink: 0;
}
.burger span {
  display: block;
  position: absolute;
  left: 50%;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: transform .2s, opacity .2s;
}
.burger span:nth-child(1) { top: 14px; }
.burger span:nth-child(2) { top: 20px; }
.burger span:nth-child(3) { top: 26px; }

.burger.is-open span:nth-child(1) { transform: translateX(-50%) rotate(45deg); top: 20px; }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateX(-50%) rotate(-45deg); top: 20px; }

/* ====== МОБИЛЬНОЕ МЕНЮ ====== */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -100%;
  width: 320px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  z-index: 200;
  transition: right .3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,.08);
  overflow-y: auto;
}
.mobile-menu.is-open { right: 0; }

.mobile-menu__inner {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100%;
}

.mobile-menu__search {
  display: flex;
  gap: 6px;
  background: #F5F6F7;
  border-radius: 8px;
  padding: 4px 4px 4px 12px;
}
.mobile-menu__search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  padding: 8px 0;
}
.mobile-menu__search button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.mobile-menu__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-menu__list li a {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--text);
  transition: background .1s, color .1s;
}
.mobile-menu__list li a:hover { background: #F5F6F7; }
.mobile-menu__list li a.is-active {
  background: #FFF1E8;
  color: var(--accent);
  font-weight: 600;
}

.mobile-menu__footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mobile-menu__cabinet {
  width: 100%;
  text-align: center;
}
.mobile-menu__logout {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.mobile-menu__logout:hover { color: var(--accent); }

/* === ОВЕРЛЕЙ === */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 150;
  opacity: 0;
  pointer-events: none;   /* ← ключевое: не ловит клики, когда закрыт */
  transition: opacity .3s;
}
.mobile-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;   /* ← включает клики, когда открыт */
}

/* ===================================================
   АДАПТИВ
   =================================================== */

/* Планшет — убираем второстепенное */
@media (max-width: 1024px) {
  .header__top-link:nth-child(2) { display: none; }
  .logo__text small { display: none; }
}

@media (max-width: 900px) {
  .header__main-inner { height: 64px; gap: 16px; }
  .logo__mark { width: 38px; height: 38px; }
  .logo__text strong { font-size: 13px; }
  .header-search__btn { padding: 8px 14px; font-size: 13px; }
  .header-action--hide-mobile { display: none; }
}

/* Мобильный — бургер, поиск компактный, город убираем из верхней полосы */
@media (max-width: 720px) {
  .header__top-inner {
    height: auto;
    padding: 6px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .header__top-right { gap: 12px; flex-wrap: wrap; }
  .header__top-link { font-size: 12px; }

  .header__main-inner { height: 60px; gap: 10px; }
  .burger { display: block; }
  .mobile-menu { display: block; }
  /* ↓ УБРАЛ отсюда .mobile-menu-overlay { display: block } — он не должен быть виден всегда */

  .header-search {
    order: 3;
    width: 100%;
    max-width: none;
    height: 40px;
    padding: 0 4px 0 12px;
  }
  .header-search input { font-size: 14px; }
  .header-search__btn { padding: 7px 14px; font-size: 13px; }

  .header-actions { margin-left: auto; gap: 6px; }
  .header-action { padding: 8px 10px; }
  .header-action:not(.header-action--primary) { display: none; }
  .header-action--primary .header-action__label { display: none; }
  .header-action--primary { padding: 8px 10px; }

  .logo__mark { width: 34px; height: 34px; }
  .logo__text strong { font-size: 12px; letter-spacing: .3px; }

  .header__main-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 0;
  }
}

/* Очень узкий экран */
@media (max-width: 400px) {
  .logo__text { display: none; }
  .header-search { padding-left: 10px; }
  .header-search input { font-size: 13px; }
}