/* ==========================================================================
   ELITE BACKTESTER CSS
   Glassmorphism, Quant Terminal Vibes, SVG Charting
   ========================================================================== */

/* Layout & Globals */
.bt-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; display: flex; flex-direction: column; gap: 24px; font-family: 'Inter', sans-serif; }
.bt-layout { display: flex; gap: 24px; align-items: flex-start; }
.bt-rules-builder { width: 380px; flex-shrink: 0; position: sticky; top: 32px; }
.bt-results { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.bt-layout-2col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; }

/* Utilities */
.hidden { display: none !important; }
.m-0 { margin: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; }
.uppercase { text-transform: uppercase; } .letter-spacing { letter-spacing: 1px; } .font-bold { font-weight: 700; }
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; }
.bg-white { background: #fff; } .bg-purple { background: #c084fc; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseBtn { 0% { box-shadow: 0 0 0 0 rgba(168,85,247,0.6); } 70% { box-shadow: 0 0 0 15px rgba(168,85,247,0); } 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); } }
.fade-in { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseBtn 2s infinite; }

/* Cards (Glassmorphism) */
.bt-card { background: rgba(255,255,255,0.03); backdrop-filter: blur(24px) saturate(180%); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05); transition: all 0.4s; }
.bt-card--highlight { border-color: rgba(192,132,252,0.4); box-shadow: 0 8px 32px rgba(168,85,247,0.15), inset 0 1px 0 rgba(192,132,252,0.2); background: radial-gradient(circle at top right, rgba(168,85,247,0.1), rgba(0,0,0,0)); }

/* Header Elements */
.bt-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.bt-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.bt-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.bt-header__stats { display: flex; gap: 24px; }
.bt-stat-card { text-align: center; }
.bt-stat-val { display: block; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bt-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Buttons & Inputs */
.bt-btn { padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); border: none; text-transform: uppercase; font-family: inherit; }
.bt-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; }
.bt-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.bt-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.bt-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.bt-btn--massive { width: 100%; padding: 16px; font-size: 1.1rem; border-radius: 16px; }
.bt-btn-icon { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.bt-btn-icon:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }

.bt-input, .bt-select { width: 100%; padding: 10px 14px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; font-family: inherit; font-size: 0.85rem; outline: none; }
.bt-input:focus, .bt-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.bt-form-group { margin-bottom: 16px; }
.bt-form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); }

/* Rules Builder Specifics */
.bt-section-title { font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 16px 0; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.bt-presets-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-preset-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); padding: 6px 12px; border-radius: 16px; font-size: 0.75rem; cursor: pointer; transition: 0.3s; }
.bt-preset-btn:hover { background: rgba(251,191,36,0.1); border-color: #fbbf24; color: #fbbf24; }

.bt-filter-row { display: grid; grid-template-columns: 2fr 1.5fr 2fr auto; gap: 8px; margin-bottom: 8px; align-items: center; background: rgba(0,0,0,0.2); padding: 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); }
.bt-filter-row.first-row { grid-template-columns: 2fr 1.5fr 2fr auto; } /* Logic dropdown hidden/disabled via JS for first */

/* Switch & Sliders */
.bt-switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.bt-switch input { opacity: 0; width: 0; height: 0; }
.bt-slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 24px; }
.bt-slider-toggle:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.bt-switch input:checked + .bt-slider-toggle { background-color: #a855f7; }
.bt-switch input:checked + .bt-slider-toggle:before { transform: translateX(20px); }

.bt-range { -webkit-appearance: none; width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; outline: none; }
.bt-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #c084fc; cursor: pointer; box-shadow: 0 0 10px rgba(192,132,252,0.5); transition: 0.2s; }
.bt-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

.bt-wf-bar { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; display: flex; font-size: 0.6rem; text-align: center; line-height: 8px; font-weight: 700; color: #000; }
.bt-wf-train { background: rgba(255,255,255,0.4); transition: width 0.3s; }
.bt-wf-test { background: #c084fc; transition: width 0.3s; }

/* Hero Results */
.bt-hero-grid { display: flex; gap: 16px; align-items: stretch; }
.bt-hero-grid > .bt-card { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.bt-vs-icon { display: flex; align-items: center; justify-content: center; width: 40px; font-size: 1.5rem; color: rgba(255,255,255,0.2); }
.bt-hero-metric { display: flex; flex-direction: column; }
.bt-hero-metric .lbl { font-size: 0.85rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }
.bt-hero-metric .val { font-size: 2.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }

.bt-alpha-verdict { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); padding: 12px 24px; border-radius: 12px; color: #22c55e; font-weight: 700; text-align: center; }
.bt-alpha-verdict.negative { background: rgba(239,83,80,0.1); border-color: rgba(239,83,80,0.3); color: #ef5350; }

/* SVG Chart */
.bt-svg-container { width: 100%; height: 300px; background: rgba(0,0,0,0.2); border-radius: 12px; position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,0.05); }
.bt-chart-legend { display: flex; gap: 16px; justify-content: center; font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-box { width: 12px; height: 12px; border-radius: 2px; }
.chart-axis { stroke: rgba(255,255,255,0.1); stroke-width: 1; }
.chart-path-base { fill: none; stroke: rgba(255,255,255,0.3); stroke-width: 2; stroke-linejoin: round; }
.chart-path-filt { fill: none; stroke: #c084fc; stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(192,132,252,0.5)); }
.chart-wf-line { stroke: #fbbf24; stroke-width: 1; stroke-dasharray: 4; }

/* Walk Forward Grid */
.bt-wf-grid { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 16px; }
.wf-col { background: rgba(0,0,0,0.2); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.wf-col--test { border-color: rgba(192,132,252,0.3); background: rgba(192,132,252,0.05); }
.wf-col--verdict { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.wf-metric { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.9rem; }
.wf-metric .lbl { color: rgba(255,255,255,0.5); }

/* Metrics Table */
.bt-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.bt-table th { text-align: left; padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; }
.bt-table td { padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.05); font-variant-numeric: tabular-nums; }
.bt-table tr:last-child td { border-bottom: none; }
.delta-pos { color: #22c55e; font-weight: 700; }
.delta-neg { color: #ef5350; font-weight: 700; }
.delta-neu { color: rgba(255,255,255,0.6); }

/* Insights */
.bt-insights-list { display: flex; flex-direction: column; gap: 12px; }
.bt-insight-card { background: rgba(0,0,0,0.3); padding: 16px; border-radius: 12px; border-left: 3px solid #c084fc; font-size: 0.85rem; line-height: 1.4; display: flex; gap: 12px; align-items: flex-start; }
.bt-insight-card i { font-size: 1.2rem; margin-top: 2px; }