/* ═══════════════════════════════════════════════════════════
   CRYPTO TERMINAL — Dark Trading Theme
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');
:root {
    --bg-primary: #0a0e17; --bg-secondary: #0f1420; --bg-card: #161b28; --bg-tertiary: #1a2030;
    --bg-input: #131825; --bg-hover: #1a2238; --accent-glow: rgba(59,130,246,.08);
    --border: #1e2640; --border-active: #2d3a5c;
    --text-primary: #e4e8ef; --text-secondary: #8892a4; --text-muted: #505a6e;
    --green: #00E676; --green-dim: #00c853; --red: #FF5252; --red-dim: #d32f2f;
    --yellow: #FFD740; --orange: #FF9100; --accent: #3b82f6; --accent-hover: #2563eb;
    --radius: 8px; --radius-sm: 4px;
    --font-mono: 'JetBrains Mono', monospace; --font-sans: 'Outfit', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-sans); min-height: 100vh; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-active); }
a { color: var(--accent); text-decoration: none; }

/* ─── Layout ─────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
.main-content { margin-left: 220px; flex: 1; padding: 24px; min-width: 0; }
.sidebar-logo { padding: 16px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.logo-text { font-weight: 700; font-size: 14px; }
.logo-sub { font-size: 10px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-section-title { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; padding: 12px 10px 4px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13px; font-weight: 500; margin-bottom: 2px; transition: all .15s; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ─── Page ───────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ─── Cards ──────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.mb-6 { margin-bottom: 24px; }

.summary-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.summary-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.summary-card .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.summary-card .value { font-size: 22px; font-weight: 700; font-family: var(--font-mono); }
.summary-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
.positive, .text-green { color: var(--green) !important; }
.negative, .text-red { color: var(--red) !important; }

/* ─── Stats ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 22px; font-weight: 700; font-family: var(--font-mono); margin-top: 6px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Win Rate Ring */
.win-rate-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.win-rate-ring svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.ring-fill { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.win-rate-center { position: absolute; font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.ls-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.ls-bar-long { background: var(--green); transition: width .3s; }
.ls-bar-short { background: var(--red); transition: width .3s; }
.ls-labels { display: flex; justify-content: space-between; font-size: 11px; }
.long-label { color: var(--green); }
.short-label { color: var(--red); }

/* ─── Tables ─────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
.data-table td { padding: 8px 12px; border-bottom: 1px solid rgba(30,38,64,.3); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.data-table tr:hover { background: var(--bg-hover); }
.col-symbol { font-weight: 600; color: var(--text-primary); }
.col-side-long { color: var(--green); font-weight: 600; }
.col-side-short { color: var(--red); font-weight: 600; }
.col-pnl-pos { color: var(--green); font-weight: 600; }
.col-pnl-neg { color: var(--red); font-weight: 600; }
.side-badge { padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.side-badge.long { background: rgba(0,230,118,.12); color: var(--green); }
.side-badge.short { background: rgba(255,82,82,.12); color: var(--red); }

/* ─── Forms ──────────────────────────────────────── */
.form-control, select, .form-group input, .form-group select {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary); padding: 7px 12px;
    border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 12.5px; outline: none; transition: border-color .15s;
}
.form-control:focus, select:focus { border-color: var(--accent); }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── Buttons ────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px;
    font-weight: 600; font-family: var(--font-sans); cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-dim); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* ─── Filter Bar ─────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; padding: 12px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }

/* ─── Pagination ─────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; justify-content: center; }
.page-btn { padding: 5px 12px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-info { font-size: 12px; color: var(--text-muted); margin-left: 12px; }

/* ─── Balance Row ────────────────────────────────── */
.balance-row { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(30,38,64,.3); }
.balance-coin { display: flex; align-items: center; gap: 8px; width: 80px; }
.coin-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; }
.balance-amount { flex: 1; font-family: var(--font-mono); font-size: 12px; }
.balance-value { width: 90px; text-align: right; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }

/* ─── Modal ──────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 200; display: none; justify-content: center; align-items: flex-start; padding: 40px 20px; overflow-y: auto; }
.modal-overlay.show { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 700px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Chart ──────────────────────────────────────── */
.chart-container { position: relative; width: 100%; height: 280px; }
.chart-container canvas { width: 100%; height: 100%; }

/* ─── Calendar ───────────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar-header-cell { background: var(--bg-secondary); padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.calendar-cell { background: var(--bg-card); padding: 10px; min-height: 90px; }
.calendar-cell.other-month { opacity: .3; }
.calendar-cell.today { border: 1px solid var(--accent); }
.day-num { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.day-pnl { font-family: var(--font-mono); font-size: 14px; font-weight: 700; }
.day-pnl.positive { color: var(--green); }
.day-pnl.negative { color: var(--red); }
.day-trades { font-size: 10px; color: var(--text-muted); }
.no-trades { font-size: 10px; color: var(--text-muted); }
.btn-group { display: flex; gap: 0; }
.btn-group .btn { border-radius: 0; } .btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); } .btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ─── Journal ────────────────────────────────────── */
.journal-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.journal-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.journal-textarea { width: 100%; min-height: 100px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); padding: 10px; font-family: var(--font-sans); font-size: 13px; resize: vertical; }
.rating-stars { display: flex; gap: 4px; }
.rating-star { font-size: 22px; color: var(--border); cursor: pointer; transition: color .15s; }
.rating-star.active, .rating-star:hover { color: var(--yellow); }
.comment-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-input-row input { flex: 1; }
.comment-item { padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-bottom: 8px; }
.comment-meta { display: flex; justify-content: space-between; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: 12px; }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-content { font-size: 13px; }
.pnl-chip { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.pnl-chip.positive { background: rgba(0,230,118,.12); color: var(--green); }
.pnl-chip.negative { background: rgba(255,82,82,.12); color: var(--red); }

/* ─── Account Cards ──────────────────────────────── */
.account-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
.account-avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0; }
.account-info { flex: 1; min-width: 0; }
.account-name { font-size: 15px; font-weight: 700; }
.account-exchange { font-size: 12px; color: var(--text-muted); }
.account-stats { display: flex; gap: 30px; }
.account-stat-item .stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.account-stat-item .stat-val { font-size: 15px; font-weight: 700; font-family: var(--font-mono); margin-top: 2px; }
.account-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.inactive { background: var(--red); }
.account-actions { display: flex; gap: 6px; }

/* ─── Trade Detail Grid ──────────────────────────── */
.trade-detail-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }
.trade-detail-item { background: var(--bg-tertiary); padding: 10px; border-radius: var(--radius-sm); }
.td-label { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 2px; }
.td-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }

/* ─── Toast ──────────────────────────────────────── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: #fff; transition: opacity .3s; }
.toast.info { background: var(--accent); }
.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 1200px) { .summary-grid, .stats-grid { grid-template-columns: repeat(2,1fr); } .trade-detail-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 768px) { .sidebar { width: 60px; } .main-content { margin-left: 60px; } .logo-text, .logo-sub, .nav-item span:not(.nav-icon) { display: none; } .nav-section-title { display: none; } }
