/* ═══════════════════════════════════════════════════════════════
   CRYPTO METRICS DASHBOARD — DESIGN SYSTEM & STYLE GUIDE
   ═══════════════════════════════════════════════════════════════

   Design tokens: CSS custom properties + semantic class tokens.
   A cohesive, dark-mode crypto-native aesthetic.

   Palette
   ───────
   --bg-0       : deep space black (page background)
   --bg-1       : panel / card background
   --bg-2       : elevated surface (hover, active)
   --bg-3       : subtle border / divider

   --accent-blue          : primary brand color (electric cyan-blue)
   --accent-purple        : secondary accent (vibrant purple)
   --accent-green         : positive / up / gain
   --accent-red           : negative / down / loss
   --accent-warm          : amber/orange for warnings & highlights
   --accent-teal          : chart accent & data points

   --text-0       : primary text (near-white)
   --text-1       : secondary text (muted)
   --text-2       : tertiary / placeholder (faint)

   --glow-blue    : box-shadow glow for primary accents
   --glow-purple  : glow for secondary accents

   Typography
   ──────────
   --font-sans   : 'Inter', system-ui stack — UI text
   --font-mono   : 'JetBrains Mono', 'Fira Code', monospace — data, labels, code

   Spacing scale (8px base)
   ────────────────────────
   --space-1  4px   --space-4  16px  --space-8  32px  --space-12 48px
   --space-2  8px   --space-5  24px  --space-9  40px  --space-16 64px
   --space-3  12px  --space-6  28px  --space-10 44px

   Border radius
   ─────────────
   --radius-sm   4px   --radius-md   10px   --radius-lg   16px   --radius-xl  24px

   Font sizes
   ───────────
   --text-xs   11px  --text-sm   13px  --text-base  15px
   --text-md   17px  --text-lg   20px  --text-xl   24px
   --text-2xl  30px  --text-3xl  38px  --text-4xl  48px

   Shadows
   ───────
   --shadow-card   : subtle card elevation
   --shadow-glow   : accent glow (blue | purple variants)
   --shadow-hover  : lift on hover

   Transitions
   ───────────
   --ease-smooth  250ms cubic-bezier(0.4, 0, 0.2, 1)
   --ease-spring  400ms cubic-bezier(0.34, 1.56, 0.64, 1)

   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Backgrounds */
  --bg-0: #0a0b1a;
  --bg-1: #12142a;
  --bg-2: #1a1d3a;
  --bg-3: #25284a;
  --bg-gradient: radial-gradient(ellipse at 20% 0%, rgba(30, 60, 180, 0.12) 0%, transparent 60%),
                 radial-gradient(ellipse at 80% 100%, rgba(120, 40, 200, 0.08) 0%, transparent 60%);
  --bg-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");

  /* Accents */
  --accent-blue:      #3b82f6;
  --accent-blue-bright: #60a5fa;
  --accent-purple:    #8b5cf6;
  --accent-purple-bright: #a78bfa;
  --accent-green:     #22c55e;
  --accent-green-dim: #16a34a;
  --accent-red:       #ef4444;
  --accent-red-dim:   #dc2626;
  --accent-warm:      #f59e0b;
  --accent-teal:      #14b8a6;
  --accent-cyan:      #06b6d4;

  /* Text */
  --text-0: #f1f5f9;
  --text-1: #94a3b8;
  --text-2: #64748b;
  --text-0-dim: rgba(241, 245, 249, 0.7);
  --text-glow: rgba(59, 130, 246, 0.4);

  /* Glows */
  --glow-blue: 0 0 20px rgba(59, 130, 246, 0.25), 0 0 60px rgba(59, 130, 246, 0.08);
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.25), 0 0 60px rgba(139, 92, 246, 0.08);
  --glow-green: 0 0 20px rgba(34, 197, 94, 0.25), 0 0 60px rgba(34, 197, 94, 0.08);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Spacing */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;
  --space-4: 16px;  --space-5: 24px;  --space-6: 28px;
  --space-8: 32px;  --space-9: 40px;  --space-10: 44px;
  --space-12: 48px; --space-14: 56px; --space-16: 64px;
  --space-20: 80px; --space-24: 96px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-pill: 9999px;

  /* Text sizes */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;
  --text-4xl:  48px;
  --text-5xl:  56px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-card-lg: 0 8px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.15), 0 0 80px rgba(59, 130, 246, 0.05);
  --shadow-glow-purple: 0 0 30px rgba(139, 92, 246, 0.15), 0 0 80px rgba(139, 92, 246, 0.05);
  --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --ease-smooth: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-w-container: 1200px;
  --max-w-4xl: 880px;
  --max-w-lg: 640px;
  --nav-height: 64px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-0);
  background-color: var(--bg-0);
  background-image: var(--bg-gradient), var(--bg-noise);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ── Typography primitives ─────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-0);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p { line-height: 1.7; color: var(--text-1); }

a {
  color: var(--accent-blue-bright);
  text-decoration: none;
  transition: color var(--ease-smooth);
}
a:hover { color: var(--accent-blue); text-decoration: underline; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

small { font-size: var(--text-sm); }

/* ── Layout primitives ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w-container);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.container-sm {
  max-width: var(--max-w-lg);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Card / Panel system ───────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--ease-smooth), border-color var(--ease-smooth), transform var(--ease-smooth);
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-hover);
}

.card-elevated {
  background: var(--bg-2);
  border: 1px solid rgba(139, 92, 246, 0.15);
  box-shadow: var(--shadow-glow-purple);
}

.card-glow {
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: var(--shadow-glow-blue);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

/* ── Button system ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--ease-smooth);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  background: var(--accent-blue-bright);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue-bright);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-1);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--bg-2);
  color: var(--text-0);
  border-color: var(--bg-3);
}

.btn-large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}

/* ── Badge / Tag system ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  line-height: 1.6;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue-bright);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple-bright);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.badge-green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-red {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warm {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warm);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-neutral {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--bg-3);
}

/* ── Stat / Metric display ─────────────────────────────────── */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.metric-value.sm { font-size: var(--text-xl); }
.metric-value.xs { font-size: var(--text-md); }

.metric-change {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.metric-change.positive { color: var(--accent-green); }
.metric-change.negative { color: var(--accent-red); }

.metric-label {
  font-size: var(--text-sm);
  color: var(--text-1);
  font-weight: 500;
}

.metric-sub {
  font-size: var(--text-xs);
  color: var(--text-2);
  font-family: var(--font-mono);
}

/* ── Form elements ─────────────────────────────────────────── */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-0);
  background: var(--bg-0);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--ease-smooth), box-shadow var(--ease-smooth);
}

.input::placeholder { color: var(--text-2); }

.input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: var(--space-2);
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--bg-3), transparent);
  border: none;
  margin: var(--space-6) 0;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* ── Selection ─────────────────────────────────────────────── */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-0);
}

/* ── Utilities ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-mono { font-family: var(--font-mono); }
.text-blue { color: var(--accent-blue-bright); }
.text-purple { color: var(--accent-purple-bright); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-warm { color: var(--accent-warm); }
.text-cyan { color: var(--accent-cyan); }

.text-muted { color: var(--text-1); }
.text-faint { color: var(--text-2); }
.text-glow { text-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-light { font-weight: 400; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.tracking-wide { letter-spacing: 0.05em; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow { box-shadow: var(--shadow-card); }

.op-50 { opacity: 0.5; }
.op-75 { opacity: 0.75; }

.inline-flex { display: inline-flex; }

.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.grow { flex-grow: 1; }

.whitespace-nowrap { white-space: nowrap; }

.cursor-pointer { cursor: pointer; }
.cursor-grab { cursor: grab; }

.transition { transition: all var(--ease-smooth); }
.transition-fast { transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1); }

.hover-lift { transition: transform var(--ease-smooth), box-shadow var(--ease-smooth); }
.hover-lift:hover { transform: translateY(-2px); }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
  50%       { box-shadow: 0 0 30px rgba(59, 130, 246, 0.4), 0 0 60px rgba(59, 130, 246, 0.15); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer-loading {
  0%   { opacity: 0.3; }
  50%  { opacity: 0.7; }
  100% { opacity: 0.3; }
}

.animate-fadeIn  { animation: fadeIn 400ms ease-out forwards; }
.animate-slideUp { animation: slideUp 400ms ease-out forwards; }
.animate-float   { animation: float 3s ease-in-out infinite; }

/* Stagger delays for list animations */
.delay-100  { animation-delay: 100ms; }
.delay-200  { animation-delay: 200ms; }
.delay-300  { animation-delay: 300ms; }
.delay-400  { animation-delay: 400ms; }
.delay-500  { animation-delay: 500ms; }
.delay-600  { animation-delay: 600ms; }

/* ── Skeleton / Loading shimmer ────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ── Responsive helpers ────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --text-4xl: 36px; --text-3xl: 28px; --text-2xl: 24px; }

  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .container { padding: 0 var(--space-4); }
  .container-sm { padding: 0 var(--space-4); }
}

@media (max-width: 480px) {
  :root { --text-4xl: 28px; --text-3xl: 22px; --text-2xl: 20px; --text-xl: 18px; }
  .btn-large { padding: var(--space-3) var(--space-5); font-size: var(--text-sm); }
  .card { padding: var(--space-4); }
  .container { padding: 0 var(--space-3); }
}

@media (min-width: 1400px) {
  :root { --max-w-container: 1320px; }
}
