/* ══════════════════════════════════════════════════════════
   NEURO-QUANT DASHBOARD — DESIGN SYSTEM
   Dark Neon + Glassmorphism + Premium Typography
   ══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #060613;
    --bg-secondary: #0c0c24;
    --bg-card: rgba(14, 14, 40, 0.7);
    --bg-card-hover: rgba(20, 20, 55, 0.85);
    --border-card: rgba(100, 100, 255, 0.08);
    --border-glow: rgba(0, 240, 255, 0.15);

    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #55557a;

    --accent-cyan: #00f0ff;
    --accent-purple: #7c3aed;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-gradient: linear-gradient(135deg, #00f0ff 0%, #7c3aed 100%);

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow-cyan: 0 0 40px rgba(0, 240, 255, 0.08);
    --shadow-glow-purple: 0 0 40px rgba(124, 58, 237, 0.08);
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

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

body::before {
    content: '';
    position: fixed;
    top: -200px; left: -200px;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -300px; right: -200px;
    width: 700px; height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.screen { display: none; }
.screen.active { display: flex; }

/* ══════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════ */

#login-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-container {
    position: relative;
    z-index: 1;
}

.login-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.06) 0%, rgba(124, 58, 237, 0.04) 50%, transparent 70%);
    border-radius: 50%;
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.login-card {
    position: relative;
    width: 400px;
    padding: 48px 40px;
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card), var(--shadow-glow-cyan);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
}

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

.login-logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.25);
}

.btn-primary:active { transform: translateY(0); }

.error-msg {
    color: var(--accent-red);
    font-size: 0.82rem;
    margin-top: 14px;
    text-align: center;
    min-height: 20px;
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════ */

#dashboard-screen {
    flex-direction: column;
    min-height: 100vh;
    padding: 0 24px 40px;
    position: relative;
    z-index: 1;
}

/* ── Header ─────────────────────────────────────────────── */

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-card);
    margin-bottom: 28px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.badge-version {
    font-size: 0.65rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    vertical-align: super;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-controls {
    display: flex;
    align-items: center;
}

.status-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid;
}

.status-badge.mode-simu {
    border-color: rgba(0, 240, 255, 0.3);
    background: rgba(0, 240, 255, 0.06);
    color: var(--accent-cyan);
}

.status-badge.mode-real {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.06);
    color: var(--accent-orange);
    animation: real-glow 2s infinite;
}

@keyframes real-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.1); }
    50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.2); }
}

.btn-primary-sm {
    padding: 6px 14px;
    background: var(--accent-orange);
    border: none;
    border-radius: var(--radius-xs);
    color: #000;
    font-weight: 700;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: dot-pulse 2s infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.btn-icon {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-glow);
}

/* ── KPI Cards ──────────────────────────────────────────── */

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

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 22px 20px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.kpi-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-cyan);
}

.kpi-card:hover::before { opacity: 1; }

.kpi-card.accent-green { border-color: rgba(34, 197, 94, 0.12); }
.kpi-card.accent-purple { border-color: rgba(124, 58, 237, 0.12); }

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ── Panels ─────────────────────────────────────────────── */

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

.panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-xs);
    padding: 3px;
}

.tab {
    padding: 5px 14px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent-cyan);
}

.tab:hover:not(.active) { color: var(--text-secondary); }

.chart-container {
    height: 280px;
    position: relative;
}

/* ── Stats Panel ─────────────────────── */

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

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
}

.stat-item:hover { background: rgba(255, 255, 255, 0.02); }

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.green { color: var(--accent-green); }
.stat-value.red { color: var(--accent-red); }
.stat-value.small { font-size: 0.78rem; }

/* ── Trade Table ──────────────────────── */

.trade-panel { margin-bottom: 20px; }

.trade-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

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

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border-card);
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    white-space: nowrap;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.trade-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.trade-type.tp {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.trade-type.sl {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Budget Control */
.budget-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-left: 10px;
}

.budget-control .label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

.budget-control input {
    background: transparent;
    border: none;
    color: var(--accent-cyan);
    font-weight: 700;
    width: 60px;
    font-size: 0.9rem;
    text-align: right;
    outline: none;
}

.budget-control .icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s;
    padding: 0;
}

.budget-control .icon-btn:hover {
    transform: scale(1.2);
}

.pnl-positive { color: var(--accent-green); font-weight: 700; font-family: var(--font-mono); }
.pnl-negative { color: var(--accent-red); font-weight: 700; font-family: var(--font-mono); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
    font-style: italic;
}

/* ── Footer ──────────────────────────── */

.dash-footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-card);
    margin-top: auto;
}

/* ── Responsive ──────────────────────── */

@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
    #dashboard-screen { padding: 0 12px 24px; }
    .login-card { width: 90vw; padding: 32px 24px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-value { font-size: 1.2rem; }
}

/* ── Animations ──────────────────────── */

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

.kpi-card { animation: fadeInUp 0.5s ease both; }
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.3s; }

.panel { animation: fadeInUp 0.6s ease 0.35s both; }
.trade-panel { animation: fadeInUp 0.6s ease 0.45s both; }
