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

:root {
    --bg-color: #050b18;
    --card-bg: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #00f2ff;
    --secondary-color: #7000ff;
    --success: #00ff88;
    --danger: #ff0055;
    --warning: #f1c40f;
    --text-main: #ffffff;
    --text-dim: #778;
    --gradient: linear-gradient(135deg, #7000ff, #00f2ff);
    --card-border: 1px solid rgba(255,255,255,0.07);
    --sidebar-width: 240px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    background-image:
        radial-gradient(at 0% 0%, rgba(112, 0, 255, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 242, 255, 0.08) 0px, transparent 50%);
    min-height: 100vh;
}

.app-container { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(5, 11, 24, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.4;
}

.nav-menu { list-style: none; flex: 1; }

.nav-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.3rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.nav-icon { font-size: 1.1rem; }
.nav-item.active {
    background: linear-gradient(135deg, rgba(112,0,255,0.2), rgba(0,242,255,0.1));
    color: var(--text-main);
    border: 1px solid rgba(0,242,255,0.2);
}
.nav-item:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255,255,255,0.04);
}

.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-color); }

.regime-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.03);
}
.regime-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
}

.tab-view { display: none; animation: fadeIn 0.3s ease; }
.tab-view.active { display: block; }

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.header h1 { font-size: 1.6rem; font-weight: 700; }
.header h1 + p { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.2rem; }

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 255, 136, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(0,255,136,0.2);
    font-size: 0.85rem;
    font-weight: 600;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    transition: border-color 0.3s;
}
.stat-card:hover { border-color: rgba(0,242,255,0.2); }
.stat-label { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.6rem; }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-trend { font-size: 0.8rem; margin-top: 0.4rem; color: var(--text-dim); }

/* ===== REGIME BANNER ===== */
.regime-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid;
    transition: all 0.5s;
}
.regime-banner.bullish { background: rgba(0,255,136,0.08); border-color: rgba(0,255,136,0.3); color: var(--success); }
.regime-banner.bearish { background: rgba(255,0,85,0.08); border-color: rgba(255,0,85,0.3); color: var(--danger); }
.regime-banner.sideways { background: rgba(241,196,15,0.08); border-color: rgba(241,196,15,0.3); color: var(--warning); }

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0 1rem;
}
.section-header h2 { font-size: 1.05rem; font-weight: 600; }

/* ===== TABLE SECTION ===== */
.table-section {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 0.8rem 1rem;
    text-align: left;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
}
tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody td { padding: 0.85rem 1rem; font-size: 0.88rem; }

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.tag-buy { background: rgba(0,255,136,0.15); color: var(--success); }
.tag-sell { background: rgba(255,0,85,0.15); color: var(--danger); }

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ===== BUTTONS ===== */
.btn-gradient {
    background: var(--gradient);
    border: none;
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
}
.btn-gradient:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-gradient:active { transform: translateY(0); }

/* ===== FORM ===== */
.form-label {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.form-control {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    width: 100%;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); }

/* ===== SEARCH INPUT ===== */
.search-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    outline: none;
    width: 220px;
    font-size: 0.85rem;
}
.search-input:focus { border-color: var(--primary); }

/* ===== AGENT GRID (Debate Page) ===== */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.agent-card {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: 14px;
    padding: 1.2rem;
    transition: border-color 0.3s;
}
.agent-card.quant { border-top: 3px solid #00f2ff; }
.agent-card.sentiment { border-top: 3px solid #f1c40f; }
.agent-card.whale { border-top: 3px solid #9b59b6; }
.agent-card.macro { border-top: 3px solid #e67e22; }
.agent-card.risk { border-top: 3px solid #00ff88; grid-column: span 4; display: grid; grid-template-columns: auto 1fr 1fr; gap: 1rem; align-items: center; }

.agent-icon { font-size: 1.8rem; margin-bottom: 0.5rem; }
.agent-name { font-size: 0.8rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.agent-desc { font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; }
.agent-verdict {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: var(--text-dim);
    display: inline-block;
}

/* ===== AI TERMINAL ===== */
.ai-terminal {
    background: #02060f;
    border: 1px solid #1a2a4b;
    border-radius: 12px;
    overflow: hidden;
}
.terminal-header {
    background: #0a1628;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #1a2a4b;
}
.terminal-dot {
    width: 12px; height: 12px; border-radius: 50%;
}
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }
.terminal-body {
    font-family: 'JetBrains Mono', monospace;
    color: #00ffcc;
    font-size: 0.82rem;
    line-height: 1.6;
    height: 320px;
    overflow-y: auto;
    padding: 1.2rem 1.4rem;
    scrollbar-width: thin;
    scrollbar-color: #1a2a4b transparent;
}

/* ===== MEMORY PAGE ===== */
.maturity-bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.maturity-bar-label { width: 100px; font-size: 0.85rem; color: var(--text-dim); }
.maturity-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}
.maturity-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}
.maturity-bar-count { width: 60px; font-size: 0.8rem; color: var(--text-dim); text-align: right; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.thinking-entry { margin-bottom: 1rem; border-bottom: 1px solid rgba(0,255,204,0.1); padding-bottom: 0.8rem; }
.thinking-timestamp { color: rgba(0,255,204,0.5); font-size: 0.78rem; }

/* ===== CACHED MARKET ROWS ===== */
.mkt-row.cached {
    opacity: 0.7;
    border-left: 3px solid rgba(255, 193, 7, 0.5);
}

.cache-indicator {
    font-size: 0.7rem;
    color: rgba(255, 193, 7, 0.8);
    margin-left: 4px;
}
