/* ==========================================================================
   ELITE CORRELATION LIVE CSS
   Glassmorphism, Matrix Grids, SVG Plots
   ========================================================================== */

/* Layout & Globals */
.cl-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; display: flex; flex-direction: column; gap: 24px; position: relative; overflow-x: hidden; }
.cl-layout { display: flex; gap: 24px; align-items: flex-start; }
.cl-main-view { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.cl-sidebar { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 24px; }

/* Utilities */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.m-0 { margin: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; } .text-center { text-align: center; }
.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; } .gap-8 { gap: 8px; }

/* Palette */
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-white { color: #ffffff; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(251,191,36,0.4); } 70% { box-shadow: 0 0 0 15px rgba(251,191,36,0); } 100% { box-shadow: 0 0 0 0 rgba(251,191,36,0); } }
@keyframes popIn { 0% { opacity:0; transform: scale(0.9); } 100% { opacity:1; transform: scale(1); } }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes flashCell { 0% { background: rgba(255,255,255,0.8); } 100% { background: var(--base-bg); } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse { animation: pulseGlow 2s infinite; border-radius: 50%; }
.spinning { animation: spin 1s linear infinite; }
.flash-update { animation: flashCell 1s ease-out; }

/* Cards & Buttons */
.cl-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; }

.cl-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; }
.cl-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.cl-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.cl-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.cl-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.cl-btn-icon { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; font-size: 1.2rem; }
.cl-btn-icon:hover { color: white; transform: scale(1.1); }
.cl-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; }
.cl-btn-icon-small:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }

.cl-input, .cl-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; }
.cl-input:focus, .cl-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.cl-form-group { margin-bottom: 16px; }
.cl-form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); font-weight: 600; }
.cl-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.cl-chip-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; cursor: pointer; transition: 0.2s; }
.cl-chip-btn:hover { background: rgba(192,132,252,0.2); border-color: #c084fc; }

/* Banners */
.cl-offline-banner { background: rgba(249,115,22,0.15); border: 1px solid rgba(249,115,22,0.3); color: #fdba74; padding: 12px 24px; border-radius: 12px; font-weight: 700; text-align: center; font-size: 0.9rem; }
.cl-shifts { background: radial-gradient(circle at left, rgba(251,191,36,0.15), transparent); border: 1px solid rgba(251,191,36,0.3); padding: 16px 24px; border-radius: 16px; animation: slideDown 0.4s ease-out; }
.cl-shifts-header { display: flex; justify-content: space-between; align-items: center; }
.cl-shifts-list { display: flex; flex-direction: column; gap: 8px; }
.cl-shift-item { background: rgba(0,0,0,0.3); padding: 12px 16px; border-radius: 8px; font-size: 0.85rem; border-left: 3px solid #fbbf24; cursor: pointer; transition: 0.2s; display: flex; justify-content: space-between; align-items: center; }
.cl-shift-item:hover { background: rgba(255,255,255,0.05); transform: translateX(4px); }

/* Header Elements */
.cl-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.cl-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.cl-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.cl-header__stats { display: flex; gap: 24px; }
.cl-stat-card { text-align: center; }
.cl-stat-val { display: block; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cl-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Macro Regime Banner */
.cl-regime-banner { background: radial-gradient(circle at right, 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: 24px 32px; display: flex; justify-content: space-between; align-items: center; transition: 0.5s; }
.cl-regime-icon { font-size: 3rem; opacity: 0.8; }
.regime-risk-on { background: radial-gradient(circle at right, rgba(34,197,94,0.15), rgba(0,0,0,0.5)); border-color: rgba(34,197,94,0.3); color: #4ade80; }
.regime-risk-off { background: radial-gradient(circle at right, rgba(239,83,80,0.15), rgba(0,0,0,0.5)); border-color: rgba(239,83,80,0.3); color: #ef5350; }
.regime-decoupled { background: radial-gradient(circle at right, rgba(255,255,255,0.1), rgba(0,0,0,0.5)); border-color: rgba(255,255,255,0.2); color: #fff; }

/* Time Window Nav */
.cl-window { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.03); padding: 12px 24px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.cl-tf-group { display: flex; gap: 8px; }
.cl-tab { background: transparent; border: 1px solid transparent; color: rgba(255,255,255,0.6); padding: 6px 12px; border-radius: 12px; font-weight: 700; cursor: pointer; transition: 0.3s; }
.cl-tab:hover { color: white; background: rgba(255,255,255,0.05); }
.cl-tab.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: rgba(192,132,252,0.4); }
.cl-win-group { display: flex; align-items: center; gap: 12px; }

/* Heatmap Grid */
.cl-legend { display: flex; align-items: center; gap: 12px; }
.cl-legend-bar { width: 150px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #ef5350, #1a1a1a, #22c55e); }
.cl-heatmap-wrapper { overflow-x: auto; padding-top: 16px; padding-bottom: 16px; }
.cl-heatmap-header { display: grid; margin-bottom: 8px; }
.cl-col-sym { font-size: 0.75rem; color: rgba(255,255,255,0.6); text-transform: uppercase; font-weight: 700; text-align: center; }
.cl-heatmap-body { display: flex; flex-direction: column; gap: 4px; }
.cl-heat-row { display: grid; gap: 4px; align-items: center; }
.cl-row-sym { font-weight: 800; font-size: 0.85rem; padding-right: 16px; text-align: right; }
.cl-cell { height: 40px; border-radius: 6px; display: flex; justify-content: center; align-items: center; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; position: relative; opacity: 0; animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.cl-cell:hover { transform: scale(1.15); z-index: 10; box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid white; }
.cl-cell--empty { background: rgba(255,255,255,0.02); color: rgba(255,255,255,0.2); pointer-events: none; }
.cl-cell--diag { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); pointer-events: none; }

/* Lists & Bubbles */
.cl-clusters-list { display: flex; gap: 16px; flex-wrap: wrap; }
.cl-cluster-bubble { background: rgba(192,132,252,0.1); border: 1px solid rgba(192,132,252,0.3); padding: 12px 20px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 20px rgba(192,132,252,0.05); }
.cl-cluster-title { font-size: 0.75rem; text-transform: uppercase; color: #c084fc; margin-bottom: 8px; font-weight: 700; }
.cl-cluster-members { font-size: 0.9rem; font-weight: 600; text-align: center; }

.cl-changes-list { display: flex; flex-direction: column; gap: 12px; }
.cl-change-card { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); padding: 16px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s; }
.cl-change-card:hover { background: rgba(255,255,255,0.05); transform: translateX(-4px); border-color: rgba(192,132,252,0.3); }

/* Diversification */
.cl-div-score-box { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,0.3); padding: 16px; border-radius: 12px; }
.cl-div-score-box .val { font-size: 2.5rem; font-weight: 800; color: #fff; }
.cl-verdict-box { padding: 12px; border-radius: 8px; font-weight: 700; text-align: center; font-size: 0.9rem; }
.v-good { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #22c55e; }
.v-bad { background: rgba(239,83,80,0.1); border: 1px solid rgba(239,83,80,0.3); color: #ef5350; }
.v-neu { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; }

/* Drilldown Slide Panel */
.cl-slide-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 999; transition: opacity 0.4s; }
.cl-slide-panel { position: fixed; top: 0; right: 0; width: 450px; 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; }
.cl-slide-panel.open { transform: translateX(0); }
.cl-slide-header { padding: 32px 24px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: flex-start; }
.cl-slide-body { padding: 24px; overflow-y: auto; flex-grow: 1; }

.cl-chart-container { width: 100%; height: 220px; position: relative; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; }
.cl-svg-chart { width: 100%; height: 100%; overflow: visible; padding: 10px; }
.cl-stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.cl-stat-box { background: rgba(0,0,0,0.3); padding: 12px; border-radius: 8px; display: flex; flex-direction: column; text-align: center; }
.cl-stat-box .lbl { font-size: 0.7rem; color: rgba(255,255,255,0.5); text-transform: uppercase; margin-bottom: 4px; }
.cl-stat-box .val { font-size: 1.1rem; font-weight: 700; }

/* SVG Elements */
.chart-axis { stroke: rgba(255,255,255,0.1); stroke-width: 1; }
.chart-zero { stroke: rgba(255,255,255,0.3); stroke-width: 1; stroke-dasharray: 4; }
.chart-line { fill: none; stroke: #c084fc; stroke-width: 2; stroke-linejoin: round; }
.chart-line-hist { fill: none; stroke: rgba(255,255,255,0.3); stroke-width: 1.5; stroke-dasharray: 2; }
.scatter-dot { fill: #06b6d4; opacity: 0.7; }
.scatter-line { stroke: #fbbf24; stroke-width: 2; stroke-dasharray: 4; }
.scatter-x-label { position: absolute; bottom: 8px; right: 16px; font-size: 0.65rem; color: rgba(255,255,255,0.4); }
.scatter-y-label { position: absolute; top: 8px; left: 16px; font-size: 0.65rem; color: rgba(255,255,255,0.4); }

/* Modals */
.cl-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.cl-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.cl-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: fadeInUp 0.3s ease-out; }
.cl-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; }
.cl-modal__close:hover { color: white; }

/* Tooltip */
.cl-tooltip { position: fixed; background: #140f19; border: 1px solid rgba(192,132,252,0.4); padding: 12px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 2000; pointer-events: none; font-size: 0.8rem; color: white; transform: translate(-50%, -120%); transition: opacity 0.2s; white-space: nowrap; }