:root {
    --bg-terminal: #05070a;
    --pane-bg: rgba(10, 15, 25, 0.85); /* Glassmorphism Base */
    --border-tactical: rgba(0, 255, 136, 0.25);
    --primary: #00ff9d; /* More vibrant neon */
    --primary-glow: rgba(0, 255, 157, 0.4);
    --secondary: #00f2ff;
    --danger: #ff2d55;
    --text-terminal: #f8fafc;
    --text-muted: #94a3b8;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --stream: #00f2ff;
    --glass-border: rgba(255, 255, 255, 0.05);
}

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

body {
    background: var(--bg-terminal);
    color: var(--text-terminal);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
    /* Bloomberg-style scanlines effect */
    background-image: linear-gradient(rgba(18, 16, 16, 0.1) 50%, transparent 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 2px, 3px 100%;
}

.terminal-interface {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
}

/* Ticker Ribbon */
.ticker-ribbon {
    background: #000;
    border-bottom: 1px solid var(--border-tactical);
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    height: 40px; /* Explicit height */
    z-index: 10;
}

.ticker-wrap {
    display: flex;
    animation: ticker-slide 60s linear infinite;
}

@keyframes ticker-slide {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    margin-right: 2rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
    padding: 2px 8px;
    border-radius: 4px;
}

.ticker-item.pulse {
    background: rgba(0, 242, 255, 0.1);
    color: var(--text-terminal);
    transform: scale(1.05);
}

.ticker-item .price { color: var(--secondary); margin-left: 5px; }

/* Main Grid Layout */
.main-workspace {
    display: grid !important;
    grid-template-columns: 280px 1fr 350px !important;
    grid-template-rows: 1fr !important;
    gap: 1px !important;
    background: var(--border-tactical);
    flex: 1 !important;
    height: calc(100vh - 240px) !important;
    width: 100vw !important;
    overflow: hidden !important;
}

.pane {
    background: var(--pane-bg);
    backdrop-filter: blur(12px); /* Glassmorphism */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.pane-header {
    padding: 10px 15px;
    background: rgba(0, 255, 157, 0.05);
    border-bottom: 1px solid var(--border-tactical);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--primary);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.2);
}

/* Sidebar & Navigation */
.nav-list {
    flex: 1;
    padding: 1rem;
}

.nav-item {
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: 0.2s;
    color: var(--text-muted);
}

.nav-item:hover { background: rgba(0, 255, 136, 0.05); color: var(--text-terminal); }
.nav-item.active { background: var(--primary-glow); color: var(--primary); font-weight: 700; }

/* Chart Area */
#chart-main {
    flex: 1;
    position: relative;
    padding: 5px;
}

/* Doctrine Toggle */
.doctrine-toggle {
    display: flex;
    background: #000;
    border-radius: 20px;
    padding: 3px;
    border: 1px solid var(--border-tactical);
}

.status-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.latency-pill {
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-mono);
}

.imbalance-meter {
    width: 100%;
    height: 6px;
    background: #000;
    display: flex;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
    border: 1px solid var(--border-tactical);
}

.toggle-btn {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.65rem;
    cursor: pointer;
    transition: 0.3s;
    border: none;
    color: var(--text-muted);
    background: transparent;
}

.toggle-btn.active {
    background: var(--primary);
    color: #000;
    font-weight: 800;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Status Stream Indicator */
.status-pill.stream {
    background: rgba(0, 242, 255, 0.1);
    color: var(--stream);
    border: 1px solid var(--stream);
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-pill.stream::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--stream);
    border-radius: 50%;
    animation: flash-pulse 1s infinite;
}

@keyframes flash-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Logs & Data */
.log-stream {
    flex: 1;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow-y: auto;
    color: var(--text-muted);
}

.log-entry { margin-bottom: 5px; line-height: 1.4; border-left: 2px solid transparent; padding-left: 10px; }
.log-entry.buy { color: var(--primary); border-color: var(--primary); }
.log-entry.sell { color: var(--danger); border-color: var(--danger); }

/* ALERT FLASH */
@keyframes alert-buy-glow {
    0% { box-shadow: inset 0 0 0px var(--primary); }
    50% { box-shadow: inset 0 0 100px var(--primary-glow); }
    100% { box-shadow: inset 0 0 0px var(--primary); }
}

@keyframes alert-sell-glow {
    0% { box-shadow: inset 0 0 0px var(--danger); }
    50% { box-shadow: inset 0 0 100px rgba(255, 0, 85, 0.2); }
    100% { box-shadow: inset 0 0 0px var(--danger); }
}

.alert-buy { animation: alert-buy-glow 1.5s ease-out 2; }
.alert-sell { animation: alert-sell-glow 1.5s ease-out 2; }

/* Dashboard Widgets */
.gauge-container {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.assets-footer {
    grid-row: 3;
    background: var(--pane-bg);
    border-top: 1px solid var(--border-tactical);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 1.5rem;
}

.status-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 1.2rem; font-weight: 800; font-family: var(--font-mono); }

/* Tab Visibility Logic */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    animation: fade-in-tactical 0.3s ease-out;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

@keyframes fade-in-tactical {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Module Views & Tactical Elements */
.module-view h3 {
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-card .label { font-size: 0.55rem; color: var(--text-muted); }
.stat-card .value { font-size: 1rem; font-weight: 800; color: var(--secondary); font-family: var(--font-mono); }

.tactical-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.tactical-table th {
    text-align: left;
    padding: 10px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-tactical);
    font-size: 0.6rem;
}

.tactical-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--glass-border);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    font-family: var(--font-mono);
    font-weight: 800;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.3s;
    text-transform: uppercase;
    font-size: 0.7rem;
    margin-top: 1rem;
}

.btn-danger:hover {
    box-shadow: 0 0 15px rgba(255, 45, 85, 0.4);
    transform: scale(1.02);
}

.config-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.config-item label {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.config-item select {
    background: #000;
    color: var(--primary);
    border: 1px solid var(--border-tactical);
    padding: 8px;
    width: 200px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}
