/* ============================================================
   PropFlow Trading Platform — Master Stylesheet
   Dark navy / gold — trading terminal aesthetic
   ============================================================ */

:root {
    --navy-deep:   #080C14;
    --navy-dark:   #0D1526;
    --navy-mid:    #131E35;
    --navy-light:  #1C2D4A;
    --navy-border: #243550;
    --gold:        #C8A86B;
    --gold-light:  #E0C88A;
    --gold-dim:    #8A7248;
    --green:       #00C48C;
    --green-dim:   #007A59;
    --red:         #FF4D6A;
    --red-dim:     #A0203A;
    --blue-accent: #3B82F6;
    --text-primary:   #E8EDF5;
    --text-secondary: #8899BB;
    --text-muted:     #4A5E80;
    --font-display: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
    --transition: 0.18s ease;
}

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

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

body {
    font-family: var(--font-display);
    background: var(--navy-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

/* ── Typography ── */
h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

.text-gold   { color: var(--gold); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono   { font-family: var(--font-mono); }

/* ── Auth Pages ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-deep);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200,168,107,0.06) 0%, transparent 70%);
    padding: 2rem;
}

.auth-card {
    background: var(--navy-dark);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-card);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.auth-logo-mark {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy-deep);
}

.auth-logo-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.auth-logo-name span { color: var(--gold); }

/* ── Sidebar Navigation ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: var(--navy-dark);
    border-right: 1px solid var(--navy-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--navy-deep);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-text span { color: var(--gold); }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem 0.3rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 2px solid transparent;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(200,168,107,0.06);
}

.nav-item.active {
    color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(200,168,107,0.08);
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--navy-border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--navy-mid);
    border: 1px solid var(--navy-border);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--navy-deep);
    flex-shrink: 0;
}

.user-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* ── Main Content Layout ── */
.main-wrapper {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 56px;
    background: var(--navy-dark);
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.content-area { padding: 1.5rem; flex: 1; }

/* ── Cards ── */
.card {
    background: var(--navy-dark);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

/* ── Stat Cards ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--navy-dark);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), transparent);
}

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

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

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.4rem;
    font-family: var(--font-mono);
}

/* ── Tables ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.825rem;
}

.data-table th {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.6rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--navy-border);
    background: var(--navy-mid);
    white-space: nowrap;
}

.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(36,53,80,0.5);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:hover { background: rgba(200,168,107,0.03); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table td.font-mono { font-family: var(--font-mono); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-green  { background: rgba(0,196,140,0.12); color: var(--green); border: 1px solid rgba(0,196,140,0.2); }
.badge-red    { background: rgba(255,77,106,0.12); color: var(--red);   border: 1px solid rgba(255,77,106,0.2); }
.badge-gold   { background: rgba(200,168,107,0.12); color: var(--gold); border: 1px solid rgba(200,168,107,0.2); }
.badge-blue   { background: rgba(59,130,246,0.12); color: var(--blue-accent); border: 1px solid rgba(59,130,246,0.2); }
.badge-muted  { background: rgba(74,94,128,0.15); color: var(--text-muted); border: 1px solid rgba(74,94,128,0.2); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.825rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gold);
    color: var(--navy-deep);
    border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-light); color: var(--navy-deep); }

.btn-buy {
    background: rgba(0,196,140,0.12);
    color: var(--green);
    border-color: rgba(0,196,140,0.3);
}
.btn-buy:hover { background: var(--green); color: var(--navy-deep); }

.btn-sell {
    background: rgba(255,77,106,0.12);
    color: var(--red);
    border-color: rgba(255,77,106,0.3);
}
.btn-sell:hover { background: var(--red); color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--navy-border);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-control {
    width: 100%;
    background: var(--navy-mid);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.875rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-display);
    transition: border-color var(--transition);
    outline: none;
}

.form-control:focus { border-color: var(--gold); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

.form-control.is-invalid { border-color: var(--red); }
.invalid-feedback { font-size: 0.75rem; color: var(--red); margin-top: 0.25rem; }

/* ── Progress / Drawdown bars ── */
.progress-bar-wrap {
    background: var(--navy-mid);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
    margin-top: 0.4rem;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.progress-bar-fill.fill-green { background: var(--green); }
.progress-bar-fill.fill-gold  { background: var(--gold); }
.progress-bar-fill.fill-red   { background: var(--red); }

/* ── Alert/Flash ── */
.flash-msg {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.825rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flash-success { background: rgba(0,196,140,0.1); border: 1px solid rgba(0,196,140,0.25); color: var(--green); }
.flash-error   { background: rgba(255,77,106,0.1); border: 1px solid rgba(255,77,106,0.25); color: var(--red); }
.flash-warning { background: rgba(200,168,107,0.1); border: 1px solid rgba(200,168,107,0.25); color: var(--gold); }
.flash-info    { background: rgba(59,130,246,0.1);  border: 1px solid rgba(59,130,246,0.25);  color: var(--blue-accent); }

/* ── Chart container ── */
.chart-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--navy-mid);
}

.tv-chart-wrap {
    height: 380px;
}

/* ── Account selector ── */
.account-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.account-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--navy-border);
    background: var(--navy-mid);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.account-chip:hover, .account-chip.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(200,168,107,0.08);
}

.account-chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.account-chip.active .dot { background: var(--green); }

/* ── Trade panel ── */
.trade-panel {
    background: var(--navy-dark);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
}

.symbol-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--navy-border);
}

.symbol-tab {
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    border: 1px solid var(--navy-border);
    background: var(--navy-mid);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.symbol-tab:hover, .symbol-tab.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(200,168,107,0.08);
}

/* ── Price ticker ── */
.price-ticker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--navy-border);
    background: var(--navy-mid);
}

.price-symbol { font-size: 0.85rem; font-weight: 700; font-family: var(--font-mono); }
.price-bid, .price-ask { font-size: 1.1rem; font-weight: 700; font-family: var(--font-mono); }
.price-bid { color: var(--red); }
.price-ask { color: var(--green); }
.price-spread { font-size: 0.65rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ── Challenge status ── */
.challenge-card {
    background: var(--navy-dark);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.challenge-phase {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.phase-challenge    { background: rgba(59,130,246,0.12); color: var(--blue-accent); border: 1px solid rgba(59,130,246,0.2); }
.phase-verification { background: rgba(200,168,107,0.12); color: var(--gold); border: 1px solid rgba(200,168,107,0.2); }
.phase-funded       { background: rgba(0,196,140,0.12); color: var(--green); border: 1px solid rgba(0,196,140,0.2); }
.phase-failed       { background: rgba(255,77,106,0.12); color: var(--red); border: 1px solid rgba(255,77,106,0.2); }
.phase-passed       { background: rgba(0,196,140,0.12); color: var(--green); border: 1px solid rgba(0,196,140,0.2); }

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.metric-label { font-size: 0.75rem; color: var(--text-muted); }
.metric-value { font-size: 0.85rem; font-weight: 600; font-family: var(--font-mono); }

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--navy-dark);
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    transform: translateY(16px);
    transition: transform 0.2s ease;
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--navy-mid);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--navy-border); color: var(--text-primary); }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--navy-border); display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ── Notification dot ── */
.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy-deep); }
::-webkit-scrollbar-thumb { background: var(--navy-border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
}

@media (max-width: 640px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .content-area { padding: 1rem; }
    .tv-chart-wrap { height: 260px; }
}

/* ── Utility ── */
.d-flex  { display: flex; }
.d-grid  { display: grid; }
.gap-1   { gap: 0.5rem; }
.gap-2   { gap: 1rem; }
.gap-3   { gap: 1.5rem; }
.mb-1    { margin-bottom: 0.5rem; }
.mb-2    { margin-bottom: 1rem; }
.mb-3    { margin-bottom: 1.5rem; }
.mt-auto { margin-top: auto; }
.ms-auto { margin-left: auto; }
.w-100   { width: 100%; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.overflow-hidden { overflow: hidden; }

/* ── Pnl colors ── */
.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }
.pnl-zero     { color: var(--text-muted); }
