AndyKandy26 commited on
Commit
3fac8c0
·
verified ·
1 Parent(s): 2a60f7b

Delete calculators.html

Browse files
Files changed (1) hide show
  1. calculators.html +0 -905
calculators.html DELETED
@@ -1,905 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>FinWise — Calculators</title>
7
- <link rel="stylesheet" href="shared.css">
8
- <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
9
- <style>
10
- .calc-tabs {
11
- display: flex;
12
- gap: 8px;
13
- flex-wrap: wrap;
14
- margin-bottom: 28px;
15
- }
16
- .calc-tab {
17
- display: flex;
18
- align-items: center;
19
- gap: 8px;
20
- padding: 12px 20px;
21
- border-radius: var(--r);
22
- border: 1px solid var(--border);
23
- background: var(--card);
24
- color: var(--text2);
25
- font-family: var(--font-body);
26
- font-size: 14px;
27
- font-weight: 600;
28
- cursor: pointer;
29
- transition: all var(--transition);
30
- white-space: nowrap;
31
- }
32
- .calc-tab:hover { border-color: var(--border2); color: var(--text); transform: translateY(-1px); }
33
- .calc-tab.active {
34
- border-color: var(--cyan);
35
- background: rgba(34,211,238,0.08);
36
- color: var(--cyan);
37
- box-shadow: var(--glow-c);
38
- }
39
- .calc-tab-icon { font-size: 20px; }
40
-
41
- .calc-panel { display: none; }
42
- .calc-panel.active { display: block; }
43
-
44
- .result-hero {
45
- text-align: center;
46
- padding: 32px 20px;
47
- background: linear-gradient(135deg, rgba(34,211,238,0.06), rgba(16,185,129,0.04));
48
- border: 1px solid var(--border2);
49
- border-radius: var(--r-lg);
50
- margin-bottom: 24px;
51
- position: relative;
52
- overflow: hidden;
53
- }
54
- .result-hero::before {
55
- content: '';
56
- position: absolute;
57
- width: 300px; height: 300px;
58
- border-radius: 50%;
59
- background: radial-gradient(circle, rgba(34,211,238,0.06) 0%, transparent 70%);
60
- top: -100px; left: 50%;
61
- transform: translateX(-50%);
62
- }
63
- .result-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text2); font-weight: 700; }
64
- .result-value { font-family: var(--font-head); font-size: 52px; font-weight: 800; line-height: 1; margin: 12px 0; }
65
- .result-value.positive { color: var(--emerald); }
66
- .result-sub { font-size: 14px; color: var(--text2); }
67
-
68
- .result-breakdown {
69
- display: grid;
70
- grid-template-columns: repeat(3,1fr);
71
- gap: 12px;
72
- margin-bottom: 24px;
73
- }
74
- .rb-box {
75
- background: var(--bg3);
76
- border-radius: var(--r-sm);
77
- padding: 14px;
78
- text-align: center;
79
- }
80
- .rb-box-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); margin-bottom: 6px; font-weight: 700; }
81
- .rb-box-val { font-family: var(--font-head); font-size: 20px; font-weight: 800; }
82
-
83
- .chart-panel { height: 260px; position: relative; }
84
-
85
- .input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
86
- @media (max-width: 600px) { .input-row { grid-template-columns: 1fr; } .result-breakdown { grid-template-columns: 1fr 1fr; } }
87
-
88
- .preset-pills {
89
- display: flex;
90
- gap: 6px;
91
- flex-wrap: wrap;
92
- margin-bottom: 8px;
93
- }
94
- .preset-pill {
95
- padding: 4px 10px;
96
- border-radius: 100px;
97
- border: 1px solid var(--border2);
98
- background: transparent;
99
- color: var(--text2);
100
- font-size: 12px;
101
- font-weight: 600;
102
- cursor: pointer;
103
- font-family: var(--font-body);
104
- transition: all var(--transition);
105
- }
106
- .preset-pill:hover { border-color: var(--cyan); color: var(--cyan); }
107
- .preset-pill.active { background: rgba(34,211,238,0.1); border-color: var(--cyan); color: var(--cyan); }
108
-
109
- .milestone-grid {
110
- display: grid;
111
- grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
112
- gap: 10px;
113
- margin-top: 16px;
114
- }
115
- .milestone-card {
116
- background: var(--bg3);
117
- border: 1px solid var(--border);
118
- border-radius: var(--r-sm);
119
- padding: 14px;
120
- text-align: center;
121
- transition: all var(--transition);
122
- }
123
- .milestone-card.reached {
124
- border-color: var(--emerald);
125
- background: rgba(16,185,129,0.07);
126
- }
127
- .milestone-card.reached .ms-icon { filter: none; }
128
- .milestone-icon { font-size: 28px; margin-bottom: 6px; filter: grayscale(0.7); }
129
- .milestone-val { font-family: var(--font-head); font-size: 18px; font-weight: 800; margin-bottom: 4px; }
130
- .milestone-lbl { font-size: 11px; color: var(--text2); }
131
- .milestone-yr { font-size: 10px; color: var(--emerald); margin-top: 4px; font-weight: 700; }
132
-
133
- .compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top:16px; }
134
- .compare-box {
135
- background: var(--bg3);
136
- border-radius: var(--r-sm);
137
- padding: 16px;
138
- text-align: center;
139
- border: 1px solid var(--border);
140
- }
141
- .cb-label { font-size: 12px; color: var(--text2); margin-bottom: 8px; font-weight: 600; }
142
- .cb-val { font-family: var(--font-head); font-size: 24px; font-weight: 800; }
143
-
144
- .sip-frequency {
145
- display: flex;
146
- gap: 8px;
147
- margin-bottom: 16px;
148
- }
149
- .freq-btn {
150
- flex: 1;
151
- padding: 10px;
152
- border-radius: var(--r-sm);
153
- border: 1px solid var(--border);
154
- background: transparent;
155
- color: var(--text2);
156
- font-family: var(--font-body);
157
- font-size: 13px;
158
- font-weight: 600;
159
- cursor: pointer;
160
- transition: all var(--transition);
161
- }
162
- .freq-btn.active { border-color: var(--cyan); background: rgba(34,211,238,0.1); color: var(--cyan); }
163
-
164
- .inflation-impact {
165
- display: flex;
166
- align-items: center;
167
- gap: 16px;
168
- padding: 16px;
169
- background: var(--bg3);
170
- border-radius: var(--r-sm);
171
- border-left: 3px solid var(--rose);
172
- margin-bottom: 16px;
173
- }
174
- .inf-icon { font-size: 32px; }
175
- .inf-text { flex: 1; }
176
- .inf-title { font-weight: 700; margin-bottom: 4px; }
177
- .inf-desc { font-size: 13px; color: var(--text2); }
178
- </style>
179
- </head>
180
- <body>
181
- <div class="app-shell">
182
- <nav class="sidebar">
183
- <div class="sidebar-logo">
184
- <div class="logo-mark">
185
- <div class="logo-icon">📈</div>
186
- <div><div class="logo-text">FinWise</div><div class="logo-sub">Smart Investing</div></div>
187
- </div>
188
- </div>
189
- <div class="nav-section">
190
- <div class="nav-label">Main</div>
191
- <a href="index.html" class="nav-item"><span class="nav-icon">🏠</span> Dashboard</a>
192
- <a href="portfolio.html" class="nav-item"><span class="nav-icon">📊</span> Portfolio Builder</a>
193
- <a href="risk.html" class="nav-item"><span class="nav-icon">🎯</span> Risk Analyzer</a>
194
- <a href="tracker.html" class="nav-item"><span class="nav-icon">📈</span> Tracker</a>
195
- <div class="nav-label">Tools</div>
196
- <a href="calculators.html" class="nav-item"><span class="nav-icon">🧮</span> Calculators</a>
197
- <a href="insights.html" class="nav-item"><span class="nav-icon">💡</span> Insights</a>
198
- </div>
199
- <div class="sidebar-footer">
200
- <div class="market-ticker">Live Market</div>
201
- <div id="sidebar-tickers"></div>
202
- </div>
203
- </nav>
204
-
205
- <main class="main-content">
206
- <div class="page-header fade-in">
207
- <div class="page-title">Financial <span>Calculators</span></div>
208
- <div class="page-subtitle">Interactive tools to plan, project, and optimize your wealth</div>
209
- </div>
210
-
211
- <!-- Calculator Tabs -->
212
- <div class="calc-tabs fade-in">
213
- <button class="calc-tab active" data-calc="growth">
214
- <span class="calc-tab-icon">📈</span> Investment Growth
215
- </button>
216
- <button class="calc-tab" data-calc="retirement">
217
- <span class="calc-tab-icon">🏖️</span> Retirement
218
- </button>
219
- <button class="calc-tab" data-calc="sip">
220
- <span class="calc-tab-icon">🔄</span> SIP / Recurring
221
- </button>
222
- <button class="calc-tab" data-calc="inflation">
223
- <span class="calc-tab-icon">🔥</span> Inflation Impact
224
- </button>
225
- </div>
226
-
227
- <!-- ════════════════════════════════════════════════════════════
228
- CALCULATOR 1: Investment Growth
229
- ════════════════════════════════════════════════════════════ -->
230
- <div class="calc-panel active fade-in" id="calc-growth">
231
- <div class="grid-60-40">
232
- <div>
233
- <div class="card">
234
- <div class="section-title">📈 Investment Growth Calculator</div>
235
- <div class="text-muted text-sm" style="margin-bottom:20px">See how your one-time investment grows over time with compound returns</div>
236
-
237
- <div class="slider-wrap">
238
- <div class="slider-header"><span class="slider-label">💵 Initial Investment</span><span class="slider-val" id="g-init-val">$10,000</span></div>
239
- <div class="preset-pills">
240
- <button class="preset-pill" onclick="setGrowthPreset('g-init',1000)">$1K</button>
241
- <button class="preset-pill active" onclick="setGrowthPreset('g-init',10000)">$10K</button>
242
- <button class="preset-pill" onclick="setGrowthPreset('g-init',25000)">$25K</button>
243
- <button class="preset-pill" onclick="setGrowthPreset('g-init',50000)">$50K</button>
244
- <button class="preset-pill" onclick="setGrowthPreset('g-init',100000)">$100K</button>
245
- </div>
246
- <input type="range" id="g-init" min="500" max="200000" value="10000" step="500" oninput="calcGrowth()">
247
- </div>
248
-
249
- <div class="slider-wrap">
250
- <div class="slider-header"><span class="slider-label">📅 Time Horizon</span><span class="slider-val" id="g-years-val">20 years</span></div>
251
- <div class="preset-pills">
252
- <button class="preset-pill" onclick="setGrowthPreset('g-years',5)">5yr</button>
253
- <button class="preset-pill" onclick="setGrowthPreset('g-years',10)">10yr</button>
254
- <button class="preset-pill active" onclick="setGrowthPreset('g-years',20)">20yr</button>
255
- <button class="preset-pill" onclick="setGrowthPreset('g-years',30)">30yr</button>
256
- </div>
257
- <input type="range" id="g-years" min="1" max="50" value="20" step="1" oninput="calcGrowth()">
258
- </div>
259
-
260
- <div class="slider-wrap">
261
- <div class="slider-header"><span class="slider-label">📊 Annual Return Rate</span><span class="slider-val" id="g-rate-val">8%</span></div>
262
- <div class="preset-pills">
263
- <button class="preset-pill" onclick="setGrowthPreset('g-rate',4,'%')">Bonds 4%</button>
264
- <button class="preset-pill" onclick="setGrowthPreset('g-rate',7,'%')">S&P Avg 7%</button>
265
- <button class="preset-pill active" onclick="setGrowthPreset('g-rate',8,'%')">Moderate 8%</button>
266
- <button class="preset-pill" onclick="setGrowthPreset('g-rate',12,'%')">Aggressive 12%</button>
267
- </div>
268
- <input type="range" id="g-rate" min="1" max="25" value="8" step="0.5" oninput="calcGrowth()">
269
- </div>
270
-
271
- <div class="slider-wrap">
272
- <div class="slider-header"><span class="slider-label">📆 Compound Frequency</span><span class="slider-val" id="g-compound-val">Annually</span></div>
273
- <input type="range" id="g-compound" min="1" max="12" value="1" step="1" oninput="calcGrowth()">
274
- <div style="display:flex;justify-content:space-between;font-size:11px;color:var(--text3);margin-top:4px">
275
- <span>Annually</span><span>Quarterly</span><span>Monthly</span>
276
- </div>
277
- </div>
278
- </div>
279
- </div>
280
-
281
- <div>
282
- <div class="result-hero">
283
- <div class="result-label">Future Value</div>
284
- <div class="result-value positive" id="g-future">$0</div>
285
- <div class="result-sub" id="g-sub">You'd earn <strong id="g-profit">$0</strong> in profit</div>
286
- </div>
287
-
288
- <div class="result-breakdown">
289
- <div class="rb-box">
290
- <div class="rb-box-label">Invested</div>
291
- <div class="rb-box-val" id="g-rb-invested">$0</div>
292
- </div>
293
- <div class="rb-box">
294
- <div class="rb-box-label">Earnings</div>
295
- <div class="rb-box-val" style="color:var(--emerald)" id="g-rb-earn">$0</div>
296
- </div>
297
- <div class="rb-box">
298
- <div class="rb-box-label">Total Return</div>
299
- <div class="rb-box-val" style="color:var(--cyan)" id="g-rb-pct">0%</div>
300
- </div>
301
- </div>
302
-
303
- <div class="card" style="padding:16px">
304
- <div class="card-title">📊 Growth Over Time</div>
305
- <div class="chart-panel">
306
- <canvas id="growthChart"></canvas>
307
- </div>
308
- </div>
309
-
310
- <!-- Milestones -->
311
- <div class="card" style="margin-top:16px;padding:16px">
312
- <div class="card-title">🏆 Milestones</div>
313
- <div class="milestone-grid" id="milestones-grid"></div>
314
- </div>
315
- </div>
316
- </div>
317
- </div>
318
-
319
- <!-- ════════════════════════════════════════════════════════════
320
- CALCULATOR 2: Retirement
321
- ════════════════════════════════════════════════════════════ -->
322
- <div class="calc-panel" id="calc-retirement">
323
- <div class="grid-60-40">
324
- <div>
325
- <div class="card">
326
- <div class="section-title">🏖️ Retirement Calculator</div>
327
- <div class="text-muted text-sm" style="margin-bottom:20px">Plan your retirement savings and see if you're on track</div>
328
-
329
- <div class="input-row" style="margin-bottom:16px">
330
- <div class="field-group">
331
- <label class="field-label">Current Age</label>
332
- <input type="number" id="ret-age" value="30" min="18" max="80" oninput="calcRetirement()">
333
- </div>
334
- <div class="field-group">
335
- <label class="field-label">Retirement Age</label>
336
- <input type="number" id="ret-age2" value="65" min="40" max="85" oninput="calcRetirement()">
337
- </div>
338
- </div>
339
-
340
- <div class="slider-wrap">
341
- <div class="slider-header"><span class="slider-label">💰 Current Savings</span><span class="slider-val" id="ret-saved-val">$15,000</span></div>
342
- <input type="range" id="ret-saved" min="0" max="500000" value="15000" step="1000" oninput="calcRetirement()">
343
- </div>
344
-
345
- <div class="slider-wrap">
346
- <div class="slider-header"><span class="slider-label">📅 Monthly Contribution</span><span class="slider-val" id="ret-monthly-val">$500/mo</span></div>
347
- <input type="range" id="ret-monthly" min="50" max="5000" value="500" step="50" oninput="calcRetirement()">
348
- </div>
349
-
350
- <div class="slider-wrap">
351
- <div class="slider-header"><span class="slider-label">📈 Annual Return</span><span class="slider-val" id="ret-rate-val">7%</span></div>
352
- <input type="range" id="ret-rate" min="2" max="15" value="7" step="0.5" oninput="calcRetirement()">
353
- </div>
354
-
355
- <div class="slider-wrap">
356
- <div class="slider-header"><span class="slider-label">🏦 Desired Monthly Income in Retirement</span><span class="slider-val" id="ret-need-val">$4,000/mo</span></div>
357
- <input type="range" id="ret-need" min="1000" max="20000" value="4000" step="500" oninput="calcRetirement()">
358
- </div>
359
- </div>
360
- </div>
361
-
362
- <div>
363
- <div class="result-hero">
364
- <div class="result-label">Retirement Nest Egg</div>
365
- <div class="result-value positive" id="ret-future">$0</div>
366
- <div class="result-sub" id="ret-status">—</div>
367
- </div>
368
-
369
- <div class="result-breakdown">
370
- <div class="rb-box">
371
- <div class="rb-box-label">Years to Retire</div>
372
- <div class="rb-box-val" style="color:var(--amber)" id="ret-rb-years">0</div>
373
- </div>
374
- <div class="rb-box">
375
- <div class="rb-box-label">Monthly Draw</div>
376
- <div class="rb-box-val" style="color:var(--cyan)" id="ret-rb-draw">$0/mo</div>
377
- </div>
378
- <div class="rb-box">
379
- <div class="rb-box-label">Fund Duration</div>
380
- <div class="rb-box-val" style="color:var(--emerald)" id="ret-rb-dur">0 yrs</div>
381
- </div>
382
- </div>
383
-
384
- <div class="card" style="padding:16px">
385
- <div class="card-title">📊 Savings Trajectory</div>
386
- <div class="chart-panel">
387
- <canvas id="retChart"></canvas>
388
- </div>
389
- </div>
390
-
391
- <div id="ret-on-track-box" style="margin-top:16px;padding:16px;border-radius:var(--r-sm);border:1px solid"></div>
392
- </div>
393
- </div>
394
- </div>
395
-
396
- <!-- ════════════════════════════════════════════════════════════
397
- CALCULATOR 3: SIP / Recurring
398
- ════════════════════════════════════════════════════════════ -->
399
- <div class="calc-panel" id="calc-sip">
400
- <div class="grid-60-40">
401
- <div>
402
- <div class="card">
403
- <div class="section-title">🔄 SIP / Recurring Investment</div>
404
- <div class="text-muted text-sm" style="margin-bottom:16px">How regular investments compound over time</div>
405
-
406
- <div style="margin-bottom:16px">
407
- <div class="field-label" style="margin-bottom:8px">Contribution Frequency</div>
408
- <div class="sip-frequency">
409
- <button class="freq-btn" onclick="setSipFreq('weekly',this)">Weekly</button>
410
- <button class="freq-btn active" onclick="setSipFreq('monthly',this)">Monthly</button>
411
- <button class="freq-btn" onclick="setSipFreq('quarterly',this)">Quarterly</button>
412
- <button class="freq-btn" onclick="setSipFreq('annually',this)">Annually</button>
413
- </div>
414
- </div>
415
-
416
- <div class="slider-wrap">
417
- <div class="slider-header"><span class="slider-label">💵 Contribution Amount</span><span class="slider-val" id="sip-amount-val">$300/mo</span></div>
418
- <div class="preset-pills">
419
- <button class="preset-pill" onclick="setSipPreset('sip-amount',100)">$100</button>
420
- <button class="preset-pill active" onclick="setSipPreset('sip-amount',300)">$300</button>
421
- <button class="preset-pill" onclick="setSipPreset('sip-amount',500)">$500</button>
422
- <button class="preset-pill" onclick="setSipPreset('sip-amount',1000)">$1K</button>
423
- </div>
424
- <input type="range" id="sip-amount" min="10" max="5000" value="300" step="10" oninput="calcSIP()">
425
- </div>
426
-
427
- <div class="slider-wrap">
428
- <div class="slider-header"><span class="slider-label">📅 Duration</span><span class="slider-val" id="sip-years-val">15 years</span></div>
429
- <input type="range" id="sip-years" min="1" max="40" value="15" step="1" oninput="calcSIP()">
430
- </div>
431
-
432
- <div class="slider-wrap">
433
- <div class="slider-header"><span class="slider-label">📊 Expected Return</span><span class="slider-val" id="sip-rate-val">9%</span></div>
434
- <input type="range" id="sip-rate" min="2" max="20" value="9" step="0.5" oninput="calcSIP()">
435
- </div>
436
-
437
- <div class="slider-wrap">
438
- <div class="slider-header"><span class="slider-label">📈 Annual Step-Up %</span><span class="slider-val" id="sip-stepup-val">0%</span></div>
439
- <input type="range" id="sip-stepup" min="0" max="20" value="0" step="1" oninput="calcSIP()">
440
- <div class="text-muted text-sm" style="margin-top:4px">Increase contribution amount each year by this %</div>
441
- </div>
442
- </div>
443
- </div>
444
-
445
- <div>
446
- <div class="result-hero">
447
- <div class="result-label">Total Wealth Created</div>
448
- <div class="result-value positive" id="sip-future">$0</div>
449
- <div class="result-sub">Total invested: <strong id="sip-invested">$0</strong></div>
450
- </div>
451
-
452
- <div class="result-breakdown">
453
- <div class="rb-box">
454
- <div class="rb-box-label">Invested</div>
455
- <div class="rb-box-val" id="sip-rb-inv">$0</div>
456
- </div>
457
- <div class="rb-box">
458
- <div class="rb-box-label">Gains</div>
459
- <div class="rb-box-val" style="color:var(--emerald)" id="sip-rb-gain">$0</div>
460
- </div>
461
- <div class="rb-box">
462
- <div class="rb-box-label">Gain %</div>
463
- <div class="rb-box-val" style="color:var(--cyan)" id="sip-rb-pct">0%</div>
464
- </div>
465
- </div>
466
-
467
- <div class="card" style="padding:16px">
468
- <div class="card-title">📊 Contribution vs Growth</div>
469
- <div class="chart-panel">
470
- <canvas id="sipChart"></canvas>
471
- </div>
472
- </div>
473
-
474
- <div class="compare-grid">
475
- <div class="compare-box">
476
- <div class="cb-label">💤 Without Investing<br>(under mattress)</div>
477
- <div class="cb-val" id="sip-no-invest" style="color:var(--rose)">$0</div>
478
- </div>
479
- <div class="compare-box">
480
- <div class="cb-label">📈 With Investing<br>(your strategy)</div>
481
- <div class="cb-val" id="sip-with-invest" style="color:var(--emerald)">$0</div>
482
- </div>
483
- </div>
484
- </div>
485
- </div>
486
- </div>
487
-
488
- <!-- ════════════════════════════════════════════════════════════
489
- CALCULATOR 4: Inflation Impact
490
- ════════════════════════════════════════════════════════════ -->
491
- <div class="calc-panel" id="calc-inflation">
492
- <div class="grid-60-40">
493
- <div>
494
- <div class="card">
495
- <div class="section-title">🔥 Inflation Impact Calculator</div>
496
- <div class="text-muted text-sm" style="margin-bottom:20px">Understand how inflation erodes your money's purchasing power</div>
497
-
498
- <div class="slider-wrap">
499
- <div class="slider-header"><span class="slider-label">💵 Amount Today</span><span class="slider-val" id="inf-amount-val">$10,000</span></div>
500
- <div class="preset-pills">
501
- <button class="preset-pill" onclick="setInfPreset('inf-amount',5000)">$5K</button>
502
- <button class="preset-pill active" onclick="setInfPreset('inf-amount',10000)">$10K</button>
503
- <button class="preset-pill" onclick="setInfPreset('inf-amount',50000)">$50K</button>
504
- <button class="preset-pill" onclick="setInfPreset('inf-amount',100000)">$100K</button>
505
- </div>
506
- <input type="range" id="inf-amount" min="1000" max="500000" value="10000" step="1000" oninput="calcInflation()">
507
- </div>
508
-
509
- <div class="slider-wrap">
510
- <div class="slider-header"><span class="slider-label">📅 Years Ahead</span><span class="slider-val" id="inf-years-val">20 years</span></div>
511
- <input type="range" id="inf-years" min="1" max="50" value="20" step="1" oninput="calcInflation()">
512
- </div>
513
-
514
- <div class="slider-wrap">
515
- <div class="slider-header"><span class="slider-label">🔥 Annual Inflation Rate</span><span class="slider-val" id="inf-rate-val">3.5%</span></div>
516
- <div class="preset-pills">
517
- <button class="preset-pill" onclick="setInfPreset('inf-rate',2)">Low 2%</button>
518
- <button class="preset-pill active" onclick="setInfPreset('inf-rate',3.5)">Average 3.5%</button>
519
- <button class="preset-pill" onclick="setInfPreset('inf-rate',6)">High 6%</button>
520
- <button class="preset-pill" onclick="setInfPreset('inf-rate',10)">Crisis 10%</button>
521
- </div>
522
- <input type="range" id="inf-rate" min="0.5" max="15" value="3.5" step="0.5" oninput="calcInflation()">
523
- </div>
524
-
525
- <div class="slider-wrap">
526
- <div class="slider-header"><span class="slider-label">📈 Investment Return Rate</span><span class="slider-val" id="inf-invest-val">7%</span></div>
527
- <input type="range" id="inf-invest" min="0" max="20" value="7" step="0.5" oninput="calcInflation()">
528
- <div class="text-muted text-sm" style="margin-top:4px">If you invest vs keep as cash</div>
529
- </div>
530
- </div>
531
- </div>
532
-
533
- <div>
534
- <div class="inflation-impact">
535
- <div class="inf-icon">💸</div>
536
- <div class="inf-text">
537
- <div class="inf-title">Purchasing Power Loss</div>
538
- <div class="inf-desc">Your money <strong id="inf-today">$10,000</strong> today will only be worth <strong id="inf-future-worth" style="color:var(--rose)">—</strong> in real terms after <span id="inf-years-txt">20</span> years.</div>
539
- </div>
540
- </div>
541
-
542
- <div class="result-hero">
543
- <div class="result-label">Inflation-Adjusted Value</div>
544
- <div class="result-value" id="inf-result" style="color:var(--rose)">$0</div>
545
- <div class="result-sub">Real purchasing power loss: <strong id="inf-loss" style="color:var(--rose)">$0</strong></div>
546
- </div>
547
-
548
- <div class="result-breakdown">
549
- <div class="rb-box">
550
- <div class="rb-box-label">Nominal Value</div>
551
- <div class="rb-box-val" id="inf-rb-nom">$0</div>
552
- </div>
553
- <div class="rb-box">
554
- <div class="rb-box-label">Real Value</div>
555
- <div class="rb-box-val" style="color:var(--rose)" id="inf-rb-real">$0</div>
556
- </div>
557
- <div class="rb-box">
558
- <div class="rb-box-label">If Invested</div>
559
- <div class="rb-box-val" style="color:var(--emerald)" id="inf-rb-inv">$0</div>
560
- </div>
561
- </div>
562
-
563
- <div class="card" style="padding:16px">
564
- <div class="card-title">📊 Cash vs Invested vs Inflation</div>
565
- <div class="chart-panel">
566
- <canvas id="infChart"></canvas>
567
- </div>
568
- </div>
569
- </div>
570
- </div>
571
- </div>
572
-
573
- </main>
574
- </div>
575
-
576
- <nav class="bottom-nav">
577
- <div class="bottom-nav-inner">
578
- <a href="index.html" class="bottom-nav-item"><span class="bnav-icon">🏠</span>Home</a>
579
- <a href="portfolio.html" class="bottom-nav-item"><span class="bnav-icon">📊</span>Portfolio</a>
580
- <a href="risk.html" class="bottom-nav-item"><span class="bnav-icon">🎯</span>Risk</a>
581
- <a href="tracker.html" class="bottom-nav-item"><span class="bnav-icon">📈</span>Track</a>
582
- <a href="calculators.html" class="bottom-nav-item"><span class="bnav-icon">🧮</span>Calc</a>
583
- <a href="insights.html" class="bottom-nav-item"><span class="bnav-icon">💡</span>Insights</a>
584
- </div>
585
- </nav>
586
-
587
- <script src="shared.js"></script>
588
- <script>
589
- // ══ Tab Switching ═════════════════════════════════════════════════
590
- document.querySelectorAll('.calc-tab').forEach(btn => {
591
- btn.addEventListener('click', () => {
592
- document.querySelectorAll('.calc-tab,.calc-panel').forEach(el => el.classList.remove('active'));
593
- btn.classList.add('active');
594
- document.getElementById('calc-' + btn.dataset.calc).classList.add('active');
595
- setTimeout(() => { calcGrowth(); calcRetirement(); calcSIP(); calcInflation(); }, 50);
596
- });
597
- });
598
-
599
- // ══ Shared helpers ════════════════════════════════════════════════
600
- let growthChart=null, retChart=null, sipChart=null, infChart=null;
601
- let sipFreq = 'monthly'; // periods per year
602
- const FREQ_MAP = { weekly:52, monthly:12, quarterly:4, annually:1 };
603
- const FREQ_LABEL = { weekly:'wk', monthly:'mo', quarterly:'qtr', annually:'yr' };
604
-
605
- function sliderSync(id, labelId, prefix='$', suffix='', scale=1, decimals=0) {
606
- const el = document.getElementById(id);
607
- const lbl = document.getElementById(labelId);
608
- const update = () => {
609
- const v = parseFloat(el.value) * scale;
610
- lbl.textContent = prefix + (decimals ? v.toFixed(decimals) : Math.round(v).toLocaleString()) + suffix;
611
- };
612
- el.addEventListener('input', update);
613
- }
614
-
615
- // ══ CALCULATOR 1: Investment Growth ═══════════════════════════════
616
- function setGrowthPreset(id, val, unit) {
617
- document.getElementById(id).value = val;
618
- calcGrowth();
619
- }
620
- function setSipPreset(id, val) { document.getElementById(id).value = val; calcSIP(); }
621
- function setInfPreset(id, val) { document.getElementById(id).value = val; calcInflation(); }
622
-
623
- function calcGrowth() {
624
- const P = parseFloat(document.getElementById('g-init').value);
625
- const n = parseInt(document.getElementById('g-years').value);
626
- const r = parseFloat(document.getElementById('g-rate').value) / 100;
627
- const c = parseInt(document.getElementById('g-compound').value);
628
-
629
- document.getElementById('g-init-val').textContent = '$' + P.toLocaleString();
630
- document.getElementById('g-years-val').textContent = n + ' year' + (n===1?'':'s');
631
- const compoundLabels = {1:'Annually',2:'Semi-annually',3:'Tri-annually',4:'Quarterly',6:'Bi-monthly',12:'Monthly'};
632
- document.getElementById('g-compound-val').textContent = compoundLabels[c] || c + 'x/yr';
633
- document.getElementById('g-rate-val').textContent = r*100 + '%';
634
-
635
- const FV = P * Math.pow(1 + r/c, c*n);
636
- const profit = FV - P;
637
- const pct = (profit/P)*100;
638
-
639
- document.getElementById('g-future').textContent = fmt$(FV);
640
- document.getElementById('g-profit').textContent = fmt$(profit);
641
- document.getElementById('g-rb-invested').textContent = fmt$(P);
642
- document.getElementById('g-rb-earn').textContent = fmt$(profit);
643
- document.getElementById('g-rb-pct').textContent = '+' + pct.toFixed(1) + '%';
644
-
645
- // Chart data
646
- const years = Array.from({length:n+1},(_,i)=>i);
647
- const vals = years.map(y => P * Math.pow(1+r/c, c*y));
648
- const invested = years.map(() => P);
649
-
650
- if (growthChart) growthChart.destroy();
651
- const ctx = document.getElementById('growthChart').getContext('2d');
652
- const grad = ctx.createLinearGradient(0,0,0,260);
653
- grad.addColorStop(0,'rgba(16,185,129,0.35)'); grad.addColorStop(1,'rgba(16,185,129,0)');
654
-
655
- growthChart = new Chart(ctx, {
656
- type:'line',
657
- data:{
658
- labels: years.map(y => 'Yr '+y),
659
- datasets:[
660
- { label:'Portfolio Value', data:vals, borderColor:'#10b981', backgroundColor:grad, borderWidth:2.5, fill:true, tension:0.4, pointRadius:0 },
661
- { label:'Amount Invested', data:invested, borderColor:'rgba(34,211,238,0.5)', borderDash:[5,5], borderWidth:1.5, fill:false, pointRadius:0, tension:0 }
662
- ]
663
- },
664
- options:{ responsive:true, maintainAspectRatio:false,
665
- plugins:{ legend:{ labels:{font:{size:11}} },
666
- tooltip:{ callbacks:{ label: ctx => ' '+fmt$(ctx.raw) } } },
667
- scales:{
668
- x:{ grid:{display:false}, ticks:{maxTicksLimit:8,font:{size:11}} },
669
- y:{ grid:{color:'rgba(34,211,238,0.06)'}, ticks:{ callback:v=>'$'+(v/1000).toFixed(0)+'K', font:{size:11} } }
670
- }
671
- }
672
- });
673
-
674
- // Milestones
675
- const milestones = [
676
- { icon:'💯', label:'2× Money', target:P*2 },
677
- { icon:'🚀', label:'5× Money', target:P*5 },
678
- { icon:'💎', label:'10× Money', target:P*10 },
679
- { icon:'🌟', label:'$100K', target:100000 },
680
- { icon:'🏆', label:'$250K', target:250000 },
681
- { icon:'👑', label:'$1M', target:1000000 },
682
- ];
683
- document.getElementById('milestones-grid').innerHTML = milestones.map(m => {
684
- const reached = FV >= m.target;
685
- const yearsTo = reached ? Math.log(m.target/P) / (c * Math.log(1+r/c)) : null;
686
- return `
687
- <div class="milestone-card ${reached?'reached':''}">
688
- <div class="milestone-icon">${m.icon}</div>
689
- <div class="milestone-val">${m.label}</div>
690
- <div class="milestone-lbl">${fmt$(m.target)}</div>
691
- ${reached ? `<div class="milestone-yr">✅ ~Yr ${Math.round(yearsTo)}</div>` : `<div class="milestone-yr" style="color:var(--text3)">Not reached</div>`}
692
- </div>`;
693
- }).join('');
694
- }
695
-
696
- // ══ CALCULATOR 2: Retirement ══════════════════════════════════════
697
- function calcRetirement() {
698
- const age = parseInt(document.getElementById('ret-age').value) || 30;
699
- const retAge = parseInt(document.getElementById('ret-age2').value) || 65;
700
- const saved = parseFloat(document.getElementById('ret-saved').value);
701
- const mo = parseFloat(document.getElementById('ret-monthly').value);
702
- const r = parseFloat(document.getElementById('ret-rate').value)/100;
703
- const need = parseFloat(document.getElementById('ret-need').value);
704
-
705
- document.getElementById('ret-saved-val').textContent = '$'+saved.toLocaleString();
706
- document.getElementById('ret-monthly-val').textContent = '$'+mo.toLocaleString()+'/mo';
707
- document.getElementById('ret-rate-val').textContent = r*100 + '%';
708
- document.getElementById('ret-need-val').textContent = '$'+need.toLocaleString()+'/mo';
709
-
710
- const years = Math.max(retAge - age, 1);
711
- const rMo = r/12;
712
- const FV_existing = saved * Math.pow(1+r, years);
713
- const FV_contrib = mo * ((Math.pow(1+rMo, years*12)-1)/rMo);
714
- const total = FV_existing + FV_contrib;
715
- const annualy = need * 12;
716
- const fundDur = total > 0 ? Math.log(1 - (annualy * (1-(1+r/4))) / (total * (r/4))) / Math.log(1+r/4) * (-1) : 0;
717
- const safeDrawdown = total * 0.04 / 12;
718
- const onTrack = total >= annualy * 25;
719
-
720
- document.getElementById('ret-future').textContent = fmt$(total);
721
- document.getElementById('ret-rb-years').textContent = years + ' yrs';
722
- document.getElementById('ret-rb-draw').textContent = '$' + Math.round(safeDrawdown).toLocaleString() + '/mo';
723
- document.getElementById('ret-rb-dur').textContent = Math.round(Math.max(fundDur,0)) + ' yrs';
724
-
725
- const box = document.getElementById('ret-on-track-box');
726
- if (onTrack) {
727
- box.style.cssText = 'padding:16px;border-radius:var(--r-sm);border:1px solid rgba(16,185,129,0.4);background:rgba(16,185,129,0.08)';
728
- box.innerHTML = `<div style="font-weight:700;color:var(--emerald);margin-bottom:6px">✅ You're on track!</div>
729
- <div style="font-size:13px;color:var(--text2)">Your projected nest egg supports $${Math.round(safeDrawdown).toLocaleString()}/mo using the 4% rule. That's more than your $${need.toLocaleString()}/mo target.</div>`;
730
- } else {
731
- const gap = annualy*25 - total;
732
- box.style.cssText = 'padding:16px;border-radius:var(--r-sm);border:1px solid rgba(245,158,11,0.4);background:rgba(245,158,11,0.08)';
733
- box.innerHTML = `<div style="font-weight:700;color:var(--amber);margin-bottom:6px">⚠️ Savings Gap Detected</div>
734
- <div style="font-size:13px;color:var(--text2)">You're projected to be <strong style="color:var(--amber)">${fmt$(gap)}</strong> short of your retirement goal. Consider increasing contributions by $${Math.round(gap/(years*12)).toLocaleString()}/mo.</div>`;
735
- }
736
-
737
- document.getElementById('ret-status').textContent = onTrack ? '🎉 On track for retirement!' : `Need ${fmt$(annualy*25)} total`;
738
-
739
- // Chart
740
- const yrs = Array.from({length:years+1},(_,i)=>i);
741
- const trajectory = yrs.map(y => {
742
- const fe = saved * Math.pow(1+r,y);
743
- const fc = mo * ((Math.pow(1+r/12, y*12)-1)/(r/12));
744
- return fe+fc;
745
- });
746
-
747
- if (retChart) retChart.destroy();
748
- const ctx = document.getElementById('retChart').getContext('2d');
749
- const grad = ctx.createLinearGradient(0,0,0,260);
750
- grad.addColorStop(0,'rgba(34,211,238,0.3)'); grad.addColorStop(1,'rgba(34,211,238,0)');
751
-
752
- retChart = new Chart(ctx, {
753
- type:'line',
754
- data:{
755
- labels: yrs.map(y => age+y),
756
- datasets:[
757
- { label:'Projected Savings', data:trajectory, borderColor:'#22d3ee', backgroundColor:grad, borderWidth:2.5, fill:true, tension:0.4, pointRadius:0 },
758
- { label:'Target', data:yrs.map(()=>annualy*25), borderColor:'rgba(245,158,11,0.6)', borderDash:[6,4], borderWidth:1.5, fill:false, pointRadius:0 }
759
- ]
760
- },
761
- options:{ responsive:true, maintainAspectRatio:false,
762
- plugins:{ legend:{labels:{font:{size:11}}}, tooltip:{ callbacks:{ label:ctx=>' '+fmt$(ctx.raw) } } },
763
- scales:{
764
- x:{ grid:{display:false}, ticks:{maxTicksLimit:8,font:{size:11}} },
765
- y:{ grid:{color:'rgba(34,211,238,0.06)'}, ticks:{ callback:v=>'$'+(v/1000).toFixed(0)+'K', font:{size:11} } }
766
- }
767
- }
768
- });
769
- }
770
-
771
- // ══ CALCULATOR 3: SIP ═════════════════════════════════════════════
772
- function setSipFreq(freq, btn) {
773
- sipFreq = freq;
774
- document.querySelectorAll('.freq-btn').forEach(b=>b.classList.remove('active'));
775
- btn.classList.add('active');
776
- calcSIP();
777
- }
778
-
779
- function calcSIP() {
780
- const amount = parseFloat(document.getElementById('sip-amount').value);
781
- const years = parseInt(document.getElementById('sip-years').value);
782
- const rate = parseFloat(document.getElementById('sip-rate').value)/100;
783
- const stepup = parseFloat(document.getElementById('sip-stepup').value)/100;
784
- const n = FREQ_MAP[sipFreq];
785
- const lbl = FREQ_LABEL[sipFreq];
786
-
787
- document.getElementById('sip-amount-val').textContent = '$'+amount.toLocaleString()+'/'+lbl;
788
- document.getElementById('sip-years-val').textContent = years + ' year' + (years===1?'':'s');
789
- document.getElementById('sip-rate-val').textContent = rate*100 + '%';
790
- document.getElementById('sip-stepup-val').textContent = (stepup*100).toFixed(0) + '%';
791
-
792
- // Step-up SIP calculation
793
- let FV = 0, totalInvested = 0;
794
- let currentAmount = amount;
795
- const yearlyVals = [], yearlyInv = [];
796
-
797
- for (let y=1; y<=years; y++) {
798
- if (y>1 && stepup>0) currentAmount *= (1+stepup);
799
- for (let p=0; p<n; p++) {
800
- FV = (FV + currentAmount) * (1 + rate/n);
801
- totalInvested += currentAmount;
802
- }
803
- yearlyVals.push(FV);
804
- yearlyInv.push(totalInvested);
805
- }
806
-
807
- const gain = FV - totalInvested;
808
- const gainPct = (gain/totalInvested)*100;
809
-
810
- document.getElementById('sip-future').textContent = fmt$(FV);
811
- document.getElementById('sip-invested').textContent = fmt$(totalInvested);
812
- document.getElementById('sip-rb-inv').textContent = fmt$(totalInvested);
813
- document.getElementById('sip-rb-gain').textContent = fmt$(gain);
814
- document.getElementById('sip-rb-pct').textContent = '+'+gainPct.toFixed(1)+'%';
815
- document.getElementById('sip-no-invest').textContent = fmt$(totalInvested);
816
- document.getElementById('sip-with-invest').textContent = fmt$(FV);
817
-
818
- if (sipChart) sipChart.destroy();
819
- const ctx = document.getElementById('sipChart').getContext('2d');
820
- const labels = Array.from({length:years},(_,i)=>'Yr '+(i+1));
821
-
822
- sipChart = new Chart(ctx, {
823
- type:'bar',
824
- data:{
825
- labels,
826
- datasets:[
827
- { label:'Total Invested', data:yearlyInv, backgroundColor:'rgba(34,211,238,0.4)', borderRadius:4, order:2 },
828
- { label:'Portfolio Value', data:yearlyVals, type:'line', borderColor:'#10b981', backgroundColor:'rgba(16,185,129,0.15)', borderWidth:2.5, fill:true, tension:0.4, pointRadius:0, order:1 }
829
- ]
830
- },
831
- options:{ responsive:true, maintainAspectRatio:false,
832
- plugins:{ legend:{labels:{font:{size:11}}}, tooltip:{ callbacks:{ label:ctx=>' '+fmt$(ctx.raw) } } },
833
- scales:{
834
- x:{ grid:{display:false}, stacked:false, ticks:{maxTicksLimit:8,font:{size:11}} },
835
- y:{ grid:{color:'rgba(34,211,238,0.06)'}, ticks:{ callback:v=>'$'+(v/1000).toFixed(0)+'K', font:{size:11} } }
836
- }
837
- }
838
- });
839
- }
840
-
841
- // ══ CALCULATOR 4: Inflation ════���══════════════════════════════════
842
- function calcInflation() {
843
- const amount = parseFloat(document.getElementById('inf-amount').value);
844
- const years = parseInt(document.getElementById('inf-years').value);
845
- const infRate = parseFloat(document.getElementById('inf-rate').value)/100;
846
- const invRate = parseFloat(document.getElementById('inf-invest').value)/100;
847
-
848
- document.getElementById('inf-amount-val').textContent = '$'+amount.toLocaleString();
849
- document.getElementById('inf-years-val').textContent = years+' year'+(years===1?'':'s');
850
- document.getElementById('inf-rate-val').textContent = (infRate*100).toFixed(1)+'%';
851
- document.getElementById('inf-invest-val').textContent = (invRate*100).toFixed(1)+'%';
852
-
853
- const realValue = amount / Math.pow(1+infRate, years);
854
- const nomValue = amount; // cash under mattress, nominal stays same
855
- const invValue = amount * Math.pow(1+invRate, years);
856
- const loss = amount - realValue;
857
-
858
- document.getElementById('inf-today').textContent = fmt$(amount);
859
- document.getElementById('inf-future-worth').textContent = fmt$(realValue);
860
- document.getElementById('inf-years-txt').textContent = years;
861
- document.getElementById('inf-result').textContent = fmt$(realValue);
862
- document.getElementById('inf-loss').textContent = fmt$(loss);
863
- document.getElementById('inf-rb-nom').textContent = fmt$(nomValue);
864
- document.getElementById('inf-rb-real').textContent = fmt$(realValue);
865
- document.getElementById('inf-rb-inv').textContent = fmt$(invValue);
866
-
867
- // Chart
868
- const yrs = Array.from({length:years+1},(_,i)=>i);
869
- const cash = yrs.map(()=>amount);
870
- const real = yrs.map(y => amount/Math.pow(1+infRate,y));
871
- const inv = yrs.map(y => amount*Math.pow(1+invRate,y));
872
-
873
- if (infChart) infChart.destroy();
874
- const ctx = document.getElementById('infChart').getContext('2d');
875
-
876
- infChart = new Chart(ctx, {
877
- type:'line',
878
- data:{
879
- labels: yrs.map(y=>'Yr '+y),
880
- datasets:[
881
- { label:'Invested', data:inv, borderColor:'#10b981', backgroundColor:'rgba(16,185,129,0.1)', borderWidth:2.5, fill:true, tension:0.4, pointRadius:0 },
882
- { label:'Cash (nominal)', data:cash, borderColor:'rgba(34,211,238,0.5)', borderDash:[5,5], borderWidth:1.5, fill:false, pointRadius:0 },
883
- { label:'Real Value (after inflation)', data:real, borderColor:'#f43f5e', backgroundColor:'rgba(244,63,94,0.1)', borderWidth:2, fill:true, tension:0.4, pointRadius:0 }
884
- ]
885
- },
886
- options:{ responsive:true, maintainAspectRatio:false,
887
- plugins:{ legend:{labels:{font:{size:11}}}, tooltip:{ callbacks:{ label:ctx=>' '+fmt$(ctx.raw) } } },
888
- scales:{
889
- x:{ grid:{display:false}, ticks:{maxTicksLimit:8,font:{size:11}} },
890
- y:{ grid:{color:'rgba(34,211,238,0.06)'}, ticks:{ callback:v=>'$'+(v/1000).toFixed(0)+'K', font:{size:11} } }
891
- }
892
- }
893
- });
894
- }
895
-
896
- document.addEventListener('DOMContentLoaded', () => {
897
- applyChartDefaults();
898
- calcGrowth();
899
- calcRetirement();
900
- calcSIP();
901
- calcInflation();
902
- });
903
- </script>
904
- </body>
905
- </html>