/* Бонусы в шапке: таблетка баланса + окно по hover (референс М.Видео) */
.zp-nav-bonus {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.zp-nav-bonus__pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 40px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: #e31c23;
  color: #fff;
  font-family: var(--zp-font-ui, "Nunito", system-ui, sans-serif);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(227, 28, 35, 0.28);
  transition: background 0.15s ease, transform 0.15s ease;
}

.zp-nav-bonus__pill:hover,
.zp-nav-bonus__pill:focus-visible {
  background: #c9181e;
  color: #fff;
  outline: none;
}

.zp-nav-bonus__ico {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #fff 0 38%, transparent 40%),
    linear-gradient(180deg, #fff 0 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  position: relative;
}

.zp-nav-bonus__ico::after {
  content: "Б";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #e31c23;
  line-height: 1;
}

.zp-nav-bonus__val {
  font-variant-numeric: tabular-nums;
}

.zp-nav-bonus__pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1200;
  width: min(320px, calc(100vw - 24px));
  padding: 18px 18px 14px;
  border-radius: 18px;
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 16px 40px rgba(23, 18, 47, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.zp-nav-bonus__pop::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 0;
  left: 0;
  height: 10px;
}

.zp-nav-bonus--desktop:hover .zp-nav-bonus__pop,
.zp-nav-bonus--desktop:focus-within .zp-nav-bonus__pop,
.zp-nav-bonus--desktop.is-open .zp-nav-bonus__pop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.zp-nav-bonus__balance {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.zp-nav-bonus__label {
  margin: 2px 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.zp-nav-bonus__expire {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.35;
}

.zp-nav-bonus__expire-amt {
  color: #e31c23;
  font-weight: 800;
}

.zp-nav-bonus__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 14px;
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.zp-nav-bonus__link::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.7;
}

.zp-nav-bonus__link:hover {
  color: #6440bf;
}

.zp-nav-bonus__hr {
  height: 1px;
  margin: 0 0 14px;
  background: #eceaf2;
  border: 0;
}

.zp-nav-bonus__promo {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: #1a1a1a;
}

.zp-nav-bonus__promo-sub {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: #8b8798;
  line-height: 1.35;
}

.zp-nav-bonus__promo-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.zp-nav-bonus__promo-link::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.7;
}

.zp-nav-bonus__promo-link:hover {
  color: #6440bf;
}

/* Мобильная таблетка компактнее; окно — по тапу (is-open) */
.zp-nav-bonus--mobile .zp-nav-bonus__pill {
  min-height: 34px;
  padding: 5px 12px 5px 8px;
  font-size: 13px;
}

.zp-nav-bonus--mobile .zp-nav-bonus__ico {
  width: 18px;
  height: 18px;
}

.zp-nav-bonus--mobile .zp-nav-bonus__ico::after {
  font-size: 9px;
}

.zp-nav-bonus--mobile .zp-nav-bonus__pop {
  right: 0;
  left: auto;
}

.zp-nav-bonus--mobile.is-open .zp-nav-bonus__pop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 1319px) {
  .zp-nav-bonus--desktop {
    display: none;
  }
}

@media (min-width: 1320px) {
  .zp-nav-bonus--mobile {
    display: none;
  }

  html.nav--compact .zp-nav-bonus--desktop {
    display: none;
  }

  html.nav--compact .zp-nav-bonus--mobile {
    display: inline-flex;
  }
}

/* Скрытый логин рядом с виджетом */
.nav-tray__login.is-zp-bonus-hidden,
.nav-mobile-head__login.is-zp-bonus-hidden {
  display: none !important;
}

/* Drawer: баланс бонусов не в шапке меню — только крестик */
.nav-mobile-head .zp-nav-bonus,
.nav-mobile-head__login {
  display: none !important;
}

/* Кнопка профиля в шапке — референс М.Видео (48×48, tertiary icon) */
.zp-nav-profile {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.zp-nav-profile:hover,
.zp-nav-profile:focus-visible {
  background: rgba(100, 64, 191, 0.08);
  outline: none;
}

.zp-nav-profile__icon {
  display: block;
  width: 24px;
  height: 24px;
}

.zp-nav-profile.is-auth {
  color: #3b135c;
}

@media (max-width: 1319px) {
  body.home-layout-ref .zp-nav-profile {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  body.home-layout-ref .zp-nav-profile__icon {
    width: 22px;
    height: 22px;
  }
}

html.nav--compact body.home-layout-ref .zp-nav-profile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

html.nav--compact body.home-layout-ref .nav-tray > .zp-nav-profile {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  z-index: 2;
  margin-right: 76px;
}

/*
 * Compact / mobile шапка форсирует «Войти» через !important —
 * без этих правил логин остаётся видимым рядом с бонусами,
 * а таблетка из display:contents уезжает в колонку toggler (слева).
 */
html.nav--compact body.home-layout-ref .nav-tray__login--mobile.is-zp-bonus-hidden,
html.nav--measure body.home-layout-ref .nav-tray__login--mobile.is-zp-bonus-hidden,
body.home-layout-ref .nav-tray__login--mobile.is-zp-bonus-hidden {
  display: none !important;
}

html.nav--compact body.home-layout-ref .nav-tray > .zp-nav-bonus--mobile,
html.nav--compact body.home-layout-ref .zp-nav-bonus.zp-nav-bonus--mobile {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  display: inline-flex !important;
  z-index: 2;
}

@media (max-width: 767px) {
  body.home-layout-ref .nav-tray__login--mobile.is-zp-bonus-hidden {
    display: none !important;
  }

  body.home-layout-ref .nav-tray > .zp-nav-bonus--mobile {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    display: inline-flex !important;
  }
}
