/* Shared navigation contract for the public site and Admin. Page-specific
   styles own only behavior that is genuinely different, such as Admin tabs. */
.snfx-nav-shell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 24px 48px;
  border-bottom: 1px solid rgba(108, 99, 255, 0.08);
  background: linear-gradient(180deg, rgba(5, 5, 15, 0.7) 0%, rgba(5, 5, 12, 0.3) 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

[data-theme="light"] .snfx-nav-shell {
  border-bottom-color: rgba(108, 99, 255, 0.12);
  background: linear-gradient(180deg, rgba(240, 240, 245, 0.85) 0%, rgba(240, 240, 245, 0.5) 100%);
}

.snfx-nav-brand {
  position: relative;
  flex: 0 0 auto;
  min-width: max-content;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 14px;
  border: 1px solid rgba(108, 99, 255, 0.35);
  border-radius: 14px;
  background: rgba(108, 99, 255, 0.08);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 -2px 0 rgba(0, 0, 0, 0.3) inset,
    0 0 24px rgba(108, 99, 255, 0.2);
  color: inherit;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.snfx-nav-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 40%, transparent 60%, rgba(0, 0, 0, 0.1) 100%);
  pointer-events: none;
}

.snfx-nav-brand:hover {
  border-color: rgba(108, 99, 255, 0.6);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 -2px 0 rgba(0, 0, 0, 0.4) inset,
    0 0 36px rgba(108, 99, 255, 0.35);
  transform: translateY(-1px);
}

.snfx-nav-brand:active {
  transform: translateY(1px);
}

.snfx-nav-brand-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.snfx-nav-brand-mark {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}

.snfx-nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 36px;
  min-width: 0;
  margin-left: 48px;
}

.snfx-nav-links > a {
  position: relative;
  padding: 10px 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0.5;
  touch-action: manipulation;
  transition: opacity 300ms ease, text-shadow 300ms ease;
}

.snfx-nav-links > a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 0 8px rgba(108, 99, 255, 0.4);
  transition: width 300ms ease, left 300ms ease;
}

.snfx-nav-links > a:hover,
.snfx-nav-links > a.active {
  opacity: 1;
  text-shadow: 0 0 20px rgba(108, 99, 255, 0.5), 0 0 40px rgba(108, 99, 255, 0.2);
}

.snfx-nav-links > a:hover::after,
.snfx-nav-links > a.active::after {
  left: 0;
  width: 100%;
}

.snfx-nav-controls {
  position: static;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.snfx-nav-controls .music-wrapper {
  position: relative;
  margin-left: 12px;
}

@media (min-width: 1181px) {
  #nav .snfx-nav-links {
    position: absolute;
    left: 50%;
    margin-left: 0;
    transform: translateX(-50%);
  }
}

.snfx-nav-controls .jelly-toggle,
.snfx-nav-controls .bubble-toggle,
.snfx-nav-controls .snow-toggle,
.snfx-nav-controls .code-rain-toggle,
.snfx-nav-controls .theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 300ms ease, border-color 300ms ease, background-color 300ms ease, transform 300ms ease;
}

.snfx-nav-controls .jelly-toggle.active {
  color: var(--accent2);
  border-color: rgba(0, 212, 170, 0.3);
}

.snfx-nav-controls .bubble-toggle.active {
  color: var(--accent);
  border-color: rgba(108, 99, 255, 0.3);
}

.snfx-nav-controls .snow-toggle.active {
  color: #b8e4ff;
  border-color: rgba(184, 228, 255, 0.4);
}

.snfx-nav-controls .jelly-toggle:hover,
.snfx-nav-controls .bubble-toggle:hover,
.snfx-nav-controls .snow-toggle:hover,
.snfx-nav-controls .code-rain-toggle:hover,
.snfx-nav-controls .theme-toggle:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.08);
  color: var(--text);
}

.snfx-nav-controls .music-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: 54px;
  height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: background-color 300ms ease, border-color 300ms ease;
}

[data-theme="light"] .snfx-nav-controls .music-toggle {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.05);
}

.snfx-nav-controls .music-toggle:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.15);
}

.snfx-nav-controls .music-toggle .music-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.snfx-nav-controls .music-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.snfx-nav-controls .music-bars .bar {
  display: block;
  width: 3px;
  height: 4px;
  border-radius: 1px;
  background: var(--accent2);
  transition: height 200ms ease;
}

.snfx-nav-controls .music-toggle.playing .music-icon--play {
  display: none;
}

.snfx-nav-controls .music-toggle.playing .music-icon--pause {
  display: block !important;
}

.snfx-nav-controls .music-toggle:not(.playing) .music-icon--play {
  display: block;
}

.snfx-nav-controls .music-toggle:not(.playing) .music-icon--pause {
  display: none !important;
}

.snfx-nav-controls .music-toggle.playing .music-bars .bar {
  animation: snfxNavBarBounce 800ms ease-in-out infinite alternate;
}

.snfx-nav-controls .music-toggle.playing .music-bars .bar:nth-child(2) {
  animation-delay: 150ms;
}

.snfx-nav-controls .music-toggle.playing .music-bars .bar:nth-child(3) {
  animation-delay: 300ms;
}

.snfx-nav-controls .music-toggle.playing .music-bars .bar:nth-child(4) {
  animation-delay: 450ms;
}

.snfx-nav-controls .song-selector {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  bottom: auto;
  z-index: 1000;
  width: 280px;
  max-height: 320px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(10, 14, 24, 0.95);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transition: opacity 250ms ease, transform 250ms ease, visibility 250ms ease;
}

[data-theme="light"] .snfx-nav-controls .song-selector {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.95);
}

.snfx-nav-controls .song-selector.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.snfx-nav-controls .song-selector-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

[data-theme="light"] .snfx-nav-controls .song-selector-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.snfx-nav-controls .song-list {
  max-height: 270px;
  overflow-y: auto;
}

.snfx-nav-controls .song-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease;
}

.snfx-nav-controls .song-item:hover {
  background: rgba(108, 99, 255, 0.1);
}

.snfx-nav-controls .song-item.active {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent);
}

.snfx-nav-controls .song-item-icon {
  flex: 0 0 16px;
  width: 16px;
  text-align: center;
  opacity: 0.5;
}

.snfx-nav-controls .song-item.active .song-item-icon {
  opacity: 1;
}

.snfx-nav-controls .song-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snfx-nav-brand:focus-visible,
.snfx-nav-links > a:focus-visible,
.snfx-nav-controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.admin-topbar.snfx-nav-shell .admin-topbar-context {
  display: none;
}

@media (max-width: 1180px) and (min-width: 769px) {
  .snfx-nav-shell {
    padding-inline: 24px;
  }

  .snfx-nav-links {
    gap: 16px;
    margin-left: 24px;
  }

  .snfx-nav-brand-text {
    display: none;
  }
}

@media (max-width: 768px) {
  .snfx-nav-shell {
    min-height: 76px;
    padding:
      calc(16px + env(safe-area-inset-top, 0px))
      24px
      16px;
  }

  .snfx-nav-links {
    display: none;
  }

  .admin-topbar.snfx-nav-shell .admin-topbar-context {
    display: flex;
    min-width: 0;
    margin-left: 14px;
  }

  .snfx-nav-controls {
    position: fixed;
    top: calc(100dvh - 70px - env(safe-area-inset-bottom, 0px));
    right: 12px;
    bottom: auto;
    z-index: 9999;
    gap: 5px;
    max-width: calc(100vw - 24px);
    margin: 0;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(18, 18, 28, 0.7);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  [data-theme="light"] .snfx-nav-controls {
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.12);
  }

  .snfx-nav-controls .jelly-toggle,
  .snfx-nav-controls .bubble-toggle,
  .snfx-nav-controls .snow-toggle,
  .snfx-nav-controls .code-rain-toggle,
  .snfx-nav-controls .theme-toggle {
    width: 44px;
    height: 44px;
  }

  .snfx-nav-controls .music-wrapper {
    margin-left: 0;
  }

  .snfx-nav-controls .music-toggle {
    min-width: 54px;
    height: 44px;
    padding: 6px 10px;
    border-radius: 22px;
  }

  .snfx-nav-controls .song-selector {
    top: auto;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(280px, calc(100vw - 32px));
    max-height: min(320px, calc(100vh - 120px));
  }
}

@media (max-width: 480px) {
  .snfx-nav-shell {
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      16px
      12px;
  }

}

@media (max-width: 380px) {
  .snfx-nav-controls {
    gap: 2px;
    padding-inline: 6px;
  }

  .snfx-nav-controls .music-toggle {
    min-width: 44px;
    padding-inline: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snfx-nav-brand,
  .snfx-nav-links > a,
  .snfx-nav-links > a::after,
  .snfx-nav-controls button,
  .snfx-nav-controls .song-selector,
  .snfx-nav-controls .music-bars .bar {
    transition-duration: 0.01ms;
    animation: none;
  }
}

@keyframes snfxNavBarBounce {
  from { height: 4px; }
  to { height: 14px; }
}

.snfx-update-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: 14px;
  padding: 4px 11px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.snfx-update-badge[hidden] { display: none; }
.snfx-update-badge:hover { background: var(--accent); color: #fff; }
.snfx-update-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .snfx-update-badge { margin-left: 8px; padding: 3px 8px; font-size: 11px; }
}