/* ═══════════════════════════════════════════════════════
   FCFVA Unified Navigation v1.0
   Mobile-first bottom tab bar + desktop top nav
   Shared across: Main Site, Apps, Games, News, Currents
   ═══════════════════════════════════════════════════════ */

:root {
  --nav-bg: rgba(8, 8, 20, 0.97);
  --nav-border: rgba(0, 212, 255, 0.12);
  --nav-text: #8a8a9a;
  --nav-text-active: #00d4ff;
  --nav-text-hover: #ffffff;
  --nav-accent: #00d4ff;
  --nav-accent-glow: rgba(0, 212, 255, 0.25);
  --nav-highlight: #e94560;
  --nav-purple: #9b59f0;
  --nav-surface: rgba(255, 255, 255, 0.04);
  --nav-surface-hover: rgba(255, 255, 255, 0.08);
  --nav-height-desktop: 56px;
  --nav-height-mobile-top: 52px;
  --nav-height-mobile-bottom: 60px;
  --nav-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-z: 10000;
}

[data-theme="light"] {
  --nav-bg: rgba(250, 250, 252, 0.97);
  --nav-border: rgba(0, 0, 0, 0.08);
  --nav-text: #6b6b7b;
  --nav-text-active: #0066cc;
  --nav-text-hover: #111;
  --nav-accent: #0066cc;
  --nav-accent-glow: rgba(0, 102, 204, 0.15);
  --nav-surface: rgba(0, 0, 0, 0.03);
  --nav-surface-hover: rgba(0, 0, 0, 0.06);
}

/* ═══════════════════════════════════════════════════════
   RESET — Override any page-specific nav styling
   ═══════════════════════════════════════════════════════ */
.fcfva-nav * { box-sizing: border-box; margin: 0; padding: 0; }
.fcfva-nav a { text-decoration: none; color: inherit; }
.fcfva-nav button { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }

/* ═══════════════════════════════════════════════════════
   1. TOP BAR (All screens)
   ═══════════════════════════════════════════════════════ */
.fcfva-topbar {
  position: sticky;
  top: 0;
  z-index: var(--nav-z);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--nav-border);
  height: var(--nav-height-mobile-top);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}

.fcfva-topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', monospace, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--nav-accent);
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.fcfva-topbar-logo img {
  height: 28px;
  width: auto;
}

/* Desktop nav links (hidden on mobile) */
.fcfva-topbar-links {
  display: none;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.fcfva-topbar-links a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--nav-text);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  position: relative;
}

.fcfva-topbar-links a:hover {
  color: var(--nav-text-hover);
  background: var(--nav-surface-hover);
}

.fcfva-topbar-links a.active {
  color: var(--nav-text-active);
  background: var(--nav-accent-glow);
}

.fcfva-topbar-links a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--nav-accent);
  border-radius: 1px;
}

/* Play dropdown */
.fcfva-topbar-dropdown {
  position: relative;
}

.fcfva-topbar-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%; padding-top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: 12px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.fcfva-topbar-dropdown:hover .fcfva-topbar-dropdown-menu,
.fcfva-topbar-dropdown.open .fcfva-topbar-dropdown-menu {
  display: block;
}

.fcfva-topbar-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--nav-text);
  transition: all 0.15s;
}

.fcfva-topbar-dropdown-menu a:hover {
  background: var(--nav-surface-hover);
  color: var(--nav-text-hover);
}

.fcfva-topbar-dropdown-menu a .dd-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

/* Right controls */
.fcfva-topbar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.fcfva-topbar-controls button,
.fcfva-topbar-controls a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--nav-text);
  transition: color 0.2s, background 0.2s;
}

.fcfva-topbar-controls button:hover,
.fcfva-topbar-controls a:hover {
  color: var(--nav-text-hover);
  background: var(--nav-surface-hover);
}

.fcfva-topbar-controls svg {
  width: 18px;
  height: 18px;
}

/* Wallet badge */
.fcfva-wallet-badge {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--nav-purple);
  background: rgba(155, 89, 240, 0.1);
  border: 1px solid rgba(155, 89, 240, 0.2);
}

.fcfva-wallet-badge.connected { display: flex; }

/* User avatar */
.fcfva-topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--nav-border);
  object-fit: cover;
}

/* Login button */
.fcfva-topbar-login {
  padding: 6px 14px !important;
  width: auto !important;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff !important;
  background: linear-gradient(135deg, var(--nav-accent), var(--nav-purple)) !important;
  border-radius: 8px;
}

.fcfva-topbar-login:hover {
  opacity: 0.9;
  background: linear-gradient(135deg, var(--nav-accent), var(--nav-purple)) !important;
}

/* ═══════════════════════════════════════════════════════
   2. MOBILE BOTTOM TAB BAR
   ═══════════════════════════════════════════════════════ */
.fcfva-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--nav-z);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--nav-border);
  height: calc(var(--nav-height-mobile-bottom) + var(--nav-safe-bottom));
  padding-bottom: var(--nav-safe-bottom);
  display: flex;
  align-items: stretch;
}

.fcfva-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--nav-text);
  transition: color 0.2s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.fcfva-tab:active {
  transform: scale(0.92);
}

.fcfva-tab.active {
  color: var(--nav-text-active);
}

.fcfva-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--nav-accent);
  border-radius: 0 0 2px 2px;
}

.fcfva-tab-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.fcfva-tab-icon svg {
  width: 22px;
  height: 22px;
}

.fcfva-tab-label {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Play tab popup (replaces dropdown on mobile) */
.fcfva-play-popup {
  display: none;
  position: fixed;
  bottom: calc(var(--nav-height-mobile-bottom) + var(--nav-safe-bottom) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--nav-z) + 1);
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: 16px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.fcfva-play-popup.visible {
  display: block;
  animation: popupSlideUp 0.2s ease-out;
}

@keyframes popupSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.fcfva-play-popup a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--nav-text);
  transition: all 0.15s;
}

.fcfva-play-popup a:hover,
.fcfva-play-popup a:active {
  background: var(--nav-surface-hover);
  color: var(--nav-text-hover);
}

.fcfva-play-popup .dd-icon {
  font-size: 1.2rem;
}

/* Backdrop for popup */
.fcfva-popup-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: calc(var(--nav-z));
  background: rgba(0, 0, 0, 0.3);
}

.fcfva-popup-backdrop.visible {
  display: block;
}

/* ═══════════════════════════════════════════════════════
   3. MOBILE SEARCH OVERLAY
   ═══════════════════════════════════════════════════════ */
.fcfva-search-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--nav-z) + 2);
  background: var(--nav-bg);
  padding: 8px 12px;
  border-bottom: 1px solid var(--nav-border);
}

.fcfva-search-overlay.visible { display: flex; gap: 8px; align-items: center; }

.fcfva-search-overlay input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  background: var(--nav-surface);
  border: 1px solid var(--nav-border);
  border-radius: 10px;
  color: var(--nav-text-hover);
  font-size: 0.88rem;
  outline: none;
}

.fcfva-search-overlay input:focus {
  border-color: var(--nav-accent);
  box-shadow: 0 0 0 2px var(--nav-accent-glow);
}

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

.fcfva-search-overlay button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nav-text);
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════
   4. DESKTOP SEARCH (inline in top bar)
   ═══════════════════════════════════════════════════════ */
.fcfva-desktop-search {
  display: none;
  position: relative;
  max-width: 220px;
}

.fcfva-desktop-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  background: var(--nav-surface);
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  color: var(--nav-text-hover);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, width 0.3s;
}

.fcfva-desktop-search input:focus {
  border-color: var(--nav-accent);
  box-shadow: 0 0 0 2px var(--nav-accent-glow);
}

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

.fcfva-desktop-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--nav-text);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   5. BODY PADDING (prevent content behind bars)
   ═══════════════════════════════════════════════════════ */
body.fcfva-has-bottombar {
  padding-bottom: calc(var(--nav-height-mobile-bottom) + var(--nav-safe-bottom) + 8px);
}

/* ═══════════════════════════════════════════════════════
   6. DESKTOP BREAKPOINT (768px+)
   ═══════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .fcfva-topbar {
    height: var(--nav-height-desktop);
    padding: 0 24px;
    gap: 16px;
  }

  .fcfva-topbar-logo {
    font-size: 1.2rem;
  }

  .fcfva-topbar-logo img { height: 32px; }

  .fcfva-topbar-links { display: flex; }
  .fcfva-desktop-search { display: block; }

  /* Hide mobile-only elements */
  .fcfva-bottombar { display: none; }
  .fcfva-play-popup { display: none !important; }
  .fcfva-popup-backdrop { display: none !important; }
  .fcfva-mobile-only { display: none !important; }

  body.fcfva-has-bottombar { padding-bottom: 0; }
}

/* ═══════════════════════════════════════════════════════
   7. LARGE DESKTOP (1200px+)
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1200px) {
  .fcfva-topbar { padding: 0 32px; }
  .fcfva-desktop-search { max-width: 280px; }
  .fcfva-topbar-links a { padding: 6px 18px; }
}

/* ═══════════════════════════════════════════════════════
   8. THEME TOGGLE ICON STATES
   ═══════════════════════════════════════════════════════ */
[data-theme="dark"] .fcfva-sun-icon { display: none; }
[data-theme="dark"] .fcfva-moon-icon { display: block; }
[data-theme="light"] .fcfva-sun-icon { display: block; }
[data-theme="light"] .fcfva-moon-icon { display: none; }

/* ═══════════════════════════════════════════════════════
   9. STANDALONE PAGE OVERRIDES
   When nav is used on Apps/Games/News (non-WP pages)
   ═══════════════════════════════════════════════════════ */
.fcfva-standalone-page {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0a0a0a;
  color: #f0f0f0;
  margin: 0;
}

.fcfva-standalone-content {
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-height-mobile-top) - var(--nav-height-mobile-bottom));
}

@media (min-width: 768px) {
  .fcfva-standalone-content {
    min-height: calc(100vh - var(--nav-height-desktop));
  }
}

/* Logout button */
.fcfva-topbar-logout {
  padding: 6px 12px !important;
  width: auto !important;
  height: auto !important;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--nav-text) !important;
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  white-space: nowrap;
}

.fcfva-topbar-logout:hover {
  color: var(--hp-magenta, #e94560) !important;
  border-color: var(--hp-magenta, #e94560);
  background: rgba(233, 69, 96, 0.1) !important;
}

/* Ensure login button is always visible */
.fcfva-topbar-login {
  display: inline-flex !important;
  align-items: center !important;
  height: auto !important;
}


/* Social Popup (Mobile) */
#fcfva-social-popup {
  display: none;
  position: fixed;
  bottom: calc(var(--nav-height-mobile-bottom, 60px) + env(safe-area-inset-bottom, 0px) + 8px);
  right: 12px;
  z-index: 10001;
  background: var(--nav-bg, #0a0a1a);
  border: 1px solid var(--nav-border, rgba(0,212,255,0.08));
  border-radius: 16px;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#fcfva-social-popup.visible {
  display: block;
  animation: popupSlideUp 0.2s ease-out;
}

#fcfva-social-popup a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--nav-text, #c8c8d8);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s;
}

#fcfva-social-popup a:hover {
  background: var(--nav-hover, rgba(255,255,255,0.06));
}

#fcfva-social-popup .dd-icon {
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  #fcfva-social-popup { display: none !important; }
}

/* Social dropdown positioning (Desktop) */
.fcfva-topbar-dropdown:last-of-type .fcfva-topbar-dropdown-menu {
  right: 0;
  left: auto;
}
