/* ===== DESIGN TOKENS ===== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --yellow: #f59e0b;
    --gradient-accent: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-green: linear-gradient(135deg, #10b981, #34d399);
    --gradient-red: linear-gradient(135deg, #ef4444, #f87171);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 20px rgba(99, 102, 241, 0.15);
    --radius: 16px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
}

/* ===== HEADER ===== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-right { display: flex; align-items: center; gap: 32px; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 24px; }
.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.3px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.status-online { background: var(--green-bg); color: var(--green); }
.status-offline { background: var(--red-bg); color: var(--red); }
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-stat { text-align: right; }
.stat-label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { display: block; font-size: 18px; font-weight: 600; font-family: var(--font-mono); }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    padding: 24px 32px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-accent);
}
.card-wide { grid-column: 2; }
.card-full { grid-column: 1 / -1; }

/* Chart container — constrained height */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Positions badge */
.positions-count {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 12px;
    background: var(--green-bg);
    color: var(--green);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-header .card-title { margin-bottom: 0; }

/* ===== SCORE PANEL ===== */
.score-ring-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}
.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-light);
}

.score-breakdown { display: flex; flex-direction: column; gap: 14px; }
.score-item { display: flex; align-items: center; gap: 10px; }
.score-label { font-size: 12px; color: var(--text-secondary); min-width: 90px; }
.score-bar {
    flex: 1;
    height: 6px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
.score-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.score-pts {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
}

/* ===== STATS ROW ===== */
.stats-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.3s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}
.stat-icon { font-size: 28px; }
.stat-number {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
    display: block;
}
.stat-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

/* ===== TABLE ===== */
.table-container { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 12px 16px;
    font-size: 13px;
    font-family: var(--font-mono);
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
}
tr:hover td { background: rgba(99, 102, 241, 0.03); }
.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }

/* ===== FILTER BUTTONS ===== */
.trade-filters { display: flex; gap: 8px; }
.filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.filter-btn.active {
    background: var(--gradient-accent);
    color: white;
    border-color: transparent;
}

/* ===== EVENT LOG ===== */
.log-container {
    max-height: 300px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 13px;
}
.log-entry {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.log-time { color: var(--text-muted); min-width: 70px; }
.log-message { color: var(--text-primary); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== GRADUATION ===== */
.graduation-badge {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    background: var(--gradient-accent);
    color: white;
}
.graduation-badge.passed {
    background: var(--gradient-green);
}
.graduation-bar-container {
    height: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}
.graduation-bar {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.graduation-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.grad-item {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.grad-item.passed { color: var(--green); }
.grad-item.passed .grad-dot { color: var(--green); }
.grad-dot { font-size: 14px; }
.graduation-stats {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    line-height: 1.8;
}

/* ===== EXIT REASONS ===== */
.exit-breakdown { display: flex; flex-direction: column; gap: 14px; }
.exit-item { display: flex; align-items: center; gap: 10px; }
.exit-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
}
.exit-bar-wrap {
    flex: 1;
    height: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    overflow: hidden;
}
.exit-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 0;
}
.exit-tp { background: var(--gradient-green); }
.exit-sl { background: var(--gradient-red); }
.exit-trail { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.exit-time { background: linear-gradient(135deg, #6366f1, #818cf8); }
.exit-val {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    .card-wide { grid-column: 1; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .graduation-grid { grid-template-columns: repeat(3, 1fr); }
    header { flex-direction: column; gap: 12px; padding: 12px 16px; }
    .header-right { gap: 16px; }
}
@media (max-width: 640px) {
    .stats-row { grid-template-columns: 1fr; }
    .graduation-grid { grid-template-columns: repeat(2, 1fr); }
}
