/* ==========================================================================
   ELITE FUNDING RATE HEATMAP CSS
   Glassmorphism, Grid Matrix, Pulse Alerts
   ========================================================================== */

/* Layout & Globals */
.fnd-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; }
.fnd-layout { display: flex; gap: 24px; align-items: flex-start; }
.fnd-main-view { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.fnd-detail-panel { width: 340px; flex-shrink: 0; }

/* Utilities */
.hidden { display: none !important; }
.m-0 { margin: 0; } .mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.pb-16 { padding-bottom: 16px; } .border-bottom { border-bottom: 1px solid rgba(255,255,255,0.1); }
.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; }

/* 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 spin { 100% { transform: rotate(360deg); } }
@keyframes pulseDanger { 0% { box-shadow: 0 0 0 0 rgba(239,83,80,0.4); } 70% { box-shadow: 0 0 0 15px rgba(239,83,80,0); } 100% { box-shadow: 0 0 0 0 rgba(239,83,80,0); } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.spinning { animation: spin 1s linear infinite; }
.pulse { animation: pulseDanger 2s infinite; border-radius: 50%; }

/* Cards & Buttons */
.fnd-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; }

.fnd-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; }
.fnd-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.fnd-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.fnd-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.fnd-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.fnd-btn-icon { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; font-size: 1.2rem; }
.fnd-btn-icon:hover { color: white; }

.fnd-input, .fnd-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; }
.fnd-input:focus, .fnd-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }

/* Switch Toggle */
.fnd-switch { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.fnd-switch input { opacity: 0; width: 0; height: 0; }
.fnd-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; }
.fnd-slider-toggle:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.fnd-switch input:checked + .fnd-slider-toggle { background-color: #a855f7; }
.fnd-switch input:checked + .fnd-slider-toggle:before { transform: translateX(20px); }

/* Banners */
.fnd-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; margin-bottom: 8px; }
.fnd-alerts { background: radial-gradient(circle at left, rgba(239,83,80,0.15), transparent); border: 1px solid rgba(239,83,80,0.3); padding: 16px 24px; border-radius: 16px; animation: slideDown 0.4s ease-out; }
.fnd-alerts-header { display: flex; justify-content: space-between; align-items: center; }
.fnd-alerts-list { display: flex; flex-direction: column; gap: 8px; }
.fnd-alert-item { background: rgba(0,0,0,0.3); padding: 12px 16px; border-radius: 8px; font-size: 0.85rem; border-left: 3px solid #ef5350; cursor: pointer; transition: 0.2s; }
.fnd-alert-item:hover { background: rgba(255,255,255,0.05); transform: translateX(4px); }
.fnd-alert-item.bullish { border-left-color: #22c55e; }

/* Header */
.fnd-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.fnd-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.fnd-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.fnd-header__stats { display: flex; gap: 24px; }
.fnd-stat-card { text-align: center; }
.fnd-stat-val { display: block; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fnd-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Summary */
.fnd-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; background: rgba(0,0,0,0.2); padding: 24px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.fnd-kpi-box { display: flex; flex-direction: column; align-items: center; text-align: center; }
.fnd-kpi-box .lbl { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; margin-bottom: 8px; }
.fnd-kpi-box .val { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Tabs */
.fnd-tabs { display: flex; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 16px; }
.fnd-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; }
.fnd-tab:hover { color: white; background: rgba(255,255,255,0.05); }
.fnd-tab.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: rgba(192,132,252,0.4); }
.fnd-view-section { animation: fadeInUp 0.4s forwards; }

/* Heatmap Grid */
.fnd-legend { display: flex; align-items: center; gap: 12px; }
.fnd-legend-bar { width: 150px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #ef5350, #1a1a1a, #22c55e); }
.fnd-heatmap-wrapper { overflow-x: auto; padding-bottom: 16px; }
.fnd-heatmap-header { display: grid; margin-bottom: 8px; }
.fnd-exch-col { font-size: 0.75rem; color: rgba(255,255,255,0.6); text-transform: uppercase; font-weight: 700; text-align: center; }
.fnd-heatmap-body { display: flex; flex-direction: column; gap: 4px; }
.fnd-heat-row { display: grid; gap: 4px; align-items: center; }
.fnd-sym-lbl { font-weight: 800; font-size: 0.9rem; padding-right: 16px; cursor: pointer; transition: 0.2s; }
.fnd-sym-lbl:hover { color: #c084fc; }
.fnd-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: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fnd-cell:hover { transform: scale(1.1); z-index: 10; box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid white; }
.fnd-cell--empty { background: rgba(255,255,255,0.02); color: rgba(255,255,255,0.2); pointer-events: none; }

/* Table */
.fnd-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.fnd-table th { text-align: right; padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); text-transform: uppercase; font-size: 0.75rem; }
.fnd-table th:first-child { text-align: left; }
.fnd-table td { text-align: right; padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.05); font-variant-numeric: tabular-nums; }
.fnd-table td:first-child { text-align: left; font-weight: 700; cursor: pointer; }
.fnd-table tr:hover td { background: rgba(255,255,255,0.02); }
.val-pos { color: #ef5350; font-weight: 700; } /* Bears want Longs to pay */
.val-neg { color: #22c55e; font-weight: 700; } /* Bulls want Shorts to pay */
.val-neu { color: rgba(255,255,255,0.8); }

/* Arb List */
.fnd-arb-list { display: flex; flex-direction: column; gap: 12px; }
.fnd-arb-card { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3); padding: 16px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; }

/* Detail Panel */
.fnd-badge { font-size: 0.65rem; padding: 3px 6px; border-radius: 4px; background: rgba(255,255,255,0.1); text-transform: uppercase; font-weight: 800; letter-spacing: 1px; color: #fff; }
.badge-extreme-bull { background: rgba(34,197,94,0.2); color: #4ade80; border: 1px solid rgba(34,197,94,0.4); }
.badge-extreme-bear { background: rgba(239,83,80,0.2); color: #ef5350; border: 1px solid rgba(239,83,80,0.4); }

.fnd-timeline-list, .fnd-rate-list { display: flex; flex-direction: column; gap: 8px; }
.fnd-time-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 8px; background: rgba(0,0,0,0.2); border-radius: 6px; }
.fnd-rate-row { display: flex; justify-content: space-between; font-size: 0.95rem; font-weight: 700; padding: 12px; background: rgba(0,0,0,0.2); border-radius: 6px; font-variant-numeric: tabular-nums; }

.fnd-calc-box { background: rgba(168,85,247,0.1); border-top: 3px solid #c084fc; padding: 16px; border-radius: 12px; }
.fnd-form-group { margin-bottom: 12px; }
.fnd-form-group label { display: block; margin-bottom: 6px; font-size: 0.8rem; color: rgba(255,255,255,0.7); }
.fnd-calc-result { padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.fnd-calc-result .val { font-size: 1.5rem; color: #fbbf24; }

/* Modals */
.fnd-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.fnd-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.fnd-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; }
.fnd-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; }
.fnd-modal__close:hover { color: white; }
.fnd-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fnd-settings-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }

/* Tooltip */
.fnd-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; }