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

:root {
  --bg: #050505;
  --bg-card: #0A0A0A;
  --bg-muted: #1A1A1A;
  --fg: #EDEDED;
  --fg-card: #FFFFFF;
  --fg-muted: #888888;
  --primary: #00F0FF;
  --primary-dim: rgba(0,240,255,0.15);
  --secondary: #00FF94;
  --secondary-dim: rgba(0,255,148,0.15);
  --danger: #FF2E2E;
  --danger-dim: rgba(255,46,46,0.15);
  --border: #1F1F1F;
  --border-glow: rgba(0,240,255,0.3);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-neon: 0 0 30px -8px rgba(0,240,255,0.35);
  --shadow-card: 0 8px 32px -10px rgba(0,0,0,0.6);
  --space-1: 0.5rem;
  --space-2: 0.875rem;
  --space-3: 1.25rem;
  --space-4: 1.75rem;
  --space-5: 2.5rem;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-heading: 'Unbounded', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --premium-gold: #F7B731;
  --premium-gold-dim: rgba(247,183,49,0.15);
  --premium-glow: rgba(0,240,255,0.25);
  --premium-violet: #7C5CFC;
  --premium-pink: #FF5FB8;
  --grad-premium: linear-gradient(135deg, var(--premium-violet) 0%, var(--primary) 50%, var(--premium-pink) 100%);
  --data-positive: #00FF94;
  --data-negative: #FF2E2E;
  --data-neutral: #888888;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 4rem); font-weight: 900; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 600; }
.mono { font-family: var(--font-mono); }
.label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted); }
.muted { color: var(--fg-muted); }
a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.container { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: #000;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.8rem;
  box-shadow: var(--shadow-neon);
}
.sidebar-logo-text { font-family: var(--font-heading); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; }
.sidebar-logo-text span { color: var(--primary); }
.sidebar-nav { padding: 1rem 0.75rem; flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-section-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--fg-muted); padding: 0.5rem 0.5rem 0.25rem; margin-top: 0.5rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 0.85rem; font-weight: 500;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}
.nav-link:hover { color: var(--fg); background: var(--bg-muted); }
.nav-link.active { color: var(--primary); background: var(--primary-dim); }
.nav-link svg { flex-shrink: 0; }
.sidebar-bottom { padding: 1rem 0.75rem; border-top: 1px solid var(--border); }

/* ── Main Content ── */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; }
.topbar {
  position: sticky; top: 0; z-index: 90;
  background: rgba(5,5,5,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.page-content { padding: 1.5rem; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.625rem;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, transparent 100%);
  pointer-events: none;
}
.card-hover { transition: border-color 0.2s; }
.card-hover:hover { border-color: rgba(0,240,255,0.3); }
.card-glow { box-shadow: var(--shadow-neon); border-color: rgba(0,240,255,0.3); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.card-title { font-family: var(--font-heading); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); }

/* ── Stat Cards ── */
.stat-card { }
.stat-value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700; color: var(--fg-card); margin-bottom: 0.4rem; letter-spacing: -0.01em; }
.stat-change { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; }
.stat-change.pos { color: var(--secondary); }
.stat-change.neg { color: var(--danger); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; border: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary); color: #000;
  box-shadow: 0 0 15px rgba(0,240,255,0.3);
}
.btn-primary:hover { background: #00d4e0; box-shadow: 0 0 25px rgba(0,240,255,0.5); }
.btn-secondary { background: var(--secondary); color: #000; }
.btn-secondary:hover { background: #00e085; }
.btn-outline {
  background: transparent;
  border: 1px solid rgba(0,240,255,0.4);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary-dim); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--fg-muted); }
.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.2); background: var(--bg-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.7rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 0.85rem; }
.btn-icon { padding: 0.5rem; }

/* ── Inputs ── */
.input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(31,31,31,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.input::placeholder { color: var(--fg-muted); }
.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 700;
}
.badge-up { background: var(--secondary-dim); color: var(--secondary); }
.badge-down { background: var(--danger-dim); color: var(--danger); }
.badge-neutral { background: var(--bg-muted); color: var(--fg-muted); }
.badge-primary { background: var(--primary-dim); color: var(--primary); }

/* ── Ticker ── */
.ticker-bar {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: 36px;
  display: flex; align-items: center;
}
.ticker-track { display: flex; gap: 2rem; animation: ticker 40s linear infinite; white-space: nowrap; padding: 0 1rem; }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ticker-item { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.72rem; }
.ticker-name { color: var(--fg-muted); font-weight: 600; }
.ticker-price { color: var(--fg); font-weight: 500; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-muted); text-align: left; padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid rgba(31,31,31,0.7); font-size: 0.875rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(31,31,31,0.4); }
.data-table .coin-name { font-weight: 600; }
.data-table .coin-symbol { font-family: var(--font-mono); color: var(--fg-muted); font-size: 0.75rem; }
.data-table .price { font-family: var(--font-mono); font-weight: 500; }
.data-table .rank { font-family: var(--font-mono); color: var(--fg-muted); font-size: 0.75rem; }

/* ── Grid system ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── News ── */
.news-item { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.875rem 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-source { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--primary); }
.news-title { font-size: 0.9rem; font-weight: 600; line-height: 1.4; }
.news-title a:hover { color: var(--primary); }
.news-meta { font-size: 0.72rem; color: var(--fg-muted); }

/* ── Coin Icon ── */
.coin-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.65rem; flex-shrink: 0; }

/* ── Progress ── */
.progress-bar { height: 4px; background: var(--bg-muted); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--primary); transition: width 0.3s; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 0.6rem 1.25rem;
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-muted);
  cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Grid lines background ── */
.grid-bg {
  background-image: linear-gradient(to right, #1f1f1f 1px, transparent 1px),
                    linear-gradient(to bottom, #1f1f1f 1px, transparent 1px);
  background-size: 4rem 4rem;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 60%, transparent 100%);
}

/* ── Glow effects ── */
.glow-cyan { text-shadow: 0 0 20px rgba(0,240,255,0.6); }
.glow-green { text-shadow: 0 0 20px rgba(0,255,148,0.6); }
.border-glow { border-color: rgba(0,240,255,0.4) !important; box-shadow: var(--shadow-neon); }

/* ── Loading ── */
.skeleton { background: linear-gradient(90deg, var(--bg-muted) 25%, rgba(40,40,40,0.8) 50%, var(--bg-muted) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.loading-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: pulse 1.5s infinite; }
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* ── Micro-animations ── */
.fade-in { animation: fadeIn 0.3s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Chart container ── */
.chart-container { position: relative; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  font-size: 0.85rem; min-width: 260px;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast-success { border-left: 3px solid var(--secondary); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--primary); }

/* ── Search ── */
.search-input { position: relative; }
.search-input input { padding-left: 2.25rem; }
.search-input svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--fg-muted); pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .bento { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-3, .grid-4, .bento { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── Utility ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.p-0 { padding: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.pointer { cursor: pointer; }
.relative { position: relative; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.row-span-2 { grid-row: span 2; }
