/**
 * Десктопный нижний ряд шапки (пилюли, корзина, контакты) — макет из local/doc/header/prototype.
 * Включается классом .header--actions-bar на <header>.
 * Десктопные действия / верхняя полоса — с 48em; компактная мобилка — до 47.99875em (tabbar).
 */

/* Не даём шапке раздувать страницу по горизонтали (logo min-width + search width:100% в flex-ряду) */
.header.header--actions-bar {
  max-width: 100%;
  overflow-x: clip;
}

.header.header--actions-bar .header__container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
  width: 100%;
  max-width: min(85.3125rem, 100%);
  min-width: 0;
}

.header.header--actions-bar .header__bottom,
.header.header--actions-bar .header__bottom-wrapper,
.header.header--actions-bar .header__top-wrapper {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.header.header--actions-bar .header__top-wrapper {
  align-items: center;
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

.header.header--actions-bar .header__navbar {
  display: none;
}

.header.header--actions-bar .header__navbar-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Отдельная строка меню под шапкой (лого + пилюли) */
.header.header--actions-bar .header__navbar--under {
  display: none;
}

.header.header--actions-bar .header__info {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.header.header--actions-bar .header__info-link {
  gap: 0.5rem;
}

.header.header--actions-bar .header__info-link--accent .header__info-text {
  color: var(--brown);
}

/* PRO Деменция — акцент слева от «Я хочу помочь» */
.header.header--actions-bar .header__info-link--pro-dementsiya {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(209, 65, 107, 0.1);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.header.header--actions-bar .header__info-link--pro-dementsiya .header__info-text {
  color: #d1416b;
  font-weight: 700;
  white-space: nowrap;
}

.header.header--actions-bar .header__info-link--pro-dementsiya:hover {
  background: rgba(209, 65, 107, 0.18);
}

.header.header--actions-bar .header__info-link--pro-dementsiya:focus-visible {
  outline: 2px solid #d1416b;
  outline-offset: 2px;
}

.menu__link--accent,
.menu__info-link--pro-dementsiya {
  color: #d1416b !important;
  font-weight: 700;
}

/* --- Нижний ряд: новый блок только на широком экране --- */
.header.header--actions-bar .header__desktop-actions {
  display: none;
}

@media (min-width: 48em) {
  .header.header--actions-bar .header__bottom-wrapper {
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.125rem;
    width: 100%;
  }

  .header.header--actions-bar .header__logo {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .header.header--actions-bar .header__logo img {
    min-width: 0 !important;
    width: auto;
    max-width: min(15.625rem, 100%);
  }

  .header.header--actions-bar .header__desktop-actions {
    display: flex;
    flex: 1 1 320px;
    min-width: 0;
    max-width: 100%;
    align-items: center;
    justify-content: flex-end;
  }

  .header.header--actions-bar .header__actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 66.75rem;
    margin-left: auto;
    gap: 1.875rem;
  }

  .header.header--actions-bar .header__navbar--under {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 0 1rem;
    border: 0;
  }

  .header.header--actions-bar .header__navbar--under .header__navbar-list {
    justify-content: flex-start;
    gap: 1.5rem;
  }

  .header.header--actions-bar .header__navbar--under .header__navbar-item {
    margin: 0;
    padding: 0;
  }

  .header.header--actions-bar .header__navbar--under .header__navbar-link {
    display: inline-block;
    margin: 0;
    padding: 0;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.25;
    white-space: nowrap;
    color: var(--blue-dark, #27314a);
    text-decoration: none;
  }

  .header.header--actions-bar .header__navbar--under .header__navbar-link:hover {
    color: #d1416b;
  }

  .header.header--actions-bar .header__actions-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    width: 100%;
  }

  /* Старый блок формы /sidelki/ остаётся в DOM для JS — только визуально убираем */
  .header.header--actions-bar .header__search--legacy {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    clip-path: inset(50%) !important;
  }

  .header.header--actions-bar .header__contacts--legacy {
    display: none !important;
  }

  .header.header--actions-bar .header__bottom-wrapper > .header__login,
  .header.header--actions-bar .header__bottom-wrapper > .header__dropdown {
    display: none !important;
  }

  /* Бургер из style.min до 81.25em — не дублируем с desktop-actions */
  .header.header--actions-bar .header__menu > button.menu__icon.icon-menu {
    display: none;
  }
}

/* Пилюли и элементы ряда */
.header.header--actions-bar .header__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.375rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 2rem;
  background: var(--gray-light, #f2f2f2);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  font-family: Onest, Montserrat, system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  color: var(--blue-dark);
  box-sizing: border-box;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.header.header--actions-bar .header__pill:hover {
  background: #e8e8e8;
}

.header.header--actions-bar .header__pill:focus-visible {
  outline: 2px solid var(--brown);
  outline-offset: 2px;
}

.header.header--actions-bar .header__pill--narrow {
  min-width: 5.625rem;
}

.header.header--actions-bar .header__pill--search {
  flex: 1 1 auto;
  max-width: 23.3125rem;
  min-width: min(12.5rem, 100%);
  justify-content: flex-start;
}

.header.header--actions-bar .header__search-input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--blue-dark);
  outline: none;
}

.header.header--actions-bar .header__search-input::placeholder {
  color: #d9d9d9;
}

.header.header--actions-bar .header__pill--sidelki {
  display: inline-grid;
  grid-template-columns: auto minmax(0, max-content);
  align-items: center;
  gap: 0 1rem;
  justify-items: start;
}

.header.header--actions-bar .header__pill--shop {
  display: inline-grid;
  grid-template-columns: auto minmax(0, max-content);
  align-items: center;
  gap: 0 1rem;
  justify-items: start;
}

.header.header--actions-bar .header__pill-shop-icon {
  grid-column: 1;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header.header--actions-bar .header__pill-shop-icon svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.header.header--actions-bar .header__pill-shop-label {
  grid-column: 2;
  min-width: 0;
  text-align: left;
}

.header.header--actions-bar .header__pill-sidelki-icon {
  grid-column: 1;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header.header--actions-bar .header__pill-sidelki-icon svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.header.header--actions-bar .header__pill-sidelki-label {
  grid-column: 2;
  min-width: 0;
  text-align: left;
}

.header.header--actions-bar .header__pill--service {
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.625rem 1rem;
  min-height: 3rem;
}

.header.header--actions-bar .header__pill--service svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

/* «Войти» / «Личный кабинет» — как «Магазин товаров» (.header__pill), сброс legacy .header__login / .hero */
.header.header--actions-bar .header__desktop-actions .header__login.header__pill,
.header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 3.375rem;
  padding: 0.75rem 1.5rem;
  gap: 0;
  border: none;
  border-radius: 2rem;
  background: var(--gray-light, #f2f2f2);
  color: var(--blue-dark);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  font-family: Onest, Montserrat, system-ui, sans-serif;
  text-align: center;
  box-shadow: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.header.header--actions-bar .header__desktop-actions .header__login.header__pill:hover,
.header.header--actions-bar .header__desktop-actions .header__login.header__pill:focus,
.header.header--actions-bar .header__desktop-actions .header__login.header__pill:focus-visible,
.header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill:hover,
.header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill:focus,
.header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill:focus-visible {
  background: #e8e8e8;
  color: var(--blue-dark);
  border: none;
  box-shadow: none;
}

.hero .header.header--actions-bar .header__desktop-actions .header__login.header__pill,
.hero .header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill {
  color: var(--blue-dark);
  border: none;
}

.hero .header.header--actions-bar .header__desktop-actions .header__login.header__pill:hover,
.hero .header.header--actions-bar .header__desktop-actions .header__login.header__pill:focus,
.hero .header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill:hover,
.hero .header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login.header__pill:focus {
  background: #e8e8e8;
  color: var(--blue-dark);
  border: none;
}

/* На случай span.header__login-text внутри пилюли */
.header.header--actions-bar .header__desktop-actions .header__login.header__pill .header__login-text,
.header.header--actions-bar .header__desktop-actions .header__dropdown > .header__login .header__login-text {
  font: inherit;
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.header.header--actions-bar .header__desktop-actions .header__dropdown {
  position: relative;
}

.header.header--actions-bar .header__cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.3125rem;
  height: 3.375rem;
  flex-shrink: 0;
  border-radius: 3.125rem;
  background: var(--gray-light, #f2f2f2);
  text-decoration: none;
  color: var(--blue-dark);
}

.header.header--actions-bar .header__cart:hover {
  background: #e8e8e8;
}

.header.header--actions-bar .header__cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.header.header--actions-bar .header__cart-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.header.header--actions-bar .header__cart-badge {
  position: absolute;
  top: -0.125rem;
  right: -0.25rem;
  box-sizing: border-box;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #D1416B;
  color: var(--white, #fff);
  font-family: Onest, Montserrat, system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--gray-light, #f2f2f2);
}

.header.header--actions-bar .header__cart-badge[hidden] {
  display: none !important;
}

.header.header--actions-bar .header__cart-icon svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.header.header--actions-bar .header__desktop-actions .header__contacts {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
}

.header.header--actions-bar .header__desktop-actions .header__phone {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--blue-dark);
  text-decoration: none;
  white-space: nowrap;
}

.header.header--actions-bar .header__desktop-actions .footer__mail {
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--gray);
  text-decoration: none;
}

.header.header--actions-bar .header__logo img {
  max-height: 5.125rem;
  width: auto;
  max-width: min(15.625rem, 42vw);
  height: auto;
}

/* вместо style.min.css: padding: 1.875rem 0 на широкой шапке */
@media (min-width: 81.25em) {
  .header.header--actions-bar .header__bottom-wrapper {
    padding: 0;
    margin: 0;
  }

  .header.header--actions-bar .header__container {
    gap: 1rem;
  }

  .header.header--actions-bar .header__bottom {
    margin: 0;
    padding: 0;
  }
}

/* Телефон: без верхней полосы и navbar; колонка, чтобы не было горизонтального скролла */
@media (max-width: 47.99875em) {
  .header.header--actions-bar .header__top {
    display: none;
  }

  .header.header--actions-bar .header__navbar--under {
    display: none;
  }

  .header.header--actions-bar .header__bottom-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
  }

  .header.header--actions-bar .header__logo {
    align-self: flex-start;
    max-width: 100%;
    min-width: 0;
  }

  .header.header--actions-bar .header__logo img {
    min-width: 0 !important;
    max-width: min(15.625rem, 100%);
    width: auto;
    height: auto;
  }

  .header.header--actions-bar .header__search--legacy {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .header.header--actions-bar .header__search--legacy .header__search-wrap {
    align-items: stretch;
  }

  .header.header--actions-bar .header__search--legacy .header__form-control {
    width: 100%;
    min-width: 0;
  }

  .header.header--actions-bar .header__search--legacy .header__pill--sidelki {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .header.header--actions-bar .header__contacts--legacy {
    max-width: 100%;
    min-width: 0;
  }

  .header.header--actions-bar .header__contacts--legacy .header__phone,
  .header.header--actions-bar .header__contacts--legacy .footer__mail {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Футер: те же пилюли, что в шапке (.header__pill) */
.footer__form .footer__form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.footer__form .header__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.375rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 2rem;
  background: var(--gray-light, #f2f2f2);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  font-family: Onest, Montserrat, system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  color: var(--blue-dark);
  box-sizing: border-box;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.footer__form .header__pill:hover {
  background: #e8e8e8;
}

.footer__form .header__pill:focus-visible {
  outline: 2px solid var(--brown);
  outline-offset: 2px;
}

.footer__form .header__pill--sidelki {
  display: inline-grid;
  grid-template-columns: auto minmax(0, max-content);
  align-items: center;
  gap: 0 1rem;
  justify-items: start;
}

.footer__form .header__pill-sidelki-icon {
  grid-column: 1;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer__form .header__pill-sidelki-icon svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.footer__form .header__pill-sidelki-label {
  grid-column: 2;
  min-width: 0;
  text-align: left;
}

.footer__form .header__pill--service {
  gap: 1rem;
}

.footer__form .header__pill--service svg {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 53.125em) {
  .footer__form .footer__form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .footer__form .header__pill,
  .footer__form .header__pill--sidelki,
  .footer__form .header__pill--service {
    width: 100%;
  }
}
