/* Shared Nexoverse navigation */
#navbar.navbar {
  --nav-surface: rgba(15, 16, 20, 0.96);
  --nav-surface-raised: #191a20;
  --nav-text: #f4f4f5;
  --nav-muted: #a1a1aa;
  --nav-line: rgba(255, 255, 255, 0.1);
  --nav-accent: #ff7445;
  --nav-accent-soft: rgba(255, 116, 69, 0.12);
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 110;
  width: min(1280px, calc(100% - 48px));
  height: 64px;
  padding: 0;
  transform: translateX(-50%);
  color: var(--nav-text);
  font-family: var(--font-body, 'Manrope', sans-serif);
  pointer-events: none;
}

#navbar .navbar-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 1.5vw, 22px);
  width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 8px 14px 8px 18px;
  border: 1px solid var(--nav-line);
  border-radius: 18px;
  background: var(--nav-surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

#navbar.scrolled .navbar-inner {
  background: rgba(12, 13, 17, 0.98);
  border-color: rgba(255, 255, 255, 0.12);
}

#navbar .navbar-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  margin-right: 0;
  color: var(--nav-text);
  text-decoration: none;
}

#navbar .navbar-brand-mark {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: #f5f5f4;
}

#navbar .navbar-brand-mark img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

#navbar .navbar-brand-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
  line-height: 1.05;
}

#navbar .navbar-brand-name {
  color: var(--nav-text);
  font-size: 1.125rem;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

#navbar .navbar-brand-tagline {
  color: var(--nav-muted);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

#navbar .top-nav-menu {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#navbar .top-nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

#navbar .top-nav-link,
#navbar .top-nav-more > summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 clamp(10px, 1vw, 15px);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #d4d4d8;
  font: 600 0.8rem/1.1 var(--font-body, 'Manrope', sans-serif);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

#navbar .top-nav-link:hover,
#navbar .top-nav-more > summary:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

#navbar .top-nav-link.active,
#navbar .top-nav-more.active > summary {
  border-color: rgba(255, 116, 69, 0.16);
  background: var(--nav-accent-soft);
  color: #ffad8b;
}

#navbar .top-nav-more {
  position: relative;
}

#navbar .top-nav-more > summary {
  list-style: none;
}

#navbar .top-nav-more > summary::-webkit-details-marker {
  display: none;
}

#navbar .top-nav-chevron,
#navbar .profile-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 150ms ease;
}

#navbar .top-nav-more[open] > summary .top-nav-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

#navbar .top-nav-more-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  background: var(--nav-surface-raised);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
  animation: navbar-dropdown-in 140ms ease both;
}

#navbar .top-nav-more-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 11px;
  border-radius: 8px;
  color: #d4d4d8;
  font-size: 0.8rem;
  font-weight: 550;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease;
}

#navbar .top-nav-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  color: currentColor;
}

#navbar .top-nav-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

#navbar .top-nav-more-link:hover,
#navbar .top-nav-more-link.active {
  background: var(--nav-accent-soft);
  color: #ffad8b;
}

#navbar .navbar-right {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  justify-self: end;
}

#navbar .navbar-right [hidden] {
  display: none !important;
}

#navbar .navbar-auth-link,
#navbar .navbar-auth-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

#navbar .navbar-auth-link {
  color: #e4e4e7;
}

#navbar .navbar-auth-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

#navbar .navbar-auth-primary {
  background: var(--nav-accent);
  color: #1c0c06;
  box-shadow: 0 4px 14px rgba(255, 116, 69, 0.2);
}

#navbar .navbar-auth-primary:hover {
  background: #ff8b62;
  box-shadow: 0 6px 18px rgba(255, 116, 69, 0.28);
}

#navbar .profile-dropdown-wrap {
  position: relative;
}

#navbar .profile-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 3px 9px 3px 4px;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--nav-text);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

#navbar .profile-trigger:hover,
#navbar .profile-dropdown-wrap.open .profile-trigger {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.075);
}

#navbar .profile-trigger .avatar {
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 116, 69, 0.22);
  border-radius: 50%;
  background: rgba(255, 116, 69, 0.14);
  color: #ffad8b;
  font-size: 0.75rem;
  font-weight: 750;
}

#navbar .profile-trigger .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#navbar .profile-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

#navbar .profile-name {
  max-width: 132px;
  overflow: hidden;
  color: var(--nav-text);
  font-size: 0.75rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#navbar .profile-role {
  color: var(--nav-muted);
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: capitalize;
}

#navbar .profile-chevron {
  margin: 0 2px 3px 1px;
  color: var(--nav-muted);
}

#navbar .profile-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 120;
  display: grid;
  width: min(260px, calc(100vw - 32px));
  padding: 7px;
  border: 1px solid var(--nav-line);
  border-radius: 13px;
  background: var(--nav-surface-raised);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

#navbar .profile-dropdown-wrap.open .profile-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#navbar .dropdown-header {
  padding: 9px 10px 12px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--nav-line);
}

#navbar .dropdown-name {
  color: var(--nav-text);
  font-size: 0.84rem;
  font-weight: 700;
}

#navbar .dropdown-email {
  margin-top: 3px;
  color: var(--nav-muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

#navbar .dropdown-profile-slug {
  display: inline-flex;
  max-width: 100%;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid var(--nav-accent-soft);
  border-radius: 999px;
  background: rgba(255, 116, 69, 0.07);
  color: #ffb18e;
  font-size: 0.7rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease;
}

#navbar .dropdown-profile-slug[href]:hover {
  border-color: rgba(255, 116, 69, 0.35);
  background: rgba(255, 116, 69, 0.14);
}

#navbar .dropdown-profile-slug:not([href]) {
  color: var(--nav-muted);
  cursor: default;
}

#navbar .dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d4d4d8;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease;
}

#navbar .dropdown-item:hover,
#navbar .dropdown-item.active {
  background: var(--nav-accent-soft);
  color: #ffad8b;
}

#navbar .dropdown-item.danger {
  color: #fca5a5;
}

#navbar .dropdown-item.danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

#navbar .dropdown-divider {
  height: 1px;
  margin: 5px 0;
  background: var(--nav-line);
}

#navbar .hamburger-btn {
  display: none;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

#navbar .hamburger-btn:hover {
  border-color: rgba(255, 116, 69, 0.36);
  background: rgba(255, 116, 69, 0.08);
}

#navbar .hamburger-line {
  width: 17px;
  height: 1.5px;
  border-radius: 99px;
  background: var(--nav-text);
  transition: transform 150ms ease, opacity 150ms ease;
}

#navbar.nav-menu-open .hamburger-line:first-child {
  transform: translateY(5.5px) rotate(45deg);
}

#navbar.nav-menu-open .hamburger-line:nth-child(2) {
  opacity: 0;
}

#navbar.nav-menu-open .hamburger-line:last-child {
  transform: translateY(-5.5px) rotate(-45deg);
}

#navbar .top-nav-mobile-actions {
  display: none;
}

#navbar .top-nav-link:focus-visible,
#navbar .top-nav-more > summary:focus-visible,
#navbar .hamburger-btn:focus-visible,
#navbar .profile-trigger:focus-visible,
#navbar .dropdown-item:focus-visible,
#navbar .navbar-auth-link:focus-visible,
#navbar .navbar-auth-primary:focus-visible {
  outline: 2px solid rgba(255, 145, 105, 0.85);
  outline-offset: 3px;
}

@keyframes navbar-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  #navbar.navbar {
    top: 10px;
    width: calc(100% - 32px);
    height: 60px;
  }

  #navbar .navbar-inner {
    display: flex;
    gap: 10px;
    padding: 7px 8px 7px 12px;
    border-radius: 16px;
  }

  #navbar .navbar-brand {
    gap: 9px;
    margin-right: auto;
  }

  #navbar .hamburger-btn {
    display: flex;
    order: 4;
  }

  #navbar .navbar-right {
    order: 3;
    margin-left: auto;
  }

  #navbar .navbar-right.navbar-guest {
    display: none;
  }

  #navbar .profile-identity,
  #navbar .profile-trigger > .profile-chevron {
    display: none;
  }

  #navbar .profile-trigger {
    padding: 3px;
    border-color: transparent;
    background: transparent;
  }

  #navbar .top-nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    display: block;
    width: 100%;
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--nav-line);
    border-radius: 16px;
    background: rgba(17, 18, 23, 0.99);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    visibility: hidden;
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
  }

  #navbar.navbar.nav-menu-open .top-nav-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
  }

  #navbar .top-nav-links {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    border-radius: 12px;
  }

  #navbar .top-nav-link,
  #navbar .top-nav-more > summary {
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 0.88rem;
  }

  #navbar .top-nav-more-menu {
    position: static;
    min-width: 0;
    margin: 2px 0 6px 10px;
    padding: 3px 0 3px 8px;
    border: 0;
    border-left: 1px solid rgba(255, 116, 69, 0.3);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
  }

  #navbar .top-nav-more-link {
    min-height: 42px;
  }

  #navbar .top-nav-mobile-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--nav-line);
  }

  #navbar .top-nav-mobile-actions .navbar-auth-link,
  #navbar .top-nav-mobile-actions .navbar-auth-primary {
    flex: 1;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  #navbar.navbar {
    top: 8px;
    width: calc(100% - 20px);
    height: 56px;
  }

  #navbar .navbar-inner {
    padding: 6px 7px 6px 10px;
    border-radius: 14px;
  }

  #navbar .navbar-brand-mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  #navbar .navbar-brand-mark img {
    width: 29px;
    height: 29px;
  }

  #navbar .navbar-brand-name {
    font-size: 1.125rem;
  }

  #navbar.navbar .navbar-brand-tagline {
    display: block !important;
  }

  #navbar .hamburger-btn {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  #navbar .top-nav-menu {
    max-height: calc(100dvh - 82px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #navbar *,
  #navbar *::before,
  #navbar *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
