.header {
  position: relative;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid var(--grey-light);
  margin-bottom: 24px;
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  position: relative;
  gap: 20px;
}

.header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.header__logo img {
  max-height: 44px;
  width: auto;
}

.header__nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header__nav-list {
  display: flex;
  align-items: center;
  gap: 0;
}

.header__nav-item--has-mega:hover .header__mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header__nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  min-height: 80px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
}

.header__nav-link:hover {
  color: var(--primary);
}
.header__nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.header__nav-link:hover::after {
  opacity: 1;
}

.header__nav-arrow {
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.header__nav-item--has-mega:hover .header__nav-arrow {
  transform: rotate(180deg);
}

.header__mega-menu {
  position: absolute;
  top: 100%;
  left: 0%;
  transform: translateY(-10px);
  width: 100%;
  background: var(--white);
  border: 1px solid var(--grey-light);
  border-top: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1001;
}

.header__mega-content {
  display: flex;
  gap: 48px;
  padding: 5px 15px;
}

.header__mega-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.header__mega-title {
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 1px;
}

.header__mega-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.header__submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header__mega-link {
  color: var(--grey);
  text-decoration: none;
  transition: color 0.3s ease;
}

.header__mega-link:hover {
  color: var(--primary);
}

/* ===== КНОПКИ ===== */
.header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header__login-icon {
  display: none;
}
.header__bonus-btn {
  gap: 5px;
  padding: 10px 15px 10px 15px;
  background: #fee7e7;
}

.header__bonus-btn:hover {
  background: #fdd5d5;
}

.header__bonus-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.header__login-btn {
  gap: 10px;
  padding: 10px 20px;
  background: var(--grey-light);
}

.header__login-btn:hover {
  background: #e8e8e8;
}

/* ===== МОБИЛЬНОЕ МЕНЮ ===== */
.header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.header__burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #232323;
  margin: 2px 0;
  transition: all 0.3s ease;
}

.header__burger[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.header__burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.header__burger[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

@media (max-width: 850px) {
  .header__container {
    min-height: 60px;
  }
  .header__mega-menu {
    position: static;
    display: grid;
    grid-template-rows: 0fr;
    transition: all 0.7s ease;
  }
  .header__mega-content {
    overflow: hidden;
    padding: 0;
    flex-direction: column;
    gap: 10px;
    transition: all 0.7s ease;
  }
  .header__nav-item--open .header__mega-menu {
    grid-template-rows: 1fr;
  }
  .header__nav-item--open .header__mega-content {
    padding: 10px 15px;
  }
  .header__nav {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--white);
    border-top: none;
  }
  .header__nav-list {
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: flex-start;
  }
  .header__nav-link {
    min-height: auto;
    width: 100%;
    border-bottom: 1px solid var(--grey-light);
    padding: 10px 15px;
    justify-content: space-between;
  }
  .header__nav-list li {
    width: 100%;
  }
  .header__burger {
    display: flex;
  }
  .header__actions {
    margin-left: auto;
  }
  .header__burger {
    order: 3;
  }

  .header__mega-title {
    font-size: 16px;
  }
  .header__submenu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
}

/* ===== ФОКУС ===== */
@media (hover: hover) and (pointer: fine) {
  .header__nav-link:focus,
  .header__bonus-btn:focus,
  .header__login-btn:focus,
  .header__burger:focus {
    outline: 2px solid #9345d8;
    outline-offset: 2px;
  }
}

/* ===== АКТИВНОЕ СОСТОЯНИЕ МЕГА МЕНЮ ===== */
.header__nav-item--active .header__mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.header__nav-item--active .header__nav-arrow {
  transform: rotate(180deg);
}
@media (max-width: 450px) {
  .header__bonus-text,
  .header__login-text {
    display: none;
  }
  .header__bonus-btn,
  .header__login-btn {
    padding: 10px;
  }
  .header__login-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .header__burger {
    background: var(--grey-light);
    border-radius: 10px;
    width: 40px;
    height: 40px;
  }
  .header__container {
    gap: 10px;
  }
  .header__burger {
    order: initial;
  }
}
.header__mobile-menu--open .header__nav {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}
