/* ═══════════════════════════════════════════════════════════
   F&O TERMINAL — BLOOMBERG-GRADE (v4.1 design, Apr 21 2026)
   ═══════════════════════════════════════════════════════════
   Philosophy:
   - Pure black (#000). No dark-gray cop-outs.
   - Amber #FFA629 is the single living accent (Bloomberg's signature).
   - Sharp rectangles, zero border-radius, 1px hairline borders.
   - IBM Plex Mono for numbers (tabular-nums). Plex Sans for labels.
   - Dense. ~12px base. This is a terminal, not a blog.
   - No gradients. No drop-shadows. No glows that aren't data.
   - Flash animations on price updates — brief, functional.
   - Mobile: horizontal-scroll tables, not stripped-down cards.
   ═══════════════════════════════════════════════════════════ */

:root {
    /* ─── Surfaces ─── */
    --bg:            #000000;
    --bg-base:       #000000;
    --bg-card:       #0a0a0a;
    --bg-elevated:   #141414;
    --bg-hover:      #1a1a1a;

    /* ─── Borders (hairline, unmistakably Bloomberg) ─── */
    --border:        #1f1f1f;
    --border-light:  #2a2a2a;
    --border-strong: #3a3a3a;

    /* ─── Text (tight greyscale ladder, no blue tint) ─── */
    --text:          #e8e8e8;
    --text-primary:  #e8e8e8;
    --text-bright:   #ffffff;
    --text-secondary:#a0a0a0;
    --text-muted:    #6e6e6e;
    --text-dim:      #4a4a4a;

    /* ─── Accent: Bloomberg amber ─── */
    --accent:        #ffa629;
    --accent-dim:    rgba(255, 166, 41, 0.12);
    --accent-glow:   rgba(255, 166, 41, 0.28);
    --accent-strong: #ffb84d;

    /* ─── Semantic (hard, saturated — flat without being cartoonish) ─── */
    --green:         #00d665;
    --green-dim:     rgba(0, 214, 101, 0.11);
    --green-glow:    rgba(0, 214, 101, 0.25);

    --red:           #ff3b30;
    --red-dim:       rgba(255, 59, 48, 0.11);
    --red-glow:      rgba(255, 59, 48, 0.25);

    --yellow:        #ffdf00;  /* flash + warning */
    --yellow-dim:    rgba(255, 223, 0, 0.12);

    --cyan:          #00b4d8;  /* secondary accent, rarely used */

    /* ─── Radii: ZERO. Bloomberg is rectangular. ─── */
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;

    /* ─── Timing ─── */
    --transition: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 80ms linear;

    /* ─── Type ─── */
    --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
    --font-sans: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;

    /* ─── Shadow (almost never used) ─── */
    --shadow-md: none;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.35;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
    font-feature-settings: 'tnum' 1, 'kern' 1;
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

body.dashboard-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Selection */
::selection {
    background: var(--accent);
    color: #000;
}

/* Scrollbars — thin, terminal-like */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY UTILITIES
   ═══════════════════════════════════════════════════════════ */
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }
.sans { font-family: var(--font-sans); }

/* Label: the Bloomberg ALL-CAPS 10px label that's everywhere */
.label,
.dim {
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-sans);
}
.dim { letter-spacing: 0; text-transform: none; }  /* .dim is a softer dim, not always label */

.bright { color: var(--text-bright); }
.muted  { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }

.green { color: var(--green); }
.red   { color: var(--red); }
.amber, .accent { color: var(--accent); }
.yellow { color: var(--yellow); }
.cyan  { color: var(--cyan); }

h1, h2, h3, h4, h5 {
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════
   NAV (top strip — Bloomberg command bar)
   ═══════════════════════════════════════════════════════════ */
.nav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    height: 32px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-size: 10.5px;
    border-right: 1px solid var(--border);
    transition: color var(--transition), background var(--transition);
    position: relative;
}
.nav a:hover {
    color: var(--text-bright);
    background: var(--bg-card);
}
.nav a.active {
    color: var(--accent);
    background: var(--bg-card);
}
.nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 1px;
    background: var(--accent);
}

.nav .spacer {
    flex: 1;
}

.nav #clock,
.nav > span {
    padding: 0 10px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    height: 100%;
    display: flex;
    align-items: center;
}
.nav > span:last-child {
    border-right: none;
}

/* Legacy pipe separators in the nav — hide them (we use borders now) */
.nav > span[style*="color:var(--border)"] {
    display: none;
}

.nav-sep {
    display: none;
}

/* Status chips */
.status, .nav-status {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.4px;
    padding: 0 10px;
    color: var(--green);
    background: transparent;
}
.status.off, .nav-status.off {
    color: var(--red);
}
/* Explicit .on selector needed so specificity (0,2,0) beats
   `.nav a` (0,1,1) — otherwise anchor-based status chips inherit
   the neutral text-secondary color from the nav rule. */
.status.on, .nav-status.on {
    color: var(--green);
}

/* ═══════════════════════════════════════════════════════════
   CARDS / SURFACES
   ═══════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px 16px;
}

.card-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   HERO — the top-of-dashboard P&L block
   Bloomberg-style: big bright numbers on black, tiny labels above
   ═══════════════════════════════════════════════════════════ */
.hero {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hero-avg-daily,
.hero-stat .value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-bright);
    font-feature-settings: 'tnum' 1;
}

/* ═══════════════════════════════════════════════════════════
   TABLES (the core data surface — Bloomberg is nothing without tables)
   ═══════════════════════════════════════════════════════════ */
table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 11.5px;
}

th {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    padding: 7px 10px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 32px;  /* below nav */
    z-index: 2;
}

td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
    font-feature-settings: 'tnum' 1;
}

tbody tr {
    transition: background var(--transition-fast);
}
tbody tr:hover td {
    background: var(--bg-card);
}
tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.008);
}
tbody tr:nth-child(even):hover td {
    background: var(--bg-card);
}

/* Table-specific cells */
.cell-rank   { color: var(--text-muted); width: 32px; }
.cell-symbol { color: var(--text-bright); font-weight: 500; }
.cell-price  { text-align: right; }
.cell-change { text-align: right; font-weight: 500; }
.col-num     { text-align: right; }

/* ═══════════════════════════════════════════════════════════
   FLASH ANIMATIONS — for live price updates
   ═══════════════════════════════════════════════════════════ */
@keyframes flash-up {
    0%   { background-color: rgba(0, 214, 101, 0.35); }
    100% { background-color: transparent; }
}
@keyframes flash-down {
    0%   { background-color: rgba(255, 59, 48, 0.35); }
    100% { background-color: transparent; }
}
@keyframes flash-neutral {
    0%   { background-color: rgba(255, 223, 0, 0.30); }
    100% { background-color: transparent; }
}

.flash-up   { animation: flash-up 500ms ease-out; }
.flash-down { animation: flash-down 500ms ease-out; }
.flash      { animation: flash-neutral 400ms ease-out; }

/* ═══════════════════════════════════════════════════════════
   BADGES / PILLS (BUY CE, BUY PE, WATCH, SKIP)
   Sharp rectangles. No border-radius. No padding bloat.
   ═══════════════════════════════════════════════════════════ */
.badge-buy,
.badge-watch,
.badge-none,
.action-badge,
.action-pill,
.action-buy-ce,
.action-buy-pe,
.action-watch,
.action-skip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    text-transform: uppercase;
    line-height: 1.5;
}

.action-buy-ce,
.badge-buy {
    background: var(--green-dim);
    color: var(--green);
    border-left: 2px solid var(--green);
}
.action-buy-pe {
    background: var(--red-dim);
    color: var(--red);
    border-left: 2px solid var(--red);
}
.action-watch,
.badge-watch {
    background: var(--accent-dim);
    color: var(--accent);
    border-left: 2px solid var(--accent);
}
.action-skip,
.badge-none {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border-left: 2px solid var(--border-strong);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn,
button.btn,
button:not([class]) {
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 7px 14px;
    background: var(--bg-card);
    color: var(--text-bright);
    border: 1px solid var(--border-strong);
    cursor: pointer;
    transition: all var(--transition);
}
.btn:hover,
button:not([class]):hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-elevated);
}
.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: #000;
}
.btn-danger {
    color: var(--red);
    border-color: var(--red);
}
.btn-danger:hover {
    background: var(--red);
    color: #000;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
select,
textarea {
    font-family: var(--font-mono);
    font-size: 11.5px;
    padding: 7px 10px;
    background: var(--bg-card);
    color: var(--text-bright);
    border: 1px solid var(--border-light);
    transition: border-color var(--transition);
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}
input::placeholder {
    color: var(--text-dim);
    font-family: var(--font-sans);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.4px;
}

label, .field label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.field {
    margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════
   ALERTS / BANNERS
   ═══════════════════════════════════════════════════════════ */
.alert {
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 12px;
    margin-bottom: 12px;
}
.alert-error,
.alert.error {
    border-left: 3px solid var(--red);
    color: var(--red);
    background: var(--red-dim);
}
.alert-success,
.alert.success {
    border-left: 3px solid var(--green);
    color: var(--green);
    background: var(--green-dim);
}
.alert-info {
    border-left: 3px solid var(--cyan);
    color: var(--cyan);
}

/* View-only banner on /scanner */
.view-only-banner {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   DOT INDICATORS (position status)
   ═══════════════════════════════════════════════════════════ */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-open  { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.dot-win   { background: var(--green); }
.dot-loss  { background: var(--red); }
.dot       { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   CHIPS (inline key-value pairs, e.g. dashboard summary strip)
   ═══════════════════════════════════════════════════════════ */
.chip-icon {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent);
    margin-right: 6px;
}
.chip-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}
.chip-value {
    font-family: var(--font-mono);
    color: var(--text-bright);
    font-weight: 500;
    margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════
   DECISION / DAY BAR — dashboard side blocks
   ═══════════════════════════════════════════════════════════ */
.day-bar {
    height: 4px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}
.day-bar .bar {
    height: 100%;
    background: var(--accent);
    transition: width var(--transition);
}

.decision-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    font-size: 11px;
    border-bottom: 1px solid var(--border);
}
.decision-row:last-child {
    border-bottom: none;
}
.decision-row .time {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10.5px;
    min-width: 44px;
}

.empty-msg {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════
   LINKS (inline)
   ═══════════════════════════════════════════════════════════ */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent-strong);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN / SETUP — center-of-screen forms
   ═══════════════════════════════════════════════════════════ */
body:has(form.auth),
body.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   TICKER RULE — thin decorative top stripe for key sections
   Usage: <div class="ticker-rule"></div>
   ═══════════════════════════════════════════════════════════ */
.ticker-rule {
    height: 2px;
    background: linear-gradient(90deg,
        var(--accent) 0%,
        var(--accent) 30%,
        var(--border) 30%,
        var(--border) 100%);
}

/* ═══════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-1 { flex: 1; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }

/* Numeric alignment */
.text-right { text-align: right; }
.tabular { font-feature-settings: 'tnum' 1; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════
   MOBILE (< 768px)
   Bloomberg philosophy: don't dumb it down. Give horizontal scroll
   with a sticky first column. Density > prettiness.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    html {
        font-size: 11px;
    }

    .nav {
        height: 30px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .nav a {
        padding: 0 10px;
        font-size: 10px;
    }
    .nav > span {
        font-size: 10px;
        padding: 0 8px;
    }

    /* Tables: allow horizontal scroll within container, keep density */
    .trades-wrap,
    .scanner-wrap,
    table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    th, td {
        padding: 5px 7px;
        font-size: 11px;
    }
    th { top: 30px; }

    /* Hero — smaller numbers but same layout */
    .hero {
        padding: 12px 12px 10px;
    }
    .hero-avg-daily,
    .hero-stat .value {
        font-size: 18px;
    }

    /* Cards pad less */
    .card { padding: 10px 12px; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT (in case anyone ever prints a trade log)
   ═══════════════════════════════════════════════════════════ */
@media print {
    html { background: #fff; color: #000; }
    .nav, .btn, button { display: none !important; }
    table, td, th { border-color: #000; color: #000; }
}
