/* =====================================================
   TRADING SYSTEM - Dashboard Styles
   Dark theme professional trading interface
   ===================================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1f2b3d;
    --border: #2a3a4e;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.1);
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}
.header-title .icon { font-size: 1.4rem; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.strategy-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    outline: none;
}
.strategy-select:focus { border-color: var(--accent); }
.strategy-select option { background: var(--bg-card); color: var(--text-primary); }
.header-time {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 16px;
}

.main { flex: 1; padding: 20px 24px; }

/* Navigation tabs */
.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.nav-tab {
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    border: none;
    background: transparent;
}
.nav-tab:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-tab.active {
    background: var(--accent);
    color: white;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--accent); }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }

@media (max-width: 1200px) {
    .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .main { padding: 12px; }
}

/* Metric cards */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: var(--mono);
}
.metric-change {
    font-size: 0.8rem;
    font-family: var(--mono);
    margin-top: 4px;
}

/* Colors */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.bg-green { background: var(--green-bg); }
.bg-red { background: var(--red-bg); }
.bg-yellow { background: var(--yellow-bg); }

/* Tables */
.table-container { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}
td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(42, 58, 78, 0.5);
    font-family: var(--mono);
    font-size: 0.8rem;
}
tr:hover td { background: var(--bg-card-hover); }
td.symbol {
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-buy { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge-sell { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.badge-neutral { background: rgba(107,114,128,0.1); color: var(--text-muted); border: 1px solid rgba(107,114,128,0.3); }
.badge-pass { background: var(--green-bg); color: var(--green); }
.badge-fail { background: var(--red-bg); color: var(--red); }

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Signal strength bar */
.signal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.signal-bar-track {
    flex: 1;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
}
.signal-bar-fill {
    height: 100%;
    border-radius: 2px;
}

/* Chart container */
.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
}
.chart-container canvas { width: 100% !important; height: 100% !important; }

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.form-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 0.85rem;
}
.form-input:focus { outline: none; border-color: var(--accent); }

/* Risk check list */
.risk-checks { list-style: none; }
.risk-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(42,58,78,0.3);
    font-size: 0.85rem;
}
.risk-check-icon { font-size: 1rem; }

/* Scrollbar */
::-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(--text-muted); }

/* Animations */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* View containers */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

/* Toast notifications */
.toast-container { position: fixed; top: 70px; right: 24px; z-index: 300; }
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Paper Trading */
.paper-comparison .metric-card { padding: 10px 14px; }
.paper-comparison .metric-value { font-size: 1.1rem; }

/* Equity curve simple */
.equity-point {
    display: inline-block;
    width: 3px;
    margin-right: 1px;
    vertical-align: bottom;
    border-radius: 1px 1px 0 0;
}
