/* static/css/navbar.css — AICUEVANA navbar (fully scoped to #nxNav) */
#nxNav {
  --bg: #0a0810; --cyan: #22d3ee; --teal: #2dd4bf; --gold: #fbbf24;
  --purple: #a855f7; --pink: #ec4899; --red: #f87171;
  display: contents;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
#nxNav *, #nxNav *::before, #nxNav *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ============ TOP BAR ============ */
#nxNav .topbar {
  position: sticky; top: 0; z-index: 50;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(168, 85, 247, 0.10);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 22px 4px;
  /* Branding ▸ "closeness to the left edge". Right side keeps the classic 22px;
     only the leading edge is operator-controlled. */
  padding-left: var(--nx-edge-left, 22px);
  /* iOS Safari cannot smoothly interpolate `backdrop-filter`; animating it on
     a sticky element while crossing the scroll boundary (scrollY ~40) forces a
     compositor re-render that reads as a visible glitch when flinging back up
     to the very top. Transition only the non-compositor props; the blur snaps
     onto its own layer instead. `translateZ(0)` pins the bar to its own
     compositor layer so toggling the class never re-flows the page. */
  transform: translateZ(0);
  will-change: transform;
  transition: background 0.3s ease, border-color 0.3s ease;
}
/* Frosted brand-glass wash behind the navbar, extends into the iOS safe area */
#nxNav .topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(130% 220% at 15% -10%, rgba(168, 85, 247, 0.22), transparent 50%),
    radial-gradient(130% 220% at 85% -10%, rgba(34, 211, 238, 0.14), transparent 50%),
    linear-gradient(180deg,
      rgba(16, 10, 30, 0.80) 0%,
      rgba(12, 8, 22, 0.50) 45%,
      rgba(10, 8, 16, 0.16) 80%,
      transparent 100%);
  transition: opacity 0.3s ease;
}
#nxNav .topbar.scrolled::before {
  opacity: 0;
}
#nxNav .topbar.scrolled {
  background: rgba(10, 8, 16, .78);
  border-bottom: 1px solid rgba(168, 85, 247, .18);
}
/* Frosted glass only where it is stable. On touch / coarse-pointer devices
   (iOS Safari, iPadOS) the blur must NEVER appear inside the `.scrolled`
   class flip: toggling backdrop-filter none<->blur() on a position:sticky bar
   while the full-bleed hero video is composited beneath it forces WebKit to
   rebuild the backdrop root on every 40px scroll-boundary crossing. Flinging
   back up near the hero crosses that line several times per gesture, which
   reads as the navbar + hero glitching. Those devices get the same dark tint
   (slightly more opaque for readability) with no filter at all. */
@media (hover: hover) and (pointer: fine) {
  #nxNav .topbar.scrolled {
    background: rgba(10, 8, 16, .78);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
  }
}
@media (hover: none), (pointer: coarse) {
  #nxNav .topbar.scrolled {
    background: rgba(10, 8, 16, .9);
  }
}
/* Branding ▸ fixed bar height: the bar stops hugging its content and the row
   centers vertically inside the chosen height instead. */
#nxNav .topbar.fixed-h { padding-top: calc(4px + env(safe-area-inset-top, 0px)); }
#nxNav .topbar.fixed-h .navbar {
  min-height: calc(var(--nx-bar-h, 56px) - env(safe-area-inset-top, 0px));
}
#nxNav .navbar { display: flex; align-items: center; gap: 16px; max-width: 1300px; margin: 0 auto; }
#nxNav .spacer { flex: 1; }

/* ============ HOME BUTTON ============ */
#nxNav .home-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, .07); color: #fff;
  display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0; text-decoration: none;
  transition: background .25s ease, transform .2s ease;
}
#nxNav .home-btn:hover { background: rgba(255, 255, 255, .16); transform: scale(1.06); }
#nxNav .home-btn svg { width: 21px; height: 21px; }

/* ============ LOGO ============ */
#nxNav .logo {
  display: flex; align-items: center;
  text-decoration: none; flex-shrink: 0;
}
#nxNav .logo img { height: var(--nx-logo-h, 30px); width: auto; object-fit: contain; display: block; }
#nxNav span.logo { cursor: default; }   /* Branding ▸ home_mode=hidden renders the logo unlinked */

/* ============ SVG DEFS CONTAINER ============ */
#nxNav .nx-svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ============ LIQUID GLASS PILLS ============ */

#nxNav .pill {
  --c: var(--cyan);
  --mx: 50%;
  --my: -40%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  color: var(--c);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--c) 85%, transparent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25),
              0 0 14px color-mix(in srgb, var(--c) 22%, transparent);
  transition: box-shadow 0.25s ease, transform 0.2s ease,
              background 0.25s ease;
}

#nxNav .pill svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Edge refraction + pointer-tracked specular */
#nxNav .pill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.25s ease;
  background: radial-gradient(140% 180% at var(--mx) var(--my),
              rgba(255, 255, 255, 0.10), transparent 46%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 1.4px 2.4px 1px -1.6px rgba(255, 255, 255, 0.35),
    inset -1.2px -1.8px 1.6px -1.2px rgba(255, 255, 255, 0.10),
    inset 0 -5px 7px -4px color-mix(in srgb, var(--c) 50%, transparent),
    inset 0 4px 6px -4px rgba(255, 255, 255, 0.12);
}

#nxNav .pill:hover {
  transform: translateY(-1px);
}

#nxNav .pill:hover,
#nxNav .pill.active {
  background: color-mix(in srgb, var(--c) 24%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--c) 45%, transparent),
              0 4px 14px rgba(0, 0, 0, 0.3);
}

#nxNav .pill:hover::after,
#nxNav .pill.active::after {
  opacity: 1;
}

/* ---------- Variants (same palette) ---------- */

#nxNav .pill-nexa    { --c: var(--cyan); }
#nxNav .pill-contest { --c: var(--teal); }
#nxNav .pill-ranking { --c: var(--gold); }

/* ── AI Shorts: rainbow liquid-glass pill ─────────────────── */

#nxNav .pill-shorts {
  --c: #e879f9;
  color: #fff;
  background: rgba(38, 14, 70, 0.30);
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(6px) saturate(150%);
  -webkit-backdrop-filter: blur(6px) saturate(150%);
  box-shadow:
    0 0 18px rgba(217, 70, 239, 0.35),
    0 0 32px rgba(56, 189, 248, 0.18);
}

/* Iridescent swirl — oversized blurred disc spinning under the glass */
#nxNav .pill-shorts::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 220%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  opacity: 0.5;
  background:
    radial-gradient(closest-side, transparent 55%, rgba(24, 8, 48, 0.35)),
    conic-gradient(
      from 0deg,
      #f9a8d4, #fcd34d, #7dd3fc, #a5b4fc, #f0abfc, #f9a8d4
    );
  filter: blur(12px) saturate(1.25);
  transition: filter 0.3s ease;
  animation: pill-rainbow-swirl 7s linear infinite;
  will-change: transform;
}

/* OKLCH upgrade — perceptually even, pearly hue rotation */
@supports (color: oklch(0.7 0.2 320)) {
  #nxNav .pill-shorts::before {
    background:
      radial-gradient(closest-side, transparent 55%, rgba(24, 8, 48, 0.35)),
      conic-gradient(
        from 0deg in oklch,
        oklch(0.82 0.15  15),
        oklch(0.88 0.13  75),
        oklch(0.81 0.13 215),
        oklch(0.70 0.17 280),
        oklch(0.74 0.19 330),
        oklch(0.82 0.15  15)
      );
  }
}

#nxNav .pill-shorts:hover,
#nxNav .pill-shorts.active {
  border-color: rgba(255, 255, 255, 0.60);
  box-shadow:
    0 0 22px rgba(232, 121, 249, 0.55),
    0 0 46px rgba(56, 189, 248, 0.35),
    0 4px 14px rgba(0, 0, 0, 0.30);
}

#nxNav .pill-shorts:hover::before,
#nxNav .pill-shorts.active::before {
  filter: blur(10px) saturate(1.6) brightness(1.12);
}

/* Brighter specular + glass highlights over the rainbow */
#nxNav .pill-shorts::after {
  opacity: 0.85;
  background: radial-gradient(140% 180% at var(--mx) var(--my),
              rgba(255, 255, 255, 0.22), transparent 40%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 1.4px 2.4px 1px -1.6px rgba(255, 255, 255, 0.6),
    inset -1.2px -1.8px 1.6px -1.2px rgba(255, 255, 255, 0.20),
    inset 0 -5px 7px -4px color-mix(in srgb, var(--c) 65%, transparent),
    inset 0 4px 6px -4px rgba(255, 255, 255, 0.20);
}

#nxNav .pill-shorts:hover::after,
#nxNav .pill-shorts.active::after {
  opacity: 1;
}

/* Swirl + gentle "sloshing" breath */
@keyframes pill-rainbow-swirl {
  0%   { transform: rotate(0turn)  scale(1);    }
  50%  { transform: rotate(.5turn) scale(1.18); }
  100% { transform: rotate(1turn)  scale(1);    }
}

@media (prefers-reduced-motion: reduce) {
  #nxNav .pill-shorts::before { animation: none; }
}

/* ============ AUTH (logged-out) ============ */
#nxNav .auth { display: flex; align-items: center; gap: 18px; }
#nxNav .login {
  color: #e5e7eb; font-size: 15px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: color .2s ease;
  background: none; border: none; cursor: pointer; font-family: inherit;
}
#nxNav .login:hover { color: #fff; }
#nxNav .register {
  position: relative; overflow: hidden;
  background: #22d3ee; color: #08131a;
  font-size: 14px; font-weight: 700; text-decoration: none;
  padding: 11px 26px; border-radius: 999px;
  white-space: nowrap; border: none; cursor: pointer;
  transition: box-shadow .25s ease, transform .2s ease;
}
#nxNav .register:hover { box-shadow: 0 0 22px rgba(34, 211, 238, .55); transform: translateY(-1px); }
#nxNav .ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  transform: scale(0);
  animation: nxRipple .55s ease-out forwards;
  pointer-events: none;
}
@keyframes nxRipple { to { transform: scale(3); opacity: 0; } }

/* ============ AVATAR + DROPDOWN ============ */
#nxNav .avatar-wrap { position: relative; flex-shrink: 0; }
#nxNav .avatar {
  position: relative; width: 46px; height: 46px;
  border-radius: 50%; padding: 2.5px; border: none; cursor: pointer;
  display: block; text-decoration: none;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.5), rgba(236, 72, 153, 0.4), rgba(34, 211, 238, 0.35));
  transition: transform .2s ease, box-shadow .25s ease;
}
#nxNav .avatar:hover { transform: scale(1.05); box-shadow: 0 0 18px rgba(168, 85, 247, .5); }
#nxNav .avatar .inner {
  width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(135deg, #5b21b6, #0e7490);
  display: grid; place-items: center; overflow: hidden;
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: .5px;
}
#nxNav .avatar::after {
  content: ''; position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #4ade80; border: 2.5px solid transparent;
}
#nxNav .avatar .inner img,
#nxNav .mm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============ HAMBURGER ============ */
#nxNav .hamburger {
  display: none; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, .07);
  cursor: pointer; flex-direction: column;
  align-items: center; justify-content: center; gap: 4.5px;
  transition: background .25s ease;
}
#nxNav .hamburger:hover { background: rgba(255, 255, 255, .16); }
#nxNav .hamburger span {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: #fff;
  transition: transform .3s ease, opacity .25s ease, width .25s ease;
}
#nxNav .hamburger span:nth-child(2) { width: 13px; margin-right: 5px; }
#nxNav .hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#nxNav .hamburger.open span:nth-child(2) { opacity: 0; transform: translateX(-6px); }
#nxNav .hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ============ MOBILE DRAWER ============ */
#nxNav .backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 3, 10, .65);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
  z-index: 150;
}
#nxNav .backdrop.open { opacity: 1; visibility: visible; }

#nxNav .mobile-menu {
  position: fixed; top: 0; right: 0;
  height: 100dvh; width: min(330px, 88vw);
  background: #0d0a16;
  border-left: 1px solid rgba(168, 85, 247, .18);
  transform: translateX(105%);
  transition: transform .38s cubic-bezier(.32, .72, .28, 1);
  z-index: 200;
  display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px
           calc(16px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}
#nxNav .mobile-menu.open { transform: none; visibility: visible !important; }

#nxNav .mm-close {
  align-self: flex-end; width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, .07);
  color: #fff; font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s ease, transform .3s ease;
}
#nxNav .mm-close:hover { background: rgba(255, 255, 255, .16); transform: rotate(90deg); }

#nxNav .mm-user {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(168, 85, 247, .12), rgba(34, 211, 238, .08));
  border: 1px solid rgba(168, 85, 247, .25);
  margin: 8px 0 4px; text-decoration: none;
}
#nxNav .mm-user .mm-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #5b21b6, #0e7490);
  display: grid; place-items: center; overflow: hidden;
  color: #fff; font-weight: 800; font-size: 15px;
  border: 2px solid rgba(168, 85, 247, .6); flex-shrink: 0;
}
#nxNav .mm-user .name { color: #fff; font-size: 15px; font-weight: 700; }
#nxNav .mm-user .hint { color: #a78bfa; font-size: 12.5px; font-weight: 500; }

#nxNav .mm-label {
  color: #6b6b7e; font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; margin: 18px 6px 8px;
}

#nxNav .mm-row-form { display: block; }
#nxNav .mm-row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 10px; border-radius: 12px;
  text-decoration: none; color: #e5e7eb;
  font-size: 15px; font-weight: 600;
  border: none; background: none;
  width: 100%; cursor: pointer;
  font-family: inherit; text-align: left;
  transition: background .2s ease, transform .15s ease;
}
#nxNav .mm-row:active { transform: scale(.98); }
#nxNav .mm-row .icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  color: var(--c); flex-shrink: 0;
  transition: background .2s ease, color .2s ease;
}
#nxNav .mm-row .icon svg { width: 18px; height: 18px; }
#nxNav .mm-row:hover { background: color-mix(in srgb, var(--c) 12%, transparent); }
#nxNav .mm-row:hover .icon { background: var(--c); color: #0d0a16; }
#nxNav .mm-row .chev { margin-left: auto; color: #55556a; }
#nxNav .mm-row .chev svg { width: 16px; height: 16px; display: block; }
#nxNav .mm-row.logout { color: var(--red); }

#nxNav .mm-auth { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
#nxNav .mm-auth a { text-decoration: none; }
#nxNav .mm-auth .register, #nxNav .mm-auth .login-btn {
  text-align: center; padding: 13px; border-radius: 12px; font-size: 15px;
}
#nxNav .mm-auth .login-btn {
  background: rgba(255, 255, 255, .07);
  color: #fff; font-weight: 600;
  border: none; cursor: pointer; font-family: inherit;
  transition: background .2s ease;
}
#nxNav .mm-auth .login-btn:hover { background: rgba(255, 255, 255, .14); }

/* staggered entrance */
#nxNav .mobile-menu.open .mm-row,
#nxNav .mobile-menu.open .mm-user { animation: nxSlideIn .4s ease both; }
#nxNav .mobile-menu.open .mm-user { animation-delay: .05s; }
#nxNav .mobile-menu.open .mm-row:nth-of-type(1) { animation-delay: .08s; }
@keyframes nxSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: none; }
}

/* nav-links gap between pills */
#nxNav .nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============ RESPONSIVE BREAKPOINT ============ */
#nxNav .logout-btn-wrap { margin: 0 4px 0 2px; flex-shrink: 0; }
#nxNav .logout-icon {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid rgba(168, 85, 247, .28);
  border-radius: 12px;
  background: rgba(168, 85, 247, .10);
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .25s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
#nxNav .logout-icon:hover {
  transform: scale(1.06);
  background: rgba(248, 113, 113, .16);
  border-color: rgba(248, 113, 113, .55);
  color: #f87171;
  box-shadow: 0 0 16px rgba(248, 113, 113, .35);
}
#nxNav .logout-icon:active { transform: scale(.96); }
#nxNav .logout-icon svg { display: block; }

@media (max-width: 900px) {
  #nxNav .nav-links, #nxNav .auth, #nxNav .avatar-wrap, #nxNav .logout-btn-wrap { display: none; }
  #nxNav .hamburger { display: flex; }
  #nxNav .topbar {
    padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 4px;
    padding-left: max(8px, calc(var(--nx-edge-left, 22px) - 6px));
  }
  #nxNav .home-btn, #nxNav .hamburger { width: 40px; height: 40px; }
  #nxNav .logo img { height: max(18px, calc(var(--nx-logo-h, 30px) * 0.86)); }
}

/* ── Notification bell ─────────────────────────────────────── */
.notif-wrap{position:relative;flex-shrink:0;margin-right:12px}
.notif-bell{display:flex;align-items:center;justify-content:center;width:46px;height:46px;
  border-radius:50%;color:rgba(255,255,255,.72);text-decoration:none;cursor:pointer;
  transition:color .18s ease,transform .18s ease,background .18s ease}
.notif-bell:hover{color:#fff;background:rgba(255,255,255,.06);transform:scale(1.06)}
.notif-bell:active{transform:scale(.94)}
.notif-bell:focus-visible{outline:2px solid #00E5FF;outline-offset:2px}
.notif-badge{position:absolute;left:4px;bottom:4px;min-width:17px;height:17px;padding:0 4px;
  border-radius:999px;background:#ef4444;color:#fff;font-size:10px;font-weight:800;
  line-height:17px;text-align:center;pointer-events:none;
  box-shadow:0 0 0 2px rgba(6,6,14,.92)}
.notif-badge[hidden]{display:none}
#nxNav .mm-row .icon{position:relative}
.mm-notif-badge{left:auto;right:-5px;bottom:-5px;min-width:15px;height:15px;line-height:15px;font-size:9px}
@media (prefers-reduced-motion:reduce){.notif-bell{transition:none}}
@media (max-width:900px){#nxNav .notif-wrap{display:none}}