/* =====================================================================
   Impulse — shared app stylesheet
   Design system: "Velocity HUD" (glassmorphism + futuristic HUD)
   Shell (sidebar / topbar / background / mobile nav) is injected by
   shell.js and styled here with plain CSS so it never depends on the
   Tailwind JIT. Page-specific effects stay inline in each page.
   ===================================================================== */

:root {
  --background: #111316;
  --surface: #111316;
  --surface-container-lowest: #0c0e11;
  --surface-container-low: #1a1c1f;
  --surface-container: #1e2023;
  --surface-container-high: #282a2d;
  --surface-container-highest: #333538;
  --on-surface: #e2e2e6;
  --on-surface-variant: #b9cbb9;
  --outline: #849585;
  --outline-variant: #3b4b3d;
  --primary-fixed: #60ff99;
  --primary-fixed-dim: #00e479;
  --primary-container: #00ff88;
  --on-primary-container: #007139;
  --secondary-container: #ff562c;
  --tertiary-fixed-dim: #00daf3;
  --error: #ffb4ab;

  --sidebar-w: 16rem;
  --topbar-h: 4rem;
}

/* ---------- base ---------- */
html { scroll-behavior: smooth; }
body {
  background-color: var(--background);
  color: var(--on-surface);
  font-family: "Geist", sans-serif;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-container-lowest); }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ---------- shared background ---------- */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -10;
  background-color: var(--background);
  background-image:
    radial-gradient(circle at 50% -10%, rgba(0, 228, 121, 0.06), transparent 55%),
    linear-gradient(to bottom, rgba(0, 255, 136, 0.015), transparent 40%),
    linear-gradient(rgba(59, 75, 61, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 75, 61, 0.10) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

/* ---------- glass helpers (shared) ---------- */
.glass-panel, .hud-glass {
  background-color: rgba(30, 32, 35, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 75, 61, 0.3);
  box-shadow: inset 0 0 20px rgba(0, 228, 121, 0.05);
}
.neon-text-primary { text-shadow: 0 0 10px rgba(0, 228, 121, 0.5); }
.neon-text-secondary { text-shadow: 0 0 10px rgba(255, 86, 44, 0.5); }
.neon-glow { box-shadow: 0 0 12px rgba(0, 228, 121, 0.35); }
.neon-border-primary { box-shadow: 0 0 10px rgba(0, 228, 121, 0.3), inset 0 0 10px rgba(0, 228, 121, 0.1); border-color: rgba(0, 228, 121, 0.5); }
.neon-border-secondary { box-shadow: 0 0 10px rgba(255, 86, 44, 0.3), inset 0 0 10px rgba(255, 86, 44, 0.1); border-color: rgba(255, 86, 44, 0.5); }
.grid-bg {
  background-image:
    linear-gradient(rgba(0, 228, 121, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 228, 121, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}
.scanline {
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0, 228, 121, 0.03) 3px, rgba(0,0,0,0) 4px);
}
.corner-brackets { position: relative; }
.corner-brackets::before, .corner-brackets::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--primary-fixed-dim); border-style: solid;
}
.corner-brackets::before { top: 6px; left: 6px; border-width: 2px 0 0 2px; }
.corner-brackets::after { bottom: 6px; right: 6px; border-width: 0 2px 2px 0; }

/* segmented LED progress bar (shared) */
.progress-bar-segment { width: 15%; height: 100%; margin-right: 2px; background-color: rgba(132, 149, 133, 0.3); }
.progress-bar-segment.active-primary { background-color: var(--primary-fixed-dim); box-shadow: 0 0 5px var(--primary-fixed-dim); }
.progress-bar-segment.active-secondary { background-color: var(--secondary-container); box-shadow: 0 0 5px var(--secondary-container); }

/* =====================================================================
   APP SHELL
   ===================================================================== */

/* brand wordmark */
.brand { font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: 0.04em; }
.brand .brand-accent { color: var(--primary-fixed-dim); text-shadow: 0 0 12px rgba(0, 228, 121, 0.55); }
.brand-bolt { color: var(--primary-fixed-dim); text-shadow: 0 0 12px rgba(0, 228, 121, 0.6); }

/* ---------- sidebar ---------- */
.app-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; z-index: 40;
  background-color: rgba(12, 14, 17, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--outline-variant);
}
.app-sidebar__brand { display: flex; align-items: center; gap: 10px; font-size: 22px; padding: 6px 10px 18px; }
.app-sidebar__brand .brand-bolt { font-size: 26px; }
.app-sidebar__section-label {
  font-family: "JetBrains Mono", monospace; font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--outline); text-transform: uppercase;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 0.5rem;
  color: var(--on-surface-variant); text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-left: 2px solid transparent;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-item .material-symbols-outlined { font-size: 22px; }
.nav-item:hover { background-color: rgba(255, 255, 255, 0.04); color: var(--on-surface); }
.nav-item.active {
  background-color: rgba(0, 255, 136, 0.12);
  color: var(--primary-fixed);
  border-left-color: var(--primary-fixed-dim);
  box-shadow: inset 0 0 16px rgba(0, 228, 121, 0.10);
}
.nav-item.active .material-symbols-outlined { font-variation-settings: 'FILL' 1; text-shadow: 0 0 10px rgba(0, 228, 121, 0.6); }

/* sidebar CTA */
.sidebar-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 14px 6px; padding: 13px; border-radius: 0.5rem;
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 14px; letter-spacing: 0.06em;
  color: #00210c; text-decoration: none; text-transform: uppercase;
  background: linear-gradient(135deg, var(--primary-container), var(--primary-fixed-dim));
  box-shadow: 0 0 18px rgba(0, 228, 121, 0.4); transition: box-shadow .15s ease, transform .1s ease;
}
.sidebar-cta:hover { box-shadow: 0 0 28px rgba(0, 228, 121, 0.7); }
.sidebar-cta:active { transform: scale(0.98); }

.app-sidebar__spacer { flex: 1 1 auto; }
.app-sidebar__user {
  display: flex; align-items: center; gap: 10px; margin: 8px 4px 0;
  padding: 10px; border-radius: 0.5rem; background: rgba(30, 32, 35, 0.5);
  border: 1px solid var(--outline-variant);
}
.app-sidebar__user img { width: 36px; height: 36px; border-radius: 9999px; border: 1px solid rgba(0, 228, 121, 0.5); object-fit: cover; }
.app-sidebar__user .u-name { font-weight: 600; font-size: 13px; color: var(--on-surface); }
.app-sidebar__user .u-rank { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--primary-fixed-dim); letter-spacing: 0.1em; }

/* ---------- topbar ---------- */
.app-topbar {
  position: fixed; top: 0; right: 0; left: 0; height: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background-color: rgba(12, 14, 17, 0.7);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--outline-variant);
}
.app-topbar__title { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 18px; color: var(--on-surface); }
.app-topbar__spacer { flex: 1 1 auto; }
.topbar-mobile-brand { display: none; align-items: center; gap: 8px; font-size: 18px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 0.5rem; position: relative;
  color: var(--on-surface-variant); background: transparent; border: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.05); color: var(--primary-fixed-dim); }
.icon-btn .badge {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 9999px;
  background: var(--secondary-container); box-shadow: 0 0 6px var(--secondary-container);
}
.wallet-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 9999px;
  background: rgba(30, 32, 35, 0.7); border: 1px solid var(--outline-variant);
  font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 500; color: var(--on-surface);
}
.wallet-pill .material-symbols-outlined { font-size: 18px; color: var(--primary-fixed-dim); }
.topup-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 0.5rem;
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 0.05em;
  text-transform: uppercase; text-decoration: none; color: #00210c;
  background: var(--primary-fixed-dim); transition: box-shadow .15s ease;
}
.topup-btn:hover { box-shadow: 0 0 16px rgba(0, 228, 121, 0.55); }
.app-topbar__avatar { width: 34px; height: 34px; border-radius: 9999px; border: 1px solid rgba(0, 228, 121, 0.5); object-fit: cover; }

/* ---------- main content offset ---------- */
.app-main { padding-top: var(--topbar-h); min-height: 100vh; }
.app-main > .app-main__inner { padding: 24px; }

/* ---------- mobile bottom nav ---------- */
.app-mobilenav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: none; align-items: center; justify-content: space-around;
  height: 64px; padding: 0 8px;
  background-color: rgba(12, 14, 17, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--outline-variant);
}
.app-mobilenav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--on-surface-variant); text-decoration: none; font-size: 10px; font-weight: 600;
}
.app-mobilenav a .material-symbols-outlined { font-size: 24px; }
.app-mobilenav a.active { color: var(--primary-fixed-dim); }
.app-mobilenav a.active .material-symbols-outlined { font-variation-settings: 'FILL' 1; text-shadow: 0 0 10px rgba(0, 228, 121, 0.6); }

/* hamburger only on mobile */
.app-topbar__menu { display: none; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (min-width: 768px) {
  .app-topbar { left: var(--sidebar-w); }
  .app-main { margin-left: var(--sidebar-w); }
}
@media (max-width: 767px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .app-sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.6); }
  .topbar-mobile-brand { display: flex; }
  .app-topbar__title { display: none; }
  .app-topbar__menu { display: inline-flex; }
  .app-mobilenav { display: flex; }
  .app-main { padding-bottom: 72px; }
  .wallet-pill .wallet-label { display: none; }
}

/* sidebar backdrop (mobile) */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35; display: none; }
.sidebar-backdrop.show { display: block; }
@media (min-width: 768px) { .sidebar-backdrop { display: none !important; } }
