:root {
  --auth-navy: #071a2e;
  --auth-navy-deep: #050f1c;
  --auth-gold: #d4af37;
  --auth-gold-light: #e8c766;
  --auth-white: #ffffff;
  --auth-muted: rgba(255, 255, 255, 0.68);
  --auth-shadow: 0 22px 54px rgba(5, 15, 28, 0.28);
}

.auth-loading .navbar-auth {
  visibility: hidden;
}

.navbar-auth {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.navbar-auth [hidden] {
  display: none !important;
}

.navbar-auth__guest,
.navbar-auth__user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.account-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  border: 1px solid rgba(232, 199, 102, 0.7);
  border-radius: 50%;
  background: var(--auth-navy);
  color: var(--auth-gold-light);
  box-shadow: 0 10px 24px rgba(5, 15, 28, 0.22);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.account-avatar:hover,
.account-avatar[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: var(--auth-gold-light);
  box-shadow: 0 14px 30px rgba(5, 15, 28, 0.28);
}

.account-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.account-avatar__crown {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--auth-gold-light);
  font-size: 0.78rem;
  filter: drop-shadow(0 3px 5px rgba(5, 15, 28, 0.35));
  pointer-events: none;
}

.account-avatar--admin {
  border-color: var(--auth-gold-light);
  box-shadow:
    0 10px 24px rgba(5, 15, 28, 0.22),
    0 0 0 3px rgba(212, 175, 55, 0.14);
}

.account-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 1000;
  width: min(320px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid rgba(232, 199, 102, 0.22);
  border-radius: 16px;
  background: rgba(5, 15, 28, 0.98);
  color: var(--auth-white);
  box-shadow: var(--auth-shadow);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.account-menu:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.account-menu::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 14px;
  height: 14px;
  border-left: 1px solid rgba(232, 199, 102, 0.22);
  border-top: 1px solid rgba(232, 199, 102, 0.22);
  background: rgba(5, 15, 28, 0.98);
  transform: rotate(45deg);
}

.account-menu__identity,
.navbar-auth .account-menu__identity {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.account-menu__name {
  color: var(--auth-white);
  font-size: 0.98rem;
  font-weight: 900;
}

.account-menu__email,
.account-menu__profile {
  color: var(--auth-muted);
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-word;
}

.account-menu__profile {
  color: var(--auth-gold-light);
  font-weight: 800;
  text-transform: capitalize;
}

.account-menu__actions,
.navbar-auth .account-menu__actions {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.account-menu__actions .btn {
  width: 100%;
}

.account-logout {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--auth-white);
  font-size: 0.88rem;
  font-weight: 900;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.account-logout:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 199, 102, 0.5);
  background: rgba(232, 199, 102, 0.12);
}

.navbar-auth--mobile {
  width: 100%;
  display: grid;
  gap: 12px;
}

.navbar-auth--mobile .navbar-auth__guest,
.navbar-auth--mobile .navbar-auth__user {
  width: 100%;
}

.navbar-auth--mobile .navbar-auth__guest {
  display: flex;
}

.navbar-auth--mobile .navbar-auth__guest .btn,
.navbar-auth--mobile .navbar-auth__user .btn {
  flex: 1;
}

.navbar-auth--mobile .navbar-auth__user {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.navbar-auth--mobile .account-menu {
  position: static;
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 2px;
  transform: none;
}

.navbar-auth--mobile .account-menu::before {
  display: none;
}

.navbar-auth--mobile .account-menu:not([hidden]) {
  transform: none;
}

@media (max-width: 680px) {
  .account-avatar {
    width: 42px;
    height: 42px;
  }

  .account-menu {
    right: -4px;
  }
}
