/* ==========================================================================
   ELITE AI FORECAST CSS
   Glassmorphism, SVG Monte Carlo, Math Visualization
   ========================================================================== */

/* Layout & Globals */
.aif-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; position: relative; overflow-x: hidden; }
.aif-layout { display: flex; gap: 24px; align-items: flex-start; }
.aif-main-view { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.aif-sidebar { width: 360px; flex-shrink: 0; display: flex; flex-direction: column; gap: 24px; }

/* Utilities */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.hidden-mobile { display: flex; }
@media (max-width: 768px) { .hidden-mobile { display: none !important; } .aif-layout { flex-direction: column; } .aif-sidebar { width: 100%; } }
.m-0 { margin: 0; } .mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.p-0 { padding: 0 !important; } .p-16 { padding: 16px; } .p-24 { padding: 24px; } .pt-8 { padding-top: 8px; } .pt-16 { padding-top: 16px; } .pb-8 { padding-bottom: 8px; } .pb-16 { padding-bottom: 16px; } .border-top { border-top: 1px solid rgba(255,255,255,0.1); } .border-bottom { border-bottom: 1px solid rgba(255,255,255,0.1); }
.text-xs { font-size: 0.75rem; } .text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; }
.uppercase { text-transform: uppercase; } .letter-spacing { letter-spacing: 1px; } .font-bold { font-weight: 700; } .tabular-nums { font-variant-numeric: tabular-nums; }
.flex-between { display: flex; justify-content: space-between; align-items: center; } .flex-align-center { display: flex; align-items: center; } .align-start { align-items: flex-start; } .align-end { align-items: flex-end; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .flex-grow { flex-grow: 1; min-height: 0; } .flex-shrink-0 { flex-shrink: 0; }

/* Palette */
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-orange { color: #fb923c; } .text-white { color: #ffffff; }
.bg-purple { background: #c084fc; color: #000; } .bg-cyan { background: #06b6d4; color: #000; } .bg-gold { background: #fbbf24; color: #000; } .bg-green { background: #22c55e; color: #000; } .bg-red { background: #ef5350; color: #fff; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(168,85,247,0.4); } 70% { box-shadow: 0 0 0 15px rgba(168,85,247,0); } 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); } }
@keyframes pulseGlowCyan { 0% { box-shadow: 0 0 0 0 rgba(6,182,212,0.4); } 70% { box-shadow: 0 0 0 20px rgba(6,182,212,0); } 100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); } }
@keyframes spinSlow { 100% { transform: rotate(360deg); } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseGlow 2s infinite; border-radius: 12px; }
.pulse-glow { animation: pulseGlowCyan 2s infinite; border-radius: 50%; }
.spinning-slow { animation: spinSlow 3s linear infinite; }

/* Cards & Buttons */
.aif-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; }

.aif-btn { padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; border: none; text-transform: uppercase; font-family: inherit; }
.aif-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.aip-btn-icon-small { 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; }
.aip-btn-icon-small:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }
.aif-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.aif-btn--secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.aif-btn-icon { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; }
.aif-btn-icon:hover { color: white; background: rgba(255,255,255,0.1); transform: scale(1.05); }

.aif-input, .aif-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; }
.aif-input:focus, .aif-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.aif-form-group { margin-bottom: 16px; }
.aif-form-group label { display: block; margin-bottom: 8px; font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }

.aif-range { -webkit-appearance: none; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; outline: none; }
.aif-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; }
.aif-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* Header & Regime Banner */
.aif-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; flex-shrink: 0; }
.aif-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.aif-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.aif-header__actions { display: flex; gap: 16px; align-items: center; }

.aif-regime-banner { background: radial-gradient(circle at left, rgba(34,197,94,0.15), rgba(0,0,0,0.5)); border: 1px solid rgba(34,197,94,0.3); border-radius: 16px; padding: 20px 32px; display: flex; justify-content: space-between; align-items: center; transition: 0.5s; }
.aif-regime-icon { width: 48px; height: 48px; border-radius: 50%; background: rgba(34,197,94,0.1); color: #22c55e; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.aif-regime-score { font-size: 1.5rem; font-weight: 800; color: #22c55e; margin-top: 4px; tabular-nums: tabular-nums; }
.regime-dang { background: radial-gradient(circle at left, rgba(249,115,22,0.15), rgba(0,0,0,0.5)); border-color: rgba(249,115,22,0.3); }
.regime-dang .aif-regime-icon { color: #f97316; background: rgba(249,115,22,0.1); box-shadow: 0 0 20px rgba(249,115,22,0.4); }
.regime-dang .aif-regime-score { color: #f97316; }
.regime-crit { background: radial-gradient(circle at left, rgba(239,83,80,0.2), rgba(0,0,0,0.6)); border-color: rgba(239,83,80,0.5); }
.regime-crit .aif-regime-icon { color: #ef5350; background: rgba(239,83,80,0.1); box-shadow: 0 0 25px rgba(239,83,80,0.5); }
.regime-crit .aif-regime-score { color: #ef5350; }

/* Main Forecast Area */
.aif-scenario-bar { display: flex; gap: 16px; background: rgba(0,0,0,0.4); padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.05); }

.aif-hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.aif-hero-stat { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); padding: 16px; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; }
.aif-hero-stat .lbl { font-size: 0.75rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 8px; }
.aif-hero-stat .val { font-size: 2rem; font-weight: 800; tabular-nums: tabular-nums; line-height: 1.1; margin-bottom: 4px; }
.aif-hero-stat .sub { font-size: 0.75rem; color: rgba(255,255,255,0.4); }

.border-red { border-left: 3px solid #ef5350; }

/* SVG Chart */
.aif-chart-container { width: 100%; height: 350px; background: rgba(0,0,0,0.3); border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); position: relative; overflow: hidden; }
.chart-svg { width: 100%; height: 100%; padding: 20px; overflow: visible; }
.chart-axis { stroke: rgba(255,255,255,0.1); stroke-width: 1; }
.chart-path-bg { fill: none; stroke: rgba(255,255,255,0.05); stroke-width: 0.5; }
.chart-band-95 { fill: rgba(34,197,94,0.1); stroke: none; }
.chart-band-5 { fill: rgba(239,83,80,0.1); stroke: none; }
.chart-line-med { fill: none; stroke: #c084fc; stroke-width: 2.5; stroke-linecap: round; filter: drop-shadow(0 4px 10px rgba(192,132,252,0.3)); }
.chart-line-tgt { fill: none; stroke: #fbbf24; stroke-width: 1.5; stroke-dasharray: 4; }
.chart-line-dd { fill: none; stroke: #ef5350; stroke-width: 1.5; stroke-dasharray: 4; }
.chart-lbl { font-size: 0.7rem; fill: rgba(255,255,255,0.5); font-family: 'Inter', sans-serif; }

.aif-chart-legend { display: flex; gap: 12px; font-size: 0.75rem; color: rgba(255,255,255,0.6); }
.leg-item { display: flex; align-items: center; gap: 6px; }
.l-box { width: 12px; height: 4px; border-radius: 2px; }

/* What-If Explorer */
.aif-sliders-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.aif-slider-box { background: rgba(0,0,0,0.2); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }

/* Sidebar Probabilities */
.aif-prob-list { display: flex; flex-direction: column; gap: 8px; }
.aif-prob-row { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); padding: 12px 16px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s; position: relative; overflow: hidden; }
.aif-prob-row:hover { background: rgba(255,255,255,0.05); border-color: rgba(192,132,252,0.3); transform: translateX(4px); }
.aif-prob-lbl { font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,0.9); z-index: 2; position: relative; }
.aif-prob-val { font-size: 1.1rem; font-weight: 800; tabular-nums: tabular-nums; z-index: 2; position: relative; }
.aif-prob-bg { position: absolute; left: 0; top: 0; height: 100%; background: rgba(6,182,212,0.15); z-index: 1; transition: width 1s ease-out; }

.aif-risk-box { background: rgba(0,0,0,0.3); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }

/* Modals & Slide Panel */
.aif-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.aif-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.aif-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: popIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards; }
.aif-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: 0.3s; z-index: 10; }
.aif-modal__close:hover { color: white; }

.aif-giant-icon { font-size: 4rem; display: inline-block; }
.aif-progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.aif-progress-fill { height: 100%; border-radius: 4px; transition: width 0.2s linear; }

.aif-slide-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 999; transition: opacity 0.4s; }
.aif-slide-panel { position: fixed; top: 0; right: 0; width: 100%; max-width: 500px; height: 100vh; background: #0d0b12; border-left: 1px solid rgba(255,255,255,0.1); z-index: 1000; box-shadow: -10px 0 30px rgba(0,0,0,0.5); transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; }
.aif-slide-panel.open { transform: translateX(0); }
.aif-detail-bg { position: absolute; top:0; left:0; width:100%; height:100%; background: linear-gradient(to bottom, rgba(6,182,212,0.3), #0d0b12); transition: background 0.3s; }
.aif-slide-body { padding: 32px; overflow-y: auto; flex-grow: 1; }

.aif-huge-pct { font-size: 4rem; font-weight: 900; line-height: 1; text-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.aif-factor-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed rgba(255,255,255,0.05); font-size: 0.9rem; }
.aif-factor-row:last-child { border-bottom: none; }
.aif-sens-item { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); padding: 12px; border-radius: 8px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }

/* Saved Modal */
.aif-sv-item { padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; margin-bottom: 12px; cursor: pointer; transition: 0.2s; display: flex; justify-content: space-between; align-items: center; }
.aif-sv-item:hover { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.05); transform: translateX(4px); }