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

/* Light Mode (Default) */
:root {
    --page-bg: #f6f7fb;
    --card-bg: #ffffff;
    --card-muted: #f4f5f9;
    --border-subtle: #e3e6ef;
    --text-main: #0f1728;
    --text-muted: #6b7285;
    --accent: #3b82f6;
    --accent-strong: #1e3a8a;
    --accent-soft: rgba(59, 130, 246, 0.12);
    --accent-soft-stronger: rgba(59, 130, 246, 0.18);
    --pill-hover: rgba(15, 23, 40, 0.05);
    --success: #22c55e;
    --destructive: #e11d48;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --primary: #5770ff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* Dark Mode */
[data-theme="dark"] {
    --page-bg: #07223ba6;
    --card-bg: #061b30;
    --card-muted: #07223bd5;
    --border-subtle: #2a3142;
    --text-main: #e7e9ee;
    --text-muted: #9ea6b6;
    --accent: #7c9bff;
    --accent-strong: #a9c1ff;
    --accent-soft: rgba(124, 155, 255, 0.15);
    --accent-soft-stronger: rgba(124, 155, 255, 0.22);
    --pill-hover: rgba(255, 255, 255, 0.08);
    --success: #58db96;
    --destructive: #ff6b6b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
    --primary: #5770ff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--page-bg);
    color: var(--text-main);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
}

.eyebrow {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

a {
    color: inherit;
}

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 150ms ease;
    color: var(--text-main);
}

.card:hover {
    border-color: var(--accent-soft);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    background: var(--card-muted);
}

.badge.positive {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
    background: rgba(34, 197, 94, 0.08);
}

.badge.negative {
    color: var(--destructive);
    border-color: rgba(225, 29, 72, 0.2);
    background: rgba(225, 29, 72, 0.08);
}

.pill-table {
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--card-bg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.pill-table th,
.pill-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.pill-table th {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pill-table tr:last-child td {
    border-bottom: none;
}

.news-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.news-card {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    background: var(--card-bg);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.news-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.sparkline {
    width: 100%;
    height: 240px;
    background: linear-gradient(180deg, rgba(59,130,246,0.06), rgba(59,130,246,0));
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.space-y {
    display: grid;
    gap: 1.25rem;
}

.tab-strip {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tab-button {
    border: 1px solid var(--border-subtle);
    background: var(--card-muted);
    color: var(--text-muted);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.tab-button:hover {
    background: var(--pill-hover);
    color: var(--text-main);
}

.tab-button.active {
    background: var(--accent-soft);
    color: var(--text-main);
    border-color: rgba(59, 130, 246, 0.4);
}

.chart-header {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-meta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.75rem 0 1.25rem;
}

.chart-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.2rem 0 0;
}

.chart-change {
    text-align: right;
    font-weight: 700;
    display: grid;
    gap: 0.15rem;
}

.chart-change small {
    font-weight: 600;
    color: var(--text-muted);
}

.text-positive {
    color: var(--success);
}

.text-negative {
    color: var(--destructive);
}

/* Keep default error UI accessible */
#blazor-error-ui {
    color-scheme: light only;
    background: #fde68a;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Page Header Shared Styles */
.page-header,
.trade-header,
.portfolio-header,
.account-header,
.settings-header,
.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    object-fit: cover;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-muted);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    text-decoration: none;
    transition: all 150ms ease;
}

.icon-button i {
    font-size: 1.25rem;
}

.icon-button:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.icon-button.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}