/* ===================================================
   Seasonality Analyzer — Seasonax-Style Light Theme
   Replicates the exact Seasonax.com interface
   =================================================== */

:root {
    /* Teal accent (Seasonax brand color) */
    --teal: #00b4b6;
    --teal-dark: #009a9c;
    --teal-light: #e0f7f7;
    --teal-bg: rgba(0, 180, 182, 0.08);
    --teal-fill: rgba(0, 180, 182, 0.12);

    /* Positive / Negative */
    --gain: #00b4b6;
    --loss: #e74c3c;
    --gain-bg: rgba(0, 180, 182, 0.1);
    --loss-bg: rgba(231, 76, 60, 0.1);

    /* Neutrals */
    --bg-page: #f5f6f8;
    --bg-white: #ffffff;
    --bg-hover: #f0f1f3;
    --bg-sidebar: #f9fafb;

    /* Borders */
    --border: #e5e7eb;
    --border-light: #f0f0f0;

    /* Text */
    --text-dark: #1a1f36;
    --text-mid: #4a5568;
    --text-light: #9ca3af;
    --text-muted: #b0b8c4;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* Radius */
    --radius: 6px;
    --radius-lg: 10px;
}

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

html {
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.hidden {
    display: none !important;
}

/* ─── Top Navigation ─── */
#topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 46px;
    padding: 0 16px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.brand-accent {
    color: var(--teal);
}

.nav-links {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}

.nav-link {
    font-size: 0.92rem;
    color: var(--text-mid);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.nav-icon-group {
    display: flex;
    gap: 4px;
}

.nav-icon-btn {
    font-size: 0.85rem;
    color: var(--text-mid);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.nav-icon-btn:hover {
    background: var(--bg-hover);
}

.nav-icon-btn.active {
    background: var(--teal-light);
    color: var(--teal-dark);
    border-color: var(--teal);
}

/* ─── Ticker Info Bar ─── */
#ticker-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.ticker-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ticker-company-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
}

.ticker-symbol {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--teal);
    background: var(--teal-light);
    padding: 2px 8px;
    border-radius: 3px;
}

.ticker-tag {
    font-size: 0.72rem;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.ticker-search-wrapper {
    position: relative;
    flex: 1;
    max-width: 300px;
    min-width: 180px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#ticker-input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--bg-white);
}

#ticker-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0, 180, 182, 0.12);
}

.ticker-info-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

#years-select {
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-dark);
    background: var(--bg-white);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

#years-select:focus {
    border-color: var(--teal);
}

.more-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-mid);
    cursor: pointer;
    transition: background 0.15s;
}

.more-btn:hover {
    background: var(--bg-hover);
}

.analyze-btn {
    padding: 7px 22px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.analyze-btn:hover {
    background: var(--teal-dark);
    transform: translateY(-1px);
}

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

/* ─── Toolbar ─── */
#toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    min-height: 36px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn-group {
    display: flex;
    gap: 2px;
}

.toolbar-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--text-mid);
    cursor: pointer;
    transition: background 0.15s;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
}

.toolbar-btn.icon-btn {
    padding: 4px 8px;
    font-size: 1rem;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
}

.toolbar-selection-period {
    font-size: 0.8rem;
    color: var(--teal);
    font-weight: 600;
    padding: 3px 10px;
    background: var(--teal-light);
    border-radius: var(--radius);
}

/* ─── Main Content Layout ─── */
#main-content {
    display: grid;
    grid-template-columns: 1fr 310px;
    gap: 0;
    min-height: calc(100vh - 130px);
}

/* ─── Charts Area ─── */
#charts-area {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-panel {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 0;
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.chart-subtitle {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark);
}

.info-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.info-icon:hover {
    background: var(--bg-hover);
}

.chart-container {
    position: relative;
    padding: 8px 12px 12px;
}

.main-chart-panel .chart-container {
    height: 340px;
}

.small-chart {
    height: 180px;
}

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

.placeholder-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 5;
}

.placeholder-overlay p {
    font-size: 0.95rem;
    color: var(--text-light);
}

.placeholder-overlay strong {
    color: var(--teal);
}

.bottom-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ─── Stats Sidebar ─── */
#stats-sidebar {
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 130px);
}

.selection-indicator {
    display: flex;
    justify-content: center;
    padding: 10px 16px 4px;
}

.selection-month-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.month-badge {
    display: inline-block;
    padding: 4px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

.month-badge.start {
    background: var(--teal);
}

.month-badge.end {
    background: var(--teal);
}

.month-arrow {
    color: var(--text-light);
    font-size: 1rem;
}

/* Donut section */
.donut-section {
    text-align: center;
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.donut-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.donut-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.78rem;
    color: var(--text-mid);
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.dot.pattern {
    background: var(--teal);
}

.dot.rest {
    background: #d1d5db;
}

.hero-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.hero-stat {
    text-align: center;
}

.hero-value {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.hero-value.teal {
    color: var(--teal);
}

.hero-label {
    font-size: 0.7rem;
    color: var(--teal);
    font-weight: 500;
    margin-top: 2px;
}

/* Stats sections */
.stats-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.stats-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
    text-align: center;
}

.stat-col-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    padding-bottom: 6px;
}

.stats-grid {
    display: grid;
    gap: 6px;
}

.stats-grid.two-col {
    grid-template-columns: 1fr 1fr;
}

.stats-grid.header-grid {
    margin-bottom: 4px;
}

.stat-item {
    text-align: center;
    padding: 6px 4px;
}

.stat-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

.stat-val.teal {
    color: var(--teal);
}

.stat-val.gain-color {
    color: var(--gain);
}

.stat-val.loss-color {
    color: var(--loss);
}

.stat-lbl {
    font-size: 0.68rem;
    color: var(--teal);
    font-weight: 500;
    margin-top: 1px;
}

/* Kelly Criterion */
.stats-grid.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.kelly-treasury-label {
    font-size: 0.72rem;
    color: var(--text-mid);
    text-align: center;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(0, 180, 182, 0.06);
    border-radius: var(--radius);
    border: 1px solid rgba(0, 180, 182, 0.15);
}

.kelly-treasury-label span {
    font-weight: 700;
    color: var(--teal);
}

.kelly-val {
    font-size: 1rem !important;
}

.kelly-rf-detail {
    font-size: 0.65rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 6px;
    opacity: 0.7;
}

.kelly-rf-detail span {
    font-weight: 600;
    color: var(--text-mid);
}

/* ─── Loading Overlay ─── */
#loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    z-index: 500;
    font-size: 0.9rem;
    color: var(--text-mid);
    font-weight: 500;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Toast ─── */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    padding: 10px 18px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.25s ease, fadeOut 0.3s ease 3.5s forwards;
}

.toast.error {
    border-left: 3px solid var(--loss);
}

.toast.success {
    border-left: 3px solid var(--gain);
}

@keyframes slideIn {
    from {
        transform: translateX(80px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ─── Long/Short Toggle ─── */
.long-short-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-left: auto;
    margin-right: 8px;
}

.ls-btn {
    padding: 3px 12px;
    border: none;
    background: var(--bg-white);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
}

.ls-btn:first-child {
    border-right: 1px solid var(--border);
}

.ls-btn.active {
    background: var(--teal);
    color: white;
}

.ls-btn:not(.active):hover {
    background: var(--bg-hover);
    color: var(--text-mid);
}

/* ─── GA Optimizer Section ─── */
#ga-section {
    margin: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.ga-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--teal-light) 100%);
}

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

.ga-header-right {
    flex-shrink: 0;
}

.ga-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-dark);
}

.ga-subtitle {
    font-size: 0.8rem;
    color: var(--text-mid);
    font-weight: 400;
}

.ga-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-mid);
    font-size: 0.9rem;
}


/* ─── GA Settings Panel ─── */
.ga-settings-panel {
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
    padding: 16px 20px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ga-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.ga-setting-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ga-setting-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ga-setting-item input[type="number"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--bg-white);
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.ga-setting-item input[type="number"]:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(0,180,182,0.12);
}

.ga-setting-hint {
    font-size: 0.67rem;
    color: var(--text-light);
    line-height: 1.3;
}

.ga-settings-footer {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.ga-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
/* GA Content Grid */
.ga-content-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0;
    min-height: 400px;
}

/* GA Table */
.ga-table-wrapper {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.ga-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.ga-selected-count {
    font-size: 0.78rem;
    color: var(--teal);
    font-weight: 600;
    background: var(--teal-light);
    padding: 2px 10px;
    border-radius: 10px;
}

.ga-table-scroll {
    overflow-y: auto;
    max-height: 340px;
    flex: 1;
}

#ga-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

#ga-results-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

#ga-results-table th {
    padding: 8px 8px;
    background: var(--bg-page);
    color: var(--text-mid);
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#ga-results-table .th-check {
    width: 32px;
    text-align: center;
}

#ga-results-table .th-rank {
    width: 30px;
    text-align: center;
}

#ga-results-table .th-dir {
    width: 50px;
    text-align: center;
}

#ga-results-table .th-days {
    width: 90px;
    text-align: center;
}

#ga-results-table .th-num {
    text-align: right;
    width: 80px;
}

#ga-results-table .th-pattern {
    min-width: 160px;
}

#ga-results-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

#ga-results-table tbody tr {
    transition: background 0.1s;
    cursor: pointer;
}

#ga-results-table tbody tr:hover {
    background: var(--teal-bg);
}

#ga-results-table tbody tr.selected {
    background: var(--teal-light);
}

#ga-results-table td.td-check {
    text-align: center;
}

#ga-results-table td.td-rank {
    text-align: center;
    font-weight: 700;
    color: var(--text-light);
}

#ga-results-table td.td-num {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#ga-results-table td.td-num.positive {
    color: var(--gain);
}

#ga-results-table td.td-num.negative {
    color: var(--loss);
}

/* Pattern badges in table */
.pattern-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 1px 2px;
    white-space: nowrap;
}

.pattern-badge.long {
    background: var(--gain-bg);
    color: var(--gain);
    border: 1px solid rgba(0, 180, 182, 0.25);
}

.pattern-badge.short {
    background: var(--loss-bg);
    color: var(--loss);
    border: 1px solid rgba(231, 76, 60, 0.25);
}

.pattern-dir-icon {
    font-size: 0.7rem;
}

/* GA Table Actions */
.ga-table-actions {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* GA Equity Panel */
.ga-equity-panel {
    display: flex;
    flex-direction: column;
}

.ga-equity-panel .chart-panel {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
}

/* GA Combined Stats */
.ga-combined-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--border);
}

.ga-stat-card {
    text-align: center;
    padding: 12px 8px;
    border-right: 1px solid var(--border);
}

.ga-stat-card:last-child {
    border-right: none;
}

.ga-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

.ga-stat-val.teal {
    color: var(--teal);
}

.ga-stat-lbl {
    font-size: 0.68rem;
    color: var(--text-light);
    font-weight: 500;
    margin-top: 2px;
}

/* GA Combined Patterns */
.ga-combined-patterns {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
    flex: 1;
}

.ga-combined-patterns .pattern-badge {
    font-size: 0.78rem;
    padding: 4px 10px;
}

/* ─── Responsive ─── */
@media (max-width: 1000px) {
    #main-content {
        grid-template-columns: 1fr;
    }

    #stats-sidebar {
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .bottom-charts-row {
        grid-template-columns: 1fr;
    }

    .ga-content-grid {
        grid-template-columns: 1fr;
    }

    .ga-table-wrapper {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .ga-combined-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .nav-links {
        display: none;
    }

    .nav-icon-group {
        display: none;
    }

    .ticker-info-left {
        flex-wrap: wrap;
    }

    .ticker-search-wrapper {
        min-width: 120px;
    }

    .ga-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/*  Popular Instruments Dropdown  */
.nav-dropdown {
    position: relative;
}

.dropdown-trigger {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: #1e2230;
    border: 1px solid #2d3348;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 200;
    padding: 4px 0;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.open {
    display: block;
}

.dropdown-header {
    padding: 8px 14px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7394;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2d3348;
    margin-bottom: 2px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: #e0e4f0;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(0, 180, 182, 0.15);
    color: #ffffff;
}

.dropdown-item:active {
    background: rgba(0, 180, 182, 0.25);
}

.flag-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.instrument-name {
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* === Walk-Forward Analysis Section === */
#wfa-section {
    margin: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.wfa-settings {
    display: flex;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
    flex-wrap: wrap;
    align-items: flex-start;
}
.wfa-setting-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
    flex: 1;
}
.wfa-setting-item label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.wfa-setting-item input[type='number'] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--bg-white);
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.wfa-setting-item input[type='number']:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(0,180,182,0.12);
}
.wfa-input-row { display: flex; align-items: center; gap: 6px; }
.wfa-input-row input[type='number'] { flex: 1; }
.wfa-unit { font-size: 0.75rem; color: var(--text-light); white-space: nowrap; font-weight: 500; }
.wfa-content-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 360px;
}
.wfa-equity-panel { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.wfa-table-panel  { display: flex; flex-direction: column; }
.wfa-summary-stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.wfa-stat-card { text-align: center; padding: 12px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.wfa-stat-card:nth-child(2n) { border-right: none; }
.wfa-stat-card:nth-last-child(-n+2) { border-bottom: none; }
#wfa-fold-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
#wfa-fold-table thead { position: sticky; top: 0; z-index: 2; }
#wfa-fold-table th { padding: 8px; background: var(--bg-page); color: var(--text-mid); font-weight: 600; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.3px; }
#wfa-fold-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
#wfa-fold-table tbody tr:hover { background: var(--teal-bg); }
.loss { color: var(--loss) !important; }

/* === Multi-Market Scanner === */
#scanner-section {
    margin: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.scanner-loading { border-bottom: 1px solid var(--border); }
.scanner-progress-wrap {
    height: 3px;
    background: var(--bg-page);
    overflow: hidden;
}
.scanner-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--teal), #38d9a9);
    transition: width 0.3s ease;
}
.scanner-table-scroll { overflow-y: auto; max-height: 700px; }
#scanner-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
#scanner-table thead { position: sticky; top: 0; z-index: 2; }
#scanner-table th { padding: 10px 8px; background: var(--bg-page); color: var(--text-mid); font-weight: 600; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.3px; }
#scanner-table td { padding: 8px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
#scanner-table tbody tr { transition: background 0.1s; }
#scanner-table tbody tr:hover { background: var(--teal-bg); }
.scanner-spark-cell { padding: 4px 8px !important; }
.scanner-spark-cell canvas { display: block; }
