/* ═══════════════════════════════════════════════════════════════════
   TTG-MRB Theme — Neural Trading Terminal
   Deep-space dark theme with glowing accents and glassmorphism.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg-deep:          #060a13;
    --bg-body:          #0a0e17;
    --bg-surface:       rgba(13, 17, 28, 0.75);
    --bg-surface-solid: #0d111c;
    --bg-elevated:      rgba(18, 23, 36, 0.85);
    --bg-header:        rgba(22, 28, 44, 0.9);
    --bg-hover:         rgba(88, 166, 255, 0.04);
    --bg-active-row:    rgba(63, 185, 80, 0.06);

    /* Borders */
    --border-subtle:    rgba(88, 166, 255, 0.06);
    --border-default:   rgba(88, 166, 255, 0.12);
    --border-bright:    rgba(88, 166, 255, 0.25);
    --border-divider:   rgba(88, 166, 255, 0.05);

    /* Text */
    --text-primary:     #e6edf3;
    --text-secondary:   #8b949e;
    --text-muted:       #525a65;
    --text-faint:       #373e47;

    /* Accents */
    --accent-blue:      #58a6ff;
    --accent-green:     #3fb950;
    --accent-red:       #f85149;
    --accent-orange:    #f0883e;
    --accent-purple:    #bc8cff;
    --accent-cyan:      #39d4e0;

    /* Glows — used for box-shadow and text-shadow */
    --glow-blue:        0 0 15px rgba(88, 166, 255, 0.15), 0 0 40px rgba(88, 166, 255, 0.05);
    --glow-green:       0 0 15px rgba(63, 185, 80, 0.2), 0 0 40px rgba(63, 185, 80, 0.06);
    --glow-red:         0 0 15px rgba(248, 81, 73, 0.2), 0 0 40px rgba(248, 81, 73, 0.06);
    --glow-orange:      0 0 15px rgba(240, 136, 62, 0.2);
    --glow-purple:      0 0 15px rgba(188, 140, 255, 0.15);

    /* Glass */
    --glass-blur:       blur(20px) saturate(180%);
    --glass-bg:         linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
    --glass-bg-fallback: rgba(13, 17, 28, 0.75);
    --glass-border:     1px solid var(--border-default);

    /* Radius */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;

    /* Transitions */
    --ease-out-expo:    cubic-bezier(0.16, 1, 0.3, 1);
    --t-fast:           150ms var(--ease-out-expo);
    --t-normal:         300ms var(--ease-out-expo);
    --t-slow:           600ms var(--ease-out-expo);
    --t-glacial:        1200ms var(--ease-out-expo);
}

/* ── Base Reset & Typography ───────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Subtle noise texture on the body for depth */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(88, 166, 255, 0.03) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 100%, rgba(188, 140, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--t-fast);
}
a:hover {
    color: #79c0ff;
}

::selection {
    background: rgba(88, 166, 255, 0.25);
    color: var(--text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 166, 255, 0.3);
}

/* ── Utility Classes ───────────────────────────────────────────── */
.text-profit  { color: var(--accent-green) !important; }
.text-loss    { color: var(--accent-red) !important; }
.text-muted   { color: var(--text-secondary) !important; }
.text-faint   { color: var(--text-muted) !important; }
.text-accent  { color: var(--accent-blue) !important; }

/* Glow text variants */
.text-profit-glow {
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(63, 185, 80, 0.4);
}
.text-loss-glow {
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(248, 81, 73, 0.4);
}

/* ── Noise Texture Overlay ────────────────────────────────────── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Global Tabular Numerics ──────────────────────────────────── */
.kpi-value,
.table-neural td,
.metric-card .kpi-value,
.config-grid .config-val {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
