.header {
  position: sticky;
  z-index: 1000;
  top: 0;

  width: 100%;

  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);

  backdrop-filter: blur(18px);
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;

  height: 90px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header__logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: auto;
  height: 54px;

  font-weight: 800;
}

.header__menu {
  display: flex;
  gap: 40px;
}

.header__link {
  position: relative;

  color: var(--color-text-light);

  font-weight: 600;

  transition: var(--transition);
}

.header__link:hover {
  color: var(--color-primary);
}

.header__link::after {
  content: "";

  position: absolute;
  bottom: -8px;
  left: 0;

  width: 0;
  height: 2px;

  background: var(--color-primary);

  transition: var(--transition);
}

.header__link:hover::after {
  width: 100%;
}

.header__link.active {
  color: var(--color-primary);

  font-weight: 700;
}

.header__link.active::after {
  width: 100%;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header__login {
  position: relative;

  color: var(--color-text-light);

  background: transparent;
  border: 0;

  font: inherit;
  font-size: 16px;
  font-weight: 600;

  cursor: pointer;

  transition: var(--transition);
}

.header__login:hover {
  color: var(--color-primary);
}

.header__logout-form {
  display: inline-flex;
}

.language-switcher {
  display: inline-flex;
}

.language-switcher select {
  height: 40px;
  padding: 0 12px;

  color: var(--color-text-light);

  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;

  font: inherit;
  font-weight: 700;

  outline: none;
  cursor: pointer;
}

.header__burger {
  z-index: 1001;

  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;

  width: 42px;
  height: 42px;

  background: transparent;
  border: 0;

  cursor: pointer;
}

.header__burger span {
  width: 26px;
  height: 3px;

  background: var(--color-text, #222);
  border-radius: 2px;

  transition: 0.3s;
}

.header__drawer {
  display: contents;
}

.header-overlay {
  position: fixed;
  z-index: 999;
  inset: 0;

  background: rgba(0, 0, 0, 0.45);

  visibility: hidden;
  opacity: 0;

  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.header-overlay.active {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 1100px) {
  .container {
    width: min(100%, calc(100% - 48px));
  }

  .header__container {
    height: 80px;
  }

  .header__menu {
    gap: 28px;
  }

  .header__link {
    font-size: 15px;
  }

  .header__logo-icon,
  .header__logo img {
    height: 48px;
  }
}

@media (max-width: 900px) {
  .header {
    z-index: 1200;

    height: 70px;

    background: #fff;

    backdrop-filter: none;
  }

  .header__container {
    position: relative;
    z-index: 1201;

    height: 70px;
    min-height: 70px;
    padding: 0;
  }

  .header__logo {
    position: relative;
    z-index: 1201;

    display: flex;
    align-items: center;
  }

  .header__logo-icon,
  .header__logo img {
    width: auto;
    height: 44px;
  }

  .header__burger {
    position: relative;
    z-index: 1202;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;

    width: 42px;
    height: 42px;
    margin-left: auto;
    padding: 0;

    background: transparent;
    border: 0;
    border-radius: 10px;

    cursor: pointer;

    transition: var(--transition);
  }

  .header__burger:hover {
    background: #f8fafc;
  }

  .header__burger span {
    display: block;

    width: 22px;
    height: 2px;

    background: var(--color-text);
    border-radius: 999px;

    transition:
      transform 0.25s ease,
      opacity 0.2s ease;
  }

  .header__burger.active {
    position: fixed;
    z-index: 1300;
    top: 14px;
    right: 24px;

    background: #f8fafc;
  }

  .header__burger.active:hover {
    background: #f1f5f9;
  }

  .header__burger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .header__burger.active span:nth-child(2) {
    opacity: 0;
  }

  .header__burger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .header__drawer {
    position: fixed;
    z-index: 1201;
    top: 0;
    right: 0;

    display: flex;
    flex-direction: column;
    gap: 24px;

    width: min(72vw, 420px);
    height: 100dvh;
    padding: 82px 24px 24px;

    overflow-x: hidden;
    overflow-y: auto;

    background: #fff;
    border-left: 1px solid #eef2f7;

    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);

    visibility: hidden;
    opacity: 0;

    transform: translateX(100%);

    transition:
      transform 0.25s ease,
      opacity 0.2s ease,
      visibility 0.25s;
  }

  .header__drawer.active {
    visibility: visible;
    opacity: 1;

    transform: translateX(0);
  }

  .header__nav {
    width: 100%;

    overflow: visible;
  }

  .header__menu {
    display: flex;
    flex-direction: column;
    gap: 4px;

    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
  }

  .header__menu li {
    width: 100%;

    list-style: none;
  }

  .header__link {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
    min-height: 48px;
    padding: 0 14px;

    color: var(--color-text);

    border-radius: 12px;

    font-size: 15px;
    font-weight: 600;

    transition: var(--transition);
  }

  .header__link::after {
    display: none;
  }

  .header__link:hover,
  .header__link:focus-visible {
    color: var(--color-primary);

    background: #f8fafc;

    outline: none;
  }

  .header__link.active {
    color: var(--color-primary);

    background: #eff6ff;

    font-weight: 700;
  }

  .header__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;

    width: 100%;
    margin-top: auto;
    padding-top: 20px;

    border-top: 1px solid #eef2f7;
  }

  .header__actions .language-switcher {
    grid-column: 1 / -1;

    display: block;

    width: 100%;
  }

  .language-switcher select {
    width: 100%;
    height: 44px;
    padding: 0 12px;

    color: var(--color-text);

    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    font: inherit;
    font-size: 14px;
    font-weight: 600;

    outline: none;
    cursor: pointer;

    transition: var(--transition);
  }

  .language-switcher select:hover {
    border-color: #cbd5e1;
  }

  .language-switcher select:focus {
    border-color: var(--color-primary);

    box-shadow: 0 0 0 3px rgba(14, 141, 219, 0.12);
  }

  .header__actions > .header__link--messages {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0;

    color: var(--color-text);

    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    cursor: pointer;

    transition: var(--transition);
  }

  .header__actions > .header__link--messages:hover,
  .header__actions > .header__link--messages:focus-visible {
    color: var(--color-primary);

    background: #f8fafc;
    border-color: #bfdbfe;

    outline: none;
  }

  .header__actions > .header__link--messages.active {
    color: var(--color-primary);

    background: #eff6ff;
    border-color: #bfdbfe;
  }

  .header__actions .icon-badge {
    flex: 0 0 auto;
  }

  .header__actions .icon-badge__icon {
    width: 18px;
    height: 18px;
  }

  .header__logout-form {
    grid-column: 1 / -1;

    display: block;

    width: 100%;
  }

  .header__logout-form .header__login {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 44px;
    padding: 0 14px;

    color: var(--color-text);

    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    font: inherit;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: var(--transition);
  }

  .header__logout-form .header__login:hover,
  .header__logout-form .header__login:focus-visible {
    color: #dc2626;

    background: #fef2f2;
    border-color: #fecaca;

    outline: none;
  }

  .header__actions > a.header__login:not(.header__link--messages) {
    grid-column: 1 / -1;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 44px;
    padding: 0 14px;

    color: var(--color-text);

    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    font: inherit;
    font-size: 14px;
    font-weight: 600;

    text-align: center;
  }

  .header__actions > a.header__login:not(.header__link--messages):hover,
  .header__actions > a.header__login:not(.header__link--messages):focus-visible {
    color: var(--color-primary);

    background: #f8fafc;
    border-color: #bfdbfe;

    outline: none;
  }

  .header__actions > .button {
    grid-column: 1 / -1;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 44px;
  }

  .header-overlay {
    position: fixed;
    z-index: 1100;
    inset: 0;

    background: rgba(15, 23, 42, 0.45);

    visibility: hidden;
    opacity: 0;

    transition:
      opacity 0.25s ease,
      visibility 0.25s;
  }

  .header-overlay.active {
    backdrop-filter: blur(7px);
    visibility: visible;
    opacity: 1;
  }

  body.menu-open {
    overflow: hidden;
  }
}

@media (max-width: 520px) {

  .header {
    height: 64px;
  }

  .header__container {
    height: 64px;
    min-height: 64px;
  }

  .header__logo-icon,
  .header__logo img {
    height: 38px;
  }

  .header__burger {
    width: 40px;
    height: 40px;
  }

  .header__burger span {
    width: 21px;
  }

  .header__burger.active {
    top: 12px;
    right: 18px;
  }

  .header__drawer {
    width: min(90vw, 340px);
    height: 100dvh;
    padding: 72px 18px 20px;

    gap: 20px;
  }

  .header__link {
    min-height: 46px;
    padding: 0 12px;

    font-size: 14px;
  }

  .header__actions {
    gap: 8px;

    padding-top: 16px;
  }

  .language-switcher select,
  .header__actions > .header__link--messages,
  .header__logout-form .header__login,
  .header__actions > a.header__login:not(.header__link--messages),
  .header__actions > .button {
    min-height: 42px;

    font-size: 14px;
  }

  .header__actions .icon-badge__icon {
    width: 17px;
    height: 17px;
  }
}