/* ==========================================================================
   ELITE CORRELATION MATRIX CSS
   Glassmorphism, Quant Terminal Vibes, Data Viz Animations
   ========================================================================== */

/* Layout & Globals */
.corr-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; display: flex; flex-direction: column; gap: 24px; position: relative; overflow-x: hidden; }
.corr-layout { display: flex; gap: 24px; align-items: flex-start; }
.corr-main-stage { flex-grow: 1; min-width: 0; }
.corr-sidebar { width: 350px; flex-shrink: 0; }

/* 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; } .mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; }
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } }
.fade-in { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Cards (Glassmorphism) */
.corr-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); }

/* Header Elements */
.corr-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.corr-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; text-transform: uppercase; }
.corr-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.corr-header__stats { display: flex; gap: 24px; }
.corr-stat-card { text-align: center; }
.corr-stat-val { display: block; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.corr-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Buttons & Inputs */
.corr-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; }
.corr-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.corr-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.corr-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.corr-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.corr-btn-icon { background: transparent; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: 0.3s; }
.corr-btn-icon:hover { color: white; transform: rotate(90deg); }

.corr-select, .corr-input { padding: 8px 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; font-family: inherit; font-size: 0.85rem; outline: none; transition: 0.3s; }
.corr-select:focus, .corr-input:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }

/* Tabs & Settings */
.corr-dimensions { display: flex; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.corr-tab { background: transparent; border: 1px solid transparent; color: rgba(255,255,255,0.6); padding: 8px 16px; border-radius: 20px; font-weight: 600; cursor: pointer; transition: 0.3s; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.corr-tab:hover { color: white; background: rgba(255,255,255,0.05); }
.corr-tab.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: rgba(192,132,252,0.4); }

.corr-settings { display: flex; gap: 24px; 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); flex-wrap: wrap; }
.corr-settings-group { display: flex; align-items: center; gap: 8px; }
.corr-settings-group label { font-size: 0.85rem; color: rgba(255,255,255,0.6); }

/* Heatmap Grid Core */
.corr-heatmap-wrapper { position: relative; padding-top: 80px; padding-left: 100px; margin-top: 24px; overflow: auto; }
.corr-col-labels { position: absolute; top: 0; left: 100px; display: flex; gap: 4px; }
.corr-col-label { width: 50px; font-size: 0.75rem; color: rgba(255,255,255,0.6); transform: rotate(-45deg); transform-origin: left bottom; text-align: left; padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.corr-row-labels { display: flex; flex-direction: column; gap: 4px; margin-right: 12px; width: 88px; text-align: right; }
.corr-row-label { height: 50px; line-height: 50px; font-size: 0.75rem; color: rgba(255,255,255,0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }

.corr-heatmap { display: grid; gap: 4px; }
.corr-cell { width: 50px; height: 50px; border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; position: relative; opacity: 0; animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.corr-cell:hover { transform: scale(1.15); z-index: 10; box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid white; }
.corr-cell--empty { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02) 5px, rgba(255,255,255,0.05) 5px, rgba(255,255,255,0.05) 10px); color: rgba(255,255,255,0.3); pointer-events: none; }
.corr-cell--diag { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); pointer-events: none; }

.corr-legend { display: flex; align-items: center; gap: 12px; }
.corr-legend-bar { width: 150px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #ef5350, #1a1a1a, #22c55e); }

/* Clusters Visual */
.corr-clusters-container { display: flex; gap: 16px; flex-wrap: wrap; }
.corr-cluster-bubble { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3); padding: 12px 20px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 20px rgba(251,191,36,0.05); }
.corr-cluster-title { font-size: 0.75rem; text-transform: uppercase; color: #fbbf24; margin-bottom: 8px; font-weight: 700; }
.corr-cluster-members { font-size: 0.9rem; font-weight: 600; text-align: center; }

/* Diversification Gauge */
.corr-gauge-container { position: relative; width: 100%; max-width: 250px; margin: 0 auto; }
.corr-gauge-svg { width: 100%; overflow: visible; }
.corr-gauge-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 8; stroke-linecap: round; }
.corr-gauge-fill { fill: none; stroke: #c084fc; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1.5s cubic-bezier(0.16, 1, 0.3, 1); }
.corr-gauge-value { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: 2.5rem; font-weight: 800; }
.corr-gauge-label { margin-top: 12px; font-size: 0.9rem; font-weight: 600; color: #c084fc; text-transform: uppercase; }

/* Insights List */
.corr-insights-list { display: flex; flex-direction: column; gap: 12px; }
.corr-insight-item { 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; }
.insight--danger { border-left-color: #ef5350; }
.insight--success { border-left-color: #22c55e; }

/* Drilldown Slide Panel */
.corr-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; }
.corr-slide-panel { position: fixed; top: 0; right: 0; width: 400px; 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; }
.corr-slide-panel.open { transform: translateX(0); }
.corr-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; }
.corr-slide-body { padding: 24px; overflow-y: auto; flex-grow: 1; }

/* Scatter Plot inside Drilldown */
.corr-scatter-container { width: 100%; height: 250px; position: relative; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; margin-top: 16px; }
.corr-scatter-svg { width: 100%; height: 100%; overflow: visible; padding: 10px; }
.scatter-dot { fill: #c084fc; opacity: 0.7; transition: r 0.2s; }
.scatter-dot:hover { fill: #fff; r: 4; }
.scatter-line { stroke: #fbbf24; stroke-width: 2; stroke-dasharray: 4; }
.scatter-axis { stroke: rgba(255,255,255,0.2); stroke-width: 1; }
.scatter-x-label { position: absolute; bottom: 8px; right: 16px; font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.scatter-y-label { position: absolute; top: 8px; left: 16px; font-size: 0.7rem; color: rgba(255,255,255,0.4); }

/* Custom Tooltip */
.corr-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; }