/* ORB Trading Bot Dashboard — Dark-mode financial dashboard styling */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-blue: #58a6ff;
    --accent-yellow: #d29922;
    --accent-purple: #bc8cff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.15);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ─── Header ──────────────────────────────────────────────────────── */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.badge.live {
    background: rgba(248, 81, 73, 0.15);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.badge.dry-run {
    background: rgba(210, 153, 34, 0.15);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: var(--accent-green);
}

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

/* ─── Alert Banner ────────────────────────────────────────────────── */

.alert-banner {
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--accent-red);
}

.alert-icon {
    font-size: 1.2rem;
}

/* ─── Cards ───────────────────────────────────────────────────────── */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s;
}

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

.card-label {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.positive { color: var(--accent-green); }
.negative { color: var(--accent-red); }

/* ─── Sections ────────────────────────────────────────────────────── */

.section {
    margin-bottom: 28px;
}

.section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* ─── Chart ───────────────────────────────────────────────────────── */

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    height: 300px;
    box-shadow: var(--shadow);
}

/* ─── Date Filter ─────────────────────────────────────────────────── */

.date-filter {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-filter input[type="date"] {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
}

.date-filter input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

.btn {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 14px;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.85;
}

/* ─── Table ───────────────────────────────────────────────────────── */

.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(88, 166, 255, 0.04);
}

td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

td.mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

/* ─── Footer ──────────────────────────────────────────────────────── */

.footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ─── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .cards { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .card-value { font-size: 1.4rem; }
}
