/* ============================================
   SB Quant Strategies - Trading Dashboard
   Color palette: Dark navy + Gold accents
   Typography: Professional financial dashboard
   ============================================ */

:root {
    --bg-primary: #0b1018;
    --bg-secondary: #111827;
    --bg-card: #161e2e;
    --bg-card-hover: #1c2740;
    --bg-elevated: #243044;

    --gold-primary: #c5a44e;
    --gold-light: #d4b96a;
    --gold-dark: #9e8340;
    --gold-gradient: linear-gradient(135deg, #c5a44e 0%, #d4b96a 50%, #c5a44e 100%);

    --blue-primary: #1a3a6c;
    --blue-light: #2a5298;
    --blue-accent: #3b82f6;

    --text-primary: #e8ecf1;
    --text-secondary: #8b97a8;
    --text-muted: #5b6779;

    --positive: #22c55e;
    --positive-bg: rgba(34, 197, 94, 0.1);
    --negative: #ef4444;
    --negative-bg: rgba(239, 68, 68, 0.1);

    --border: rgba(255, 255, 255, 0.06);
    --border-gold: rgba(197, 164, 78, 0.25);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 0 20px rgba(197, 164, 78, 0.08);

    /* Font stacks - Roboto for everything, matching Myfxbook */
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-tech: 'Roboto Mono', 'SF Mono', monospace;
}

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

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
    letter-spacing: normal;
}

/* ============ HEADER ============ */
.header {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(11, 16, 24, 0.95) 100%);
    border-bottom: 1px solid var(--border-gold);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
}

.header-inner {
    max-width: 1360px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(197, 164, 78, 0.3));
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
}

.tagline {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 400;
}

.sync-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: rgba(22, 30, 46, 0.8);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--positive);
    animation: pulse 2s ease-in-out infinite;
}

.sync-dot.error {
    background: var(--negative);
}

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

/* ============ DASHBOARD ============ */
.dashboard {
    max-width: 1360px;
    margin: 0 auto;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ============ HERO STATS ============ */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-gold);
    box-shadow: var(--shadow-gold);
    transform: translateY(-1px);
}

.stat-card.hero {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.gain-icon {
    background: var(--positive-bg);
    color: var(--positive);
}

.balance-icon {
    background: rgba(197, 164, 78, 0.12);
    color: var(--gold-primary);
}

.profit-icon {
    background: rgba(59, 130, 246, 0.12);
    color: var(--blue-accent);
}

.drawdown-icon {
    background: var(--negative-bg);
    color: var(--negative);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.stat-label {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: normal;
    font-weight: 400;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 500;
    font-family: var(--font-body);
    letter-spacing: normal;
    line-height: 1.3;
    color: var(--text-primary);
}

.stat-subtitle {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: normal;
    margin-top: 2px;
}

.stat-value-sm {
    font-size: 1.25rem;
    font-weight: 500;
    font-family: var(--font-body);
    letter-spacing: normal;
    color: var(--text-primary);
}

.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* ============ SECONDARY STATS ============ */
.secondary-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.stat-card.mini {
    text-align: center;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* ============ CHARTS ============ */
.chart-row {
    display: flex;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    position: relative;
    min-height: 350px;
}

.chart-container.full-width {
    width: 100%;
    min-height: 380px;
}

.chart-container.full-width.growth {
    min-height: 420px;
}

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

.chart-header h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: normal;
}

.chart-body {
    position: relative;
    height: calc(100% - 50px);
}

.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.chart-placeholder.hidden {
    display: none;
}

/* ============ PERIOD PERFORMANCE ============ */
.section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: normal;
    margin-bottom: 16px;
}

.period-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.period-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: all 0.2s ease;
}

.period-card:hover {
    border-color: var(--border-gold);
    box-shadow: var(--shadow-gold);
}

.period-card h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gold-primary);
    margin-bottom: 14px;
    letter-spacing: normal;
}

.period-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.period-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.period-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.period-value {
    font-size: 0.85rem;
    font-weight: 400;
    font-family: var(--font-body);
    color: var(--text-primary);
}

/* ============ DETAILED STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.stats-table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: all 0.2s ease;
}

.stats-table-card:hover {
    border-color: var(--border-gold);
}

.stats-table-card h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gold-primary);
    margin-bottom: 14px;
    letter-spacing: normal;
}

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

.stats-table td {
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.stats-table td:first-child {
    font-family: var(--font-body);
    color: var(--text-muted);
    font-weight: 400;
}

.stats-table td:last-child {
    text-align: right;
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* ============ FOOTER ============ */
.footer {
    margin-top: 32px;
    padding: 28px 0;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.footer-inner {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--gold-primary);
    font-size: 0.9rem;
}

.footer-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.footer-disclaimer p {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 500px;
    font-weight: 400;
}

.footer-sync {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 400;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .secondary-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .chart-container.full-width {
        min-height: 320px;
    }
    .period-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    .header-inner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .logo-section {
        flex-direction: column;
        gap: 8px;
    }
    .logo-text {
        text-align: center;
    }
    .dashboard {
        padding: 16px 14px;
        gap: 18px;
    }
    .hero-stats {
        grid-template-columns: 1fr;
    }
    .secondary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .period-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stat-value {
        font-size: 1.3rem;
    }
    .stat-value-sm {
        font-size: 1.05rem;
    }
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
    .chart-container {
        min-height: 280px;
    }
}

@media (max-width: 480px) {
    .secondary-stats {
        grid-template-columns: 1fr 1fr;
    }
    .stat-card.hero {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card, .chart-container, .period-card, .stats-table-card {
    animation: fadeIn 0.4s ease forwards;
}

.hero-stats .stat-card:nth-child(1) { animation-delay: 0.05s; }
.hero-stats .stat-card:nth-child(2) { animation-delay: 0.1s; }
.hero-stats .stat-card:nth-child(3) { animation-delay: 0.15s; }
.hero-stats .stat-card:nth-child(4) { animation-delay: 0.2s; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
