/* CryptoSignal MVP — Sora font, light/dark theme */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root,
[data-theme="light"] {
    --bg: #f7f8fa;
    --bg-elevated: #ffffff;
    --bg-soft: #f0f2f6;
    --bg-hover: #eaedf2;
    --border: #e3e6ec;
    --border-strong: #cdd2da;
    --text: #0f1419;
    --text-muted: #5a6472;
    --text-subtle: #8a93a1;
    --accent: #0066ff;
    --accent-soft: #e6f0ff;
    --accent-hover: #0052cc;
    --success: #00a651;
    --success-soft: #e0f5e9;
    --danger: #d92d20;
    --danger-soft: #fde8e6;
    --warning: #d97706;
    --warning-soft: #fef3e2;
    --info: #6366f1;
    --shadow: 0 1px 2px rgba(15,20,25,0.04), 0 4px 12px rgba(15,20,25,0.04);
    --shadow-lg: 0 4px 24px rgba(15,20,25,0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
}

[data-theme="dark"] {
    --bg: #0a0e14;
    --bg-elevated: #131820;
    --bg-soft: #1a1f29;
    --bg-hover: #232936;
    --border: #232936;
    --border-strong: #2f3645;
    --text: #e8ecf2;
    --text-muted: #9ba3b0;
    --text-subtle: #6b7280;
    --accent: #3b82f6;
    --accent-soft: #17243d;
    --accent-hover: #5b9af7;
    --success: #10b981;
    --success-soft: #0f2820;
    --danger: #ef4444;
    --danger-soft: #2a1717;
    --warning: #f59e0b;
    --warning-soft: #2a1f0d;
    --info: #818cf8;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Sora', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

code, .mono { font-family: 'JetBrains Mono', monospace; }

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

/* ===== Layout ===== */
.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.brand-logo {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--info) 100%);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-version { font-size: 11px; color: var(--text-subtle); font-weight: 500; }

.nav-section { margin-bottom: 24px; }
.nav-label {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-subtle);
    letter-spacing: 0.05em;
    padding: 0 8px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }

.main {
    padding: 28px 36px;
    max-width: 1500px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.topbar h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.topbar-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}
.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: white;
}
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* ===== Theme toggle ===== */
.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s;
}
.theme-toggle:hover { background: var(--bg-hover); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ===== Cards ===== */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== Stat tiles ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-tile {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-family: 'JetBrains Mono', monospace;
}
.stat-change {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== Tables ===== */
.table-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data-table th {
    background: var(--bg-soft);
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
table.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--bg-soft); }

.mono-cell { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-soft);
    color: var(--text-muted);
}
.badge-buy { background: var(--success-soft); color: var(--success); }
.badge-strong-buy { background: var(--success); color: white; }
.badge-sell { background: var(--danger-soft); color: var(--danger); }
.badge-strong-sell { background: var(--danger); color: white; }
.badge-watch { background: var(--accent-soft); color: var(--accent); }
.badge-blocked { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: var(--bg-soft); color: var(--text-muted); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 80px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-soft) 100%);
}
.login-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo .brand-logo {
    margin: 0 auto 12px;
    width: 52px; height: 52px;
    font-size: 22px;
}
.login-card h1 {
    font-size: 22px; text-align: center;
    margin-bottom: 4px; letter-spacing: -0.02em;
}
.login-card .tagline {
    text-align: center; color: var(--text-muted);
    font-size: 13px; margin-bottom: 28px;
}

/* ===== Alerts/messages ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 3px solid;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ===== Misc ===== */
.row-flex { display: flex; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }

/* ===== Two col layout ===== */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .main { padding: 20px 16px; }
}

/* Pulse for live indicator */
.pulse {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 var(--success);
    animation: pulse 2s infinite;
    display: inline-block;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0,166,81,0.5); }
    70% { box-shadow: 0 0 0 8px rgba(0,166,81,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,166,81,0); }
}

/* Confidence bar */
.conf-bar {
    width: 60px; height: 6px; background: var(--bg-soft);
    border-radius: 3px; overflow: hidden; display: inline-block;
    vertical-align: middle; margin-right: 6px;
}
.conf-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), var(--success));
    border-radius: 3px;
}

/* Empty state */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty .icon { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }

/* ===== Phase 2-5 additions ===== */
.page-content { padding-top: 4px; }

.user-card {
    position: absolute; bottom: 16px; left: 16px; right: 16px;
    padding: 12px; background: var(--bg-soft); border-radius: var(--radius-sm);
    font-size: 12px;
}

.data-table-wrap { overflow-x: auto; margin-top: 8px; }

.btn-danger {
    background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn-danger:hover { filter: brightness(1.05); }

.num { font-family: 'JetBrains Mono', monospace; text-align: right; }
.mono { font-family: 'JetBrains Mono', monospace; }
.small { font-size: 11px; }
.muted { color: var(--text-muted); }
.pos { color: var(--success); }
.neg { color: var(--danger); }

.form-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 8px;
}
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 12px; color: var(--text-muted); }
.form-row input, .form-row select, .form-row textarea {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); font-size: 13px;
}

.stat-delta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-delta.pos { color: var(--success); }
.stat-delta.neg { color: var(--danger); }

.card-grid { display: grid; gap: 16px; }

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
}
