/* =========================================================
   SMC Futures Bot — Design System
   Palette grounded in a real trading terminal: a deep slate
   (not pure black) base, with candle-chart colors (long/short)
   as the only accent — not a generic near-black+neon or
   cream+terracotta theme.
   ========================================================= */

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

:root {
    --bg: #0A0F1C;
    --bg-soft: #0D1424;
    --surface: #121A2C;
    --surface-2: #17203A;
    --border: #23304A;
    --border-soft: #1A2438;

    --text: #E8ECF4;
    --text-muted: #8B97AE;
    --text-faint: #5C6883;

    --long: #2FD489;      /* bullish / success / profit */
    --long-dim: #1B7A50;
    --short: #FB6A6A;     /* bearish / danger / loss */
    --short-dim: #9A3A3A;
    --brand: #4EA8FF;     /* primary actions / links */
    --brand-dim: #1E5A99;
    --warn: #F5B84C;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 18px;

    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

    --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.55);
    --nav-h: 60px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(78,168,255,0.08), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(47,212,137,0.06), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0 0 12px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.page-title { margin-bottom: 20px; }

.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.small-text { font-size: 0.82rem; }
.divider { border: none; border-top: 1px solid var(--border-soft); margin: 22px 0; }
.section-title { color: var(--text); font-size: 0.95rem; margin-bottom: 14px; }

/* ---------- Focus & motion ---------- */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ================= NAVBAR ================= */
.navbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--nav-h);
    display: flex; align-items: center;
    background: rgba(10,15,28,0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
}
.nav-flex { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.logo {
    font-weight: 800; font-size: 1.05rem; color: var(--text);
    display: flex; align-items: center; gap: 8px;
    letter-spacing: -0.01em;
}
.logo::before {
    content: ''; width: 9px; height: 9px; border-radius: 50%;
    background: var(--long);
    box-shadow: 0 0 0 3px rgba(47,212,137,0.18);
}
.logo:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
    color: var(--text-muted); font-weight: 500; font-size: 0.9rem;
    padding: 9px 12px; border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--surface-2); }

.nav-toggle {
    display: none;
    background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); width: 40px; height: 40px; cursor: pointer;
    align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
    display: block; width: 18px; height: 2px; background: var(--text); position: relative; transition: 0.2s;
}
.nav-toggle span::before, .nav-toggle span::after { content: ''; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

/* ================= LAYOUT / CARDS ================= */
main.container { padding-top: 26px; padding-bottom: 60px; min-height: calc(100vh - var(--nav-h) - 60px); }

.card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }

.card.stat { padding: 18px 20px; }
.label { color: var(--text-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; margin-top: 6px; letter-spacing: -0.01em; }
.value.green { color: var(--long); }
.value.red { color: var(--short); }

/* ================= BADGES ================= */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
    padding: 4px 9px; border-radius: 999px; text-transform: uppercase;
    font-family: var(--font-mono);
}
.badge-success { background: rgba(47,212,137,0.14); color: var(--long); border: 1px solid rgba(47,212,137,0.3); }
.badge-danger  { background: rgba(251,106,106,0.14); color: var(--short); border: 1px solid rgba(251,106,106,0.3); }
.badge-warning { background: rgba(245,184,76,0.14); color: var(--warn); border: 1px solid rgba(245,184,76,0.3); }
.badge-info    { background: rgba(78,168,255,0.14); color: var(--brand); border: 1px solid rgba(78,168,255,0.3); }

/* ================= FORMS ================= */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.form-group .hint { display: block; margin-top: 6px; color: var(--text-faint); font-size: 0.78rem; line-height: 1.45; }

input[type="text"], input[type="tel"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(78,168,255,0.15);
    outline: none;
}
input::placeholder { color: var(--text-faint); }

.switch-row {
    display: flex !important; align-items: center; gap: 10px;
    cursor: pointer; padding: 12px 14px; background: var(--bg-soft);
    border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.switch-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, border-color 0.15s;
    text-decoration: none !important;
}
.btn:hover { background: #1D2740; border-color: #2C3A57; }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 0.78rem; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #04101F; }
.btn-primary:hover { background: #6DB6FF; }
.btn-success { background: var(--long); border-color: var(--long); color: #042A1B; }
.btn-success:hover { background: #4FE0A2; }
.btn-danger { background: transparent; border-color: rgba(251,106,106,0.4); color: var(--short); }
.btn-danger:hover { background: rgba(251,106,106,0.12); }

.inline-form { display: inline-block; margin: 2px 4px 2px 0; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 4px; }

/* ================= ALERTS / FLASH ================= */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.88rem; border: 1px solid transparent; }
.alert-success { background: rgba(47,212,137,0.1); border-color: rgba(47,212,137,0.28); color: #8FF0C4; }
.alert-danger { background: rgba(251,106,106,0.1); border-color: rgba(251,106,106,0.28); color: #FFB3B3; }

/* ================= TABLES ================= */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; min-width: 560px; }
th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); font-family: var(--font-mono); white-space: nowrap; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ================= AUTH PAGES ================= */
.auth-wrap { display: flex; justify-content: center; align-items: flex-start; padding-top: 30px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-icon { font-size: 1.8rem; margin-bottom: 6px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--text-muted); font-size: 0.86rem; }

/* ================= LIVE STATUS TICKER (signature element) =================
   A scrolling scan-log strip, evoking a real exchange ticker tape —
   the one place this app spends its "visual budget". */
.ticker-card { border-color: rgba(78,168,255,0.25); }
.ticker-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.ticker-msg { font-size: 1.05rem; font-weight: 600; color: var(--brand); font-family: var(--font-mono); }
.ticker-time { color: var(--text-faint); font-size: 0.78rem; margin-top: 4px; }
.pulse-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--long); margin-right: 6px;
    box-shadow: 0 0 0 0 rgba(47,212,137,0.5);
    animation: pulse 1.8s infinite;
}
.pulse-dot.off { background: var(--short); animation: none; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(47,212,137,0.45); }
    70% { box-shadow: 0 0 0 8px rgba(47,212,137,0); }
    100% { box-shadow: 0 0 0 0 rgba(47,212,137,0); }
}

/* ================= FOOTER ================= */
.footer { border-top: 1px solid var(--border-soft); padding: 22px 0; color: var(--text-faint); font-size: 0.8rem; }

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .container { padding: 0 14px; }
    main.container { padding-top: 18px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .card { padding: 16px; border-radius: var(--radius-sm); }
    h1 { font-size: 1.3rem; }
    .value { font-size: 1.25rem; }

    .nav-toggle { display: flex; }
    .nav-links {
        position: fixed; top: var(--nav-h); left: 0; right: 0;
        flex-direction: column; align-items: stretch;
        background: var(--bg-soft);
        border-bottom: 1px solid var(--border-soft);
        padding: 8px 14px 16px;
        transform: translateY(-8px);
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity 0.18s, transform 0.18s;
        gap: 2px;
    }
    .nav-links.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
    .nav-links a { padding: 12px 10px; border-bottom: 1px solid var(--border-soft); border-radius: 0; }
    .nav-links a:last-child { border-bottom: none; }

    .btn-block-mobile-stack .btn { width: 100%; margin: 4px 0; }
}

/* ===== Extra professional polish (v4) ===== */
.page-header { margin-bottom: 28px; }
.page-header h1 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header .text-muted { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

.wallet-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
}
.wallet-box .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.wallet-box .value { font-size: 1rem; word-break: break-all; margin-top: 4px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(47,212,137,0.15); color: var(--long); }
.badge-warn { background: rgba(245,184,76,0.15); color: var(--warn); }
.badge-danger { background: rgba(251,106,106,0.15); color: var(--short); }

.btn-block { width: 100%; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }

.brand-mark { color: var(--brand); margin-right: 4px; }
.nav-logout { color: var(--short) !important; }
.main-content { padding-top: 28px; padding-bottom: 48px; min-height: 70vh; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-size: 0.95rem;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(78,168,255,0.15);
}

.alert { padding: 14px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 0.9rem; }
.alert-success { background: rgba(47,212,137,0.12); border: 1px solid rgba(47,212,137,0.25); color: #a7f3d0; }
.alert-danger { background: rgba(251,106,106,0.12); border: 1px solid rgba(251,106,106,0.25); color: #fecaca; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; padding: 10px 12px; color: var(--text-faint); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,0.02); }

.card-title { margin: 0 0 16px; font-size: 1.05rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* Pro dashboard */
.pos-health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .pos-health-grid { grid-template-columns: 1fr; } }
.pos-health-card {
  background: #0b1220; border: 1px solid #1e293b; border-radius: 12px; padding: 12px 14px;
}
.pos-health-card .ph-sym { font-weight: 600; color: #e2e8f0; }
.pos-health-card .ph-upnl { font-size: 1.25rem; font-weight: 700; margin: 6px 0; }
.pos-health-card .ph-meta { font-size: 11px; color: #64748b; line-height: 1.45; }
.heat-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.heat-bar { height: 8px; border-radius: 4px; background: #4EA8FF; min-width: 4px; }
.skel { background: linear-gradient(90deg,#111827 25%,#1e293b 50%,#111827 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 18px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
