header {
  max-width: 1739px;
  width: 100%;
  height: 88px;
  border-radius: 40px;
  background-color: #fff;
  position: relative;
  z-index: 12;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
}

.flexbox {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-map__search .header-map__search__magnifying__glass {
  position: absolute;
}

.header-map__search .header-map__search__magnifying__head {
  position: absolute;
}

/* Добавляем padding на body, который будет работать только для header */
body {
  padding-top: 20px;
}

/* На странице карты добавляем отступ слева для кнопки HELP */
body.map-page {
  padding-left: 72px;
  /* 52px (ширина кнопки) + 10px (отступ кнопки) + 10px (зазор) */
}

@media (max-width: 768px) {
  body.map-page {
    padding-left: 68px;
    /* 48px (ширина кнопки на мобильных) + 10px (отступ) + 10px (зазор) */
  }
}

/* Базовые стили для header */
header.header-map {
  max-width: 1739px;
  width: calc(100% - 60px);
  /* Учитываем padding body */
  height: 88px;
  border-radius: 40px;
  background-color: #fff;
  position: fixed;
  top: 20px;
  /* Соответствует padding-top body */
  left: 53%;
  transform: translateX(-50%);
  z-index: 12;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  box-sizing: border-box;
  /* Убеждаемся что header не наслаивается на кнопку HELP - header центрирован, кнопка в левом углу */
}

/* Убираем правое нижнее скругление у header при активном dropdown */
header.header-map:has(.profile-dropdown.show) {
  border-bottom-right-radius: 0;
}

/* При ширине >=769px укорачиваем header, чтобы между правым краем кнопки HELP и левым краем header было минимум 5px */
/* Кнопка HELP: left: 46px, width: 78px, правый край = 124px, минимальный отступ = 5px, итого левый край header >= 129px */
/* Header центрирован: left: 54%, transform: translateX(-50%), значит левый край = 54% - width/2 */
/* Нужно: 54% - width/2 >= 129px, отсюда: width <= 2 * (54% - 129px) = 1.08 * 100vw - 258px */
@media (min-width: 769px) {
  header.header-map {
    max-width: clamp(0px, calc(1.08 * 100vw - 258px), 1739px);
  }
}

/* При ширине <=768px сдвигаем header вправо, чтобы не перекрывать кнопку HELP */
@media (max-width: 768px) {
  header.header-map {
    /* Сдвигаем header вправо на половину ширины кнопки HELP + отступы (52px + 10px + 10px = 72px / 2 = 36px) */
    left: calc(50% + 56px);
    transform: translateX(-50%);
  }
}

/* На маленьких экранах убеждаемся что header не перекрывает кнопку HELP */
@media (max-width: 500px) {
  header.header-map {
    /* На очень маленьких экранах сдвигаем header вправо, если он может перекрыть кнопку */
    left: calc(50% + 36px);
    transform: translateX(-50%);
  }
}

/* Предотвращаем переполнение на всех размерах */
header.header-map * {
  max-width: 100%;
  box-sizing: border-box;
}

.header-profile__settings {
  margin-left: 10px;
}

/*.header-profile__settings button {
  border-radius: 50%;
  background: #ededed;
  text-align: center;
  width: 60px;
  height: 60px;
  margin: 0 20px;
}*/

.header-profile__settings img {
  margin-right: 10px;
}

.header-profile__settings a {
  text-decoration: none;
}

/* Стили для кнопки заказов (аналогично news-btn) */
.orders-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-block;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.orders-btn:hover {
  transform: scale(1.1);
}

.orders-btn:focus {
  outline: none;
}

.orders-btn:focus-visible {
  outline: 2px solid rgba(0, 4, 227, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Изображение внутри кнопки должно наследовать стили от .header-profile__settings img */
.orders-btn img {
  display: block;
  pointer-events: none;
}

/* SVG и другие дочерние элементы не должны блокировать клики */
.orders-btn svg,
.orders-btn .bottom-nav-icon {
  pointer-events: none;
}

/* Стили для кнопки сигналов (аналогично news-btn и orders-btn) */
.signals-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-block;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.signals-btn:hover {
  transform: scale(1.1);
}

.signals-btn:focus {
  outline: none;
}

.signals-btn:focus-visible {
  outline: 2px solid rgba(0, 4, 227, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Изображение внутри кнопки должно наследовать стили от .header-profile__settings img */
.signals-btn img {
  display: block;
  pointer-events: none;
}

/* SVG и другие дочерние элементы не должны блокировать клики */
.signals-btn svg,
.signals-btn .bottom-nav-icon {
  pointer-events: none;
}

/* Стили для кнопки избранного (аналогично news-btn, orders-btn и signals-btn) */
.favorites-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-block;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.favorites-btn:hover {
  transform: scale(1.1);
}

.favorites-btn:focus {
  outline: none;
}

.favorites-btn:focus-visible {
  outline: 2px solid rgba(0, 4, 227, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Изображение внутри кнопки должно наследовать стили от .header-profile__settings img */
.favorites-btn img {
  display: block;
  pointer-events: none;
}

/* SVG и другие дочерние элементы не должны блокировать клики */
.favorites-btn svg,
.favorites-btn .bottom-nav-icon {
  pointer-events: none;
}

.flexbox {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-profile__account__status {
  margin-right: 26px;
  display: flex;
  flex-direction: column;
  align-items: end;
}

.header-profile__account__status img {
  width: 108px;
  height: 17px;
}

.header-profile__account__rating {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0px;
}

.header-content {
  display: flex;
  justify-content: end;
  max-width: 2090px;
  width: 100%;
  align-items: center;
  position: relative;
  box-sizing: border-box;

  margin: 0 auto;
}

/* Обеспечиваем правильное позиционирование header-content */
.header-content>* {
  flex-shrink: 1;
  min-width: 0;
}

/* Адаптивные стили для header-content */
@media (max-width: 1400px) {
  .header-content {
    max-width: 100%;
    padding: 0 10px;
  }
}

@media (max-width: 1200px) {
  .header-content {
    max-width: 100%;
    padding: 0 8px;
  }

  .account-header__help-wrapper {
    left: 20px;
  }

  .header-profile__settings {
    margin-right: 20px;
    gap: 5px;
  }

  .header-profile__settings img {
    width: 40px;
    height: 40px;
  }

  .header-profile__account__status {
    margin-right: 15px;
  }

  .header-profile__account__status p {
    font-size: 14px;
  }

  .header-profile__account__status img {
    width: 80px;
    height: 14px;
  }
}

@media (max-width: 1024px) {
  .header-content {
    max-width: 100%;
    padding: 0 5px;
  }

  .account-header__help-wrapper {
    left: 10px;
  }

  .header-profile__settings {
    margin-right: 10px;
    gap: 5px;
  }

  .header-profile__settings img {
    margin-right: 3px !important;
    width: 35px;
    height: 35px;
  }

  .header-profile__account__status {
    margin-right: 10px;
  }

  .header-profile__account__status p {
    font-size: 12px !important;
    line-height: 1.2;
  }

  .header-profile__account__status img {
    width: 70px;
    height: 12px;
  }
}

@media (max-width: 1000px) {
  .header-map__profile {
    margin-left: 20px;
  }
}

@media (max-width: 768px) {
  .header-content {
    max-width: 100%;
    padding: 0;
    justify-content: space-between;
  }

  .header-map__profile {
    display: none;
  }

  .has {
    display: none !important;
  }

  .account-header__item {
    position: relative;
  }

  .account-header__help-wrapper {
    left: 5px;
    position: absolute;
    right: auto;
  }

  .account-header__help-wrapper--desktop {
    display: flex !important;
  }

  .header-profile__settings {
    margin-right: 5px;
    gap: 8px;
  }

  .header-profile__settings img {
    margin-right: 3px !important;
    width: 30px;
    height: 30px;
  }

  .header-profile__account__status {
    display: none;
  }

  .header-map__profile__account {
    gap: 5px;
  }

  .header-map__search {
    flex: 1;
    max-width: calc(100% - 120px);
    margin: 0 5px;
  }
}

@media (max-width: 480px) {
  .header-content {
    max-width: 100%;
    padding: 0;
  }

  .header-profile__settings {
    margin-right: 3px;
    gap: 5px;
  }

  .header-profile__settings img {
    margin-right: 5px;
    width: 25px;
    height: 25px;
  }

  .header-map__search {
    max-width: calc(100% - 100px);
    margin: 0 3px;
  }

  .header-map__logo img {
    width: 30px;
    height: auto;
  }
}

@media (max-width: 360px) {
  .header-content {
    max-width: 100%;
  }

  .header-profile__settings {
    gap: 4px;
  }

  .header-profile__settings img {
    width: 25px;
    height: 25px;
    margin-right: 4px;
  }

  .header-map__search {
    max-width: calc(100% - 90px);
  }
}

.map-setting__line {
  width: 48px;
  height: 1px;
  background: var(--color-blue-83, #c9c9dd);
}

/* HELP кнопка всегда видна на всех устройствах */
.account-header__help-wrapper--desktop {
  display: flex !important;
  position: relative;
  align-items: center;
  flex-shrink: 0;
  z-index: 1001;
}

/* Адаптивные размеры для HELP кнопки */
@media (max-width: 768px) {
  .account-header__help-wrapper {
    left: 5px;
    position: absolute;
    right: auto;
  }

  .account-header__help-wrapper--desktop {
    display: flex !important;
  }

  .account-header__help-wrapper--desktop .sos-btn {
    width: 50px;
    height: 50px;
    font-size: 11px;
  }

  .account-header__help-wrapper--desktop .sos-ring {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .account-header__help-wrapper {
    left: 3px;
  }

  .account-header__help-wrapper--desktop .sos-btn {
    width: 46px;
    height: 46px;
    font-size: 10px;
  }

  .account-header__help-wrapper--desktop .sos-ring {
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 360px) {
  .account-header__help-wrapper {
    left: 2px;
  }

  .account-header__help-wrapper--desktop .sos-btn {
    width: 42px;
    height: 42px;
    font-size: 9px;
  }

  .account-header__help-wrapper--desktop .sos-ring {
    width: 42px;
    height: 42px;
  }
}

.map-settings {
  align-items: center;
  display: flex;
  width: 40px !important;
  height: 80px !important;
  padding: 11px 13px 10px 12px;
  flex-direction: column;
  justify-content: center;
  gap: 0px;
  border-radius: 50px;
  background: #DAF2FA;
}

.map-settings__icon {
  width: 40px;
  height: 40px;
  text-align: center;
}

.map-settings__item {
  display: flex;
  height: 48px;
  padding: 12px;
  width: 48px;
  align-items: center;
  gap: 10px;
  align-self: stretch;
  border-radius: 24px;
  background: #fff;
}

.header-map__search {
  position: relative;
  flex: 1;
  max-width: 619px;
  margin: 0 auto;
  min-width: 0;
}

.header-map__search__input-wrapper {
  position: relative;
    width: 100%;
    max-width: 639px !important;
    margin: 0 73px 0 73px;
    height: 70px;
    flex: 1;
    display: flex;
    align-items: center;
    /* max-width: 400px; */
    min-width: 0;
    background: #DAF2FA;
    border-radius: 50px;
}

.header-profile__account__status p {
  color: #000;
  text-align: right;
  font-family: Inter;
  font-size: 17px;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
}

.header-map__profile__account {
  cursor: pointer;
  transition: opacity 0.2s ease;
  user-select: none;
}

.header-map__profile__account:hover {
  opacity: 0.8;
}

.header-map__search input[type="text"] {
  padding-left: 70px;
}

.header-map__search__input-wrapper input {
  width: 100%;
  max-width: 828px;
  height: 70px;
  border-radius: 40px;
  position: relative;
  border: 0;
  background: #ededed;
  padding: 0 50px 0 80px;
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #000;
  outline: none;
  transition: all 0.3s ease;
  flex: 1;
}

.header-map__search input {
  width: 100%;
  max-width: 553px;
  height: 47px;
  border-radius: 40px;
  position: relative;
  margin-left: 12px;
  margin-right: 74px;
  border: 0;
  background: #fff;
  padding: 0 50px 0 40px;
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #000;
  outline: none;
  transition: all 0.3s ease;
}

.header-map__logo img {
  width: 112px;
  margin-left: 74px;
}

.header-map__search__input-wrapper input::placeholder,
.header-map__search input::placeholder {
  color: #999;
  font-size: 16px;
  padding-left: 5px;
  font-weight: 400;
}

.header-map__search__input-wrapper input:focus,
.header-map__search input:focus {
  background: #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-map__search .header-map__search__magnifying__glass {
  height: 23px;
    position: absolute;
    left: 100px;
    top: 50%;
    width: 23px;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.header-map__search__input-wrapper .header-map__search__magnifying__head,
.header-map__search .header-map__search__magnifying__head {
  position: absolute;
  right: 14px;
  border-radius: 50px;
}

@media (max-width: 1548px) {
  .header-map__search__magnifying__head {
    right: 10px !important;
  }
}

@media (max-width: 1024px) {
  body {
    padding-top: 15px;
  }
  .header-map__search__input-wrapper {
    margin: 0 20px 0 20px;
  }
}

/* Адаптивные стили для плаjншетов */
@media (max-width: 1310px) {
  .header-map__logo img {
    width: 90px;
    margin-left: 10px;
  }
  .header-map__search__input-wrapper {
    margin: 0 30px 0 0px;
  }
  .header-map__search .header-map__search__magnifying__glass {
    left: 30px;
  }

  header.header-map {
    width: calc(100% - 130px);
    max-width: 100%;
    top: 15px;
    height: 80px;
    padding: 0 10px;
    border-radius: 35px;
    /* На планшетах header может быть широким, но все равно не должен перекрывать HELP */
    left: 55%;
    transform: translateX(-50%);
  }

  .header-map__search__input-wrapper {
    width: 100%;
    max-width: 100%;
  }

  .header-map__search__input-wrapper input,
  .header-map__search input {
    width: 100%;
    max-width: 100%;
    height: 47px;
    padding: 0 45px 0 45px;
    font-size: 14px;
  }

  .header-map__search {
    flex: 1;
    min-width: 0;
  }
}

.header-profile__account__photo img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
}

.header-profile__account__heart {
  position: absolute;
  width: 48px !important;
  height: 45px !important;
  right: -10px;
  top: 36px;
}

@media (max-width: 970px) {
  .header-map__search__input-wrapper {
    margin: 0 0px 0 0px;
  }
  .header-map__search .header-map__search__magnifying__glass {
    left: 25px;
  }

}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 768px) {
  body {
    padding-top: 12px;
    padding-bottom: 70px;
    /* Отступ для bottom-nav */
  }

  header.header-map {
    width: calc(100% - 86px);
    max-width: 100%;
    top: 12px;
    height: 70px;
    padding: 0 8px;
    border-radius: 30px;
    background: none;
    z-index: 10003 !important; /* Выше left-drawer, чтобы поисковик был виден */
  }

  .header-map__search {
    max-width: 100%;
    flex: 1;
    min-width: 0;
  }

  .header-map__search__input-wrapper input,
  .header-map__search input {
    width: 100%;
    max-width: 100%;
    height: 50px;
    padding: 0 35px 0 35px;
    font-size: 13px;
  }

  .header-map__search .header-map__search__magnifying__glass {
    left: 25px;
    width: 18px;
    height: 18px;
  }

  .header-map__search__input-wrapper .header-map__search__magnifying__head,
  .header-map__search .header-map__search__magnifying__head {
    right: 6px;
    width: 40px;
    height: 40px;
  }

  .header-map__logo {
    flex-shrink: 0;
  }

  .header-map__logo img {
    max-width: 40px;
    height: auto;
  }

  .header-map__profile {
    gap: 5px;
    flex-shrink: 0;
  }

  .header-profile__account__photo img {
    width: 35px;
    height: 35px;
  }
}

/* Адаптивные стили для маленьких мобильных */
@media (max-width: 480px) {
  body {
    padding-top: 10px;
    padding-bottom: 70px;
    /* Отступ для bottom-nav */
  }

  header.header-map {
    width: calc(100% - 90px);
    max-width: 100%;
    top: 10px;
    left: 57%;
    height: 60px;
    touch-action: manipulation;
    padding: 0 6px;
    border-radius: 25px;
  }

  .header-map__search {
    flex: 1;
    min-width: 0;
  }

  .header-map__search__input-wrapper input,
  .header-map__search input {
    width: 100%;
    max-width: 100%;
    height: 45px;
    padding: 0 30px 0 30px;
    font-size: 12px;
  }

  .header-map__search .header-map__search__magnifying__glass {
    left: 20px;
    width: 16px;
    height: 16px;
  }

  .header-map__search__input-wrapper .header-map__search__magnifying__head,
  .header-map__search .header-map__search__magnifying__head {
    right: 5px;
    width: 38px;
    height: 38px;
  }

  .header-map__logo img {
    max-width: 35px;
    height: auto;
  }

  .header-profile__account__photo img {
    width: 30px;
    height: 30px;
  }
}

/* Адаптивные стили для очень маленьких экранов */
@media (max-width: 360px) {
  body {
    padding-top: 8px;
    padding-bottom: 70px;
    /* Отступ для bottom-nav */
  }

  .header-map__search__input-wrapper {
    max-width: none !important;
    width: 244px !important;
  }

  .header-map__search__magnifying__head {
    right: 14px !important;
  }

  header.header-map {
    width: calc(100% - 89px);
    max-width: 100%;
    top: 8px;
    height: 55px;
    padding: 0 5px;
    border-radius: 20px;
  }

  .header-map__search {
    flex: 1;
    min-width: 0;
  }

  .header-map__search__input-wrapper input,
  .header-map__search input {
    width: 100%;
    max-width: 299px;
    height: 40px;
    padding: 0 28px 0 28px;
    font-size: 11px;
  }

  .header-map__search .header-map__search__magnifying__glass {
    left: 22px;
    width: 14px;
    height: 14px;
  }

  .header-map__search__input-wrapper .header-map__search__magnifying__head,
  .header-map__search .header-map__search__magnifying__head {
    right: 4px;
    width: 26px;
    height: 26px;
  }

  .header-map__logo img {
    max-width: 30px;
  }

  .header-profile__account__photo img {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 391px) {
  .page-title__rubirika__links button[role="tab"][aria-selected="false"] {
    background-color: #ffffff;
    color: #666;
    font-size: 11px !important;
  }
}

.page-title__rubirika__links button[role="tab"][aria-selected="false"] {
  background-color: #ffffff;
  color: #666;
}

/* Эффект при наведении на неактивные вкладки */
.page-title__rubirika__links button[role="tab"][aria-selected="false"]:hover {
  background-color: #f8f8f8;
  color: #333;
}

/* Стили для активной вкладки */
.page-title__rubirika__links button[role="tab"][aria-selected="true"] {
  color: #000;
  font-family: Inter;
  font-size: 16px;
  font-style: normal;
  font-weight: 600;
  line-height: normal;
}

/* Стили для фокуса (для доступности с клавиатуры) */
.page-title__rubirika__links button[role="tab"]:focus {
  color: #000;
  font-family: Inter;
  font-size: 16px;
  font-style: normal;
  font-weight: 600;
  line-height: normal;
}

/* Когда открыт favorites-modal, “склеиваем” его с header-map */
body.favorites-modal-open header.header-map {
  border-bottom-right-radius: 0 !important;
}
