
/* ===== MPGroup header + search cleanup ===== */

/* убираем локальные поисковики/панели фильтров внутри страниц, оставляем только поиск в верхней панели */
body .mp-toolbar,
body .mp-filter-row,
body .mp-search-wrap,
body .mp-sort-wrap,
body .product-search,
body .catalog-search,
body .catalog-search-panel,
body .section-search,
body .search-panel,
body .search-block,
body .search-section,
body .mp-local-search {
  display: none !important;
}

.topbar {
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 16px !important;
  min-height: 74px !important;
}

.topbar .brand-link,
.topbar .brand {
  flex: 0 0 auto !important;
  min-width: 0 !important;
}

.topbar .logo-wrap {
  width: 54px !important;
  height: 54px !important;
  border-radius: 18px !important;
}

.topbar .brand-name {
  font-size: 15px !important;
  letter-spacing: .12em !important;
}

.topbar .brand-sub {
  font-size: 9.5px !important;
}

.topbar .nav {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 5px !important;
  min-width: 0 !important;
  overflow: visible !important;
}

.topbar .nav a,
.topbar .nav-dropdown > a {
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  font-size: clamp(10.5px, .78vw, 13px) !important;
  padding: 8px 7px !important;
  line-height: 1.1 !important;
}

.topbar .nav a::after {
  left: 7px !important;
  right: 7px !important;
  bottom: 3px !important;
}

.topbar .nav-dropdown {
  flex: 0 0 auto !important;
  position: relative !important;
}

.topbar .nav-dropdown-menu {
  white-space: normal !important;
  z-index: 250 !important;
}

.topbar .nav-dropdown-menu a {
  font-size: 14px !important;
  padding: 12px 14px !important;
}

/* основная кнопка поиска в верхней панели */
.topbar .site-search-trigger {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 40px !important;
  padding: 9px 12px !important;
  margin-left: 4px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

.topbar .site-search-trigger .hint {
  display: none !important;
}

.topbar .back-link,
.topbar .back-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  padding: 11px 16px !important;
  font-size: 13px !important;
}

/* планшеты: оставляем всё в одну строку, но компактнее */
@media (max-width: 1120px) {
  .topbar {
    gap: 7px !important;
    padding: 10px 12px !important;
  }

  .topbar .logo-wrap {
    width: 48px !important;
    height: 48px !important;
  }

  .topbar .brand-name {
    font-size: 13px !important;
    letter-spacing: .09em !important;
  }

  .topbar .brand-sub {
    display: none !important;
  }

  .topbar .nav {
    gap: 3px !important;
  }

  .topbar .nav a,
  .topbar .nav-dropdown > a {
    font-size: 11px !important;
    padding: 7px 5px !important;
  }

  .topbar .site-search-trigger {
    height: 36px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
}

/* телефоны: меню остаётся кнопкой, поиск остаётся в верхней панели */
@media (max-width: 760px) {
  .topbar {
    min-height: 72px !important;
    justify-content: space-between !important;
  }

  .topbar .nav {
    display: none !important;
  }

  .topbar .menu-toggle {
    display: block !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
  }

  .topbar .site-search-trigger {
    order: 2 !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 9px 11px !important;
    font-size: 12px !important;
  }

  .topbar .menu-toggle {
    order: 3 !important;
  }

  .topbar .brand-link {
    order: 1 !important;
  }

  .topbar .back-link,
  .topbar .back-btn {
    width: auto !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    font-size: 12px !important;
  }
}

/* очень узкие экраны: чтобы ничего не ломалось */
@media (max-width: 420px) {
  .topbar {
    gap: 6px !important;
    padding: 10px !important;
  }

  .topbar .logo-wrap {
    width: 42px !important;
    height: 42px !important;
  }

  .topbar .brand-name {
    font-size: 12px !important;
    letter-spacing: .07em !important;
  }

  .topbar .site-search-trigger span:first-child {
    font-size: 0 !important;
  }

  .topbar .site-search-trigger span:first-child::after {
    content: "Пошук";
    font-size: 12px;
  }
}


/* ===== FIX: search overlay must be hidden until user clicks topbar search ===== */
body .site-search-overlay {
  display: none !important;
}

body .site-search-overlay.open {
  display: flex !important;
}

body .site-search-modal {
  display: block !important;
}

body .site-search-input {
  display: block !important;
}

body .topbar .site-search-trigger {
  display: inline-flex !important;
}
