/* ===========================================
   BIAS TRACKER PAGE - TradeRune Elite
   Pure Vanilla CSS
=========================================== */

:root {
    --bs-purp-main: #a855f7;
    --bs-purp-light: #c084fc;
    --bs-purp-glow: rgba(168, 85, 247, 0.4);
    
    --bs-white-pure: #ffffff;
    --bs-white-soft: rgba(255, 255, 255, 0.85);
    --bs-white-muted: rgba(255, 255, 255, 0.5);
    
    --bs-cyan: #06b6d4;
    --bs-green: #22c55e;
    --bs-red: #ef5350;
    --bs-gold: #fbbf24;

    /* Glassmorphism Layers */
    --bs-bg-card: rgba(255, 255, 255, 0.05);
    --bs-bg-hover: rgba(255, 255, 255, 0.08);
    --bs-border-base: rgba(255, 255, 255, 0.1);
    
    --bs-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Utilities */
.bias-text-cyan { color: var(--bs-cyan); text-shadow: 0 0 10px rgba(6,182,212,0.4); }
.bias-text-gold { color: var(--bs-gold); text-shadow: 0 0 10px rgba(251,191,36,0.4); }
.bias-muted-text { color: var(--bs-white-muted); font-size: 11px; font-weight: 500; font-family: monospace; }

/* Main Wrapper */
.bias-main-wrapper {
    margin-left: 20px;
    padding: 30px 40px;
    font-family: 'Inter', sans-serif;
    color: var(--bs-white-soft);
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Header */
.bias-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 24px;
}

.bias-subtitle {
    font-size: 11px; font-weight: 800; letter-spacing: 2px;
    color: var(--bs-purp-light); text-transform: uppercase; margin-bottom: 8px;
}
.bias-pulse-icon { animation: bsPulse 2s infinite; opacity: 0.8; }
@keyframes bsPulse { 0% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.2); opacity: 1; text-shadow: 0 0 15px var(--bs-purp-light); } 100% { transform: scale(1); opacity: 0.8; } }

.bias-header h2 {
    font-size: 42px; font-weight: 900; margin: 0; letter-spacing: -1px;
    color: var(--bs-white-pure); line-height: 1.1;
}
.bias-text-gradient {
    background: linear-gradient(90deg, var(--bs-white-pure), var(--bs-purp-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px var(--bs-purp-glow);
}
.bias-header p { margin: 8px 0 0 0; color: var(--bs-white-muted); font-family: monospace; }

/* Stats Row */
.bias-stats-row { display: flex; gap: 16px; flex-wrap: wrap; }
.bias-stat-card {
    background: var(--bs-bg-card); backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--bs-border-base); border-radius: 16px;
    padding: 20px 24px; min-width: 140px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
    transition: all 0.4s var(--bs-ease);
}
.bias-stat-card:hover { transform: translateY(-3px); background: var(--bs-bg-hover); border-color: rgba(168,85,247,0.3); }
.bias-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--bs-white-muted); margin-bottom: 8px; }
.bias-stat-val { font-size: 28px; font-weight: 800; color: var(--bs-white-pure); font-variant-numeric: tabular-nums; }

/* Form Card */
.bias-form-card {
    background: var(--bs-bg-card); backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--bs-border-base); border-radius: 24px;
    padding: 32px; box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
    transition: all 0.4s var(--bs-ease);
}
.bias-form-card:hover { border-color: rgba(168,85,247,0.2); box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 20px var(--bs-purp-glow); }

.bias-form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; border-bottom: 1px solid var(--bs-border-base); padding-bottom: 16px; }
.bias-form-header h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--bs-white-pure); letter-spacing: 1px; }

.bias-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.bias-form-col { display: flex; flex-direction: column; gap: 20px; }

.bias-input-group label { display: block; font-size: 12px; font-weight: 700; color: var(--bs-white-soft); margin-bottom: 8px; text-transform: uppercase; }
.bias-input { width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--bs-border-base); padding: 14px 16px; border-radius: 12px; color: var(--bs-white-pure); font-family: monospace; font-size: 14px; transition: all 0.3s var(--bs-ease); outline: none; }
.bias-input:focus { border-color: var(--bs-purp-light); background: rgba(0,0,0,0.5); box-shadow: 0 0 15px var(--bs-purp-glow); }
.bias-date-picker { width: 180px; padding: 8px 12px; }

.bias-direction-toggles { display: flex; gap: 8px; background: rgba(0,0,0,0.3); padding: 6px; border-radius: 12px; border: 1px solid var(--bs-border-base); }
.bias-dir-btn { flex: 1; padding: 10px; border-radius: 8px; border: none; background: transparent; color: var(--bs-white-muted); font-weight: 800; font-size: 12px; cursor: pointer; transition: all 0.3s var(--bs-ease); }
.bias-dir-btn:hover { background: rgba(255,255,255,0.05); color: var(--bs-white-pure); }
.bias-dir-btn.active[data-dir="BULLISH"], .bias-dir-btn.active[data-res="CORRECT"] { background: rgba(34,197,94,0.15); color: var(--bs-green); box-shadow: 0 0 15px rgba(34,197,94,0.3); }
.bias-dir-btn.active[data-dir="BEARISH"], .bias-dir-btn.active[data-res="WRONG"] { background: rgba(239,83,80,0.15); color: var(--bs-red); box-shadow: 0 0 15px rgba(239,83,80,0.3); }
.bias-dir-btn.active[data-dir="NEUTRAL"], .bias-dir-btn.active[data-res="PARTIAL"] { background: rgba(251,191,36,0.15); color: var(--bs-gold); box-shadow: 0 0 15px rgba(251,191,36,0.3); }

.bias-stars { display: flex; gap: 8px; font-size: 24px; color: rgba(255,255,255,0.1); cursor: pointer; }
.bias-stars i { transition: all 0.2s var(--bs-ease); }
.bias-stars i:hover, .bias-stars i.active { color: var(--bs-purp-light); filter: drop-shadow(0 0 8px var(--bs-purp-glow)); transform: scale(1.1); }

textarea.bias-input { resize: vertical; min-height: 120px; }
.bias-levels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.bias-form-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--bs-border-base); }
.bias-btn-submit { background: linear-gradient(135deg, var(--bs-purp-deep), var(--bs-purp-main)); color: var(--bs-white-pure); border: 1px solid var(--bs-purp-light); padding: 14px 32px; border-radius: 12px; font-weight: 800; font-size: 14px; letter-spacing: 1px; cursor: pointer; transition: all 0.3s var(--bs-ease); box-shadow: 0 8px 24px var(--bs-purp-glow); }
.bias-btn-submit:hover { transform: translateY(-3px); box-shadow: 0 12px 32px var(--bs-purp-glow); filter: brightness(1.1); }

kbd { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; border: 1px solid rgba(255,255,255,0.2); }

/* Sections */
.bias-section { display: flex; flex-direction: column; gap: 16px; }
.bias-section-title { margin: 0; font-size: 14px; font-weight: 800; color: var(--bs-white-pure); letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 0 15px var(--bs-purp-glow); }

/* Active Table */
.bias-active-table { background: var(--bs-bg-card); border: 1px solid var(--bs-border-base); border-radius: 16px; overflow: hidden; backdrop-filter: blur(24px); }
.bias-table-header { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 0.5fr; padding: 16px 24px; background: rgba(0,0,0,0.3); border-bottom: 1px solid var(--bs-border-base); font-size: 10px; font-weight: 800; color: var(--bs-white-muted); letter-spacing: 1px; }
.bias-table-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 0.5fr; padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.03); align-items: center; font-size: 13px; font-weight: 600; transition: background 0.3s var(--bs-ease); }
.bias-table-row:hover { background: var(--bs-bg-hover); }
.bias-table-row:last-child { border-bottom: none; }

.bias-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.bias-chip.bull { background: rgba(34,197,94,0.1); color: var(--bs-green); border: 1px solid rgba(34,197,94,0.2); }
.bias-chip.bear { background: rgba(239,83,80,0.1); color: var(--bs-red); border: 1px solid rgba(239,83,80,0.2); }
.bias-chip.neut { background: rgba(251,191,36,0.1); color: var(--bs-gold); border: 1px solid rgba(251,191,36,0.2); }

.bias-stars-mini i { color: rgba(255,255,255,0.1); font-size: 10px; margin-right: 2px; }
.bias-stars-mini i.filled { color: var(--bs-purp-light); text-shadow: 0 0 5px var(--bs-purp-glow); }

.bias-res-chip { font-size: 11px; font-weight: 800; font-family: monospace; }

.bias-icon-btn { background: transparent; border: none; color: var(--bs-white-muted); cursor: pointer; transition: 0.3s; padding: 6px; }
.bias-icon-btn:hover { color: var(--bs-white-pure); transform: scale(1.2); }
.bias-icon-btn.del:hover { color: var(--bs-red); }

/* Insights */
.bias-insights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bias-insight-card { background: var(--bs-bg-card); backdrop-filter: blur(16px); border: 1px solid var(--bs-border-base); border-left: 3px solid var(--bs-purp-main); border-radius: 16px; padding: 20px; font-size: 13px; line-height: 1.6; color: var(--bs-white-soft); transition: transform 0.3s var(--bs-ease); }
.bias-insight-card:hover { transform: translateY(-3px); background: var(--bs-bg-hover); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }

/* Analytics */
.bias-analytics { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.bias-analytics-card { background: var(--bs-bg-card); backdrop-filter: blur(16px); border: 1px solid var(--bs-border-base); border-radius: 20px; padding: 24px; }
.bias-analytics-card h4 { margin: 0 0 20px 0; font-size: 12px; color: var(--bs-white-muted); text-transform: uppercase; letter-spacing: 1px; }

.bias-svg-container { width: 100%; height: 200px; }

.bias-conviction-table { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.bias-conv-row { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); padding: 10px 16px; border-radius: 8px; font-size: 12px; font-family: monospace; }
.bias-insight-text { font-size: 12px; color: var(--bs-purp-light); font-style: italic; margin: 0; padding: 12px; background: rgba(168,85,247,0.05); border-radius: 8px; border-left: 2px solid var(--bs-purp-main); }

/* History Timeline */
.bias-history-header { display: flex; justify-content: space-between; align-items: center; }
.bias-filter-pills { display: flex; gap: 8px; background: rgba(0,0,0,0.3); padding: 4px; border-radius: 20px; border: 1px solid var(--bs-border-base); }
.bias-filter-pill { background: transparent; border: none; color: var(--bs-white-muted); padding: 6px 16px; border-radius: 16px; font-size: 11px; font-weight: 700; cursor: pointer; transition: 0.3s; }
.bias-filter-pill.active { background: rgba(168,85,247,0.2); color: var(--bs-white-pure); }

.bias-history-timeline { display: flex; flex-direction: column; gap: 16px; border-left: 2px solid var(--bs-border-base); padding-left: 24px; margin-left: 12px; }
.bias-hist-card { position: relative; background: var(--bs-bg-card); backdrop-filter: blur(16px); border: 1px solid var(--bs-border-base); border-radius: 16px; padding: 20px; cursor: pointer; transition: all 0.3s var(--bs-ease); }
.bias-hist-card::before { content: ''; position: absolute; left: -32px; top: 24px; width: 14px; height: 14px; border-radius: 50%; background: var(--bs-purp-main); border: 3px solid #020005; box-shadow: 0 0 10px var(--bs-purp-glow); }
.bias-hist-card:hover { transform: translateX(5px); background: var(--bs-bg-hover); border-color: rgba(168,85,247,0.3); }

/* Modal */
.bias-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(12px); z-index: 100000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.25s var(--bs-ease); }
.bias-modal-backdrop.show { opacity: 1; pointer-events: all; }
.bias-modal { width: 600px; max-width: 95vw; background: linear-gradient(145deg, rgba(20,15,30,0.95), rgba(10,8,15,0.98)); border: 1px solid rgba(168,85,247,0.3); border-radius: 24px; box-shadow: 0 32px 64px rgba(0,0,0,0.8), inset 0 0 30px rgba(168,85,247,0.05); display: flex; flex-direction: column; transform: scale(0.95); transition: transform 0.35s var(--bs-ease); }
.bias-modal-backdrop.show .bias-modal { transform: scale(1); }

.bias-modal-header { padding: 24px 32px; border-bottom: 1px solid var(--bs-border-base); display: flex; justify-content: space-between; align-items: center; }
.bias-modal-header h2 { margin: 0; font-size: 24px; font-weight: 900; color: #fff; }
.bias-modal-body { padding: 32px; overflow-y: auto; max-height: 60vh; }
.bias-modal-tags { display: flex; gap: 10px; margin-bottom: 24px; }
.bias-modal-block { margin-bottom: 24px; background: rgba(0,0,0,0.2); padding: 20px; border-radius: 12px; border: 1px solid var(--bs-border-base); }
.bias-modal-block h5 { margin: 0 0 12px 0; color: var(--bs-white-muted); font-size: 11px; letter-spacing: 2px; }
.bias-modal-block p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--bs-white-soft); }

.bias-modal-lvl { display: flex; flex-direction: column; background: rgba(255,255,255,0.02); padding: 12px; border-radius: 8px; text-align: center; border: 1px solid var(--bs-border-base); }
.bias-modal-lvl span { font-size: 10px; color: var(--bs-white-muted); margin-bottom: 4px; }
.bias-modal-lvl strong { font-size: 16px; font-family: monospace; }

.bias-modal-footer { padding: 20px 32px; border-top: 1px solid var(--bs-border-base); display: flex; justify-content: flex-end; gap: 12px; background: rgba(0,0,0,0.2); border-radius: 0 0 24px 24px; }
.bias-btn-secondary { padding: 12px 24px; border-radius: 12px; font-size: 13px; font-weight: 800; cursor: pointer; background: rgba(255,255,255,0.05); color: var(--bs-white-faded); border: 1px solid var(--bs-border-base); transition: 0.3s; }
.bias-btn-secondary:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Multi-Timeframe Matrix */
.bias-mtf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.bias-mtf-card {
    background: var(--bs-bg-card); backdrop-filter: blur(16px);
    border: 1px solid var(--bs-border-base); border-radius: 16px;
    padding: 20px; text-align: center; transition: all 0.3s var(--bs-ease);
}
.bias-mtf-card:hover { border-color: rgba(168,85,247,0.3); transform: translateY(-2px); }

.bias-mtf-label { font-size: 11px; font-weight: 900; color: var(--bs-white-muted); letter-spacing: 2px; margin-bottom: 16px; }

.bias-mtf-bias { display: flex; flex-direction: column; gap: 12px; }
.bias-mtf-direction { display: flex; justify-content: center; }

.mtf-select {
    width: 100%; background: rgba(0,0,0,0.4); border: 1px solid var(--bs-border-base);
    color: var(--bs-white-pure); padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 700;
    cursor: pointer; outline: none;
}
.mtf-select:focus { border-color: var(--bs-purp-light); }
.mtf-select option { background: #1a1a24; color: #fff; }

.bias-mtf-strength { display: flex; gap: 4px; justify-content: center; }
.mtf-str-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--bs-border-base);
    color: var(--bs-white-muted); padding: 6px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700; cursor: pointer; transition: 0.3s;
}
.mtf-str-btn:hover { background: rgba(168,85,247,0.1); color: var(--bs-purp-light); }
.mtf-str-btn.active { background: rgba(168,85,247,0.2); color: var(--bs-purp-light); border-color: var(--bs-purp-main); }

.bias-mtf-confidence { font-size: 11px; color: var(--bs-white-muted); font-family: monospace; }
.bias-mtf-confidence span { color: var(--bs-gold); font-weight: 800; }

.mtf-slider {
    width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
    background: rgba(255,255,255,0.1); border-radius: 4px; outline: none; cursor: pointer;
}
.mtf-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bs-purp-main); cursor: pointer;
    box-shadow: 0 0 10px var(--bs-purp-glow);
}

.bias-mtf-summary {
    background: rgba(0,0,0,0.3); border: 1px solid var(--bs-border-base);
    border-radius: 16px; padding: 20px 24px;
    display: flex; justify-content: space-around; align-items: center; gap: 20px;
}
.bias-mtf-overall { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bias-mtf-overall-label { font-size: 10px; color: var(--bs-white-muted); letter-spacing: 1px; font-weight: 600; }
.bias-mtf-overall-value { font-size: 18px; font-weight: 900; color: var(--bs-white-pure); font-family: monospace; }
#mtf-overall-bias { color: var(--bs-gold); text-shadow: 0 0 10px rgba(251,191,36,0.4); }

/* Reason Presets */
.bias-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bias-preset-chip {
    background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.2);
    color: var(--bs-purp-light); padding: 6px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 700; cursor: pointer; transition: 0.3s;
}
.bias-preset-chip:hover { background: rgba(168,85,247,0.2); border-color: var(--bs-purp-main); }
.bias-preset-chip.active { background: var(--bs-purp-main); color: #fff; }

/* Cross-Asset Panel */
.bias-cross-panel { background: var(--bs-bg-card); border: 1px solid var(--bs-border-base); border-radius: 16px; padding: 24px; }
.bias-cross-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.bias-cross-header h4 { margin: 0; font-size: 14px; color: var(--bs-white-pure); letter-spacing: 1px; }
.bias-cross-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bias-cross-item {
    background: rgba(0,0,0,0.2); border: 1px solid var(--bs-border-base);
    border-radius: 12px; padding: 16px; text-align: center; transition: 0.3s;
}
.bias-cross-item:hover { background: var(--bs-bg-hover); }
.bias-cross-symbol { font-size: 12px; color: var(--bs-white-muted); margin-bottom: 8px; font-weight: 700; }
.bias-cross-bias { font-size: 16px; font-weight: 900; }
.bias-cross-bias.bull { color: var(--bs-green); }
.bias-cross-bias.bear { color: var(--bs-red); }
.bias-cross-bias.neut { color: var(--bs-gold); }
.bias-cross-conf { font-size: 11px; color: var(--bs-white-muted); margin-top: 4px; font-family: monospace; }
.bias-cross-add { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--bs-border-base); color: var(--bs-white-muted); cursor: pointer; }
.bias-cross-add:hover { border-color: var(--bs-purp-main); color: var(--bs-purp-light); }

/* Reports Section */
.bias-reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bias-report-card {
    background: var(--bs-bg-card); border: 1px solid var(--bs-border-base);
    border-radius: 16px; padding: 24px; transition: 0.3s;
}
.bias-report-card:hover { border-color: rgba(168,85,247,0.3); }
.bias-report-card h4 { margin: 0 0 16px 0; font-size: 14px; color: var(--bs-white-pure); font-weight: 800; }
.bias-report-stats { display: flex; flex-direction: column; gap: 12px; }
.bias-report-row { display: flex; justify-content: space-between; align-items: center; }
.bias-report-row span:first-child { font-size: 12px; color: var(--bs-white-muted); }
.bias-report-row span:last-child { font-size: 14px; font-weight: 800; color: var(--bs-white-pure); font-family: monospace; }
.bias-report-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.bias-report-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s var(--bs-ease); }

/* Validation Tracking */
.bias-validation-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.bias-valid-card {
    background: var(--bs-bg-card); border: 1px solid var(--bs-border-base);
    border-radius: 16px; padding: 20px;
}
.bias-valid-card h5 { margin: 0 0 12px 0; font-size: 11px; color: var(--bs-white-muted); letter-spacing: 1px; }
.bias-target-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,0.05); }
.bias-target-row:last-child { border-bottom: none; }
.bias-target-row span { font-size: 12px; color: var(--bs-white-soft); }
.bias-target-row strong { font-family: monospace; color: var(--bs-white-pure); }
.bias-target-hit { color: var(--bs-green) !important; }
.bias-target-miss { color: var(--bs-red) !important; }

/* Responsive */
@media (max-width: 1100px) {
    .bias-mtf-grid { grid-template-columns: repeat(2, 1fr); }
    .bias-cross-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .bias-form-grid, .bias-analytics { grid-template-columns: 1fr; }
    .bias-insights { grid-template-columns: 1fr; }
    .bias-stats-row { display: grid; grid-template-columns: 1fr 1fr; }
    .bias-reports-grid { grid-template-columns: 1fr; }
    .bias-validation-grid { grid-template-columns: 1fr; }
}