:root {
    --bg-deep: #050810;
    --bg-space: #0a0e1a;
    --bg-panel: #0d1225;
    --bg-card: #111833;
    --bg-card-hover: #151d3d;
    --border-dim: rgba(0, 180, 255, 0.08);
    --border-glow: rgba(0, 212, 255, 0.2);
    --border-active: rgba(0, 212, 255, 0.5);

    --ancient-cyan: #00d4ff;
    --ancient-teal: #00b4d8;
    --ancient-blue: #0077b6;
    --ancient-gold: #c8a84e;
    --ancient-amber: #e8b849;
    --naquadah-green: #22c55e;
    --wraith-red: #ef4444;
    --ori-orange: #f59e0b;

    --text-primary: #e8edf5;
    --text-secondary: #8892a8;
    --text-muted: #5a6478;
    --text-glow: #00d4ff;

    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.15);
    --glow-cyan-strong: 0 0 30px rgba(0, 212, 255, 0.3);
    --glow-green: 0 0 15px rgba(34, 197, 94, 0.3);
    --glow-red: 0 0 15px rgba(239, 68, 68, 0.3);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.stargate-overlay {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 119, 182, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 212, 255, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(200, 168, 78, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ancient-cyan), transparent);
    opacity: 0.08;
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 9999;
}

@keyframes scanline {
    0% { top: -2px; }
    100% { top: 100vh; }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes data-stream {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 100%; }
}

.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-glow);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--ancient-cyan), transparent);
    opacity: 0.3;
}

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

.logo-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--ancient-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--glow-cyan), inset var(--glow-cyan);
    animation: pulse-glow 3s ease-in-out infinite;
}

.logo-ring::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.1);
}

.logo-inner {
    width: 36px;
    height: 36px;
}

.logo-svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.logo-sub {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 6px;
    color: var(--ancient-cyan);
    margin-top: -2px;
}

.engine-status {
    margin: 16px 16px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--text-muted);
    width: 100%;
}

.status-value {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    flex: 1;
}

.status-value.active {
    color: var(--naquadah-green);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 8px var(--text-muted);
}

.status-indicator.active {
    background: var(--naquadah-green);
    box-shadow: var(--glow-green);
    animation: pulse-glow 2s ease-in-out infinite;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(0, 212, 255, 0.05);
    border-color: var(--border-dim);
}

.nav-item:hover svg { opacity: 0.9; }

.nav-item.active {
    color: var(--ancient-cyan);
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow: var(--glow-cyan);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -13px;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--ancient-cyan);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 10px var(--ancient-cyan);
}

.nav-item.active svg {
    opacity: 1;
    color: var(--ancient-cyan);
}

.sidebar-footer {
    padding: 16px;
}

.ai-card {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(200, 168, 78, 0.05));
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 14px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.ai-card::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.15), transparent 70%);
    border-radius: 50%;
}

.ai-card .ai-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
}

.ai-card h4 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.ai-card p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-header h1 svg {
    width: 32px;
    height: 32px;
    color: var(--ancient-cyan);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

.hud-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.hud-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 14px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hud-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--glow-cyan);
}

.hud-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ancient-cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.hud-card:hover::before { opacity: 0.5; }

.hud-card .label {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.hud-card .value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.hud-card .value.positive { color: var(--naquadah-green); }
.hud-card .value.negative { color: var(--wraith-red); }
.hud-card .value.cyan { color: var(--ancient-cyan); }

.hud-card .sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-dim);
    background: rgba(0, 212, 255, 0.02);
}

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.panel-header .badge {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 1px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid;
}

.badge-active {
    color: var(--naquadah-green);
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.1);
}

.badge-standby {
    color: var(--text-muted);
    border-color: var(--border-dim);
    background: rgba(90, 100, 120, 0.1);
}

.panel-body {
    padding: 22px;
}

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

.data-table th {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-dim);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(0, 212, 255, 0.03);
}

.data-table .symbol {
    font-weight: 600;
    color: var(--ancient-cyan);
}

.data-table .positive { color: var(--naquadah-green); }
.data-table .negative { color: var(--wraith-red); }

.btn {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 1.5px;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 8px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 180, 216, 0.1));
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--ancient-cyan);
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(0, 180, 216, 0.15));
    box-shadow: var(--glow-cyan);
    border-color: var(--ancient-cyan);
}

.btn-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.1));
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--naquadah-green);
}

.btn-success:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(34, 197, 94, 0.15));
    box-shadow: var(--glow-green);
}

.btn-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.1));
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--wraith-red);
}

.btn-danger:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.15));
    box-shadow: var(--glow-red);
}

.btn-gold {
    background: linear-gradient(135deg, rgba(200, 168, 78, 0.15), rgba(232, 184, 73, 0.1));
    border-color: rgba(200, 168, 78, 0.3);
    color: var(--ancient-gold);
}

.btn-gold:hover {
    background: linear-gradient(135deg, rgba(200, 168, 78, 0.25), rgba(232, 184, 73, 0.15));
    box-shadow: 0 0 20px rgba(200, 168, 78, 0.2);
}

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

.form-group label {
    display: block;
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-space);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--border-active);
    box-shadow: var(--glow-cyan);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300d4ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.toggle-group {
    display: flex;
    gap: 6px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-dim);
    background: var(--bg-space);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.toggle-btn:hover {
    border-color: var(--border-glow);
    color: var(--text-secondary);
}

.toggle-btn.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--ancient-cyan);
    color: var(--ancient-cyan);
    box-shadow: var(--glow-cyan);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.chart-container {
    position: relative;
    height: 300px;
    padding: 10px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-dim);
    border-top-color: var(--ancient-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 22px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 14px;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--naquadah-green);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--wraith-red);
}

.toast.info {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--ancient-cyan);
}

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sentiment-bullish {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--naquadah-green);
}

.sentiment-bearish {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--wraith-red);
}

.sentiment-neutral {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--ori-orange);
}

.analysis-summary {
    padding: 18px;
    background: var(--bg-space);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.recommendation-card {
    background: var(--bg-space);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.recommendation-card:hover {
    border-color: var(--border-glow);
}

.recommendation-card .rec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.recommendation-card .rec-symbol {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--ancient-cyan);
}

.recommendation-card .rec-action {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.rec-action.buy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--naquadah-green);
}

.rec-action.sell {
    background: rgba(239, 68, 68, 0.15);
    color: var(--wraith-red);
}

.rec-action.hold {
    background: rgba(245, 158, 11, 0.15);
    color: var(--ori-orange);
}

.recommendation-card .rec-reasoning {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.strength-bar {
    height: 4px;
    background: var(--bg-deep);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.strength-bar .fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--ancient-blue), var(--ancient-cyan));
    transition: width 0.5s ease;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

.badge-active { background: rgba(34,197,94,0.15); color: var(--naquadah-green); border-color: rgba(34,197,94,0.3); }
.badge-standby { background: rgba(0,212,255,0.1); color: var(--ancient-cyan); border-color: rgba(0,212,255,0.2); }

.btn-gold { background: linear-gradient(135deg, rgba(200,168,78,0.2), rgba(232,184,73,0.1)); border: 1px solid rgba(200,168,78,0.4); color: var(--ancient-gold); }
.btn-gold:hover { background: linear-gradient(135deg, rgba(200,168,78,0.3), rgba(232,184,73,0.2)); border-color: rgba(200,168,78,0.6); }
.btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--wraith-red); }
.btn-danger:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.5); }
.btn-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--naquadah-green); }
.btn-success:hover { background: rgba(34,197,94,0.2); border-color: rgba(34,197,94,0.5); }

.recommendation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.3s;
}
.recommendation-card:hover { border-color: var(--border-glow); }
.rec-header { display: flex; justify-content: space-between; align-items: flex-start; }
.rec-symbol { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text-primary); letter-spacing: 1px; }
.rec-action { font-family: var(--font-display); font-size: 9px; padding: 4px 10px; border-radius: 4px; letter-spacing: 1px; font-weight: 600; }
.rec-action.buy { background: rgba(34,197,94,0.15); color: var(--naquadah-green); }
.rec-action.sell { background: rgba(239,68,68,0.15); color: var(--wraith-red); }
.rec-action.hold { background: rgba(0,212,255,0.1); color: var(--ancient-cyan); }

.exchange-form .form-group { margin-bottom: 12px; }

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0,212,255,0.15); }
    50% { box-shadow: 0 0 30px rgba(0,212,255,0.3); }
}

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

@media (max-width: 768px) {
    .sidebar {
        width: 72px;
    }
    .sidebar .logo-text,
    .sidebar .nav-item span,
    .sidebar .engine-status,
    .sidebar .sidebar-footer {
        display: none;
    }
    .sidebar .nav-item {
        justify-content: center;
        padding: 14px;
    }
    .sidebar-header {
        justify-content: center;
    }
    .main-content {
        margin-left: 72px;
        padding: 20px;
    }
    .hud-grid { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
}

.pe-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}
.pe-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.pe-progress-text {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 11px;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    background: transparent;
    border: 1px solid var(--border-glow);
    color: var(--ancient-cyan);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-sm:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--border-active);
}
