/* HEADER */
.site-header {
  position: sticky;
  top: 0;
  z-index: 130;
  background:
    linear-gradient(180deg, rgba(7, 8, 15, 0.92), rgba(7, 8, 15, 0.76));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.24),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 79, 216, 0.35),
    rgba(77, 163, 255, 0.35),
    transparent
  );
  opacity: 0.7;
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-height);
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 141;
  flex: 0 0 auto;
}

.brand::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 6px;
  height: 12px;
  background: radial-gradient(circle, rgba(139, 93, 255, 0.28), transparent 72%);
  filter: blur(10px);
  opacity: 0.85;
  pointer-events: none;
}

.brand img {
  display: block;
  height: 72px;
  width: auto;
  max-width: none;
  object-fit: contain;
  flex: 0 0 auto;
  filter:
    drop-shadow(0 0 10px rgba(255, 79, 216, 0.28))
    drop-shadow(0 0 20px rgba(139, 93, 255, 0.22));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.brand:hover img {
  transform: translateY(-1px) scale(1.02);
  filter:
    drop-shadow(0 0 12px rgba(255, 79, 216, 0.4))
    drop-shadow(0 0 28px rgba(139, 93, 255, 0.34));
}

.nav-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin-left: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 42px rgba(0, 0, 0, 0.24);
  position: relative;
  overflow: hidden;
}

.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.03) 24%, transparent 45%);
  opacity: 0.75;
}

.nav a,
.nav .nav-item,
.nav .nav-link-btn,
.nav .nav-logout-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: transparent;
  border: none;
  cursor: pointer;
  transition:
    color 0.22s ease,
    background 0.22s ease,
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
  overflow: hidden;
  isolation: isolate;
}

.nav a::before,
.nav .nav-item::before,
.nav .nav-link-btn::before,
.nav .nav-logout-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(
      135deg,
      rgba(255, 79, 216, 0.18),
      rgba(139, 93, 255, 0.16),
      rgba(77, 163, 255, 0.14)
    );
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: -2;
}

.nav a::after,
.nav .nav-item::after,
.nav .nav-link-btn::after,
.nav .nav-logout-btn::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 79, 216, 0.95),
    rgba(77, 163, 255, 0.95),
    transparent
  );
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.nav a:hover,
.nav .nav-item:hover,
.nav .nav-link-btn:hover,
.nav .nav-logout-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.035);
  text-shadow:
    0 0 12px rgba(255, 79, 216, 0.26),
    0 0 12px rgba(77, 163, 255, 0.18);
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 10px 24px rgba(0, 0, 0, 0.16);
}

.nav a:hover::before,
.nav .nav-item:hover::before,
.nav .nav-link-btn:hover::before,
.nav .nav-logout-btn:hover::before {
  opacity: 1;
  transform: scale(1);
}

.nav a:hover::after,
.nav .nav-item:hover::after,
.nav .nav-link-btn:hover::after,
.nav .nav-logout-btn:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.nav a:active,
.nav .nav-item:active,
.nav .nav-link-btn:active,
.nav .nav-logout-btn:active {
  transform: translateY(0) scale(0.985);
}

.nav-logout-form {
  margin: 0;
  display: flex;
}

.nav-link-btn,
.nav-logout-btn {
  appearance: none;
  -webkit-appearance: none;
}

.lang-switches {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-switch-form {
  margin: 0;
  display: inline-flex;
}

.lang-switch-form button {
  appearance: none;
  -webkit-appearance: none;
  line-height: 1;
  cursor: pointer;
}

.lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 79, 216, 0.18), rgba(139, 93, 255, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 22px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
  overflow: hidden;
}

.lang::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.08) 28%, transparent 52%);
  opacity: 0.8;
}

.lang:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.28), rgba(139, 93, 255, 0.28));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 16px rgba(139, 93, 255, 0.18),
    0 14px 28px rgba(0, 0, 0, 0.18);
}

.lang-current {
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.36), rgba(139, 93, 255, 0.36));
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 20px rgba(255, 79, 216, 0.14),
    0 0 24px rgba(139, 93, 255, 0.14);
}

.header-fade {
  height: 34px;
  background: linear-gradient(to bottom, rgba(8, 10, 16, 0.94), rgba(8, 10, 16, 0));
  pointer-events: none;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 22px rgba(0, 0, 0, 0.12);
}

.user-chip-label {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-form {
  margin: 0;
}

.logout-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.22), rgba(139, 93, 255, 0.22));
  transition: 0.2s ease;
}

.logout-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.30), rgba(139, 93, 255, 0.30));
  box-shadow: var(--glow-pink);
}

.nav-item-with-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.nav-unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 6px 16px rgba(139, 93, 255, 0.35);
}

/* ACTIVE UNDERLINE ANIMATION */
.nav a.is-active::after,
.nav .nav-item.is-active::after,
.nav .nav-link-btn.is-active::after {
  opacity: 1;
  transform: translateY(0);
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(255, 79, 216, 1),
    rgba(139, 93, 255, 1),
    rgba(77, 163, 255, 1),
    rgba(255, 79, 216, 1)
  );
  background-size: 200% 100%;
  animation: navActiveGlow 3s linear infinite;
  box-shadow:
    0 0 8px rgba(255, 79, 216, 0.6),
    0 0 14px rgba(77, 163, 255, 0.4);
}

/* ANIMATION */
@keyframes navActiveGlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* MOBILE HAMBURGER + OFF-CANVAS */
.menu-toggle {
  display: none;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  color: #fff;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 24px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
  z-index: 150;
  touch-action: manipulation;
}

.menu-toggle:hover {
  transform: translateY(-1px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  border-color: rgba(255, 255, 255, 0.16);
}

.menu-toggle:active {
  transform: scale(0.98);
}

.menu-toggle__box {
  width: 22px;
  height: 16px;
  position: relative;
  display: inline-block;
}

.menu-toggle__line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease,
    top 0.25s ease,
    box-shadow 0.25s ease;
  box-shadow:
    0 0 10px rgba(255, 79, 216, 0.22),
    0 0 10px rgba(77, 163, 255, 0.16);
}

.menu-toggle__line:nth-child(1) {
  top: 0;
}

.menu-toggle__line:nth-child(2) {
  top: 7px;
}

.menu-toggle__line:nth-child(3) {
  top: 14px;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
  z-index: 120;
}

/* narrow portrait phones only */
@media (max-width: 820px) and (orientation: portrait) {
  .header-inner {
    align-items: center;
    justify-content: space-between;
    min-height: 84px;
  }

  .brand img {
    height: 60px;
  }

  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
    flex: 0 0 auto;
  }

  .nav-wrap {
    position: fixed;
    top: 0;
    right: 0;
    width: min(86vw, 380px);
    height: 100vh;
    padding: 88px 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    margin-left: 0;
    background:
      radial-gradient(circle at top right, rgba(255, 79, 216, 0.16), transparent 24%),
      radial-gradient(circle at bottom left, rgba(77, 163, 255, 0.14), transparent 26%),
      linear-gradient(180deg, rgba(8, 10, 18, 0.98), rgba(6, 8, 15, 0.98));
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
      -20px 0 48px rgba(0, 0, 0, 0.42),
      inset 1px 0 0 rgba(255, 255, 255, 0.04);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    will-change: transform;
    z-index: 140;
  }

  .nav-wrap::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(255, 79, 216, 0.42),
      rgba(77, 163, 255, 0.42),
      transparent
    );
    opacity: 0.8;
  }

  .nav-wrap .nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border-radius: 24px;
    overflow: visible;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  }

  .nav-wrap .nav a,
  .nav-wrap .nav .nav-item,
  .nav-wrap .nav .nav-link-btn,
  .nav-wrap .nav .nav-logout-btn {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 15px;
    white-space: normal;
  }

  .nav-wrap .nav a::after,
  .nav-wrap .nav .nav-item::after,
  .nav-wrap .nav .nav-link-btn::after,
  .nav-wrap .nav .nav-logout-btn::after {
    left: 16px;
    right: 16px;
  }

  .nav-wrap .lang-switches {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
  }

  .nav-wrap .user-chip {
    width: 100%;
    justify-content: space-between;
    padding: 10px 12px 10px 14px;
    border-radius: 18px;
  }

  .nav-wrap .user-chip-label {
    max-width: 100%;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .menu-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.menu-open .nav-wrap {
    transform: translateX(0);
  }

  body.menu-open .menu-toggle__line:nth-child(1) {
    top: 7px;
    transform: rotate(45deg);
  }

  body.menu-open .menu-toggle__line:nth-child(2) {
    opacity: 0;
  }

  body.menu-open .menu-toggle__line:nth-child(3) {
    top: 7px;
    transform: rotate(-45deg);
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .brand img {
    height: 52px;
  }

  .menu-toggle {
    width: 46px;
    height: 46px;
  }

  .nav-wrap {
    width: min(92vw, 360px);
    padding: 84px 14px 18px;
  }

  .nav-wrap .nav {
    padding: 8px;
    border-radius: 20px;
  }

  .nav-wrap .nav a,
  .nav-wrap .nav .nav-item,
  .nav-wrap .nav .nav-link-btn,
  .nav-wrap .nav .nav-logout-btn {
    min-height: 46px;
    padding: 11px 14px;
    font-size: 14px;
  }

  .lang {
    min-width: 46px;
    height: 40px;
    padding: 0 12px;
  }
}

/* tablet / fold inner / small laptops: logo row + nav row */
@media (min-width: 821px) and (max-width: 1200px) {
  .header-inner {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 12px;
  }

  .brand {
    width: 100%;
  }

  .brand img {
    height: 60px;
  }

  .nav-wrap {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .nav {
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }
}

/* wider desktops */
@media (min-width: 1201px) {
  .menu-toggle {
    display: none !important;
  }

  .menu-overlay {
    display: none !important;
  }
}