/* ============================================================
   Nuvio Radar — Design System
   Load this FIRST before all other stylesheets.
   ============================================================ */

/* ── Tokens ── */
:root {
  /* Background */
  --nr-bg:         #05080d;
  --nr-bg2:        #090d14;
  --nr-bg3:        #0e1520;
  --nr-bg4:        #131c28;
  --nr-surface:    rgba(14, 21, 32, 0.9);
  --nr-overlay:    rgba(0, 0, 0, 0.75);

  /* Border */
  --nr-border:     #162030;
  --nr-border-mid: rgba(255,255,255,0.09);
  --nr-border-sub: rgba(255,255,255,0.05);

  /* Text */
  --nr-text:       #d4e0ed;
  --nr-text-mid:   #9eb8d0;
  --nr-muted:      #4d6070;
  --nr-text-inv:   #ffffff;

  /* Semantic colours */
  --nr-green:      #00e676;
  --nr-red:        #ff4560;
  --nr-yellow:     #ffd740;
  --nr-blue:       #29b6f6;
  --nr-purple:     #ce93d8;
  --nr-orange:     #ffab40;
  --nr-gold:       #c8a96e;

  /* Alpha tints */
  --nr-green-a:    rgba(0, 230, 118, 0.12);
  --nr-red-a:      rgba(255, 69, 96, 0.12);
  --nr-yellow-a:   rgba(255, 215, 64, 0.12);
  --nr-blue-a:     rgba(41, 182, 246, 0.12);
  --nr-purple-a:   rgba(206, 147, 216, 0.10);
  --nr-orange-a:   rgba(255, 171, 64, 0.12);
  --nr-gold-a:     rgba(200, 169, 110, 0.12);

  /* Typography */
  --nr-font:       'Space Mono', monospace;
  --nr-font-ui:    'Space Mono', monospace;
  --nr-text-xs:    11px;
  --nr-text-sm:    12px;
  --nr-text-base:  14px;
  --nr-text-md:    15px;
  --nr-text-lg:    18px;
  --nr-text-xl:    22px;
  --nr-text-2xl:   28px;
  --nr-text-3xl:   36px;
  --nr-lh:         1.5;

  /* Spacing */
  --nr-s1:  4px;
  --nr-s2:  8px;
  --nr-s3:  12px;
  --nr-s4:  16px;
  --nr-s5:  20px;
  --nr-s6:  24px;
  --nr-s8:  32px;
  --nr-s10: 40px;
  --nr-s12: 48px;

  /* Radii */
  --nr-r1: 4px;
  --nr-r2: 6px;
  --nr-r3: 8px;
  --nr-r4: 10px;
  --nr-r5: 12px;
  --nr-r6: 16px;
  --nr-r-full: 9999px;

  /* Shadows */
  --nr-shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --nr-shadow:    0 4px 20px rgba(0,0,0,0.45);
  --nr-shadow-lg: 0 8px 40px rgba(0,0,0,0.6);

  /* Transitions */
  --nr-t-fast:   0.10s ease;
  --nr-t:        0.18s ease;
  --nr-t-slow:   0.35s ease;

  /* Z-index ladder */
  --nr-z-base:    1;
  --nr-z-sticky:  10;
  --nr-z-header:  100;
  --nr-z-modal:   1000;
  --nr-z-toast:   2000;
}

/* ── Animations ── */
@keyframes nr-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.85); }
}
@keyframes nr-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nr-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes nr-spin {
  to { transform: rotate(360deg); }
}
@keyframes nr-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ────────────────────────────────────────────
   COMPONENTS
   ──────────────────────────────────────────── */

/* ── Card ── */
.nr-card {
  background: var(--nr-bg3);
  border: 1px solid var(--nr-border-mid);
  border-radius: var(--nr-r5);
  padding: var(--nr-s4);
  position: relative;
  overflow: hidden;
  transition: border-color var(--nr-t);
}
.nr-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 60%);
  pointer-events: none;
}
.nr-card:hover {
  border-color: rgba(255,255,255,0.14);
}
.nr-card--flat {
  background: var(--nr-bg2);
  border-color: var(--nr-border-sub);
}
.nr-card--glow-green { border-color: rgba(0,230,118,0.22); }
.nr-card--glow-red   { border-color: rgba(255,69,96,0.22); }
.nr-card--glow-blue  { border-color: rgba(41,182,246,0.22); }
.nr-card--glow-gold  { border-color: rgba(200,169,110,0.25); }

/* ── Badge ── */
.nr-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--nr-s1);
  padding: 2px 7px;
  border-radius: var(--nr-r1);
  font-family: var(--nr-font);
  font-size: var(--nr-text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.nr-badge--green  { color: var(--nr-green);  background: var(--nr-green-a);  border-color: rgba(0,230,118,0.3); }
.nr-badge--red    { color: var(--nr-red);    background: var(--nr-red-a);    border-color: rgba(255,69,96,0.3); }
.nr-badge--yellow { color: var(--nr-yellow); background: var(--nr-yellow-a); border-color: rgba(255,215,64,0.3); }
.nr-badge--blue   { color: var(--nr-blue);   background: var(--nr-blue-a);   border-color: rgba(41,182,246,0.3); }
.nr-badge--purple { color: var(--nr-purple); background: var(--nr-purple-a); border-color: rgba(206,147,216,0.28); }
.nr-badge--orange { color: var(--nr-orange); background: var(--nr-orange-a); border-color: rgba(255,171,64,0.3); }
.nr-badge--gold   { color: var(--nr-gold);   background: var(--nr-gold-a);   border-color: rgba(200,169,110,0.32); }
.nr-badge--muted  { color: var(--nr-muted);  background: rgba(255,255,255,0.04); border-color: var(--nr-border-sub); }

/* ── Metric (large number + label) ── */
.nr-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nr-metric__value {
  font-family: var(--nr-font);
  font-size: var(--nr-text-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--nr-text);
}
.nr-metric__value--lg { font-size: var(--nr-text-3xl); }
.nr-metric__value--sm { font-size: var(--nr-text-xl); }
.nr-metric__label {
  font-family: var(--nr-font);
  font-size: var(--nr-text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nr-muted);
}
.nr-metric__sub {
  font-family: var(--nr-font);
  font-size: var(--nr-text-sm);
  color: var(--nr-muted);
  margin-top: 2px;
}
.nr-metric__value.up   { color: var(--nr-green); }
.nr-metric__value.down { color: var(--nr-red); }

/* ── Section divider ── */
.nr-divider {
  display: flex;
  align-items: center;
  gap: var(--nr-s3);
  margin: var(--nr-s6) 0;
}
.nr-divider__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--nr-border-mid), transparent);
}
.nr-divider__label {
  font-family: var(--nr-font);
  font-size: var(--nr-text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nr-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--nr-s2);
}

/* ── Live dot ── */
.nr-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: var(--nr-r-full);
  background: var(--nr-green);
  flex-shrink: 0;
  animation: nr-pulse 2.5s infinite;
}
.nr-live-dot--red    { background: var(--nr-red); }
.nr-live-dot--yellow { background: var(--nr-yellow); }
.nr-live-dot--blue   { background: var(--nr-blue); }
.nr-live-dot--sm     { width: 5px; height: 5px; }
.nr-live-dot--lg     { width: 9px; height: 9px; }

/* ── Table row ── */
.nr-row {
  display: flex;
  align-items: center;
  gap: var(--nr-s3);
  padding: 8px var(--nr-s3);
  border-radius: var(--nr-r2);
  transition: background var(--nr-t-fast);
  cursor: default;
}
.nr-row:hover {
  background: rgba(255,255,255,0.04);
}
.nr-row + .nr-row {
  border-top: 1px solid var(--nr-border-sub);
}
.nr-row__rank {
  font-size: var(--nr-text-xs);
  color: var(--nr-muted);
  min-width: 18px;
  text-align: right;
}
.nr-row__sym {
  font-family: var(--nr-font);
  font-size: var(--nr-text-base);
  font-weight: 700;
  color: var(--nr-text);
  letter-spacing: 0.02em;
  flex: 1;
}
.nr-row__val {
  font-family: var(--nr-font);
  font-size: var(--nr-text-sm);
  color: var(--nr-text-mid);
  text-align: right;
}
.nr-row__val.up   { color: var(--nr-green); }
.nr-row__val.down { color: var(--nr-red); }

/* ── Buttons ── */
.nr-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--nr-s2);
  padding: 6px var(--nr-s4);
  border-radius: var(--nr-r2);
  font-family: var(--nr-font);
  font-size: var(--nr-text-sm);
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--nr-t);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.nr-btn--ghost {
  color: var(--nr-muted);
  background: rgba(255,255,255,0.04);
  border-color: var(--nr-border-sub);
}
.nr-btn--ghost:hover {
  color: var(--nr-text);
  background: rgba(255,255,255,0.08);
  border-color: var(--nr-border-mid);
}
.nr-btn--primary {
  color: var(--nr-text-inv);
  background: rgba(41,182,246,0.18);
  border-color: rgba(41,182,246,0.35);
}
.nr-btn--primary:hover {
  background: rgba(41,182,246,0.28);
  border-color: rgba(41,182,246,0.55);
}
.nr-btn--danger {
  color: var(--nr-red);
  background: rgba(255,69,96,0.10);
  border-color: rgba(255,69,96,0.28);
}
.nr-btn--danger:hover {
  background: rgba(255,69,96,0.20);
}
.nr-btn--gold {
  color: var(--nr-gold);
  background: var(--nr-gold-a);
  border-color: rgba(200,169,110,0.3);
}
.nr-btn--gold:hover {
  background: rgba(200,169,110,0.20);
  border-color: rgba(200,169,110,0.45);
}
.nr-btn--sm {
  padding: 3px 9px;
  font-size: var(--nr-text-xs);
}
.nr-btn--lg {
  padding: 10px var(--nr-s6);
  font-size: var(--nr-text-base);
}
.nr-btn:disabled,
.nr-btn[aria-disabled="true"] {
  opacity: 0.38;
  pointer-events: none;
}

/* ── Input ── */
.nr-input {
  background: var(--nr-bg3);
  border: 1px solid var(--nr-border);
  border-radius: var(--nr-r2);
  color: var(--nr-text);
  font-family: var(--nr-font);
  font-size: var(--nr-text-base);
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--nr-t);
  width: 100%;
}
.nr-input:focus {
  border-color: var(--nr-blue);
}
.nr-input::placeholder {
  color: var(--nr-muted);
}

/* ── Spinner ── */
.nr-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--nr-border-mid);
  border-top-color: var(--nr-blue);
  border-radius: var(--nr-r-full);
  animation: nr-spin 0.7s linear infinite;
}
.nr-spinner--sm { width: 12px; height: 12px; }
.nr-spinner--lg { width: 24px; height: 24px; }

/* ── Fade-in animation helper ── */
.nr-fade-in {
  animation: nr-fade-in 0.25s ease both;
}
.nr-slide-in {
  animation: nr-slide-in 0.2s ease both;
}

/* ────────────────────────────────────────────
   UTILITIES
   ──────────────────────────────────────────── */

/* Display */
.nr-flex        { display: flex; }
.nr-flex-col    { display: flex; flex-direction: column; }
.nr-grid        { display: grid; }
.nr-hidden      { display: none !important; }
.nr-block       { display: block; }

/* Flex helpers */
.nr-items-center  { align-items: center; }
.nr-items-start   { align-items: flex-start; }
.nr-items-end     { align-items: flex-end; }
.nr-justify-between { justify-content: space-between; }
.nr-justify-center  { justify-content: center; }
.nr-justify-end     { justify-content: flex-end; }
.nr-flex-1        { flex: 1; }
.nr-flex-wrap     { flex-wrap: wrap; }
.nr-gap-1         { gap: var(--nr-s1); }
.nr-gap-2         { gap: var(--nr-s2); }
.nr-gap-3         { gap: var(--nr-s3); }
.nr-gap-4         { gap: var(--nr-s4); }

/* Spacing */
.nr-p0    { padding: 0; }
.nr-p1    { padding: var(--nr-s1); }
.nr-p2    { padding: var(--nr-s2); }
.nr-p3    { padding: var(--nr-s3); }
.nr-p4    { padding: var(--nr-s4); }
.nr-px2   { padding-left: var(--nr-s2); padding-right: var(--nr-s2); }
.nr-py1   { padding-top: var(--nr-s1); padding-bottom: var(--nr-s1); }
.nr-m0    { margin: 0; }
.nr-mt1   { margin-top: var(--nr-s1); }
.nr-mt2   { margin-top: var(--nr-s2); }
.nr-mt3   { margin-top: var(--nr-s3); }
.nr-mt4   { margin-top: var(--nr-s4); }
.nr-mb2   { margin-bottom: var(--nr-s2); }
.nr-mb3   { margin-bottom: var(--nr-s3); }
.nr-mb4   { margin-bottom: var(--nr-s4); }

/* Typography */
.nr-font-mono   { font-family: var(--nr-font); }
.nr-text-xs     { font-size: var(--nr-text-xs); }
.nr-text-sm     { font-size: var(--nr-text-sm); }
.nr-text-base   { font-size: var(--nr-text-base); }
.nr-text-lg     { font-size: var(--nr-text-lg); }
.nr-text-xl     { font-size: var(--nr-text-xl); }
.nr-bold        { font-weight: 700; }
.nr-upper       { text-transform: uppercase; letter-spacing: 0.08em; }
.nr-no-select   { user-select: none; }
.nr-ellipsis    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Colors */
.nr-text-green   { color: var(--nr-green) !important; }
.nr-text-red     { color: var(--nr-red) !important; }
.nr-text-yellow  { color: var(--nr-yellow) !important; }
.nr-text-blue    { color: var(--nr-blue) !important; }
.nr-text-purple  { color: var(--nr-purple) !important; }
.nr-text-orange  { color: var(--nr-orange) !important; }
.nr-text-gold    { color: var(--nr-gold) !important; }
.nr-text-muted   { color: var(--nr-muted) !important; }
.nr-text-mid     { color: var(--nr-text-mid) !important; }
.nr-text-default { color: var(--nr-text) !important; }

/* Border */
.nr-border      { border: 1px solid var(--nr-border-mid); }
.nr-border-top  { border-top: 1px solid var(--nr-border-sub); }
.nr-border-bot  { border-bottom: 1px solid var(--nr-border-sub); }
.nr-rounded     { border-radius: var(--nr-r3); }
.nr-rounded-lg  { border-radius: var(--nr-r5); }
.nr-rounded-full{ border-radius: var(--nr-r-full); }

/* Sizing */
.nr-w-full   { width: 100%; }
.nr-h-full   { height: 100%; }
.nr-min-0    { min-width: 0; }

/* Overflow */
.nr-overflow-hidden { overflow: hidden; }
.nr-overflow-auto   { overflow: auto; }
.nr-scrollbar-thin::-webkit-scrollbar { width: 4px; }
.nr-scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.nr-scrollbar-thin::-webkit-scrollbar-thumb { background: var(--nr-border); border-radius: 2px; }

/* Pointer */
.nr-pointer { cursor: pointer; }
.nr-no-pointer { pointer-events: none; }

/* Opacity */
.nr-opacity-60 { opacity: 0.6; }
.nr-opacity-40 { opacity: 0.4; }

/* Position */
.nr-relative  { position: relative; }
.nr-absolute  { position: absolute; }
.nr-fixed     { position: fixed; }
.nr-inset-0   { inset: 0; }
.nr-z-header  { z-index: var(--nr-z-header); }
.nr-z-modal   { z-index: var(--nr-z-modal); }
