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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TaxWizard Pro: Portfolio Alchemist</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
    <script>
        // Portfolio management
        let currentPortfolio = null;
        let portfolios = [
            {
                id: 'retirement',
                name: 'Retirement Portfolio',
                lastUpdated: '2023-10-15',
                totalValue: 125342,
                holdingsCount: 12,
                taxSavings: 1245,
                description: 'Primary retirement account'
            },
            {
                id: 'taxable',
                name: 'Taxable Account',
                lastUpdated: '2023-09-28',
                totalValue: 87321,
                holdingsCount: 8,
                taxSavings: 842,
                description: 'Brokerage account for active trading'
            }
        ];

        // Initialize portfolio dropdown
        function updatePortfolioDropdown() {
            const select = document.getElementById('portfolioSelect');
            select.innerHTML = '<option value="">Select a portfolio...</option><option value="new">+ Create New Portfolio</option>';
            
            portfolios.forEach(portfolio => {
                const option = document.createElement('option');
                option.value = portfolio.id;
                option.textContent = portfolio.name;
                select.appendChild(option);
            });
        }

        // Load portfolio data
        function loadPortfolio(portfolioId) {
            if (!portfolioId || portfolioId === 'new') {
                currentPortfolio = null;
                document.getElementById('portfolioInfo').classList.add('hidden');
                document.getElementById('saveOptions').classList.remove('hidden');
                return;
            }

            const portfolio = portfolios.find(p => p.id === portfolioId);
            if (portfolio) {
                currentPortfolio = portfolio;
                document.getElementById('portfolioName').textContent = portfolio.name;
                document.getElementById('lastUpdated').textContent = new Date(portfolio.lastUpdated).toLocaleDateString();
                document.getElementById('totalValue').textContent = `${portfolio.totalValue.toLocaleString()}`;
                document.getElementById('holdingsCount').textContent = portfolio.holdingsCount;
                document.getElementById('taxSavings').textContent = `${portfolio.taxSavings.toLocaleString()}`;
                document.getElementById('portfolioInfo').classList.remove('hidden');
                document.getElementById('saveOptions').classList.add('hidden');
            }
        }

        // Toggle between upload and load modes
        document.getElementById('uploadToggle').addEventListener('click', function() {
            this.classList.add('bg-white', 'dark:bg-gray-800', 'shadow-sm');
            this.classList.remove('text-gray-500', 'dark:text-gray-400');
            document.getElementById('loadToggle').classList.remove('bg-white', 'dark:bg-gray-800', 'shadow-sm');
            document.getElementById('loadToggle').classList.add('text-gray-500', 'dark:text-gray-400');
            document.getElementById('portfolioSelect').value = '';
            loadPortfolio(null);
        });

        document.getElementById('loadToggle').addEventListener('click', function() {
            this.classList.add('bg-white', 'dark:bg-gray-800', 'shadow-sm');
            this.classList.remove('text-gray-500', 'dark:text-gray-400');
            document.getElementById('uploadToggle').classList.remove('bg-white', 'dark:bg-gray-800', 'shadow-sm');
            document.getElementById('uploadToggle').classList.add('text-gray-500', 'dark:text-gray-400');
            document.getElementById('portfolioSelect').value = portfolios[0].id;
            loadPortfolio(portfolios[0].id);
        });

        // Portfolio selection handler
        document.getElementById('portfolioSelect').addEventListener('change', function() {
            loadPortfolio(this.value);
        });

        // Save portfolio handler
        document.getElementById('savePortfolioBtn').addEventListener('click', function() {
            const saveStatus = document.getElementById('saveStatus');
            saveStatus.innerHTML = '<i data-feather="loader" class="w-3 h-3 mr-1 animate-spin"></i> Saving...';
            feather.replace();
            
            // Simulate save
            setTimeout(() => {
                saveStatus.innerHTML = '<i data-feather="check-circle" class="w-3 h-3 mr-1 text-green-500"></i> Saved';
                feather.replace();
                
                // Reset status after 3 seconds
                setTimeout(() => {
                    saveStatus.innerHTML = '<i data-feather="circle" class="w-3 h-3 mr-1 text-gray-400"></i> Saved';
                    feather.replace();
                }, 3000);
            }, 1500);
        });

        // Initialize
        document.addEventListener('DOMContentLoaded', function() {
            updatePortfolioDropdown();
            feather.replace();
        });
tailwind.config = {
            darkMode: 'class',
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#f0f9ff',
                            100: '#e0f2fe',
                            600: '#2563eb',
                            700: '#1d4ed8',
                            900: '#1e3a8a',
                        }
                    }
                }
            }
        }
    </script>
    <style>
        .dropzone {
            border: 2px dashed #94a3b8;
            transition: all 0.3s ease;
        }
        .dropzone-active {
            border-color: #3b82f6;
            background-color: rgba(59, 130, 246, 0.05);
        }
        .dark .dropzone-active {
            background-color: rgba(59, 130, 246, 0.1);
        }
        #vanta-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.15;
        }
        .theme-toggle {
            transition: all 0.3s ease;
        }
        .glow-card {
            box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.2);
        }
        .dark .glow-card {
            box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
        }
    </style>
</head>
<body class="bg-gray-50 text-gray-800 dark:bg-gray-900 dark:text-gray-100 min-h-screen transition-colors duration-300">
    <div id="vanta-bg" class="dark:opacity-30"></div>
    
    <!-- Theme Toggle -->
    <button id="themeToggle" class="fixed top-4 right-4 z-50 p-2 rounded-full bg-white dark:bg-gray-800 shadow-lg theme-toggle">
        <i data-feather="moon" class="hidden dark:block text-yellow-300"></i>
        <i data-feather="sun" class="dark:hidden text-yellow-500"></i>
    </button>

    <div class="max-w-6xl mx-auto px-4 py-12 relative z-10">
        <!-- Header -->
        <header class="mb-12 text-center">
            <div class="flex justify-center items-center mb-4">
                <div class="bg-primary-100 dark:bg-primary-900 p-3 rounded-full">
                    <i data-feather="dollar-sign" class="text-primary-600 dark:text-primary-400 w-8 h-8"></i>
                </div>
                <span class="ml-2 text-xs font-semibold bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200 px-2 py-1 rounded-full">BETA</span>
            </div>
            <h1 class="text-3xl md:text-4xl font-bold mb-2">Welcome to <span class="text-primary-600 dark:text-primary-400">TaxWizard</span> Pro</h1>
            <p class="text-gray-600 dark:text-gray-400 max-w-2xl mx-auto">Upload your brokerage statement to preview lots and generate tax-efficient trades.</p>
        </header>

        <!-- Main Card -->
        <div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 glow-card">
            <div class="md:flex">
                <!-- Left Panel -->
                <div class="md:w-1/2 p-8 md:p-10" id="uploadPanel">
                    <!-- Portfolio Selection Dropdown -->
                    <div class="mb-4 flex items-center justify-between">
                        <div class="relative w-full mr-2">
                            <select id="portfolioSelect" class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white">
                                <option value="">Select a portfolio...</option>
                                <option value="new">+ Create New Portfolio</option>
                                <option value="retirement">Retirement Portfolio</option>
                                <option value="taxable">Taxable Account</option>
                            </select>
                            <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
                                <i data-feather="chevron-down" class="w-4 h-4 text-gray-400"></i>
                            </div>
                        </div>
                        <button id="refreshPortfolios" class="p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300">
                            <i data-feather="refresh-cw" class="w-4 h-4"></i>
                        </button>
                    </div>

                    <div class="mb-8">
<div class="flex items-center mb-4">
                            <div class="bg-primary-100 dark:bg-primary-900 p-2 rounded-full mr-3">
                                <i data-feather="bar-chart-2" class="text-primary-600 dark:text-primary-400 w-5 h-5"></i>
                            </div>
                            <h2 class="text-xl font-semibold">Tax-Loss Harvesting Optimizer</h2>
                        </div>
                        <p class="text-gray-600 dark:text-gray-400">Maximize your portfolio's tax efficiency with intelligent harvesting.</p>
                        
                        <div class="flex justify-between items-center mt-6 bg-gray-100 dark:bg-gray-700 p-4 rounded-lg">
                            <div class="flex items-center workflow-step" data-step="upload">
                                <div class="bg-primary-100 dark:bg-primary-900 p-2 rounded-full mr-3">
                                    <i data-feather="upload" class="text-primary-600 dark:text-primary-400 w-4 h-4"></i>
                                </div>
                                <span class="font-medium">Upload</span>
                            </div>
                            <i data-feather="arrow-right" class="text-gray-400 dark:text-gray-500 w-5 h-5 mx-2"></i>
                            <div class="flex items-center workflow-step" data-step="settings">
                                <div class="bg-gray-200 dark:bg-gray-600 p-2 rounded-full mr-3">
                                    <i data-feather="settings" class="text-gray-500 dark:text-gray-300 w-4 h-4"></i>
                                </div>
                                <span class="text-gray-500 dark:text-gray-300">Settings</span>
                            </div>
                            <i data-feather="arrow-right" class="text-gray-400 dark:text-gray-500 w-5 h-5 mx-2"></i>
                            <div class="flex items-center workflow-step" data-step="harvest">
                                <div class="bg-gray-200 dark:bg-gray-600 p-2 rounded-full mr-3">
                                    <i data-feather="dollar-sign" class="text-gray-500 dark:text-gray-300 w-4 h-4"></i>
                                </div>
                                <span class="text-gray-500 dark:text-gray-300">Harvest</span>
                            </div>
</div>
                    </div>
                    <!-- Upload/Load Toggle -->
                    <div class="flex mb-4 bg-gray-100 dark:bg-gray-700 rounded-lg p-1">
                        <button id="uploadToggle" class="flex-1 py-2 px-4 rounded-md font-medium text-center bg-white dark:bg-gray-800 shadow-sm">
                            Upload New
                        </button>
                        <button id="loadToggle" class="flex-1 py-2 px-4 rounded-md font-medium text-center text-gray-500 dark:text-gray-400">
                            Load Saved
                        </button>
                    </div>

                    <!-- Upload Section -->
                    <div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition">
                        <div id="portfolioInfo" class="hidden text-left mb-4 p-4 bg-white dark:bg-gray-800 rounded-lg">
                            <div class="flex justify-between items-start mb-2">
                                <h4 class="font-semibold" id="portfolioName">Portfolio Name</h4>
                                <span class="text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded-full">Active</span>
                            </div>
                            <div class="grid grid-cols-2 gap-2 text-sm">
                                <div>
                                    <p class="text-gray-500 dark:text-gray-400">Last Updated</p>
                                    <p id="lastUpdated">Oct 15, 2023</p>
                                </div>
                                <div>
                                    <p class="text-gray-500 dark:text-gray-400">Total Value</p>
                                    <p id="totalValue">$125,342</p>
                                </div>
                                <div>
                                    <p class="text-gray-500 dark:text-gray-400">Holdings</p>
                                    <p id="holdingsCount">12</p>
                                </div>
                                <div>
                                    <p class="text-gray-500 dark:text-gray-400">Tax Savings</p>
                                    <p id="taxSavings">$1,245</p>
                                </div>
                            </div>
                        </div>
<i data-feather="upload-cloud" class="w-12 h-12 mx-auto text-gray-400 mb-3"></i>
                        <h3 class="text-lg font-medium mb-1">Upload Statement</h3>
                        <p class="text-gray-500 dark:text-gray-400 text-sm mb-4">Drag & drop your statement here (PDF, CSV, XLSX)</p>
                        <button class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-2 rounded-lg text-sm font-medium transition">
                            Select File
                        </button>
                    </div>
                    <!-- Save Options -->
                    <div id="saveOptions" class="hidden mb-4 p-4 bg-gray-50 dark:bg-gray-700 rounded-lg">
                        <div class="flex items-center mb-3">
                            <input type="checkbox" id="savePortfolio" class="mr-2" checked>
                            <label for="savePortfolio" class="font-medium">Save to Portfolio</label>
                        </div>
                        <div id="saveFields" class="space-y-3">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Portfolio Name</label>
                                <input type="text" id="portfolioNameInput" class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Description</label>
                                <textarea id="portfolioDescription" rows="2" class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg"></textarea>
                            </div>
                            <div class="flex items-center">
                                <input type="radio" id="saveNew" name="saveOption" value="new" class="mr-2" checked>
                                <label for="saveNew" class="mr-4">Save as new</label>
                                <input type="radio" id="saveOverwrite" name="saveOption" value="overwrite" class="mr-2">
                                <label for="saveOverwrite">Overwrite existing</label>
                            </div>
                        </div>
                    </div>

                    <div class="flex items-start text-sm">
<input type="checkbox" id="privacy" class="mt-1 mr-2 bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600">
                        <label for="privacy" class="text-gray-600 dark:text-gray-400">I agree to the <a href="#" class="text-primary-600 dark:text-primary-400 hover:underline">Privacy Notice</a></label>
                    </div>
                </div>
                <!-- Right Panel -->
                <div class="md:w-1/2 bg-gray-50 dark:bg-gray-700 p-8 md:p-10 border-t md:border-t-0 md:border-l border-gray-200 dark:border-gray-600">
                    <div class="bg-yellow-100/50 dark:bg-yellow-900/50 border-l-4 border-yellow-400 p-4 mb-6">
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <i data-feather="alert-triangle" class="h-5 w-5 text-yellow-500 dark:text-yellow-400"></i>
                            </div>
                            <div class="ml-3">
                                <p class="text-sm text-yellow-800 dark:text-yellow-300">
                                    <span class="font-semibold">BETA MODE</span> - Currently supports Robinhood and Fidelity style files one account at a time.
                                </p>
                            </div>
                        </div>
                    </div>

                    <!-- Calculations Estimates Table -->
                    <div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4 mb-6">
                        <h3 class="font-semibold text-lg mb-3 flex items-center">
                            <i data-feather="calculator" class="w-5 h-5 mr-2 text-primary-600 dark:text-primary-400"></i>
                            Tax Impact Estimates
                        </h3>
                        <div class="grid grid-cols-2 gap-4 text-sm">
                            <div>
                                <p class="text-gray-500 dark:text-gray-400">Short-Term Gain/Loss</p>
                                <p class="font-medium" id="shortTermEstimate">$0.00</p>
                            </div>
                            <div>
                                <p class="text-gray-500 dark:text-gray-400">Long-Term Gain/Loss</p>
                                <p class="font-medium" id="longTermEstimate">$0.00</p>
                            </div>
                            <div>
                                <p class="text-gray-500 dark:text-gray-400">Tax Bill Estimate</p>
                                <p class="font-medium text-red-500" id="taxBillEstimate">$0.00</p>
                            </div>
                            <div>
                                <p class="text-gray-500 dark:text-gray-400">Budget Used</p>
                                <p class="font-medium" id="budgetUsed">$0.00 <span class="text-gray-400">of $3,000</span></p>
                            </div>
                            <div class="col-span-2">
                                <div class="flex justify-between mb-1">
                                    <span class="text-sm font-medium">Tax Savings Progress</span>
                                    <span class="text-sm" id="savingsPercentage">0%</span>
                                </div>
                                <div class="w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5">
                                    <div class="bg-primary-600 h-2.5 rounded-full" id="savingsProgress" style="width: 0%"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Preview Data Panel -->
                    <div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm overflow-hidden mb-6">
                        <div class="flex justify-between items-center p-4 border-b border-gray-200 dark:border-gray-700">
                            <h3 class="font-semibold text-lg flex items-center">
                                <i data-feather="eye" class="w-5 h-5 mr-2 text-primary-600 dark:text-primary-400"></i>
                                Preview Data
                            </h3>
                            <button class="text-sm text-primary-600 dark:text-primary-400 hover:underline" id="togglePreview">
                                <i data-feather="chevron-down" class="w-4 h-4"></i>
                            </button>
                        </div>
                        <div class="p-4 hidden" id="previewDataContent">
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
                                    <thead class="bg-gray-50 dark:bg-gray-700">
                                        <tr>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Symbol</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Qty</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Market Value</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Cost Basis</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700" id="previewDataBody">
                                        <!-- Data will be populated here -->
                                    </tbody>
                                </table>
                            </div>
                            <div class="mt-4 text-center text-gray-500 dark:text-gray-400" id="noPreviewData">
                                No data available. Upload a statement to begin.
                            </div>
                        </div>
                    </div>

                    <!-- Results Panel -->
                    <div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm overflow-hidden">
                        <div class="flex justify-between items-center p-4 border-b border-gray-200 dark:border-gray-700">
                            <h3 class="font-semibold text-lg flex items-center">
                                <i data-feather="bar-chart-2" class="w-5 h-5 mr-2 text-primary-600 dark:text-primary-400"></i>
                                Harvest Results
                            </h3>
                            <button class="text-sm text-primary-600 dark:text-primary-400 hover:underline" id="toggleResults">
                                <i data-feather="chevron-down" class="w-4 h-4"></i>
                            </button>
                        </div>
                        <div class="p-4 hidden" id="resultsContent">
                            <div class="flex justify-between items-center mb-4">
                                <div>
                                    <p class="text-sm text-gray-500 dark:text-gray-400">Generated Trades</p>
                                    <p class="font-medium" id="tradeCount">0 trades</p>
                                </div>
                                <button class="flex items-center text-sm bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg">
                                    <i data-feather="download" class="w-4 h-4 mr-2"></i>
                                    Export to Excel
                                </button>
                            </div>
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
                                    <thead class="bg-gray-50 dark:bg-gray-700">
                                        <tr>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Action</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Symbol</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Qty</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Est. Gain/Loss</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700" id="resultsDataBody">
                                        <!-- Results will be populated here -->
                                    </tbody>
                                </table>
                            </div>
                            <div class="mt-4 text-center text-gray-500 dark:text-gray-400" id="noResultsData">
                                No harvest results available. Run the harvest to generate trades.
                            </div>
                        </div>
                    </div>
                </div>
</div>
        </div>
        <!-- Bottom Action Bar -->
        <div class="fixed bottom-0 left-0 w-full bg-white/90 dark:bg-gray-800/90 backdrop-blur-sm border-t border-gray-200 dark:border-gray-700 p-4 z-50">
            <div class="flex items-center justify-between mb-2">
                <div class="flex items-center text-sm text-gray-600 dark:text-gray-400">
                    <span id="saveStatus" class="flex items-center">
                        <i data-feather="circle" class="w-3 h-3 mr-1 text-gray-400"></i>
                        Not saved
                    </span>
                    <span class="mx-2">•</span>
                    <span id="autoSaveStatus" class="flex items-center">
                        <i data-feather="clock" class="w-3 h-3 mr-1 text-gray-400"></i>
                        Auto-save off
                    </span>
                </div>
                <button id="savePortfolioBtn" class="flex items-center text-blue-600 dark:text-blue-400 hover:underline">
                    <i data-feather="save" class="w-4 h-4 mr-1"></i>
                    Save Portfolio
                </button>
            </div>
<div class="max-w-6xl mx-auto flex flex-col md:flex-row items-center gap-4">
                <div class="flex-1 min-w-[150px]">
                    <label class="text-sm text-gray-600 dark:text-gray-400">Max Tax Budget ($)</label>
                    <input type="number" id="maxBudget" placeholder="e.g., 3000" class="mt-1 w-full bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded px-3 py-2 dark:text-white">
                </div>
                <div class="flex items-center gap-2">
                    <label class="text-sm text-gray-600 dark:text-gray-400">Disposition</label>
                    <select id="dispositionMethod" class="bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded px-2 py-1 text-sm dark:text-white">
                        <option value="fifo">FIFO</option>
                        <option value="lifo">LIFO</option>
                        <option value="highest">Highest Cost</option>
                        <option value="lowest">Lowest Cost</option>
                    </select>
                </div>
                <div class="flex-1">
                    <label class="text-sm text-gray-600 dark:text-gray-400">Long-Term Rate</label>
                    <input type="range" id="longTermRate" min="0" max="50" value="15" class="w-full mt-1">
                    <span class="text-primary-600 dark:text-primary-400 text-sm"><span id="longTermRateValue">15</span>%</span>
                </div>
                <div class="flex-1">
                    <label class="text-sm text-gray-600 dark:text-gray-400">Short-Term Rate</label>
                    <input type="range" id="shortTermRate" min="0" max="50" value="25" class="w-full mt-1">
                    <span class="text-primary-600 dark:text-primary-400 text-sm"><span id="shortTermRateValue">25</span>%</span>
                </div>
                <div class="flex-1">
                    <label class="text-sm text-gray-600 dark:text-gray-400">Raise Cash ($)</label>
                    <input type="number" id="raiseCash" placeholder="0" class="mt-1 w-full bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded px-3 py-2 dark:text-white">
                </div>
                <button id="runHarvest" class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-2 rounded-lg text-sm font-medium transition whitespace-nowrap">
                    <i data-feather="bar-chart-2" class="inline mr-2 w-4 h-4"></i> Run Harvest
                </button>
            </div>
        </div>
</div>
    <!-- Toast Notification Container -->
    <div id="toastContainer" class="fixed top-4 left-1/2 transform -translate-x-1/2 z-50 space-y-2 w-full max-w-md px-4"></div>

    <script>
        feather.replace();
        
        // Current step tracking
        let currentStep = 'upload';
        
        // Initialize Vanta.js
VANTA.GLOBE({
            el: "#vanta-bg",
            mouseControls: true,
            touchControls: true,
            gyroControls: false,
            minHeight: 200.00,
            minWidth: 200.00,
            scale: 1.00,
            scaleMobile: 1.00,
            color: 0x3b82f6,
            backgroundColor: 0xffffff,
            size: 0.8
        });

        // Theme toggle functionality
        const themeToggle = document.getElementById('themeToggle');
        const html = document.documentElement;
        
        themeToggle.addEventListener('click', () => {
            html.classList.toggle('dark');
            localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light');
            
            // Update Vanta.js background for theme
            if (html.classList.contains('dark')) {
                VANTA.GLOBE({
                    el: "#vanta-bg",
                    color: 0x3b82f6,
                    backgroundColor: 0x111827
                });
            } else {
                VANTA.GLOBE({
                    el: "#vanta-bg",
                    color: 0x3b82f6,
                    backgroundColor: 0xffffff
                });
            }
        });

        // Check for saved theme preference
        if (localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
            html.classList.add('dark');
            VANTA.GLOBE({
                el: "#vanta-bg",
                color: 0x3b82f6,
                backgroundColor: 0x111827
            });
        }

        // Dropzone functionality
        const dropzone = document.getElementById('dropzone');
        ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
            dropzone.addEventListener(eventName, preventDefaults, false);
        });

        function preventDefaults(e) {
            e.preventDefault();
            e.stopPropagation();
        }

        ['dragenter', 'dragover'].forEach(eventName => {
            dropzone.addEventListener(eventName, highlight, false);
        });

        ['dragleave', 'drop'].forEach(eventName => {
            dropzone.addEventListener(eventName, unhighlight, false);
        });

        function highlight() {
            dropzone.classList.add('dropzone-active');
        }

        function unhighlight() {
            dropzone.classList.remove('dropzone-active');
        }

        dropzone.addEventListener('drop', handleDrop, false);

        function handleDrop(e) {
            const dt = e.dataTransfer;
            const files = dt.files;
            handleFiles(files);
        }

        function handleFiles(files) {
            ([...files]).forEach(uploadFile);
        }
        function uploadFile(file) {
            // Show loading state
            showLoading('upload', 'Processing your file...');
            
            // Simulate file processing
            setTimeout(() => {
                hideLoading('upload');
                if (file.name.endsWith('.pdf') || file.name.endsWith('.csv') || file.name.endsWith('.xlsx')) {
                    showToast('File uploaded successfully!', 'success');
                    updateFileUploadSuccess(file.name);
                    enableNextStep('settings');
                } else {
                    showToast('Invalid file type. Please upload PDF, CSV, or XLSX.', 'error');
                }
            }, 2000);
        }

        function updateFileUploadSuccess(filename) {
            const dropzone = document.getElementById('dropzone');
            dropzone.innerHTML = `
                <div class="flex flex-col items-center">
                    <i data-feather="check-circle" class="w-12 h-12 text-green-500 mb-3"></i>
                    <h3 class="text-lg font-medium mb-1">Upload Complete</h3>
                    <p class="text-gray-500 dark:text-gray-400 text-sm mb-4">${filename}</p>
                    <button class="text-primary-600 dark:text-primary-400 text-sm hover:underline" id="changeFile">
                        Change File
                    </button>
                </div>
            `;
            feather.replace();
            document.getElementById('changeFile').addEventListener('click', resetUploader);
        }

        function resetUploader() {
            const dropzone = document.getElementById('dropzone');
            dropzone.innerHTML = `
                <i data-feather="upload-cloud" class="w-12 h-12 mx-auto text-gray-400 mb-3"></i>
                <h3 class="text-lg font-medium mb-1">Upload Statement</h3>
                <p class="text-gray-500 dark:text-gray-400 text-sm mb-4">Drag & drop your statement here (PDF, CSV, XLSX)</p>
                <button class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-2 rounded-lg text-sm font-medium transition">
                    Select File
                </button>
            `;
            feather.replace();
            currentStep = 'upload';
            updateStepUI();
        }

        function enableNextStep(nextStep) {
            currentStep = nextStep;
            updateStepUI();
        }

        function updateStepUI() {
            // Update workflow navigation highlights
            document.querySelectorAll('.workflow-step').forEach(step => {
                if (step.dataset.step === currentStep) {
                    step.classList.add('bg-primary-100', 'dark:bg-primary-900', 'text-primary-600', 'dark:text-primary-400');
                    step.classList.remove('bg-gray-200', 'dark:bg-gray-600', 'text-gray-500', 'dark:text-gray-300');
                } else {
                    step.classList.remove('bg-primary-100', 'dark:bg-primary-900', 'text-primary-600', 'dark:text-primary-400');
                    step.classList.add('bg-gray-200', 'dark:bg-gray-600', 'text-gray-500', 'dark:text-gray-300');
                }
            });

            // Show/hide panels based on current step
            if (currentStep === 'settings') {
                document.getElementById('settingsPanel').classList.remove('hidden');
                document.getElementById('uploadPanel').classList.add('hidden');
            } else {
                document.getElementById('settingsPanel').classList.add('hidden');
                document.getElementById('uploadPanel').classList.remove('hidden');
            }
        }

        function showLoading(context, message) {
            const loaderId = `${context}Loader`;
            let loader = document.getElementById(loaderId);
            
            if (!loader) {
                loader = document.createElement('div');
                loader.id = loaderId;
                loader.className = 'fixed inset-0 bg-black bg-opacity-30 flex items-center justify-center z-50';
                loader.innerHTML = `
                    <div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-xl max-w-sm w-full text-center">
                        <div class="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600 mx-auto mb-4"></div>
                        <p class="text-gray-800 dark:text-gray-200">${message}</p>
                    </div>
                `;
                document.body.appendChild(loader);
            }
        }

        function hideLoading(context) {
            const loaderId = `${context}Loader`;
            const loader = document.getElementById(loaderId);
            if (loader) {
                loader.remove();
            }
        }

        function showToast(message, type = 'info') {
            const toast = document.createElement('div');
            const types = {
                success: 'bg-green-100 border-green-400 text-green-700',
                error: 'bg-red-100 border-red-400 text-red-700',
                warning: 'bg-yellow-100 border-yellow-400 text-yellow-700',
                info: 'bg-blue-100 border-blue-400 text-blue-700'
            };
            
            toast.className = `border-l-4 ${types[type]} p-4 rounded shadow-lg mb-2 flex items-start justify-between animate-fade-in`;
            toast.innerHTML = `
                <div class="flex items-start">
                    <i data-feather="${type === 'success' ? 'check-circle' : type === 'error' ? 'alert-circle' : 'info'}" 
                       class="w-5 h-5 mr-3 mt-0.5"></i>
                    <p>${message}</p>
                </div>
                <button class="ml-4 text-gray-500 hover:text-gray-700" onclick="this.parentElement.remove()">
                    <i data-feather="x" class="w-4 h-4"></i>
                </button>
            `;
            
            document.getElementById('toastContainer').appendChild(toast);
            feather.replace();
            
            setTimeout(() => {
                toast.classList.add('animate-fade-out');
                setTimeout(() => toast.remove(), 300);
            }, 5000);
        }

        // Initialize interactive panels
        document.getElementById('togglePreview').addEventListener('click', function() {
            const content = document.getElementById('previewDataContent');
            const icon = this.querySelector('i');
            content.classList.toggle('hidden');
            icon.setAttribute('data-feather', content.classList.contains('hidden') ? 'chevron-down' : 'chevron-up');
            feather.replace();
        });

        document.getElementById('toggleResults').addEventListener('click', function() {
            const content = document.getElementById('resultsContent');
            const icon = this.querySelector('i');
            content.classList.toggle('hidden');
            icon.setAttribute('data-feather', content.classList.contains('hidden') ? 'chevron-down' : 'chevron-up');
            feather.replace();
        });

        // Real-time calculation updates
        document.getElementById('maxBudget').addEventListener('input', updateCalculations);
        document.getElementById('longTermRate').addEventListener('input', function() {
            document.getElementById('longTermRateValue').textContent = this.value;
            updateCalculations();
        });
        document.getElementById('shortTermRate').addEventListener('input', function() {
            document.getElementById('shortTermRateValue').textContent = this.value;
            updateCalculations();
        });
        document.getElementById('dispositionMethod').addEventListener('change', updateCalculations);
        document.getElementById('raiseCash').addEventListener('input', updateCalculations);

        function updateCalculations() {
            // Simulate calculations
            const budget = parseFloat(document.getElementById('maxBudget').value) || 0;
            const longTermRate = parseFloat(document.getElementById('longTermRate').value) || 0;
            const shortTermRate = parseFloat(document.getElementById('shortTermRate').value) || 0;
            
            // Update UI with simulated data
            document.getElementById('shortTermEstimate').textContent = `${(Math.random() * 1000).toFixed(2)}`;
            document.getElementById('longTermEstimate').textContent = `${(Math.random() * 500).toFixed(2)}`;
            document.getElementById('taxBillEstimate').textContent = `-${(Math.random() * 300).toFixed(2)}`;
            
            const progress = Math.min(100, (Math.random() * 100));
            document.getElementById('savingsProgress').style.width = `${progress}%`;
            document.getElementById('savingsPercentage').textContent = `${progress.toFixed(0)}%`;
        }

        // Form validation
        document.getElementById('runHarvest').addEventListener('click', function() {
            const budget = document.getElementById('maxBudget').value;
            if (!budget || isNaN(budget) || parseFloat(budget) <= 0) {
                showToast('Please enter a valid tax budget amount', 'error');
                return;
            }
            
            showLoading('harvest', 'Calculating optimal trades...');
            setTimeout(() => {
                hideLoading('harvest');
                showToast('Harvest complete! Optimal trades generated.', 'success');
                // Simulate results
                populateResultsTable();
            }, 3000);
        });

        function populateResultsTable() {
            const resultsBody = document.getElementById('resultsDataBody');
            resultsBody.innerHTML = '';
            
            // Sample data
            const sampleTrades = [
                { action: 'Sell', symbol: 'AAPL', qty: 5, gainLoss: -125.34 },
                { action: 'Sell', symbol: 'TSLA', qty: 2, gainLoss: -87.21 },
                { action: 'Buy', symbol: 'SPY', qty: 3, gainLoss: 0 }
            ];
            
            sampleTrades.forEach(trade => {
                const row = document.createElement('tr');
                row.className = 'hover:bg-gray-50 dark:hover:bg-gray-700';
                row.innerHTML = `
                    <td class="px-4 py-2 whitespace-nowrap ${trade.action === 'Sell' ? 'text-red-500' : 'text-green-500'}">${trade.action}</td>
                    <td class="px-4 py-2 whitespace-nowrap">${trade.symbol}</td>
                    <td class="px-4 py-2 whitespace-nowrap">${trade.qty}</td>
                    <td class="px-4 py-2 whitespace-nowrap ${trade.gainLoss < 0 ? 'text-red-500' : 'text-green-500'}">
                        ${Math.abs(trade.gainLoss).toFixed(2)}
                    </td>
                `;
                resultsBody.appendChild(row);
            });
            
            document.getElementById('tradeCount').textContent = `${sampleTrades.length} trades`;
            document.getElementById('resultsContent').classList.remove('hidden');
            document.getElementById('noResultsData').classList.add('hidden');
        }

        // Initialize with sample preview data
        document.addEventListener('DOMContentLoaded', function() {
            // Sample preview data
            const sampleData = [
                { symbol: 'AAPL', qty: 10, marketValue: 1750.00, costBasis: 1500.00 },
                { symbol: 'TSLA', qty: 5, marketValue: 1250.00, costBasis: 1500.00 },
                { symbol: 'SPY', qty: 15, marketValue: 6000.00, costBasis: 5500.00 }
            ];
            
            const previewBody = document.getElementById('previewDataBody');
            sampleData.forEach(item => {
                const row = document.createElement('tr');
                row.className = 'hover:bg-gray-50 dark:hover:bg-gray-700';
                row.innerHTML = `
                    <td class="px-4 py-2 whitespace-nowrap">${item.symbol}</td>
                    <td class="px-4 py-2 whitespace-nowrap">${item.qty}</td>
                    <td class="px-4 py-2 whitespace-nowrap">${item.marketValue.toFixed(2)}</td>
                    <td class="px-4 py-2 whitespace-nowrap">${item.costBasis.toFixed(2)}</td>
                    <td class="px-4 py-2 whitespace-nowrap">
                        <button class="text-primary-600 dark:text-primary-400 hover:underline text-sm">Edit</button>
                    </td>
                `;
                previewBody.appendChild(row);
            });
            
            document.getElementById('noPreviewData').classList.add('hidden');
            
            // Initialize workflow steps
            document.querySelectorAll('.workflow-step').forEach(step => {
                step.addEventListener('click', function() {
                    if (this.dataset.step === 'upload' || currentStep === 'settings') {
                        enableNextStep(this.dataset.step);
                    }
                });
            });
        });
    </script>

    <style>
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes fadeOut {
            from { opacity: 1; transform: translateY(0); }
            to { opacity: 0; transform: translateY(10px); }
        }
        .animate-fade-in {
            animation: fadeIn 0.3s ease-out forwards;
        }
        .animate-fade-out {
            animation: fadeOut 0.3s ease-out forwards;
        }
        
        /* Responsive adjustments */
        @media (max-width: 768px) {
            .bottom-action-bar {
                flex-direction: column;
                gap: 0.5rem;
                padding: 0.5rem;
            }
            .bottom-action-bar > div {
                width: 100%;
            }
            #mainCard {
                flex-direction: column;
            }
            #mainCard > div {
                width: 100%;
            }
        }
    </style>
</body>
</html>