/* ===========================
   WEALTH TIMELINE VISUALIZER
   Custom styles for the investment growth calculator
   =========================== */

/* ===========================
   CSS VARIABLES
   =========================== */

:root {
    /* Light Mode Colors */
    --wealth-bg: #ffffff;
    --wealth-surface: #f8fafc;
    --wealth-surface-elevated: #ffffff;
    --wealth-text-primary: #0f172a;
    --wealth-text-secondary: #64748b;
    --wealth-text-muted: #94a3b8;
    --wealth-border: #e2e8f0;
    --wealth-border-light: #f1f5f9;

    /* Risk Profile Colors */
    --risk-conservative: #3b82f6;
    --risk-balanced: #10b981;
    --risk-moderate: #f59e0b;
    --risk-aggressive: #ef4444;

    /* Accent Colors */
    --wealth-accent: #4338ca;
    --wealth-accent-light: #6366f1;
    --wealth-success: #10b981;
    --wealth-warning: #f59e0b;
    --wealth-danger: #ef4444;

    /* Chart Colors */
    --chart-grid: #e2e8f0;
    --chart-text: #64748b;
    --chart-tooltip-bg: #ffffff;
    --chart-tooltip-border: #e2e8f0;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Dark Mode - Comprehensive styling to match education calculator */
body.wealth-timeline-page.dark-mode {
    background: radial-gradient(circle at 20% 20%, rgba(100, 197, 255, 0.08) 0%, transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(91, 123, 255, 0.12) 0%, transparent 32%),
                linear-gradient(160deg, #0a0f1f 0%, #0b132b 40%, #0b1226 100%);
    color: #e5e7eb;
}

body.wealth-timeline-page.dark-mode .wealth-card,
body.wealth-timeline-page.dark-mode .hero-card,
body.wealth-timeline-page.dark-mode .comparison-card,
body.wealth-timeline-page.dark-mode .chart-card {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(91, 123, 255, 0.3);
    color: #e5e7eb;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.wealth-timeline-page.dark-mode h1,
body.wealth-timeline-page.dark-mode h2,
body.wealth-timeline-page.dark-mode h3,
body.wealth-timeline-page.dark-mode h4 {
    color: #f9fafb !important;
}

body.wealth-timeline-page.dark-mode p,
body.wealth-timeline-page.dark-mode .label,
body.wealth-timeline-page.dark-mode .field label {
    color: #e5e7eb;
}

body.wealth-timeline-page.dark-mode .muted,
body.wealth-timeline-page.dark-mode .hint {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .lead,
body.wealth-timeline-page.dark-mode .section-subtitle {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .input-affix {
    background: rgba(11, 19, 43, 0.6);
    border-color: rgba(91, 123, 255, 0.3);
}

body.wealth-timeline-page.dark-mode .input-affix input {
    color: #ffffff;
}

body.wealth-timeline-page.dark-mode .input-affix span {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .scenario-btn,
body.wealth-timeline-page.dark-mode .ghost-btn {
    background: rgba(11, 19, 43, 0.8);
    border-color: rgba(91, 123, 255, 0.4);
    color: #f9fafb;
}

body.wealth-timeline-page.dark-mode .scenario-btn:hover,
body.wealth-timeline-page.dark-mode .ghost-btn:hover {
    background: #5b7bff;
    border-color: #5b7bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 123, 255, 0.5);
}

body.wealth-timeline-page.dark-mode .scenario-btn i {
    color: #7c96ff;
}

body.wealth-timeline-page.dark-mode .scenario-btn:hover i {
    color: white;
}

body.wealth-timeline-page.dark-mode .btn-primary {
    background: #5b7bff;
    border-color: #5b7bff;
    color: white;
}

body.wealth-timeline-page.dark-mode .btn-primary:hover {
    background: #7c96ff;
    border-color: #7c96ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 123, 255, 0.5);
}

body.wealth-timeline-page.dark-mode .risk-btn {
    background: rgba(11, 19, 43, 0.6);
    border-color: rgba(91, 123, 255, 0.3);
}

body.wealth-timeline-page.dark-mode .risk-btn .risk-info h4 {
    color: #f9fafb !important;
}

body.wealth-timeline-page.dark-mode .risk-btn .risk-info .allocation {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .risk-btn .risk-info .return {
    color: #9ca3af;
}

body.wealth-timeline-page.dark-mode .risk-btn:hover {
    border-color: #5b7bff;
}

body.wealth-timeline-page.dark-mode .risk-btn.active {
    background: #5b7bff;
    border-color: #5b7bff;
}

body.wealth-timeline-page.dark-mode .risk-btn.active .risk-info h4,
body.wealth-timeline-page.dark-mode .risk-btn.active .risk-info .allocation,
body.wealth-timeline-page.dark-mode .risk-btn.active .risk-info .return {
    color: white !important;
}

body.wealth-timeline-page.dark-mode .risk-icon {
    background: rgba(31, 41, 55, 0.7);
}

body.wealth-timeline-page.dark-mode .risk-btn.active .risk-icon {
    background: rgba(255, 255, 255, 0.25);
}

body.wealth-timeline-page.dark-mode .summary-metrics {
    background: rgba(11, 19, 43, 0.7);
    border: 1px solid rgba(91, 123, 255, 0.2);
}

body.wealth-timeline-page.dark-mode .metric-value {
    color: #ffffff !important;
}

body.wealth-timeline-page.dark-mode .metric-value.growth-accent {
    color: #34d399 !important;
}

body.wealth-timeline-page.dark-mode .metric .label {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .metric .hint {
    color: #9ca3af;
}

body.wealth-timeline-page.dark-mode .milestone {
    background: #0b132b;
    border-color: #1f2937;
}

body.wealth-timeline-page.dark-mode .hero-number,
body.wealth-timeline-page.dark-mode .hero-subnumber {
    color: #ffffff !important;
}

body.wealth-timeline-page.dark-mode .hero-meta {
    color: #d1d5db !important;
}

body.wealth-timeline-page.dark-mode .hero-card {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(91, 123, 255, 0.4);
    box-shadow: 0 8px 32px rgba(91, 123, 255, 0.2);
}

body.wealth-timeline-page.dark-mode .hero-kicker {
    color: #7c96ff;
}

body.wealth-timeline-page.dark-mode .eyebrow {
    color: #7c96ff;
}

body.wealth-timeline-page.dark-mode .early-bird-section,
body.wealth-timeline-page.dark-mode .education-section {
    background: #0b132b;
}

body.wealth-timeline-page.dark-mode .comparison-chart-container {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(91, 123, 255, 0.3);
}

body.wealth-timeline-page.dark-mode .comparison-card h3 {
    color: #f9fafb !important;
}

body.wealth-timeline-page.dark-mode .invest-amount,
body.wealth-timeline-page.dark-mode .invest-period {
    color: #e5e7eb;
}

body.wealth-timeline-page.dark-mode .then-stop {
    color: #9ca3af;
}

body.wealth-timeline-page.dark-mode .guidance-list li {
    border-bottom-color: rgba(91, 123, 255, 0.2);
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .guidance-list strong {
    color: #f9fafb;
}

body.wealth-timeline-page.dark-mode .disclaimer-box {
    background: rgba(11, 19, 43, 0.7);
    border-color: rgba(91, 123, 255, 0.3);
}

body.wealth-timeline-page.dark-mode .disclaimer-box h4 {
    color: #f9fafb !important;
}

body.wealth-timeline-page.dark-mode .disclaimer-box p {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .total-invested {
    background: rgba(11, 19, 43, 0.7);
}

body.wealth-timeline-page.dark-mode .total-invested .label {
    color: #9ca3af;
}

body.wealth-timeline-page.dark-mode .total-invested .value {
    color: #f9fafb;
}

body.wealth-timeline-page.dark-mode .floating-steps {
    background: #0b132b;
    border-color: #1f2937;
}

body.wealth-timeline-page.dark-mode .icon-btn {
    background: rgba(11, 19, 43, 0.8);
    border-color: rgba(91, 123, 255, 0.4);
    color: #7c96ff;
}

body.wealth-timeline-page.dark-mode .icon-btn:hover {
    background: #5b7bff;
    border-color: #5b7bff;
    color: white;
    box-shadow: 0 4px 12px rgba(91, 123, 255, 0.4);
}

body.wealth-timeline-page.dark-mode input[type="range"] {
    background: rgba(31, 41, 55, 0.7);
}

body.wealth-timeline-page.dark-mode .slider-container output {
    color: #7c96ff;
    font-weight: 800;
}

body.wealth-timeline-page.dark-mode .disclaimer-section {
    background: #0a0f1f;
}

body.wealth-timeline-page.dark-mode .vs-divider {
    background: #5b7bff;
    box-shadow: 0 4px 16px rgba(91, 123, 255, 0.4);
}

body.wealth-timeline-page.dark-mode .hero-chips .chip {
    background: rgba(11, 19, 43, 0.8);
    border-color: rgba(91, 123, 255, 0.3);
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .hero-chips .chip i {
    color: #7c96ff;
}

body.wealth-timeline-page.dark-mode .milestone-markers {
    background: rgba(11, 19, 43, 0.6);
    border: 1px solid rgba(91, 123, 255, 0.2);
}

body.wealth-timeline-page.dark-mode .milestone {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(91, 123, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.wealth-timeline-page.dark-mode .milestone-text {
    color: #ffffff !important;
}

body.wealth-timeline-page.dark-mode .milestone-age {
    color: #d1d5db;
}

body.wealth-timeline-page.dark-mode .milestone-icon {
    filter: brightness(1.2);
}

body.wealth-timeline-page.dark-mode .section-kicker {
    color: #7c96ff;
}

body.wealth-timeline-page.dark-mode .card-badge {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.wealth-timeline-page.dark-mode .result-box {
    box-shadow: 0 4px 16px rgba(91, 123, 255, 0.3);
}

body.wealth-timeline-page.dark-mode .result-label {
    color: rgba(255, 255, 255, 0.95);
}

body.wealth-timeline-page.dark-mode .result-value {
    color: white;
}

body.wealth-timeline-page.dark-mode .insight-box i {
    color: #f59e0b;
}

body.wealth-timeline-page.dark-mode .insight-box p {
    color: #f9fafb;
}

body.wealth-timeline-page.dark-mode .insight-box strong {
    color: #ffffff;
}

body.wealth-timeline-page.dark-mode .wealth-hero {
    background: transparent;
}

body.wealth-timeline-page.dark-mode .calculator-shell {
    background: transparent;
}

body.wealth-timeline-page.dark-mode .early-bird-section {
    background: rgba(11, 19, 43, 0.3);
}

body.wealth-timeline-page.dark-mode .education-section {
    background: transparent;
}

body.wealth-timeline-page.dark-mode .card-header .muted {
    color: #9ca3af;
}

/* Smooth transitions for theme switching */
.wealth-timeline-page,
.wealth-timeline-page * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===========================
   MOBILE OPTIMIZATIONS
   =========================== */

/* Smooth scrolling for all browsers */
html {
    scroll-behavior: smooth;
}

/* Improve touch interactions */
@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices specifically */

    /* Remove hover effects on touch devices */
    .btn:hover,
    .ghost-btn:hover,
    .scenario-btn:hover,
    .risk-btn:hover,
    .icon-btn:hover {
        transform: none;
    }

    /* Add active states instead for touch feedback */
    .btn:active,
    .ghost-btn:active,
    .scenario-btn:active,
    .icon-btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    .risk-btn:active {
        transform: translateY(0);
        opacity: 0.9;
    }

    /* Improve scrolling performance */
    .timeline-chart-container,
    .comparison-chart-container {
        -webkit-overflow-scrolling: touch;
    }

    /* Better tap highlight */
    button, a {
        -webkit-tap-highlight-color: rgba(67, 56, 202, 0.1);
    }
}

/* Improve scrollbar on mobile webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--wealth-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--wealth-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--wealth-accent);
}

/* ===========================
   HERO SECTION
   =========================== */

.wealth-hero {
    background: linear-gradient(135deg, var(--wealth-surface) 0%, var(--wealth-bg) 100%);
    padding: 4rem 0 3rem;
    position: relative;
    overflow: hidden;
}

.wealth-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--wealth-accent-light) 0%, transparent 70%);
    opacity: 0.05;
    border-radius: 50%;
    pointer-events: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wealth-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.wealth-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--wealth-text-primary);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.wealth-hero .lead {
    font-size: 1.125rem;
    color: var(--wealth-text-secondary);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.hero-chips .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--wealth-surface);
    border: 1px solid var(--wealth-border);
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--wealth-text-secondary);
    font-weight: 500;
}

.hero-chips .chip i {
    color: var(--wealth-accent);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-card {
    background: var(--wealth-surface-elevated);
    border: 1px solid var(--wealth-border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.hero-card .eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wealth-text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.hero-card h3 {
    font-size: 1.25rem;
    color: var(--wealth-text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.hero-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--wealth-accent);
    margin-bottom: 1.5rem;
    line-height: 1;
}

.hero-subgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--wealth-border);
    margin-bottom: 1rem;
}

.hero-subgrid .label {
    font-size: 0.875rem;
    color: var(--wealth-text-muted);
    margin-bottom: 0.25rem;
}

.hero-subnumber {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wealth-text-primary);
}

.hero-meta {
    font-size: 0.875rem;
    color: var(--wealth-text-muted);
    font-style: italic;
}

/* ===========================
   FLOATING STEPS SIDEBAR
   =========================== */

.floating-steps {
    display: none; /* Hidden by default - was covering content */
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    background: var(--wealth-surface-elevated);
    border: 1px solid var(--wealth-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    z-index: 100;
    max-width: 280px;
}

.steps-title {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.steps-title i {
    font-size: 1.5rem;
    color: var(--wealth-accent);
}

.steps-title .eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--wealth-text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.steps-title strong {
    font-size: 0.875rem;
    color: var(--wealth-text-primary);
    font-weight: 600;
}

.steps-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.small-ghost {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ===========================
   CALCULATOR SECTION
   =========================== */

.calculator-shell {
    padding: 4rem 0;
    background: var(--wealth-bg);
}

.calculator-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
}

.wealth-card {
    background: var(--wealth-surface-elevated);
    border: 1px solid var(--wealth-border);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-header .eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wealth-accent);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--wealth-text-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-header .muted {
    font-size: 0.875rem;
    color: var(--wealth-text-muted);
    line-height: 1.5;
}

/* ===========================
   INPUT CONTROLS
   =========================== */

.input-grid {
    display: grid;
    gap: 1.5rem;
}

.field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wealth-text-primary);
    margin-bottom: 0.75rem;
}

.tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--wealth-text-muted);
    color: var(--wealth-bg);
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 700;
    cursor: help;
    position: relative;
}

.tip::before {
    content: '?';
}

/* Tooltip container with arrow using clip-path */
.tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--wealth-text-primary);
    color: var(--wealth-bg);
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.6;
    white-space: normal;
    width: min(320px, calc(100vw - 2rem));
    max-width: 90vw;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: left;
}

/* Tooltip arrow using border trick on after element with filter */
.tip::after {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Add small triangle pointer below tooltip */
.tip[data-tip]::after {
    /* Create arrow using a rotated square with clip-path */
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 -8px 0 0 var(--wealth-text-primary);
    clip-path: polygon(
        0 0,
        100% 0,
        100% calc(100% - 8px),
        calc(50% + 8px) calc(100% - 8px),
        50% 100%,
        calc(50% - 8px) calc(100% - 8px),
        0 calc(100% - 8px)
    );
    padding-bottom: calc(1rem + 8px);
}

/* Show tooltip on hover */
.tip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Dark mode tooltip styles */
body.wealth-timeline-page.dark-mode .tip::after {
    background: rgba(15, 23, 42, 0.98);
    color: #ffffff;
    border: 1px solid rgba(91, 123, 255, 0.4);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(91, 123, 255, 0.2),
        0 -8px 0 0 rgba(15, 23, 42, 0.98);
}

body.wealth-timeline-page.dark-mode .tip {
    background: #5b7bff;
    color: white;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--wealth-border);
    outline: none;
    -webkit-appearance: none;
    /* Increase touch area for mobile */
    padding: 8px 0;
    cursor: pointer;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wealth-accent);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover,
.slider-container input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.4);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wealth-accent);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider-container input[type="range"]::-moz-range-thumb:hover,
.slider-container input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.4);
}

.slider-container output {
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    color: var(--wealth-accent);
    font-size: 1.125rem;
}

.input-affix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--wealth-surface);
    border: 1px solid var(--wealth-border);
    border-radius: 0.5rem;
}

.input-affix span {
    color: var(--wealth-text-muted);
    font-weight: 600;
}

.input-affix input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--wealth-text-primary);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    /* Prevent zoom on iOS when focusing input */
    font-size: max(1rem, 16px);
}

/* Prevent iOS from zooming on input focus */
@media screen and (max-width: 768px) {
    .input-affix input,
    input[type="number"],
    input[type="text"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ===========================
   RISK PROFILE SELECTOR
   =========================== */

.risk-selector {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.risk-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--wealth-surface);
    border: 2px solid var(--wealth-border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.risk-btn:hover {
    border-color: var(--wealth-accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.risk-btn.active {
    border-color: var(--wealth-accent);
    background: var(--wealth-accent);
    color: white;
}

.risk-btn.active .risk-info h4,
.risk-btn.active .risk-info p {
    color: white;
}

.risk-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wealth-border-light);
    border-radius: 0.5rem;
    font-size: 1.5rem;
}

.risk-btn.active .risk-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.risk-btn[data-risk="conservative"] .risk-icon { color: var(--risk-conservative); }
.risk-btn[data-risk="balanced"] .risk-icon { color: var(--risk-balanced); }
.risk-btn[data-risk="moderate"] .risk-icon { color: var(--risk-moderate); }
.risk-btn[data-risk="aggressive"] .risk-icon { color: var(--risk-aggressive); }

.risk-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--wealth-text-primary);
    margin-bottom: 0.25rem;
}

.risk-info .allocation {
    font-size: 0.875rem;
    color: var(--wealth-text-secondary);
    margin-bottom: 0.125rem;
}

.risk-info .return {
    font-size: 0.75rem;
    color: var(--wealth-text-muted);
    font-weight: 600;
}

.risk-visual {
    max-width: 300px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* ===========================
   SCENARIO BUTTONS
   =========================== */

.scenario-buttons {
    display: grid;
    gap: 0.75rem;
}

.scenario-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--wealth-surface);
    border: 1px solid var(--wealth-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--wealth-text-primary);
    font-weight: 500;
    text-align: left;
    width: 100%;
}

.scenario-btn:hover {
    background: var(--wealth-accent);
    color: white;
    border-color: var(--wealth-accent);
    transform: translateX(4px);
}

.scenario-btn i {
    font-size: 1.25rem;
    color: var(--wealth-accent);
}

.scenario-btn:hover i {
    color: white;
}

/* ===========================
   CHART CARD
   =========================== */

.chart-card {
    position: sticky;
    top: 2rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wealth-surface);
    border: 1px solid var(--wealth-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--wealth-text-secondary);
}

.icon-btn:hover {
    background: var(--wealth-accent);
    color: white;
    border-color: var(--wealth-accent);
}

.timeline-chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 2rem;
}

.milestone-markers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--wealth-surface);
    border-radius: 0.5rem;
}

.milestone {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--wealth-bg);
    border: 1px solid var(--wealth-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.milestone-icon {
    font-size: 1rem;
}

.milestone-text {
    font-weight: 600;
    color: var(--wealth-text-primary);
}

.milestone-age {
    color: var(--wealth-text-muted);
    font-size: 0.75rem;
}

/* ===========================
   SUMMARY METRICS
   =========================== */

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--wealth-surface);
    border-radius: 0.75rem;
}

.metric {
    text-align: center;
}

.metric .label {
    font-size: 0.875rem;
    color: var(--wealth-text-muted);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--wealth-text-primary);
    margin-bottom: 0.25rem;
    line-height: 1;
}

.metric-value.growth-accent {
    color: var(--wealth-success);
}

.metric .hint {
    font-size: 0.75rem;
    color: var(--wealth-text-muted);
}

.action-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-row .btn,
.action-row .ghost-btn {
    flex: 1;
    min-width: 180px;
    justify-content: center;
}

/* ===========================
   EARLY BIRD SECTION
   =========================== */

.early-bird-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--wealth-surface) 0%, var(--wealth-bg) 100%);
}

.early-bird-risk-selector {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: center;
}

.early-bird-risk-selector .risk-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wealth-text-secondary);
    margin-bottom: 1rem;
}

.risk-button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.risk-toggle-btn {
    padding: 0.75rem 1.5rem;
    background: var(--wealth-surface-elevated);
    border: 2px solid var(--wealth-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wealth-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.risk-toggle-btn:hover {
    border-color: var(--wealth-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.risk-toggle-btn.active {
    background: var(--wealth-accent);
    border-color: var(--wealth-accent);
    color: white;
}

body.wealth-timeline-page.dark-mode .risk-toggle-btn {
    background: rgba(11, 19, 43, 0.8);
    border-color: rgba(91, 123, 255, 0.4);
    color: #f9fafb;
}

body.wealth-timeline-page.dark-mode .risk-toggle-btn:hover {
    border-color: #5b7bff;
    box-shadow: 0 4px 12px rgba(91, 123, 255, 0.3);
}

body.wealth-timeline-page.dark-mode .risk-toggle-btn.active {
    background: #5b7bff;
    border-color: #5b7bff;
    color: white;
    box-shadow: 0 4px 16px rgba(91, 123, 255, 0.5);
}

body.wealth-timeline-page.dark-mode .risk-label {
    color: #d1d5db;
}

.section-header-centered {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 4rem;
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wealth-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.section-header-centered h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--wealth-text-primary);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--wealth-text-secondary);
    line-height: 1.7;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 3rem;
}

.comparison-card {
    background: var(--wealth-surface-elevated);
    border: 2px solid var(--wealth-border);
    border-radius: 1rem;
    padding: 2rem;
    position: relative;
}

.comparison-card.early-bird {
    border-color: var(--wealth-success);
}

.comparison-card.late-bloomer {
    border-color: var(--wealth-warning);
}

.card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--wealth-accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
}

.comparison-card.early-bird .card-badge {
    background: var(--wealth-success);
}

.comparison-card.late-bloomer .card-badge {
    background: var(--wealth-warning);
}

.comparison-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wealth-text-primary);
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
}

.comparison-details {
    margin-bottom: 1.5rem;
}

.invest-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--wealth-text-primary);
    margin-bottom: 0.5rem;
}

.invest-period {
    font-size: 0.875rem;
    color: var(--wealth-text-secondary);
    margin-bottom: 0.25rem;
}

.then-stop {
    font-size: 0.875rem;
    color: var(--wealth-text-muted);
    font-style: italic;
    margin-bottom: 1rem;
}

.then-stop.invisible {
    visibility: hidden;
}

.total-invested {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--wealth-surface);
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.total-invested .label {
    font-size: 0.875rem;
    color: var(--wealth-text-muted);
    font-weight: 600;
}

.total-invested .value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--wealth-text-primary);
}

.result-box {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--wealth-accent) 0%, var(--wealth-accent-light) 100%);
    border-radius: 0.75rem;
    text-align: center;
}

.result-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--wealth-accent);
    color: white;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: 900;
    box-shadow: var(--shadow-lg);
}

.insight-box {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 2rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 1rem;
    margin-bottom: 3rem;
}

.dark-mode .insight-box {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.1) 0%, rgba(253, 230, 138, 0.1) 100%);
    border-color: var(--wealth-warning);
}

.insight-box i {
    font-size: 2rem;
    color: #f59e0b;
}

.insight-box p {
    font-size: 1rem;
    color: #92400e;
    line-height: 1.7;
}

.dark-mode .insight-box p {
    color: var(--wealth-text-primary);
}

.comparison-chart-container {
    position: relative;
    height: 400px;
    background: var(--wealth-surface-elevated);
    border: 1px solid var(--wealth-border);
    border-radius: 1rem;
    padding: 2rem;
}

/* ===========================
   EDUCATION SECTION
   =========================== */

.education-section {
    padding: 4rem 0;
    background: var(--wealth-bg);
}

.education-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.guidance-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guidance-list li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--wealth-border);
    color: var(--wealth-text-secondary);
    line-height: 1.7;
}

.guidance-list li:last-child {
    border-bottom: none;
}

.guidance-list strong {
    color: var(--wealth-text-primary);
    font-weight: 600;
}

/* ===========================
   DISCLAIMER SECTION
   =========================== */

.disclaimer-section {
    padding: 3rem 0 5rem;
    background: var(--wealth-surface);
}

.disclaimer-box {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--wealth-bg);
    border: 1px solid var(--wealth-border);
    border-radius: 1rem;
    align-items: flex-start;
}

.disclaimer-box i {
    font-size: 2rem;
    color: var(--wealth-accent);
    flex-shrink: 0;
}

.disclaimer-box h4 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--wealth-text-primary);
    margin-bottom: 0.5rem;
}

.disclaimer-box p {
    font-size: 0.875rem;
    color: var(--wealth-text-secondary);
    line-height: 1.7;
}

/* ===========================
   BUTTONS
   =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--wealth-accent);
    color: white;
    border: 2px solid var(--wealth-accent);
}

.btn-primary:hover {
    background: var(--wealth-accent-light);
    border-color: var(--wealth-accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ghost-btn {
    background: var(--wealth-surface);
    color: var(--wealth-text-primary);
    border: 2px solid var(--wealth-border);
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ghost-btn:hover {
    background: var(--wealth-accent);
    color: white;
    border-color: var(--wealth-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 1280px) {
    .floating-steps {
        display: none;
    }
}

@media (max-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .chart-card {
        position: static;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .vs-divider {
        margin: 0 auto;
    }

    .education-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .wealth-hero h1 {
        font-size: 2rem;
    }

    .hero-number {
        font-size: 2rem;
    }

    .summary-metrics {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .section-header-centered h2 {
        font-size: 1.75rem;
    }

    .result-value {
        font-size: 1.75rem;
    }

    .action-row {
        flex-direction: column;
    }

    .action-row .btn,
    .action-row .ghost-btn {
        width: 100%;
        justify-content: center;
    }

    /* Responsive chart heights */
    .timeline-chart-container {
        height: 300px;
    }

    .comparison-chart-container {
        height: 300px;
    }

    /* Better spacing for cards */
    .wealth-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Improve button sizes for touch */
    .btn,
    .ghost-btn,
    .scenario-btn,
    .risk-btn {
        min-height: 44px;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
    }

    /* Better risk button layout */
    .risk-btn {
        padding: 1.25rem 1rem;
    }

    /* Chip layout improvements */
    .hero-chips {
        gap: 0.5rem;
    }

    .hero-chips .chip {
        font-size: 0.8125rem;
        padding: 0.5rem 0.875rem;
    }

    /* Better milestone marker wrapping */
    .milestone-markers {
        gap: 0.5rem;
    }

    .milestone {
        flex: 1 1 auto;
        min-width: calc(50% - 0.25rem);
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
    }

    /* Optimize comparison grid spacing */
    .comparison-grid {
        gap: 1.5rem;
    }

    .vs-divider {
        margin: 1rem auto;
    }
}

@media (max-width: 480px) {
    .wealth-hero {
        padding: 2rem 0;
    }

    .calculator-shell {
        padding: 2rem 0;
    }

    .early-bird-section {
        padding: 3rem 0;
    }

    .wealth-card {
        padding: 1.5rem;
    }

    .hero-card {
        padding: 1.5rem;
    }

    /* Further reduce font sizes for very small screens */
    .wealth-hero h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .hero-number {
        font-size: 1.75rem;
    }

    .hero-subnumber {
        font-size: 1.25rem;
    }

    .card-header h2 {
        font-size: 1.25rem;
    }

    /* Optimize input fields */
    .input-affix {
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
    }

    .input-affix input {
        font-size: 0.875rem;
    }

    .input-affix span {
        font-size: 0.875rem;
    }

    /* Better scenario buttons */
    .scenario-btn {
        font-size: 0.875rem;
        padding: 0.875rem;
        gap: 0.625rem;
    }

    .scenario-btn i {
        font-size: 1rem;
    }

    /* Optimize comparison cards */
    .comparison-card h3 {
        font-size: 1.25rem;
    }

    .invest-amount {
        font-size: 1rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    /* Better risk profile buttons */
    .risk-btn .risk-info h4 {
        font-size: 0.9375rem;
    }

    .risk-btn .risk-info .allocation {
        font-size: 0.8125rem;
    }

    .risk-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    /* Optimize hero chips to wrap better */
    .hero-chips .chip {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    /* Smaller chart heights for very small screens */
    .timeline-chart-container {
        height: 250px;
    }

    .comparison-chart-container {
        height: 250px;
    }

    .risk-visual {
        max-width: 200px;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    /* Ultra compact layout */
    .wealth-hero h1 {
        font-size: 1.5rem;
    }

    .hero-number {
        font-size: 1.5rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .result-value {
        font-size: 1.375rem;
    }

    /* Ensure cards don't have excessive padding */
    .wealth-card,
    .hero-card {
        padding: 1.25rem;
    }

    /* Tighter spacing for summary metrics */
    .summary-metrics {
        padding: 1rem;
        gap: 0.75rem;
    }

    /* Optimize button text */
    .btn,
    .ghost-btn {
        font-size: 0.875rem;
        padding: 0.75rem 1.25rem;
    }

    /* Smaller milestones */
    .milestone {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .milestone-icon {
        font-size: 0.875rem;
    }

    /* Compact risk toggle buttons */
    .risk-toggle-btn {
        font-size: 0.8125rem;
        padding: 0.625rem 1rem;
    }

    /* Optimize card badges */
    .card-badge {
        font-size: 0.6875rem;
        padding: 0.375rem 0.75rem;
    }

    /* Smaller VS divider */
    .vs-divider {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }

    /* Reduce chart heights further */
    .timeline-chart-container,
    .comparison-chart-container {
        height: 220px;
    }

    /* Optimize input sliders */
    .slider-container output {
        font-size: 1rem;
        min-width: 40px;
    }

    /* Tighter field spacing */
    .input-grid {
        gap: 1.25rem;
    }

    /* Compact section headers */
    .section-header-centered h2 {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }
}

/* Landscape mode on mobile devices */
@media (max-width: 900px) and (orientation: landscape) {
    .timeline-chart-container {
        height: 250px;
    }

    .comparison-chart-container {
        height: 250px;
    }

    .hero-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .wealth-hero h1 {
        font-size: 1.75rem;
    }
}
