/* Dashboard Dark Theme */
:root {
    --bg-primary: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #263348;
    --border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
    --blue: #3b82f6;
    --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 12px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Status dot */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.status-dot.disconnected {
    background: var(--red);
}

.status-dot.reconnecting {
    background: var(--amber);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Buttons */
.btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.7; }

.btn-danger { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tab Navigation */
.nav-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
}

.nav-tab {
    padding: 8px 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s, color 0.2s;
}

.nav-tab:first-child { border-radius: 6px 0 0 6px; }
.nav-tab:last-child { border-radius: 0 6px 6px 0; }
.nav-tab:not(:first-child) { border-left: none; }
.nav-tab.active { background: var(--blue); color: white; border-color: var(--blue); }
.nav-tab:hover:not(.active) { background: var(--bg-card-hover); }

/* Collector Grid */
.collector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.collector-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 6px;
}

.collector-item .label {
    font-size: 11px;
}

.collector-item span:last-child,
.mono-value {
    font-size: 18px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Grid Layouts */
.grid-top {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.grid-account {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

#card-account .metric-main {
    font-size: 32px;
    color: var(--blue);
}

.grid-middle {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Metrics */
.metric-main {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 12px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

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

.metric-row span:last-child {
    font-family: var(--font-mono);
    font-weight: 500;
}

/* Performance Grid */
.perf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.perf-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.perf-item .label {
    font-size: 11px;
}

.perf-item span:last-child {
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* PnL Colors */
.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }
.pnl-neutral { color: var(--text-secondary); }

/* Badges */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.badge-green { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-red { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.badge-gray { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

/* TP Indicator */
.tp-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--text-muted);
    margin-left: 4px;
}

.tp-indicator.hit {
    background: var(--green);
    border-color: var(--green);
}

/* Halt pulsing */
.halt-active {
    animation: pulse 1s infinite;
}

/* Chart */
#pnl-chart {
    height: 250px;
    width: 100%;
}

#card-chart {
    margin-bottom: 12px;
}

/* Trade History Table */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-family: inherit;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
