@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-main: #06070a;
    --bg-sidebar: #0a0b10;
    --bg-card: #0e1017;
    --bg-card-hover: #141722;
    --bg-input: #12151e;
    
    --border-color: rgba(255, 255, 255, 0.07);
    --border-red: rgba(229, 9, 20, 0.35);
    
    --accent-red: #e50914;
    --accent-red-hover: #ff1f2d;
    --accent-red-glow: rgba(229, 9, 20, 0.25);
    
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.25);
    --accent-blue: #3b82f6;
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Subtle Canvas Particles */
#snowCanvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: #1c202d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-red); }

/* ==========================================================================
   APP WRAPPER & LUXURY SIDEBAR
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 5;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
}

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

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(229, 9, 20, 0.5));
}

.brand-name {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -0.3px;
    color: #fff;
}
.brand-name span {
    color: var(--accent-red);
}

.sidebar-nav {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 12px 4px 12px;
    margin-top: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.2s;
}

.nav-item:hover {
    color: #fff;
    background: var(--bg-card);
}
.nav-item:hover i {
    color: var(--accent-red);
}

.nav-item.active {
    background: rgba(229, 9, 20, 0.12);
    color: #fff;
    border-left: 3px solid var(--accent-red);
    font-weight: 700;
}
.nav-item.active i {
    color: var(--accent-red);
}

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

.dev-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent-red);
    object-fit: cover;
}

.dev-info h4 { font-size: 13px; font-weight: 800; color: #fff; }
.dev-info p { font-size: 11px; color: var(--accent-red); font-weight: 600; }

/* ==========================================================================
   MAIN CONTENT & TOPBAR
   ========================================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--header-height);
    background: rgba(10, 11, 16, 0.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}
.page-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.server-selector-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

.api-key-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.api-key-badge:hover {
    border-color: var(--accent-red);
    color: #fff;
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.content-body {
    padding: 28px 30px;
    flex: 1;
}

/* ==========================================================================
   TRADING-STYLE TELEMETRY TICKER BAR
   ========================================================================== */
.trading-ticker-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.ticker-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.ticker-value {
    color: #fff;
}
.ticker-up {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}
.ticker-down {
    color: var(--accent-red);
    background: rgba(229, 9, 20, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* ==========================================================================
   METRICS GRID (TRADING STATS CARDS)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card-trading {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}
.stat-card-trading::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}
.stat-card-trading:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.stat-card-trading:hover::before {
    opacity: 1;
}

.stat-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.stat-main-number {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #fff;
    margin: 8px 0;
}
.stat-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ==========================================================================
   CHARTS & GRAPHS AREA
   ========================================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    margin-bottom: 26px;
}

.chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.panel-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   CUSTOM CARDS & TABLES
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 24px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: #fff;
}

/* Badges */
.badge-id {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.badge-ban {
    background: rgba(229, 9, 20, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(229, 9, 20, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* Action Buttons */
.btn-sm {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), #a3070f);
    color: #fff;
    box-shadow: 0 4px 14px rgba(229, 9, 20, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-red-hover), var(--accent-red));
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5);
}

.btn-danger {
    background: rgba(229, 9, 20, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(229, 9, 20, 0.3);
}
.btn-danger:hover {
    background: var(--accent-red);
    color: #fff;
}

.btn-screenshot {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.btn-screenshot:hover {
    background: #3b82f6;
    color: #fff;
}

/* ==========================================================================
   TOGGLES GRID
   ========================================================================== */
.toggles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.toggle-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.toggle-card:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

.toggle-label h4 {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2px;
}
.toggle-label p {
    font-size: 12px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #202430;
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--accent-red);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* ==========================================================================
   LIVE TERMINAL CONSOLE
   ========================================================================== */
.terminal-card {
    background: #06070a;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
}
.terminal-header {
    background: #0c0e15;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}
.terminal-dots { display: flex; gap: 6px; }
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-body {
    height: 380px;
    overflow-y: auto;
    padding: 18px;
    font-size: 12px;
    line-height: 1.7;
    color: #94a3b8;
}
.terminal-line { margin-bottom: 4px; word-break: break-all; }
.term-time { color: #64748b; }
.term-red { color: var(--accent-red); font-weight: 700; }
.term-green { color: var(--accent-green); font-weight: 700; }
.term-blue { color: #38bdf8; }

.terminal-input-bar {
    display: flex;
    background: #0c0e15;
    border-top: 1px solid var(--border-color);
    padding: 10px 16px;
    align-items: center;
    gap: 12px;
}
.terminal-input-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    outline: none;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    width: 100%;
    max-width: 660px;
    padding: 30px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
}
.modal-close:hover { color: #fff; }

.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 11px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
}
.form-input:focus {
    border-color: var(--accent-red);
}

.screenshot-preview {
    width: 100%;
    border-radius: 10px;
    max-height: 420px;
    object-fit: contain;
    background: #000;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
}
