/* ══════════════════════════════════════════
   BASE.CSS — Variables, Reset, Global Styles
   ══════════════════════════════════════════ */

:root[data-theme="dark"] {
  --bg: #030308;
  --surface: #0a0a14;
  --surface2: #10101e;
  --border: #1a1a30;
  --text: #ffffff;
  --text2: #8888cc;
  --accent: #b44fff;
  --accent2: #7c00ff;
  --accent-glow: rgba(180,79,255,0.5);
  --gold: #ffd700;
  --gold2: #ff9500;
  --gold-glow: rgba(255,215,0,0.5);
  --neon-pink: #ff2d78;
  --neon-cyan: #00f5ff;
  --neon-green: #00ff88;
  --green: #00ff88;
  --yellow: #ffd700;
  --red: #ff2d78;
  --nav-h: 72px;
}
:root[data-theme="light"] {
  --bg: #0a001a;
  --surface: #120024;
  --surface2: #1a003a;
  --border: #2a1050;
  --text: #ffffff;
  --text2: #aa88cc;
  --accent: #b44fff;
  --accent2: #7c00ff;
  --accent-glow: rgba(180,79,255,0.5);
  --gold: #ffd700;
  --gold2: #ff9500;
  --gold-glow: rgba(255,215,0,0.5);
  --neon-pink: #ff2d78;
  --neon-cyan: #00f5ff;
  --neon-green: #00ff88;
  --green: #00ff88;
  --yellow: #ffd700;
  --red: #ff2d78;
  --nav-h: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanline overlay */
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  animation: scanlines 8s linear infinite;
}
@keyframes scanlines {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

/* Neon ambient glow corners */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(180,79,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgba(0,245,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(255,45,120,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 0% 100%, rgba(255,215,0,0.06) 0%, transparent 50%);
  animation: ambient-shift 6s ease-in-out infinite alternate;
}
@keyframes ambient-shift {
  0%   { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Pages sit above ambient */
.page, .navbar, #auth-screen { position: relative; z-index: 1; }
.page { padding-top: 16px; padding-bottom: 96px; }
#auth-screen { padding-bottom: 0; }

/* ── PAGE TRANSITIONS ── */
.page.active { animation: pageIn 0.3s cubic-bezier(0.22,1,0.36,1); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── PAGES ── */
#app { display: none; }

.page {
  display: none;
  padding: calc(var(--nav-h) + 16px) 16px 32px;
  max-width: 640px;
  margin: 0 auto;
  animation: fadeIn 0.25s ease;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SECTION TITLES — neon marquee style ── */
.section-title {
  font-size: 24px; font-weight: 900; letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--gold), var(--neon-pink), var(--neon-cyan), var(--gold));
  background-size: 300% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: neon-sweep 3s linear infinite;
  text-shadow: none;
}
@keyframes neon-sweep {
  0%   { background-position: 0% center; }
  100% { background-position: 300% center; }
}

/* ── SLOT MACHINE BOTTOM NAV ── */
.navbar {
  position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: 72px;
  background: rgba(5,5,15,0.95);
  border-top: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--neon-pink), var(--accent), var(--neon-cyan), var(--accent), var(--neon-pink)) 1;
  display: flex; align-items: center; justify-content: space-around;
  padding: 0 8px; z-index: 2000;
  backdrop-filter: blur(20px);
  box-shadow: 0 -4px 30px rgba(180,79,255,0.3), 0 -1px 0 rgba(180,79,255,0.5);
}
.nav-logo { display: none; }
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 8px 4px; border-radius: 14px;
  background: transparent; border: none; color: var(--text2);
  font-size: 11px; font-weight: 800; cursor: pointer;
  transition: color 0.2s; font-family: inherit; position: relative;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.nav-btn .icon {
  font-size: 26px;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), filter 0.3s;
  display: block;
}
.nav-btn.active { color: var(--gold); }
.nav-btn.active .icon {
  transform: scale(1.3) translateY(-3px);
  filter: drop-shadow(0 0 8px var(--gold)) drop-shadow(0 0 20px var(--gold2));
  animation: icon-pulse 1.5s ease-in-out infinite;
}
@keyframes icon-pulse {
  0%,100% { filter: drop-shadow(0 0 8px var(--gold)) drop-shadow(0 0 20px var(--gold2)); }
  50%      { filter: drop-shadow(0 0 16px var(--gold)) drop-shadow(0 0 40px var(--gold2)) drop-shadow(0 0 60px rgba(255,215,0,0.3)); }
}
.nav-btn.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  box-shadow: 0 0 10px var(--gold), 0 0 20px var(--gold2);
  animation: tab-line-in 0.25s ease;
}
@keyframes tab-line-in { from { width: 0; opacity: 0; } to { width: 28px; opacity: 1; } }
.nav-btn:active .icon { transform: scale(0.8) !important; }
.nav-btn.active .icon { filter: drop-shadow(0 0 10px var(--gold)) drop-shadow(0 0 25px var(--gold2)) !important; }

.theme-toggle {
  flex-shrink: 0; width: 36px; height: 36px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(180,79,255,0.2);
}
.avatar-btn {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--gold); background: linear-gradient(135deg, var(--accent2), var(--neon-pink));
  color: white; font-size: 14px; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 14px var(--gold-glow); transition: transform 0.2s;
  animation: avatar-glow 2s ease-in-out infinite;
}
@keyframes avatar-glow {
  0%,100% { box-shadow: 0 0 14px var(--gold-glow); }
  50%      { box-shadow: 0 0 28px var(--gold-glow), 0 0 50px rgba(255,215,0,0.2); }
}
.avatar-btn:active { transform: scale(0.88); }

/* ── FORM INPUTS ── */
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-label { font-size: 12px; font-weight: 700; color: var(--text2); letter-spacing: 0.3px; text-transform: uppercase; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 14px;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,106,247,0.15);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ── BUTTONS ── */
.btn-primary {
  width: 100%; padding: 14px;
  background: linear-gradient(90deg, var(--accent2), var(--accent)) !important;
  background-size: 200% auto !important;
  box-shadow: 0 4px 20px var(--accent-glow) !important;
  color: white;
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 900 !important; letter-spacing: 0.3px !important;
  cursor: pointer; transition: all 0.2s !important; font-family: inherit;
}
.btn-primary:hover { background-position: right center !important; box-shadow: 0 4px 30px var(--accent-glow) !important; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary:active { transform: scale(0.91) !important; }

.btn-secondary {
  width: 100%; padding: 13px;
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border); border-radius: 14px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.18s; font-family: inherit;
}
.btn-secondary:hover { color: var(--text); background: var(--border); }

/* ── MODALS ── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 3000; backdrop-filter: blur(4px);
}
.modal.open { display: flex; }

.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  padding: 24px; border-radius: 24px 24px 0 0;
  width: 100%; max-width: 520px;
  animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh; overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 20px;
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 18px; letter-spacing: -0.4px; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 50px;
  font-size: 14px; font-weight: 600; z-index: 9999;
  opacity: 0; transition: all 0.3s;
  white-space: nowrap; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── MISC ── */
.empty { text-align: center; padding: 48px 24px; color: var(--text2); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-msg  { font-size: 15px; }
.loader { display: flex; justify-content: center; padding: 32px; }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── THURSDAY MODE ── */
:root[data-thursday="true"] {
  --accent: #ffd700; --accent2: #ff9500; --accent-glow: rgba(255,215,0,0.5);
}
@keyframes fire-rain { 0%{transform:translateY(-20px) rotate(-15deg);opacity:1} 100%{transform:translateY(110vh) rotate(15deg);opacity:0} }
.fire-particle { position:fixed; pointer-events:none; z-index:9998; font-size:22px; animation:fire-rain linear forwards; }

/* ── CONFETTI — casino chips ── */
@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(100vh) rotate(900deg) scale(0.3); opacity: 0; }
}
.confetti-piece {
  position: fixed; pointer-events: none; z-index: 9001;
  width: 12px; height: 12px; border-radius: 50%;
  animation: confetti-fall linear forwards;
}

/* ── CONTINUOUS FLAME PARTICLES ── */
@keyframes particle-float { 0%{transform:translateY(0) scale(1);opacity:1} 100%{transform:translateY(-90px) scale(0.1);opacity:0} }
.bar-particle { position:absolute; pointer-events:none; z-index:10; font-size:18px; animation:particle-float 1s ease-out forwards; }
.flame-particle { position:absolute; pointer-events:none; z-index:20; animation:particle-float ease-out forwards; font-size:18px; }

@media (max-width: 480px) {
  .nav-btn span.label { font-size: 10px; }
  .auth-card { padding: 28px 20px; }
}

/* ── USERNAME BAR ── */
.username-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 36px;
  background: rgba(5,5,15,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: none;
  align-items: center;
  padding: 0 16px;
  z-index: 1999;
}
.username-bar-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
}

/* ── ADJUST PAGE TOP FOR USERNAME BAR ── */
#app .page {
  padding-top: calc(var(--nav-h) + 36px + 16px);
}

/* ── RIDES PAGE ── */
.rides-app-btn {
  width: 100%; padding: 16px 18px; border-radius: 18px; border: none;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.rides-app-btn:active { transform: scale(0.98); }
