/*
  Переменные, которые можно переопределить снаружи:
  --eb-menu-inset    горизонтальный отступ меню от краёв экрана
  --eb-select-accent фирменный цвет (иконка, галочка, рамка при открытии)
  --eb-select-tint   светлая подложка того же цвета
*/

/* Контейнер меню. Один и тот же вид на main (tabs) и на статичных страницах (links) */
.main-menu-wrapper,
.menu-wrapper {
  display: grid;
  grid-template-columns: 19fr 25fr 22fr 21fr 6fr;
  gap: 7px;
  align-items: flex-start;
  max-width: 833px;
  margin-left: 30px;
}

.eb-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
}

.eb-tab:focus-visible {
  outline: 2px solid var(--eb-select-accent, #5b771f);
  outline-offset: 2px;
}

.eb-tab_active {
  z-index: 80; /* раньше задавалось inline-style из компонента */
}

/* <a> (серверный fallback / режим ссылок) выглядит так же, как <div> */
.main-menu-wrapper a.eb-tab,
.menu-wrapper a.eb-tab {
  color: inherit;
  text-decoration: none;
}

.tab_content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.eb-select {
  display: none;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.eb-select__button {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px 8px 8px;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.05);
  color: #1f2937;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.eb-select__button:focus-visible,
.eb-select_open .eb-select__button {
  border-color: var(--eb-select-accent, #5b771f);
  box-shadow: 0 0 0 4px var(--eb-select-tint, #eaf0dc);
  outline: none;
}

/* иконка на светлой плитке */
.eb-select__icon {
  flex: 0 0 auto;
  box-sizing: content-box;
  width: 22px;
  height: 22px;
  padding: 7px;
  border-radius: 11px;
  background: var(--eb-select-tint, #eaf0dc);
  object-fit: contain;
}

.eb-select__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eb-select__label_placeholder {
  color: #667085;
  font-weight: 500;
}

.eb-select__arrow {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f2f4f7;
  color: #475467;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.eb-select_open .eb-select__arrow {
  background: var(--eb-select-accent, #5b771f);
  color: #fff;
}

.eb-select__chevron {
  transition: transform 0.2s ease;
}

.eb-select_open .eb-select__chevron {
  transform: rotate(180deg);
}

/* выпадающий список */
.eb-select__list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: min(60vh, 380px);
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  overscroll-behavior: contain;
  transform-origin: top center;
}

.eb-select__option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  color: #344054;
  cursor: pointer;
}

/* серверный fallback: ссылка внутри опции не меняет раскладку */
.eb-select__option > a {
  display: contents;
  color: inherit;
  text-decoration: none;
}

.eb-select__option_highlighted {
  background: #f6f7f9;
}

.eb-select__option_selected {
  background: var(--eb-select-tint, #eaf0dc);
  color: #1f2937;
  font-weight: 600;
}

.eb-select__option_selected .eb-select__icon {
  background: #fff;
}

.eb-select__check {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--eb-select-accent, #5b771f);
}

.eb-select-pop-enter-active,
.eb-select-pop-leave-active {
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.eb-select-pop-enter-from,
.eb-select-pop-leave-to {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

@media (max-width: 768px) {
  .main-menu-wrapper,
  .menu-wrapper {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0 var(--eb-menu-inset, 12px) 14px;
    overflow: visible;
  }

  .main-menu-wrapper .eb-tab,
  .menu-wrapper .eb-tab {
    display: none !important;
  }

  .eb-select {
    display: block;
  }

  .main-menu-wrapper .icon-wrapper {
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eb-select__button,
  .eb-select__arrow,
  .eb-select__chevron,
  .eb-select-pop-enter-active,
  .eb-select-pop-leave-active {
    transition: none;
  }
}

@media (min-width: 1440px) {
  .main-menu-wrapper,
  .menu-wrapper {
    max-width: 995px;
  }
}