/* ================================================================
   MF Analyzer - Modern Design System v3.0
   Glassmorphism • Gradient Accents • Micro-interactions • Dark Mode Ready
   ================================================================ */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --gradient-warning: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    --gradient-info: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    --gradient-dark: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --gradient-hero: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    --gradient-card: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --gradient-accent: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    --gradient-gold: linear-gradient(135deg, #f09819 0%, #edde5d 100%);

    /* Core Colors */
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f8f9fc;
    --color-text: #1a1d23;
    --color-text-secondary: #6b7280;
    --color-text-muted: #9ca3af;
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;

    /* Accent Palette */
    --accent-blue: #4f6af6;
    --accent-purple: #7c3aed;
    --accent-teal: #0d9488;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-pink: #ec4899;

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-blur: 20px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.14);
    --shadow-glow-blue: 0 0 32px rgba(79,106,246,0.25);
    --shadow-glow-green: 0 0 32px rgba(16,185,129,0.25);
    --shadow-glow-purple: 0 0 32px rgba(124,58,237,0.25);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-display: 'Plus Jakarta Sans', var(--font-sans);
}

/* ---------- Base Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.mf-app {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ---------- Container ---------- */
.mf-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
    .mf-container { padding: 0 var(--space-md); }
}

/* ---------- Hero Header ---------- */
.mf-hero {
    background: var(--gradient-hero);
    padding: var(--space-2xl) 0 var(--space-3xl);
    position: relative;
    overflow: hidden;
}

.mf-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(79,106,246,0.15) 0%, transparent 70%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}

.mf-hero::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(124,58,237,0.12) 0%, transparent 70%);
    animation: heroGlow 10s ease-in-out infinite alternate-reverse;
}

@keyframes heroGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -30px) scale(1.1); }
}

.mf-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
}

.mf-hero-text {
    flex: 1;
}

.mf-hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: var(--space-md);
}

.mf-hero-title .gradient-text {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mf-hero-subtitle {
    font-size: 1.125rem;
    color: rgba(255,255,255,0.7);
    max-width: 520px;
    line-height: 1.7;
}

.mf-hero-stats {
    display: flex;
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.mf-hero-stat {
    text-align: center;
}

.mf-hero-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    font-family: var(--font-display);
}

.mf-hero-stat-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.mf-hero-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    flex-wrap: wrap;
}

.mf-hero-search {
    flex: 0 0 400px;
    position: relative;
    z-index: 2;
}

@media (max-width: 1024px) {
    .mf-hero-content { flex-direction: column; text-align: center; }
    .mf-hero-subtitle { margin: 0 auto; }
    .mf-hero-stats { justify-content: center; }
    .mf-hero-actions { justify-content: center; }
    .mf-hero-search { flex: 0 0 auto; width: 100%; max-width: 500px; }
}

/* ---------- Global Search Bar ---------- */
.mf-search-box {
    position: relative;
    width: 100%;
}

.mf-search-input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    font-size: 1rem;
    font-family: var(--font-sans);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    transition: all var(--duration-base) var(--ease-out);
    box-shadow: var(--shadow-md);
}

.mf-search-input::placeholder { color: var(--color-text-muted); }

.mf-search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow-blue);
    background: #fff;
}

.mf-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color var(--duration-fast);
}

.mf-search-input:focus + .mf-search-icon,
.mf-search-input:focus ~ .mf-search-icon { color: var(--accent-blue); }

.mf-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 420px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    border: 1px solid var(--color-border-light);
}

.mf-search-results.active { display: block; animation: slideDown 0.2s var(--ease-out); }

.mf-search-result-item {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background var(--duration-fast);
    border-bottom: 1px solid var(--color-border-light);
}

.mf-search-result-item:last-child { border-bottom: none; }
.mf-search-result-item:hover { background: var(--color-surface-alt); }

.mf-search-result-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--gradient-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.mf-search-result-info { flex: 1; min-width: 0; }

.mf-search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mf-search-result-meta {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    display: flex;
    gap: 12px;
    margin-top: 2px;
}

.mf-search-result-nav {
    font-weight: 600;
    color: var(--accent-green);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ---------- Navigation Tabs ---------- */
.mf-tabs {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--color-border-light);
    padding: 0;
    margin-bottom: var(--space-xl);
}

.mf-tabs-inner {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 4px;
    padding: var(--space-sm) 0;
}

.mf-tabs-inner::-webkit-scrollbar { display: none; }

.mf-tab {
    flex-shrink: 0;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    white-space: nowrap;
}

.mf-tab i { font-size: 1rem; }

.mf-tab:hover {
    color: var(--accent-blue);
    background: rgba(79,106,246,0.08);
}

.mf-tab.active {
    color: #fff;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm), 0 2px 12px rgba(79,106,246,0.3);
}

.mf-tab .tab-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.2);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mf-tab:not(.active) .tab-badge {
    background: var(--accent-orange);
    color: #fff;
}

/* ---------- Card System ---------- */
.mf-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-base) var(--ease-out);
    overflow: hidden;
}

.mf-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--color-border);
}

.mf-card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

.mf-card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mf-card-body { padding: var(--space-lg); }
.mf-card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-surface-alt);
}

/* ---------- Fund Card ---------- */
.mf-fund-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    padding: var(--space-lg);
    transition: all var(--duration-base) var(--ease-out);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.mf-fund-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--duration-base);
}

.mf-fund-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: rgba(79,106,246,0.3);
}

.mf-fund-card:hover::before { opacity: 1; }

.mf-fund-card-top {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.mf-fund-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gradient-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.7rem;
    color: var(--accent-blue);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mf-fund-info { flex: 1; min-width: 0; }

.mf-fund-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mf-fund-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.mf-fund-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mf-fund-category-tag.equity { background: #dbeafe; color: #1d4ed8; }
.mf-fund-category-tag.debt { background: #dcfce7; color: #15803d; }
.mf-fund-category-tag.hybrid { background: #fef3c7; color: #b45309; }
.mf-fund-category-tag.elss { background: #ede9fe; color: #6d28d9; }
.mf-fund-category-tag.index { background: #e0f2fe; color: #0369a1; }
.mf-fund-category-tag.liquid { background: #f0fdf4; color: #166534; }
.mf-fund-category-tag.other  { background: #f1f5f9; color: #64748b; }

.mf-fund-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.mf-metric {
    text-align: center;
    padding: var(--space-sm);
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
}

.mf-metric-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.mf-metric-value {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.mf-metric-value.positive { color: var(--accent-green); }
.mf-metric-value.negative { color: var(--accent-red); }
.mf-metric-value.neutral { color: var(--color-text); }

.mf-fund-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border-light);
}

/* ---------- Star Rating ---------- */
.mf-stars {
    display: inline-flex;
    gap: 2px;
}

.mf-stars i {
    font-size: 0.75rem;
    color: #e5e7eb;
}

.mf-stars i.filled { color: #f59e0b; }

/* ---------- Buttons ---------- */
.mf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.mf-btn:active { transform: scale(0.97); }

.mf-btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(79,106,246,0.3);
}

.mf-btn-primary:hover {
    box-shadow: 0 4px 20px rgba(79,106,246,0.45);
    transform: translateY(-1px);
}

.mf-btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.mf-btn-secondary:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(79,106,246,0.04);
}

.mf-btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    padding: 8px 12px;
}

.mf-btn-ghost:hover { color: var(--accent-blue); background: rgba(79,106,246,0.06); }

.mf-btn-success {
    background: var(--gradient-success);
    color: #fff;
}

.mf-btn-danger {
    background: var(--gradient-danger);
    color: #fff;
}

.mf-btn-gold {
    background: var(--gradient-gold);
    color: #000;
    font-weight: 700;
}

.mf-btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.mf-btn-lg { padding: 14px 28px; font-size: 1rem; }
.mf-btn-block { width: 100%; }
.mf-btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ---------- Grid Layouts ---------- */
.mf-grid {
    display: grid;
    gap: var(--space-lg);
}

.mf-grid-2 { grid-template-columns: repeat(2, 1fr); }
.mf-grid-3 { grid-template-columns: repeat(3, 1fr); }
.mf-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .mf-grid-4, .mf-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .mf-grid-4, .mf-grid-3, .mf-grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Section Headers ---------- */
.mf-section {
    margin-bottom: var(--space-2xl);
}

.mf-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.mf-section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.mf-section-title .icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
}

.mf-section-title .icon-circle.blue { background: var(--gradient-primary); }
.mf-section-title .icon-circle.green { background: var(--gradient-success); }
.mf-section-title .icon-circle.purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.mf-section-title .icon-circle.gold { background: var(--gradient-gold); }

/* ---------- Quick Filter Chips ---------- */
.mf-chips {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.mf-chip {
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.mf-chip:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(79,106,246,0.04);
}

.mf-chip.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(79,106,246,0.25);
}

/* ---------- Stats Row ---------- */
.mf-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.mf-stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    border: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all var(--duration-base) var(--ease-out);
}

.mf-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.mf-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.mf-stat-info { flex: 1; }

.mf-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--color-text);
    line-height: 1.2;
}

.mf-stat-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mf-stat-change {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mf-stat-change.up { color: var(--accent-green); }
.mf-stat-change.down { color: var(--accent-red); }

/* ---------- Loading States ---------- */
.mf-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.mf-skeleton-card {
    height: 220px;
    border-radius: var(--radius-lg);
}

.mf-skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.mf-skeleton-text.short { width: 40%; }
.mf-skeleton-text.medium { width: 70%; }

/* ---------- Data Status Banner ---------- */
.mf-data-banner {
    background: var(--gradient-primary);
    color: #fff;
    padding: 12px var(--space-lg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    animation: slideDown 0.3s var(--ease-out);
}

.mf-data-banner.success { background: var(--gradient-success); }
.mf-data-banner.error { background: var(--gradient-danger); }

.mf-data-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.mf-data-banner-right {
    font-weight: 700;
    font-size: 0.85rem;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Wizard Steps ---------- */
.mf-wizard {
    max-width: 800px;
    margin: 0 auto;
}

.mf-wizard-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--space-2xl);
}

.mf-wizard-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.mf-wizard-step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 3px;
    background: var(--color-border-light);
    transition: background var(--duration-slow);
}

.mf-wizard-step:last-child::after { display: none; }

.mf-wizard-step.completed::after { background: var(--accent-green); }

.mf-wizard-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    transition: all var(--duration-base) var(--ease-bounce);
    z-index: 1;
}

.mf-wizard-step.active .mf-wizard-step-circle {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-glow-blue);
    transform: scale(1.1);
}

.mf-wizard-step.completed .mf-wizard-step-circle {
    background: var(--accent-green);
    color: #fff;
}

.mf-wizard-step-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 8px;
    font-weight: 500;
    text-align: center;
}

.mf-wizard-step.active .mf-wizard-step-label { color: var(--accent-blue); font-weight: 600; }
.mf-wizard-step.completed .mf-wizard-step-label { color: var(--accent-green); }

.mf-wizard-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-light);
}

.mf-wizard-question {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    color: var(--color-text);
    text-align: center;
}

.mf-wizard-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.mf-wizard-option {
    padding: var(--space-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    text-align: center;
    background: var(--color-surface);
}

.mf-wizard-option:hover {
    border-color: var(--accent-blue);
    background: rgba(79,106,246,0.03);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.mf-wizard-option.selected {
    border-color: var(--accent-blue);
    background: rgba(79,106,246,0.06);
    box-shadow: 0 0 0 3px rgba(79,106,246,0.15);
}

.mf-wizard-option-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.mf-wizard-option-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.mf-wizard-option-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ---------- Fund Details Modal / Panel ---------- */
.mf-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 560px;
    max-width: 100vw;
    height: 100vh;
    background: var(--color-surface);
    box-shadow: -8px 0 48px rgba(0,0,0,0.12);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out);
    overflow-y: auto;
}

.mf-detail-panel.open { transform: translateX(0); }

.mf-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mf-detail-overlay.open { opacity: 1; pointer-events: auto; }

.mf-detail-header {
    padding: var(--space-lg);
    background: var(--gradient-hero);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mf-detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast);
}

.mf-detail-close:hover { background: rgba(255,255,255,0.3); }

.mf-detail-body { padding: var(--space-lg); }

.mf-detail-section {
    margin-bottom: var(--space-xl);
}

.mf-detail-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Scanner / Advanced Filters ---------- */
.mf-filter-sidebar {
    position: sticky;
    top: 80px;
}

.mf-filter-group {
    margin-bottom: var(--space-lg);
}

.mf-filter-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.mf-range-slider {
    position: relative;
    height: 4px;
    background: var(--color-border-light);
    border-radius: 2px;
    margin: var(--space-lg) 0;
}

.mf-range-track {
    position: absolute;
    height: 100%;
    background: var(--accent-blue);
    border-radius: 2px;
}

.mf-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent-blue);
    box-shadow: var(--shadow-sm);
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    transition: box-shadow var(--duration-fast);
}

.mf-range-thumb:hover { box-shadow: var(--shadow-glow-blue); }

/* ---------- Comparison Table ---------- */
.mf-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.mf-compare-table th {
    background: var(--color-surface-alt);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.mf-compare-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.mf-compare-table tbody tr:hover { background: var(--color-surface-alt); }

.mf-compare-table .fund-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
}

.mf-compare-table .return-cell {
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.mf-compare-table .return-cell.positive { color: var(--accent-green); }
.mf-compare-table .return-cell.negative { color: var(--accent-red); }

/* ---------- Watchlist ---------- */
.mf-watchlist-empty {
    text-align: center;
    padding: var(--space-3xl);
}

.mf-watchlist-empty i {
    font-size: 4rem;
    color: var(--color-border);
    margin-bottom: var(--space-md);
    display: block;
}

.mf-watchlist-empty h3 {
    font-size: 1.3rem;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.mf-watchlist-empty p {
    color: var(--color-text-muted);
    max-width: 360px;
    margin: 0 auto var(--space-lg);
}

/* ---------- Premium Banner ---------- */
.mf-premium-banner {
    background: var(--gradient-dark);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.mf-premium-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(245,158,11,0.2) 0%, transparent 70%);
}

.mf-premium-banner-content { z-index: 1; }

.mf-premium-banner-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.mf-premium-banner-desc {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
}

/* ---------- Scrollbar ---------- */
.mf-app ::-webkit-scrollbar { width: 6px; height: 6px; }
.mf-app ::-webkit-scrollbar-track { background: transparent; }
.mf-app ::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
.mf-app ::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ---------- Responsive Refinements ---------- */
@media (max-width: 768px) {
    .mf-hero { padding: var(--space-xl) 0 var(--space-2xl); }
    .mf-hero-title { font-size: 1.75rem; }
    .mf-hero-stats { gap: var(--space-md); }
    .mf-hero-stat-value { font-size: 1.3rem; }
    .mf-fund-metrics { grid-template-columns: repeat(2, 1fr); }
    .mf-section-title { font-size: 1.2rem; }
    .mf-wizard-card { padding: var(--space-lg); }
    .mf-detail-panel { width: 100%; }
    .mf-premium-banner { flex-direction: column; text-align: center; }
    .mf-stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .mf-fund-metrics { grid-template-columns: repeat(2, 1fr); }
    .mf-hero-stats { flex-wrap: wrap; }
    .mf-wizard-options { grid-template-columns: 1fr; }
    .mf-stats-row { grid-template-columns: 1fr; }
}

/* ---------- Mini Chart Sparkline ---------- */
.mf-sparkline {
    width: 80px;
    height: 30px;
    display: inline-block;
    vertical-align: middle;
}

.mf-sparkline svg { width: 100%; height: 100%; }

.mf-sparkline .line {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mf-sparkline .line.up { stroke: var(--accent-green); }
.mf-sparkline .line.down { stroke: var(--accent-red); }

.mf-sparkline .area {
    opacity: 0.1;
}

.mf-sparkline .area.up { fill: var(--accent-green); }
.mf-sparkline .area.down { fill: var(--accent-red); }

/* ---------- Tooltip ---------- */
.mf-tooltip {
    position: relative;
}

.mf-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--color-text);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all var(--duration-fast);
    z-index: 50;
}

.mf-tooltip:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------- Toast Notifications ---------- */
.mf-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.mf-toast {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: toastIn 0.4s var(--ease-out);
    pointer-events: auto;
    border-left: 4px solid;
    min-width: 300px;
    max-width: 420px;
}

.mf-toast.success { border-color: var(--accent-green); }
.mf-toast.error { border-color: var(--accent-red); }
.mf-toast.info { border-color: var(--accent-blue); }

.mf-toast.hide { animation: toastOut 0.3s var(--ease-out) forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mf-animate-in {
    animation: fadeInUp 0.5s var(--ease-out) both;
}

.mf-animate-in:nth-child(2) { animation-delay: 0.06s; }
.mf-animate-in:nth-child(3) { animation-delay: 0.12s; }
.mf-animate-in:nth-child(4) { animation-delay: 0.18s; }
.mf-animate-in:nth-child(5) { animation-delay: 0.24s; }
.mf-animate-in:nth-child(6) { animation-delay: 0.30s; }

/* ---------- Pulse Dot (Live indicator) ---------- */
.mf-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    display: inline-block;
    position: relative;
}

.mf-pulse-dot::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--accent-green);
    opacity: 0.4;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.8); opacity: 0; }
}

/* ---------- Empty State ---------- */
.mf-empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.mf-empty-state-icon {
    font-size: 4rem;
    color: var(--color-border);
    margin-bottom: var(--space-lg);
}

.mf-empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.mf-empty-state p {
    color: var(--color-text-muted);
    max-width: 400px;
    margin: 0 auto var(--space-lg);
}

/* ---------- Charts Area ---------- */
.mf-chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

/* ---------- Number Counter Animation ---------- */
.mf-counter {
    display: inline-block;
    transition: all 0.6s var(--ease-out);
}

/* ---------- Back to top ---------- */
.mf-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--duration-base) var(--ease-out);
    z-index: 90;
}

.mf-back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.mf-back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow-blue);
}
