/* ==========================================================================
   ELITE MULTI-FUNDED VAULT CSS
   Glassmorphism, 3D Vault Boxes, SVG Pie Charts
   ========================================================================== */

/* Layout & Globals */
.mf-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; display: flex; flex-direction: column; position: relative; overflow-x: hidden; }

/* Utilities */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.m-0 { margin: 0; } .mr-16 { margin-right: 16px; } .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-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.pt-16 { padding-top: 16px; } .pb-16 { padding-bottom: 16px; } .border-bottom { border-bottom: 1px solid rgba(255,255,255,0.1); } .border-top { border-top: 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; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; }

/* 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 pulseDanger { 0% { box-shadow: 0 0 0 0 rgba(239,83,80,0.5); } 70% { box-shadow: 0 0 0 20px rgba(239,83,80,0); } 100% { box-shadow: 0 0 0 0 rgba(239,83,80,0); } }
@keyframes drawArc { to { stroke-dashoffset: 0; } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse { animation: pulseDanger 2s infinite; border-radius: 8px; }
.pulse-btn { animation: pulseDanger 2s infinite; border-radius: 12px; } /* override via inline style in JS if needed */

/* Cards & Buttons */
.mf-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; }

.mf-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; }
.mf-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.mf-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.mf-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.mf-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.mf-btn--danger { background: linear-gradient(135deg, #ef5350, #c62828); color: white; border-radius: 8px; }
.mf-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; font-size: 1rem; }
.mf-btn-icon-small:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }
.mf-btn-icon-small.border-red:hover { background: rgba(239,83,80,0.2); color: #ef5350; border-color: #ef5350; }

.mf-input, .mf-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; }
.mf-input:focus, .mf-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.mf-form-group { margin-bottom: 16px; }
.mf-form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); font-weight: 600; }
.mf-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Switch Toggle */
.mf-switch { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.mf-switch input { opacity: 0; width: 0; height: 0; }
.mf-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; }
.mf-slider-toggle:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.mf-switch input:checked + .mf-slider-toggle { background-color: #a855f7; }
.mf-switch input:checked + .mf-slider-toggle:before { transform: translateX(20px); }

/* Header & Stats */
.mf-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.mf-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; text-transform: uppercase; }
.mf-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.mf-header__stats { display: flex; gap: 24px; }
.mf-stat-card { text-align: center; }
.mf-stat-val { display: block; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mf-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Overview Grid */
.mf-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.mf-pie-container { width: 150px; height: 150px; position: relative; }
.mf-pie-svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.pie-slice { fill: none; stroke-width: 30; cursor: pointer; transition: stroke-width 0.2s, opacity 0.2s; stroke-dashoffset: 1000; animation: drawArc 1s ease-out forwards; }
.pie-slice:hover { stroke-width: 35; }
.mf-alloc-info { flex-grow: 1; }
.mf-alloc-list { display: flex; flex-direction: column; gap: 8px; }
.mf-alloc-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.mf-alloc-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }

.mf-hero-val { font-size: 3rem; font-weight: 800; tabular-nums: tabular-nums; line-height: 1; text-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.mf-spark-container { width: 150px; height: 50px; background: rgba(255,255,255,0.02); border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); }

/* Badges & Insights */
.mf-badge { font-size: 0.65rem; padding: 4px 8px; border-radius: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #fff; background: rgba(255,255,255,0.1); }
.bg-ok { background: rgba(34,197,94,0.2); color: #4ade80; border: 1px solid rgba(34,197,94,0.4); }
.bg-warn { background: rgba(251,191,36,0.2); color: #fbbf24; border: 1px solid rgba(251,191,36,0.4); }
.bg-dang { background: rgba(239,83,80,0.2); color: #ef5350; border: 1px solid rgba(239,83,80,0.4); }
.mf-insight-box { background: rgba(239,83,80,0.1); border-left: 3px solid #ef5350; padding: 12px; border-radius: 8px; font-size: 0.8rem; color: #ffcdd2; }

/* Sync Warning Banner */
.mf-risk-banner { background: radial-gradient(circle at left, rgba(239,83,80,0.2) 0%, rgba(0,0,0,0.8) 100%); border: 2px solid #ef5350; border-radius: 16px; padding: 16px 24px; box-shadow: 0 0 30px rgba(239,83,80,0.2), inset 0 0 15px rgba(239,83,80,0.1); display: flex; justify-content: space-between; align-items: center; }
.mf-danger-icon { font-size: 2rem; color: #ef5350; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: rgba(239,83,80,0.1); border-radius: 50%; }

/* Tabs */
.mf-view-tabs { display: flex; gap: 12px; }
.mf-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; white-space: nowrap; }
.mf-tab:hover { color: white; background: rgba(255,255,255,0.05); }
.mf-tab.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: rgba(192,132,252,0.4); }

.mf-view-section { animation: fadeInUp 0.4s forwards; }

/* Vault View */
.mf-vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 32px; perspective: 1000px; padding: 16px; }
.mf-vault-box { background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(0,0,0,0.5)); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 24px; position: relative; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.5s; cursor: pointer; box-shadow: 10px 10px 30px rgba(0,0,0,0.6), inset 2px 2px 10px rgba(255,255,255,0.05); }
.mf-vault-box:hover { transform: translateZ(20px) rotateX(-5deg) rotateY(5deg); box-shadow: 20px 20px 40px rgba(0,0,0,0.7), inset 2px 2px 15px rgba(255,255,255,0.1), 0 0 20px rgba(192,132,252,0.3); border-color: rgba(192,132,252,0.5); }
.mf-vault-box.status-dang { border-color: rgba(239,83,80,0.5); }
.mf-vault-box.status-dang:hover { box-shadow: 20px 20px 40px rgba(0,0,0,0.7), 0 0 20px rgba(239,83,80,0.4); }

.v-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid rgba(255,255,255,0.05); padding-bottom: 12px; margin-bottom: 16px; }
.v-firm { font-weight: 800; font-size: 1.1rem; color: rgba(255,255,255,0.8); }
.v-size { font-size: 1.2rem; font-weight: 800; color: #fbbf24; }
.v-body { display: flex; flex-direction: column; gap: 8px; }
.v-lbl { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }
.v-val { font-size: 1.4rem; font-weight: 800; tabular-nums: tabular-nums; }
.v-pnl { font-size: 1rem; font-weight: 700; }
.v-status { position: absolute; bottom: 16px; right: 16px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.v-status.st-dang { background: #ef5350; box-shadow: 0 0 10px #ef5350; }

/* Cards View */
.mf-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 24px; }
.mf-ac-card { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; }
.c-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 16px; }
.c-metric { display: flex; flex-direction: column; }
.c-metric .lbl { font-size: 0.75rem; color: rgba(255,255,255,0.5); }
.c-metric .val { font-size: 1.1rem; font-weight: 700; }
.mf-progress-bar { width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.mf-progress-fill { height: 100%; background: #06b6d4; border-radius: 2px; transition: width 0.5s; }

/* Table View */
.mf-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.mf-table th { text-align: left; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); text-transform: uppercase; font-size: 0.75rem; font-weight: 700; }
.mf-table td { padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.05); font-variant-numeric: tabular-nums; }
.mf-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Timeline Chart */
.mf-timeline-container { width: 100%; height: 250px; background: rgba(255,255,255,0.02); border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); position: relative; }
.tl-svg { width: 100%; height: 100%; overflow: visible; padding: 10px 10px 25px 10px; }
.tl-axis { stroke: rgba(255,255,255,0.1); stroke-width: 1; }
.tl-bar { transition: y 0.5s, height 0.5s, opacity 0.2s; cursor: pointer; }
.tl-bar:hover { opacity: 0.8; }
.tl-lbl { font-size: 0.65rem; fill: rgba(255,255,255,0.5); text-anchor: middle; }

/* Sync Modal List */
.mf-sync-list { display: flex; flex-direction: column; gap: 16px; }
.sync-item { background: rgba(0,0,0,0.3); border: 1px solid rgba(239,83,80,0.3); border-left: 4px solid #ef5350; padding: 16px; border-radius: 8px; }

/* Modals */
.mf-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.mf-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.mf-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; }
.mf-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; }
.mf-modal__close:hover { color: white; }

/* Tooltip */
.mf-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; }