/* LEO ETF — lightweight fintech theme (no heavy animations) */
:root {
    --bg: #070b14;
    --surface: #0f1623;
    --surface-2: #151d2e;
    --border: rgba(148, 163, 184, 0.12);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
    --accent: #6366f1;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(99, 102, 241, 0.08), transparent);
    color: var(--text);
    min-height: 100vh;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.text-main { color: var(--text); }
.text-muted { color: var(--muted); }
.border-theme { border-color: var(--border); }

.panel, .stat-pill, .snapshot-card {
    color: var(--text);
}

.form-input,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px;
}

.form-input::placeholder,
input::placeholder { color: var(--muted); }

/* Fix browser autofill white flash */
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
    -webkit-text-fill-color: var(--text) !important;
}

.code-block {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.snapshot-return { color: var(--text); }
.stat-pill p { color: inherit; }
.stat-pill .font-semibold { color: var(--text); }

#publicResult,
#performanceResult {
    color: var(--text);
}

.alert {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.gradient-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border-bottom: 1px solid var(--border);
}

.gradient-text {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.glass-effect {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.nav-card {
    background: linear-gradient(145deg, #1e3a5f 0%, #1e40af 50%, #312e81 100%);
    border: 1px solid rgba(96, 165, 250, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.2);
}

.hero-nav-card {
    text-align: center;
}

.hero-nav-label {
    letter-spacing: 0.12em;
}

.hero-nav-price {
    letter-spacing: -0.02em;
}

.hero-nav-footer {
    margin-top: 0.25rem;
}

.hero-nav-updated {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: rgba(219, 234, 254, 0.92);
}

.hero-nav-clock-icon {
    font-size: 1.125rem;
    color: rgba(191, 219, 254, 0.75);
    flex-shrink: 0;
}

.hero-nav-time-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    text-align: left;
}

.hero-nav-date {
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: rgba(219, 234, 254, 0.85);
}

.hero-nav-clock {
    font-size: 1.125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.hero-change-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 1.75rem;
}

.hero-change-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(191, 219, 254, 0.65);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.hero-change-badge {
    font-size: 1.125rem;
    font-weight: 600;
}

.hero-change-row:has(.hero-change-badge:empty) {
    display: none;
}

.stat-pill {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    transition: border-color 0.15s;
}

.stat-pill:hover { border-color: rgba(59, 130, 246, 0.35); }

.badge-up { color: var(--green); background: rgba(34, 197, 94, 0.12); }
.badge-down { color: var(--red); background: rgba(239, 68, 68, 0.12); }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.nav-link { transition: background 0.15s, color 0.15s; border-radius: 8px; }
.nav-link:hover { background: rgba(59, 130, 246, 0.2); color: #fff; }
.nav-link.active { background: rgba(59, 130, 246, 0.35); color: #fff; }

.display-select {
    max-width: 7.5rem;
    background: rgba(15, 23, 42, 0.65);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
}
.display-select-currency {
    max-width: 11rem;
}
.theme-light .display-select {
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    border-color: #cbd5e1;
}

.login-btn {
    background: var(--blue);
    color: #fff;
    border-radius: 10px;
    transition: transform 0.15s, background 0.15s;
}
.login-btn:hover { background: #2563eb; transform: translateY(-1px); }

.period-btn, .nav-btn, .portfolio-btn, .chart-btn {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 44px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.15s;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
}
.period-btn:hover, .nav-btn:hover { border-color: var(--green); color: #fff; }
.period-btn.active, .nav-btn.active {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--green);
    color: var(--green);
}

.period-segment {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
}
.period-segment .period-btn {
    border: none;
    background: transparent;
    border-radius: 7px;
    min-width: 2.75rem;
}
.period-segment .period-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: none;
}
.period-segment .period-btn:hover {
    color: #fff;
    border: none;
}

.chart-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    display: inline-flex;
    gap: 2px;
}
.chart-toggle button {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
}
.chart-toggle button.active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.chart-box {
    position: relative;
    height: 380px;
    min-height: 320px;
    width: 100%;
}

.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 22, 35, 0.9);
    z-index: 2;
}
.chart-loading.hidden { display: none; }

.chart-box.tall { height: 480px; }

.benchmark-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.benchmark-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.benchmark-legend i {
    width: 10px; height: 10px; border-radius: 2px; display: inline-block;
}

.leaderboard { display: flex; flex-direction: column; gap: 0.35rem; }
.leaderboard-row {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}
.leaderboard-row.is-leo {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.06);
}
.leaderboard-row.is-port {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.06);
}
.lb-rank { text-align: center; color: var(--muted); font-weight: 600; }
.lb-name { color: var(--text); }
.lb-name strong { margin-right: 0.35rem; }
.lb-cat {
    margin-left: 0.5rem;
    font-size: 0.7rem;
    color: var(--muted);
    background: rgba(148, 163, 184, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.lb-return { text-align: right; min-width: 4.5rem; }
.lb-price { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }

.snapshot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}
@media (min-width: 768px) {
    .snapshot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.snapshot-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
}
.snapshot-card.is-leo {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.06);
}
.snapshot-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.snapshot-name { font-size: 0.75rem; color: var(--muted); margin: 0.15rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snapshot-return { font-size: 1.1rem; font-weight: 700; margin-top: 0.25rem; }
.snapshot-price { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }

/* Light theme */
body.theme-light {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: rgba(15, 23, 42, 0.1);
    --text: #0f172a;
    --muted: #64748b;
}
body.theme-light .gradient-bg { background: linear-gradient(135deg, #e2e8f0, #f1f5f9); }
body.theme-light .nav-card { color: #fff; }

.input-dark {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
}

.demo-banner {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #93c5fd;
}

.transaction-buy {
    border-left: 3px solid var(--green);
    background: rgba(34, 197, 94, 0.06);
}
.transaction-sell {
    border-left: 3px solid var(--red);
    background: rgba(239, 68, 68, 0.06);
}

footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flex-wrap { scrollbar-width: none; }
.flex-wrap::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .nav-menu.active {
        display: flex; flex-direction: column;
        position: absolute; top: 4rem; left: 0; right: 0;
        background: #0f172a; padding: 1rem; z-index: 50;
        border-bottom: 1px solid var(--border);
    }
    .chart-box { height: 280px; }
}

/* Symbol picker (TradingView-style) */
.symbol-picker-wrap { position: relative; }
.symbol-category-tabs {
    display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem;
}
.symbol-category-tabs button {
    font-size: 0.75rem; padding: 0.35rem 0.75rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
    cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.symbol-category-tabs button.active,
.symbol-category-tabs button:hover {
    border-color: rgba(34, 197, 94, 0.45); color: var(--text);
}
.symbol-search-input {
    width: 100%; padding: 0.65rem 0.85rem 0.65rem 2.25rem;
    font-size: 0.95rem;
}
.symbol-search-icon {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); pointer-events: none;
}
.symbol-dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
    max-height: 280px; overflow-y: auto;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.symbol-dropdown.hidden { display: none; }
.symbol-dropdown-item {
    display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 0.5rem;
    width: 100%; text-align: left; padding: 0.55rem 0.75rem;
    border: none; background: transparent; color: var(--text);
    cursor: pointer; border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.symbol-dropdown-item:last-child { border-bottom: none; }
.symbol-dropdown-item:hover,
.symbol-dropdown-item.active { background: rgba(59, 130, 246, 0.12); }
.symbol-dropdown-sym { font-weight: 700; }
.symbol-dropdown-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symbol-dropdown-cat {
    font-size: 0.65rem; text-transform: uppercase; color: var(--muted);
    padding: 0.15rem 0.4rem; border: 1px solid var(--border); border-radius: 4px;
}
.symbol-dropdown-empty { padding: 1rem; color: var(--muted); font-size: 0.875rem; }
.symbol-selected {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 0.75rem; padding: 0.65rem 0.85rem;
    background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 8px; font-size: 0.875rem;
}
.btn-remove-asset {
    font-size: 0.7rem; padding: 0.25rem 0.55rem; border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5;
    background: rgba(239, 68, 68, 0.08); cursor: pointer;
}
.btn-remove-asset:hover { background: rgba(239, 68, 68, 0.18); color: #fecaca; }
