/* ════════════════════════════════════════════════
   Zakovat — TERMINAL INTELLIGENCE Design System
   Bloomberg-stilidagi qora terminal interfeysi
   ════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

/* ─── Default (DARK terminal) ─────────────────── */
:root,
[data-theme="dark"] {
    /* Brand — Amber accent */
    --primary:        #f5b942;
    --primary-hover:  #ffc94f;
    --primary-soft:   rgba(245, 185, 66, 0.14);
    --secondary:      #4ec9e6;        /* Cyan — ikkilamchi urg'u */
    --accent:         #f5b942;
    --on-accent:      #0a0b0d;

    /* Surfaces */
    --bg:             #0a0b0d;
    --bg-elevated:    #111317;
    --bg-elev:        #111317;
    --surface:        #141618;
    --bg-card:        #141618;
    --surface-2:      #1a1d22;
    --surface-hover:  #1a1d22;
    --bg-hover:       #1a1d22;
    --input-bg:       #141618;

    /* Borders — terminal lines */
    --border:         #22262d;
    --border-strong:  #2a2f37;
    --line:           #22262d;
    --line-soft:      #1a1d22;
    --divider:        #1a1d22;

    /* Text */
    --text:           #e8e6e1;
    --text-soft:      #9aa0a8;
    --text-dim:       #9aa0a8;
    --text-muted:     #5a606a;
    --text-mute:      #5a606a;

    /* Status (terminal style) */
    --success:        #5ddb8c;
    --pos:            #5ddb8c;
    --success-bg:     rgba(93, 219, 140, 0.10);
    --danger:         #ff6b6b;
    --neg:            #ff6b6b;
    --danger-bg:      rgba(255, 107, 107, 0.10);
    --warning:        #f5b942;
    --warning-bg:     rgba(245, 185, 66, 0.12);
    --info:           #4ec9e6;
    --info-bg:        rgba(78, 201, 230, 0.10);

    /* Effects — soft modern shadows */
    --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md:      0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg:      0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow:    0 0 32px rgba(245, 185, 66, 0.22);

    --gradient-hero:  linear-gradient(180deg, #0d0e10 0%, #0a0b0d 100%);
    --gradient-card:  linear-gradient(180deg, #16181b 0%, #141618 100%);

    /* Geometry — modern rounded */
    --r-sm:           8px;
    --r-md:           10px;
    --r-lg:           14px;
    --r-xl:           18px;
    --r-full:         9999px;

    --transition:     all 0.18s ease;
    --transition-slow: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    /* Spacing scale */
    --pad-scale:      1;
    --row-h:          34px;
}

/* ─── LIGHT (Warm paper) ──────────────────────── */
[data-theme="light"] {
    --primary:        #c2900b;
    --primary-hover:  #a47900;
    --primary-soft:   rgba(194, 144, 11, 0.12);
    --secondary:      #2b8aa8;
    --accent:         #c2900b;
    --on-accent:      #1c1a15;

    --bg:             #f4f1ea;
    --bg-elevated:    #ebe7dd;
    --bg-elev:        #ebe7dd;
    --surface:        #fbf9f4;
    --bg-card:        #fbf9f4;
    --surface-2:      #ebe7dd;
    --surface-hover:  #e4dfd2;
    --bg-hover:       #e4dfd2;
    --input-bg:       #fbf9f4;

    --border:         #d6cfbe;
    --border-strong:  #b8aa92;
    --line:           #d6cfbe;
    --line-soft:      #e4dfd2;
    --divider:        #e4dfd2;

    --text:           #1c1a15;
    --text-soft:      #5a5444;
    --text-dim:       #5a5444;
    --text-muted:     #8a8472;
    --text-mute:      #8a8472;

    --success:        #1e7a3c;
    --pos:            #1e7a3c;
    --success-bg:     rgba(30, 122, 60, 0.10);
    --danger:         #c2342c;
    --neg:            #c2342c;
    --danger-bg:      rgba(194, 52, 44, 0.10);
    --warning:        #c2900b;
    --warning-bg:     rgba(194, 144, 11, 0.12);
    --info:           #2b8aa8;
    --info-bg:        rgba(43, 138, 168, 0.10);

    --shadow-sm:      0 1px 3px rgba(28, 26, 21, 0.06);
    --shadow-md:      0 4px 12px rgba(28, 26, 21, 0.10);
    --shadow-lg:      0 12px 40px rgba(28, 26, 21, 0.15);

    --gradient-hero:  linear-gradient(180deg, #ebe7dd 0%, #f4f1ea 100%);
    --gradient-card:  #fbf9f4;
}

/* Auto detect — light mode media query */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --primary:        #c2900b;
        --primary-hover:  #a47900;
        --primary-soft:   rgba(194, 144, 11, 0.12);
        --secondary:      #2b8aa8;
        --accent:         #c2900b;
        --on-accent:      #1c1a15;
        --bg:             #f4f1ea;
        --bg-elevated:    #ebe7dd;
        --bg-elev:        #ebe7dd;
        --surface:        #fbf9f4;
        --bg-card:        #fbf9f4;
        --surface-2:      #ebe7dd;
        --surface-hover:  #e4dfd2;
        --bg-hover:       #e4dfd2;
        --input-bg:       #fbf9f4;
        --border:         #d6cfbe;
        --border-strong:  #b8aa92;
        --line:           #d6cfbe;
        --line-soft:      #e4dfd2;
        --divider:        #e4dfd2;
        --text:           #1c1a15;
        --text-soft:      #5a5444;
        --text-dim:       #5a5444;
        --text-muted:     #8a8472;
        --text-mute:      #8a8472;
        --success:        #1e7a3c;
        --pos:            #1e7a3c;
        --success-bg:     rgba(30, 122, 60, 0.10);
        --danger:         #c2342c;
        --neg:            #c2342c;
        --danger-bg:      rgba(194, 52, 44, 0.10);
        --warning:        #c2900b;
        --warning-bg:     rgba(194, 144, 11, 0.12);
        --info:           #2b8aa8;
        --info-bg:        rgba(43, 138, 168, 0.10);
        --gradient-hero:  linear-gradient(180deg, #ebe7dd 0%, #f4f1ea 100%);
        --gradient-card:  #fbf9f4;
    }
}

/* ════════════════════════════════════════════════
   Base reset
   ════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.2s, color 0.2s;
    font-size: 14px;
}

/* JetBrains Mono — raqamlar, ID, ELO, meta */
.mono, code, kbd, samp, pre {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* Instrument Serif — katta sarlavhalar uchun */
.serif, .display {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

button { font-family: inherit; }

input, textarea, select {
    font-family: inherit;
    color: inherit;
}

/* Custom scrollbar — terminal style */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Selection — amber */
::selection {
    background: var(--primary);
    color: var(--on-accent);
}

/* ════════════════════════════════════════════════
   Mono / meta / labels — terminal helper utilities
   ════════════════════════════════════════════════ */
.meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

.label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 600;
}

.tabular { font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════
   Theme toggle button (header'da)
   ════════════════════════════════════════════════ */
.theme-toggle:not(.dropdown-item) {
    width: 38px;
    height: 38px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:not(.dropdown-item):hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle:not(.dropdown-item):active {
    background: var(--bg-hover);
}

/* Sun/moon swap */
[data-theme="dark"] .theme-toggle .icon-light,
:root:not([data-theme]) .theme-toggle .icon-light { display: inline; }
[data-theme="dark"] .theme-toggle .icon-dark,
:root:not([data-theme]) .theme-toggle .icon-dark { display: none; }

[data-theme="light"] .theme-toggle .icon-light { display: none; }
[data-theme="light"] .theme-toggle .icon-dark { display: inline; }

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) .theme-toggle .icon-light { display: none; }
    :root:not([data-theme]) .theme-toggle .icon-dark { display: inline; }
}

/* ════════════════════════════════════════════════
   Shared utilities
   ════════════════════════════════════════════════ */
.hidden { display: none !important; }

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 768px) {
    .container { padding: 0 24px; }
}

/* Live dot — pulsing red (real-time indicator) */
.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    animation: livePulse 1.5s infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5); }
    50%      { opacity: 0.4; box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); }
}

/* Ticker (Bloomberg-style scrolling bar) — kelajakda */
.ticker {
    display: flex;
    overflow: hidden;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    padding: 6px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
}
