:root {
    --bg-main: #0B0E14;
    --bg-card: #121824;
    --bg-card-hover: #182030;
    --bg-sidebar: #0E131F;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.3);
    
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    --accent-blue: #3B82F6;
    --accent-indigo: #6366F1;
    --accent-purple: #8B5CF6;
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.logo-text h2 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.logo-text h2 span {
    color: var(--accent-blue);
}

.logo-text p {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 20px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.02));
    border-left: 3px solid var(--accent-indigo);
    color: #818CF8;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--color-success);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-success);
    border-radius: 50%;
}

.status-dot.pulsing {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.server-time {
    color: var(--text-muted);
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(14, 19, 31, 0.7);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title h1 {
    font-size: 22px;
    font-weight: 700;
}

.topbar-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mode-badge {
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60A5FA;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
}

.btn-secondary {
    background: #374151;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.content-body {
    padding: 24px 32px;
    flex: 1;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-card);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.icon-balance { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.icon-equity { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }
.icon-pnl { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.icon-winrate { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.icon-pf { background: rgba(236, 72, 153, 0.15); color: #F472B6; }
.icon-dd { background: rgba(239, 68, 68, 0.15); color: #F87171; }

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 18px;
    font-weight: 700;
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}

/* Health Cards */
.health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.health-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}

.health-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.health-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}

.h-stat {
    display: flex;
    justify-content: space-between;
}

.h-stat span {
    color: var(--text-muted);
}

.h-stat strong {
    font-family: 'JetBrains Mono', monospace;
}

/* Common Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.card-header {
    margin-bottom: 16px;
}

.card-header.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header .subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-btns {
    display: flex;
    gap: 10px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.badge-bull { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.badge-bear { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.badge-neutral { background: rgba(156, 163, 175, 0.15); color: #9CA3AF; }

.val-up { color: #34D399; font-weight: 600; }
.val-down { color: #F87171; font-weight: 600; }

/* Filter Matrix Grid */
.filter-matrix-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.filter-index-card {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-index-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-index-name {
    font-weight: 700;
    font-size: 14px;
}

.filter-index-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 700;
}

/* Settings Form */
.settings-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: #090C12;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-group-checkbox {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 13px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.mt-3 { margin-top: 16px; }

/* Logs Console */
.logs-console {
    background: #07090E;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    height: 480px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry {
    display: flex;
    gap: 12px;
}

.log-time { color: var(--text-muted); }
.log-level-INFO { color: #60A5FA; }
.log-level-WARNING { color: #FBBF24; }
.log-level-ERROR { color: #F87171; }
.log-msg { color: var(--text-primary); }

/* Responsive */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .health-grid { grid-template-columns: 1fr; }
    .filter-matrix-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}
