@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Palette — drawn from the VectaBit mark */
  --bg: #08080b;
  --bg-elevated: #131319;
  --bg-card: #16161d;
  --bg-card-hover: #1c1c25;
  --border: rgba(212, 175, 55, 0.16);
  --border-bright: rgba(212, 175, 55, 0.4);

  --gold: #d4af37;
  --gold-bright: #f5d365;
  --gold-dim: #8a6d20;
  --silver: #e7e7ee;

  --text: #f2f2f5;
  --text-muted: #98989f;
  --text-faint: #5c5c66;

  --up: #21c67a;
  --up-bg: rgba(33, 198, 122, 0.12);
  --down: #e6473f;
  --down-bg: rgba(230, 71, 63, 0.12);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-gold: 0 8px 30px rgba(212, 175, 55, 0.12);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Circuit-pattern ambient background, echoing the logo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(212,175,55,0.05) 0, transparent 35%),
    radial-gradient(circle at 85% 75%, rgba(212,175,55,0.05) 0, transparent 35%),
    linear-gradient(var(--bg), var(--bg));
  z-index: -1;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.section {
  padding: 90px 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--gold);
}

.gradient-text {
  background: linear-gradient(100deg, var(--gold-bright), var(--gold) 60%, var(--gold-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold) 70%);
  color: #0a0a0d;
  box-shadow: var(--shadow-gold);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.5), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.btn-primary:hover::after { left: 130%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(212,175,55,0.22); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-bright);
}
.btn-outline:hover { background: rgba(212,175,55,0.08); border-color: var(--gold); }
.btn-ghost { color: var(--text-muted); padding: 13px 18px; }
.btn-ghost:hover { color: var(--gold); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 18px; font-size: 0.85rem; }
.btn-buy { background: linear-gradient(135deg, #2fe08d, var(--up)); color: #04160c; }
.btn-sell { background: linear-gradient(135deg, #f26862, var(--down)); color: #1d0605; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(212,175,55,0.3), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0,0,0,0.5); }

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(8, 8, 11, 0.82);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.navbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.navbar-brand img { width: 38px; height: 38px; }
.navbar-links { display: flex; align-items: center; gap: 6px; }
.navbar-links a {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.navbar-links a:hover, .navbar-links a.active { color: var(--gold); background: rgba(212,175,55,0.08); }
.navbar-actions { display: flex; align-items: center; gap: 12px; }
.navbar-toggle { display: none; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #0a0a0d; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; margin-bottom: 12px; }
.footer-brand img { width: 34px; height: 34px; }
.footer-col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); margin-bottom: 16px; }
.footer-col a { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; transition: color 0.2s; }
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px; border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-faint); flex-wrap: wrap; gap: 12px;
}
.simulated-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--gold); border: 1px solid var(--border-bright);
  padding: 4px 10px; border-radius: 999px;
}

/* Candlestick divider — echoes the logo mark */
.candle-divider {
  display: flex; align-items: flex-end; justify-content: center; gap: 6px;
  height: 26px; margin: 0 auto;
}
.candle-divider span {
  width: 4px; background: var(--gold); border-radius: 2px; opacity: 0.7;
}
.candle-divider span:nth-child(1) { height: 12px; }
.candle-divider span:nth-child(2) { height: 24px; }
.candle-divider span:nth-child(3) { height: 16px; }

/* Forms */
.field { margin-bottom: 20px; }
.field label {
  display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: 8px;
}
.field input, .field select {
  width: 100%; padding: 13px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--gold);
}
.field-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 6px; }
.field-error { font-size: 0.8rem; color: var(--down); margin-top: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-up { background: var(--up-bg); color: var(--up); }
.badge-down { background: var(--down-bg); color: var(--down); }
.badge-pending { background: rgba(212,175,55,0.12); color: var(--gold); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: rgba(212,175,55,0.03); }
td.mono, th.mono { font-family: var(--font-mono); }

/* Toasts */
#toast-container { position: fixed; top: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  color: var(--text); padding: 14px 20px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card); font-size: 0.9rem; opacity: 0; transform: translateX(20px);
  transition: all 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-error { border-color: var(--down); }
.toast-success { border-color: var(--up); }

/* Loading skeleton */
.skeleton { background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%); background-size: 200% 100%; animation: shimmer 1.6s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: 14px; }

/* TradingView widget container */
.tv-widget-wrap {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d0d12;
}
.tv-widget-wrap-lg { height: 500px; }
.tv-widget-wrap > div { height: 100%; width: 100%; }

/* Stat grids — reused across dashboard, wallet, markets, prices */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  position: relative; overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.stat-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0; transition: opacity 0.25s ease;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--border-bright); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 10px; }
.stat-card .stat-value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; }

/* Tabs (used for buy/sell toggle, chart range toggle) */
.tab-group { display: inline-flex; background: var(--bg-elevated); border-radius: 999px; padding: 4px; border: 1px solid var(--border); }
.tab-group button { padding: 8px 18px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); transition: all 0.2s; }
.tab-group button.active-tab { background: var(--gold); color: #0a0a0d; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: none; align-items: center; justify-content: center; z-index: 200;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-card);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity:0; transform: translateY(10px) scale(0.98);} to { opacity:1; transform: translateY(0) scale(1);} }
.modal-close { position: absolute; }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom: 20px; }
.modal-header h3 { font-size: 1.2rem; }
.modal-header button { color: var(--text-muted); font-size: 1.3rem; }

/* Scroll-reveal utility — toggled by main.js via IntersectionObserver */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Navbar gains a subtle depth shadow once scrolled */
.navbar.scrolled { box-shadow: 0 8px 24px rgba(0,0,0,0.35); border-bottom-color: var(--border-bright); }

/* Demo-mode banner (backend-less preview) */
.demo-banner {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(212,175,55,0.16), rgba(212,175,55,0.08));
  border-bottom: 1px solid var(--border-bright);
  color: var(--gold-bright);
  font-size: 0.82rem;
  padding: 9px 20px;
  text-align: center;
}
.demo-banner button {
  background: transparent; border: 1px solid var(--border-bright);
  color: var(--gold-bright); padding: 4px 12px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; white-space: nowrap;
}
.demo-banner button:hover { background: rgba(212,175,55,0.12); }

::selection { background: var(--gold); color: #0a0a0d; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 10px; }
