/* ═══════════════════════════════════════════════════════════════════════════
   Navbar — Transparent → Solid on scroll
   ═══════════════════════════════════════════════════════════════════════════ */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--duration-slow) var(--ease-out),
              border-color var(--duration-slow) var(--ease-out),
              backdrop-filter var(--duration-slow) var(--ease-out);
}

.site-nav.scrolled {
  background: var(--bg-base);
  border-bottom-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Logo ───────────────────────────────────────────────────────────────── */
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand img {
  height: 48px;
  width: auto;
}

.nav-brand-text {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Center links ───────────────────────────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 769px) {
  .nav-links {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: 44px;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--ease-out);
  white-space: nowrap;
}

.nav-links a i,
.nav-links a .nav-icon {
  font-size: 1.15em;
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  text-align: center;
  object-fit: contain;
  vertical-align: middle;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.nav-links a.active {
  color: var(--accent);
}

/* ── Right section (credits, badge, user dropdown) ──────────────────────── */
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.nav-credits {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--accent);
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: border-color var(--duration) var(--ease-out);
  cursor: pointer;
}

.nav-avatar:hover {
  border-color: var(--accent);
}

/* ── Dropdown ───────────────────────────────────────────────────────────── */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--duration) var(--ease-out);
}

.nav-dropdown-toggle:hover {
  background: var(--bg-surface);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) 0;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration) var(--ease-out);
  z-index: 1001;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: all var(--duration) var(--ease-out);
}

.nav-dropdown-item:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-dropdown-item.danger {
  color: var(--danger);
}

.nav-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-2) 0;
}

/* ── Guest auth buttons ─────────────────────────────────────────────────── */
.nav-auth {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-auth .btn-outline {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
}

.nav-auth .btn-accent {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
}

/* ── Mobile hamburger ───────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--duration) var(--ease-out);
}

.nav-hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-nav {
    padding: var(--space-3) var(--space-4);
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4);
    gap: var(--space-1);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: var(--space-3) var(--space-4);
    width: 100%;
  }

  .nav-right {
    gap: var(--space-2);
  }

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

/* ── Expanding Search Dock ───────────────────────────────────────────────── */
/* js/shared/search-dock.js renders into this span. display:contents takes
   the span out of layout so .nav-search-dock stays the direct flex child
   that .nav-right and .nav-auth size and space. */
.nav-search-mount {
  display: contents;
}

.nav-search-dock {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out),
              transform 0.2s var(--ease-out),
              opacity 0.2s var(--ease-out);
}

.nav-search-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}

.nav-search-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Expanded search form */
.nav-search-form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 0;
  opacity: 0;
  overflow: hidden;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.4s var(--ease-out),
              border-color 0.4s var(--ease-out),
              background 0.4s var(--ease-out),
              backdrop-filter 0.4s var(--ease-out);
}

.nav-search-dock.expanded .nav-search-btn {
  transform: scale(0);
  opacity: 0;
  width: 0;
  pointer-events: none;
  position: absolute;
}

.nav-search-dock.expanded .nav-search-form {
  width: 300px;
  opacity: 1;
  border-color: var(--border);
  background: rgba(26, 32, 53, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-search-form .search-icon {
  margin-left: var(--space-4);
  flex-shrink: 0;
  color: var(--text-muted);
}

.nav-search-form .search-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-search-input {
  flex: 1;
  height: 40px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding-right: var(--space-2);
}

.nav-search-input::placeholder {
  color: var(--text-muted);
}

.nav-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  margin-right: var(--space-2);
  flex-shrink: 0;
  transition: background var(--duration) var(--ease-out),
              transform 0.15s var(--ease-out);
}

.nav-search-close:hover {
  background: var(--bg-surface);
  transform: scale(1.1);
}

.nav-search-close:active {
  transform: scale(0.9);
}

.nav-search-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 768px) {
  .nav-search-dock.expanded .nav-search-form {
    width: 200px;
  }
}

/* ── Spacer to push page content below fixed nav ────────────────────────── */
.nav-spacer {
  height: 68px;
}

/* ── Search Results Dropdown ────────────────────────────────────────────── */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 300px;
  max-height: 420px;
  overflow-y: auto;
  background: rgba(10, 15, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-top: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1001;
}

.search-results.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.search-group {
  padding: 6px 0;
}

.search-group + .search-group {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.search-group-label {
  padding: 8px 16px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-brand, #0ea5e9);
}

.search-results .search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 6px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--clr-silver, #c8cfd8);
  transition: background 0.15s ease;
  cursor: pointer;
}

.search-results .search-item:hover,
.search-results .search-item:focus {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.search-results .search-item:hover .search-item-name {
  color: #fff;
}

.search-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.search-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(14, 165, 233, 0.12);
  color: var(--clr-brand, #0ea5e9);
  font-size: 0.85rem;
}

.search-item-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.search-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  font-size: 0.72rem;
  color: rgba(200, 207, 216, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 4px;
}

.search-badge.pro {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #000;
}

.search-badge.premium {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
}

.search-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(200, 207, 216, 0.4);
}

/* Scrollbar styling for results */
.search-results::-webkit-scrollbar {
  width: 4px;
}
.search-results::-webkit-scrollbar-track {
  background: transparent;
}
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

@media (max-width: 768px) {
  .search-results {
    width: 200px;
    max-height: 360px;
  }
}
