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
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
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>TradePulse: Online Brokerage</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta charset="utf-8" />
    <meta name="description" content="Trade stocks, ETFs, and crypto with TradePulse's online brokerage platform" />
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
    <style>
      input:focus {
        outline: 2px solid #1d4ed8;
      }
      .error {
        border-color: #ef4444;
      }
      @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
      }
      .fade-in {
        animation: fadeIn 0.5s ease-in;
      }
      .autocomplete-suggestions {
        position: absolute;
        background: white;
        border: 1px solid #d1d5db;
        max-height: 150px;
        overflow-y: auto;
        width: 100%;
        z-index: 10;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
      }
      .autocomplete-suggestions div {
        padding: 8px;
        cursor: pointer;
      }
      .autocomplete-suggestions div:hover {
        background: #f3f4f6;
      }
      .dark .autocomplete-suggestions {
        background: #1f2937;
        border-color: #374151;
      }
      .dark .autocomplete-suggestions div:hover {
        background: #374151;
      }
      .glow {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
      }
      .price-up {
        color: #10b981;
      }
      .price-down {
        color: #ef4444;
      }
      .price-neutral {
        color: #6b7280;
      }
      .ticker-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
      }
      .ticker-card {
        transition: all 0.2s ease;
      }
      .blink {
        animation: blink 1s step-end infinite;
      }
      @keyframes blink {
        50% { opacity: 0.5; }
      }
    </style>
  </head>
  <body class="flex flex-col min-h-screen bg-gray-100 font-sans transition-colors duration-300 dark:bg-gray-900" id="theme-body">
    <!-- Header -->
    <header class="bg-blue-800 text-white py-4 shadow-md dark:bg-gray-800">
      <div class="container mx-auto px-4 sm:px-6 flex justify-between items-center">
        <div class="flex items-center space-x-2">
          <i class="fas fa-chart-line text-xl"></i>
          <h1 class="text-xl font-bold">TradePulse</h1>
        </div>
        <nav class="hidden md:flex items-center space-x-4">
          <a href="#home" class="hover:underline flex items-center space-x-1">
            <i class="fas fa-home"></i>
            <span>Home</span>
          </a>
          <a href="#dashboard" class="hover:underline flex items-center space-x-1">
            <i class="fas fa-tachometer-alt"></i>
            <span>Dashboard</span>
          </a>
          <a href="#trade" class="hover:underline flex items-center space-x-1">
            <i class="fas fa-exchange-alt"></i>
            <span>Trade</span>
          </a>
          <button id="theme-toggle" class="bg-blue-600 px-4 py-2 rounded-md hover:bg-blue-700 flex items-center space-x-2 dark:bg-gray-700 dark:hover:bg-gray-600">
            <i class="fas fa-moon"></i>
            <span>Dark Mode</span>
          </button>
          <button class="bg-blue-600 px-4 py-2 rounded-md hover:bg-blue-700 flex items-center space-x-2 dark:bg-gray-700 dark:hover:bg-gray-600">
            <i class="fas fa-sign-in-alt"></i>
            <span>Login</span>
          </button>
        </nav>
        <button id="mobile-menu-button" class="md:hidden text-xl">
          <i class="fas fa-bars"></i>
        </button>
      </div>
      <!-- Mobile menu -->
      <div id="mobile-menu" class="hidden md:hidden bg-blue-900 dark:bg-gray-700">
        <div class="container mx-auto px-4 py-2 flex flex-col space-y-2">
          <a href="#home" class="hover:underline flex items-center space-x-2 py-1">
            <i class="fas fa-home w-5"></i>
            <span>Home</span>
          </a>
          <a href="#dashboard" class="hover:underline flex items-center space-x-2 py-1">
            <i class="fas fa-tachometer-alt w-5"></i>
            <span>Dashboard</span>
          </a>
          <a href="#trade" class="hover:underline flex items-center space-x-2 py-1">
            <i class="fas fa-exchange-alt w-5"></i>
            <span>Trade</span>
          </a>
          <button id="theme-toggle-mobile" class="w-full text-left hover:underline flex items-center space-x-2 py-1">
            <i class="fas fa-moon w-5"></i>
            <span>Dark Mode</span>
          </button>
          <button class="w-full text-left hover:underline flex items-center space-x-2 py-1">
            <i class="fas fa-sign-in-alt w-5"></i>
            <span>Login</span>
          </button>
        </div>
      </div>
    </header>

    <!-- Hero Section -->
    <section id="home" class="bg-gradient-to-r from-blue-50 to-blue-100 py-12 text-center dark:from-gray-800 dark:to-gray-700 relative overflow-hidden">
      <div class="absolute inset-0 opacity-10 dark:opacity-5">
        <div class="absolute top-0 left-0 w-full h-full bg-[url('https://enzostvs-deepsite.hf.space/grid.svg')]"></div>
      </div>
      <div class="container mx-auto px-6 relative z-10">
        <span class="text-xs rounded-full mb-2 inline-block px-3 py-1 border border-blue-500/15 bg-blue-500/15 text-blue-500 dark:bg-blue-400/15 dark:text-blue-300">
          <i class="fas fa-bolt mr-1"></i> Start Investing Today
        </span>
        <h2 class="text-3xl lg:text-5xl font-bold text-gray-800 dark:text-white">
          <span class="text-xl lg:text-3xl text-gray-400 block font-medium dark:text-gray-300">Your Wealth, Your Way,</span>
          Trade with <span class="text-blue-600 dark:text-blue-400">TradePulse</span>.
        </h2>
        <p class="mt-4 text-gray-600 max-w-2xl mx-auto dark:text-gray-300">
          Buy and sell stocks, ETFs, and cryptocurrencies with zero commissions and real-time insights.
        </p>
        <button onclick="alert('Please verify your identity to start trading.')" class="mt-6 bg-blue-600 text-white px-6 py-3 rounded-md hover:bg-blue-700 glow transition-all duration-300 flex items-center mx-auto space-x-2">
          <i class="fas fa-play"></i>
          <span>Get Started</span>
        </button>
      </div>
      <img
        src="https://enzostvs-deepsite.hf.space/arrow.svg"
        alt="Decorative arrow"
        class="absolute bottom-8 left-0 w-[100px] transform rotate-[30deg] hidden md:block"
      />
    </section>

    <!-- Market Tickers -->
    <div class="bg-white dark:bg-gray-800 py-3 border-b border-gray-200 dark:border-gray-700 overflow-hidden">
      <div class="container mx-auto px-4">
        <div class="marquee">
          <div class="marquee-content flex space-x-8">
            <!-- Tickers will be added here by JavaScript -->
          </div>
        </div>
      </div>
    </div>

    <!-- Dashboard Section -->
    <section id="dashboard" class="py-12 bg-white dark:bg-gray-900">
      <div class="container mx-auto px-6">
        <h3 class="text-2xl font-bold text-gray-800 dark:text-white text-center">
          <i class="fas fa-tachometer-alt mr-2"></i>Your Dashboard
        </h3>
        <div class="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-6">
          <!-- Portfolio Overview -->
          <div class="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
            <div class="flex justify-between items-center">
              <h4 class="text-lg font-semibold text-gray-700 dark:text-gray-300">
                <i class="fas fa-wallet mr-2"></i>Portfolio Value
              </h4>
              <span class="text-xs bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-300 px-2 py-1 rounded-full">
                <i class="fas fa-arrow-up mr-1"></i>2.3%
              </span>
            </div>
            <p class="text-3xl font-bold text-blue-600 dark:text-blue-400 mt-2">$12,345.67</p>
            <p class="text-sm text-gray-500 dark:text-gray-400">+$280.45 today</p>
            <div class="mt-4 h-64">
              <canvas id="portfolio-chart" class="w-full h-full" aria-label="Portfolio allocation chart"></canvas>
            </div>
            <div class="mt-4 flex justify-between text-sm">
              <span class="text-gray-500 dark:text-gray-400">Available Cash</span>
              <span class="font-medium text-gray-700 dark:text-gray-300">$5,000.00</span>
            </div>
          </div>
          
          <!-- Watchlist -->
          <div class="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
            <div class="flex justify-between items-center">
              <h4 class="text-lg font-semibold text-gray-700 dark:text-gray-300">
                <i class="fas fa-star mr-2"></i>Watchlist
              </h4>
              <button class="text-blue-600 dark:text-blue-400 text-sm">
                <i class="fas fa-plus mr-1"></i>Add
              </button>
            </div>
            <ul class="mt-4 space-y-3">
              <li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
                <div>
                  <div class="font-medium text-gray-800 dark:text-gray-200">Apple</div>
                  <div class="text-xs text-gray-500 dark:text-gray-400">AAPL</div>
                </div>
                <div class="text-right">
                  <div class="font-medium text-gray-800 dark:text-gray-200">$235.40</div>
                  <div class="text-xs price-up">
                    <i class="fas fa-arrow-up mr-1"></i>1.2%
                  </div>
                </div>
              </li>
              <li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
                <div>
                  <div class="font-medium text-gray-800 dark:text-gray-200">Tesla</div>
                  <div class="text-xs text-gray-500 dark:text-gray-400">TSLA</div>
                </div>
                <div class="text-right">
                  <div class="font-medium text-gray-800 dark:text-gray-200">$420.15</div>
                  <div class="text-xs price-down">
                    <i class="fas fa-arrow-down mr-1"></i>0.8%
                  </div>
                </div>
              </li>
              <li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
                <div>
                  <div class="font-medium text-gray-800 dark:text-gray-200">Bitcoin</div>
                  <div class="text-xs text-gray-500 dark:text-gray-400">BTC</div>
                </div>
                <div class="text-right">
                  <div class="font-medium text-gray-800 dark:text-gray-200">$65,200.00</div>
                  <div class="text-xs price-up">
                    <i class="fas fa-arrow-up mr-1"></i>3.5%
                  </div>
                </div>
              </li>
              <li class="ticker-card bg-white dark:bg-gray-700 p-3 rounded-md flex justify-between items-center">
                <div>
                  <div class="font-medium text-gray-800 dark:text-gray-200">SPDR S&P 500</div>
                  <div class="text-xs text-gray-500 dark:text-gray-400">SPY</div>
                </div>
                <div class="text-right">
                  <div class="font-medium text-gray-800 dark:text-gray-200">$550.20</div>
                  <div class="text-xs price-neutral">
                    <i class="fas fa-minus mr-1"></i>0.0%
                  </div>
                </div>
              </li>
            </ul>
          </div>
          
          <!-- Market News -->
          <div class="bg-gray-50 dark:bg-gray-800 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
            <h4 class="text-lg font-semibold text-gray-700 dark:text-gray-300">
              <i class="fas fa-newspaper mr-2"></i>Market News
            </h4>
            <ul class="mt-4 space-y-4">
              <li class="border-b border-gray-200 dark:border-gray-700 pb-3">
                <h5 class="font-medium text-gray-800 dark:text-gray-200">Tech stocks rally as AI demand surges</h5>
                <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Major tech companies report strong earnings driven by AI product demand...</p>
                <span class="text-xs text-gray-500 dark:text-gray-500 mt-1 block">2 hours ago</span>
              </li>
              <li class="border-b border-gray-200 dark:border-gray-700 pb-3">
                <h5 class="font-medium text-gray-800 dark:text-gray-200">Fed signals steady interest rates for 2025</h5>
                <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Federal Reserve indicates no rate cuts until inflation reaches 2% target...</p>
                <span class="text-xs text-gray-500 dark:text-gray-500 mt-1 block">5 hours ago</span>
              </li>
              <li>
                <h5 class="font-medium text-gray-800 dark:text-gray-200">Bitcoin hits new high amid ETF approvals</h5>
                <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Cryptocurrency markets surge as SEC approves additional Bitcoin ETFs...</p>
                <span class="text-xs text-gray-500 dark:text-gray-500 mt-1 block">1 day ago</span>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </section>

    <!-- Trade Section -->
    <section id="trade" class="py-12 bg-gray-100 dark:bg-gray-800">
      <div class="container mx-auto px-6">
        <h3 class="text-2xl font-bold text-gray-800 dark:text-white text-center">
          <i class="fas fa-exchange-alt mr-2"></i>Trade Assets
        </h3>
        <div class="mt-8 max-w-4xl mx-auto grid grid-cols-1 lg:grid-cols-2 gap-8">
          <!-- Trade Form -->
          <div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
            <h4 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">
              <i class="fas fa-trade-alt mr-2"></i>Place Order
            </h4>
            <form id="trade-form" class="space-y-4" novalidate>
              <div>
                <label for="asset-search" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
                  Search Asset
                  <span title="Enter stock or crypto ticker" class="text-blue-500 dark:text-blue-400 cursor-help ml-1">
                    <i class="fas fa-info-circle"></i>
                  </span>
                </label>
                <div class="relative mt-1">
                  <input
                    id="asset-search"
                    type="text"
                    placeholder="e.g., AAPL, Bitcoin"
                    class="w-full p-3 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white"
                    aria-describedby="asset-error"
                    autocomplete="off"
                  />
                  <div id="autocomplete-suggestions" class="autocomplete-suggestions hidden"></div>
                </div>
                <p id="asset-error" class="mt-1 text-sm text-red-500 dark:text-red-400 hidden"></p>
              </div>
              
              <div class="grid grid-cols-2 gap-4">
                <div>
                  <label for="quantity" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Quantity</label>
                  <input
                    id="quantity"
                    type="number"
                    step="1"
                    min="1"
                    placeholder="e.g., 10"
                    class="w-full p-3 mt-1 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white"
                    aria-describedby="quantity-error"
                    required
                  />
                  <p id="quantity-error" class="mt-1 text-sm text-red-500 dark:text-red-400 hidden"></p>
                </div>
                
                <div>
                  <label for="order-type" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Order Type</label>
                  <select id="order-type" class="w-full p-3 mt-1 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white">
                    <option value="buy">Buy</option>
                    <option value="sell">Sell</option>
                  </select>
                </div>
              </div>
              
              <div class="grid grid-cols-2 gap-4">
                <div>
                  <label class="block text-sm font-medium text-gray-700 dark:text-gray-300">Price Type</label>
                  <div class="mt-1 flex rounded-md shadow-sm">
                    <button type="button" class="order-price-type bg-blue-600 text-white px-4 py-2 rounded-l-md dark:bg-blue-700" data-type="market">
                      Market
                    </button>
                    <button type="button" class="order-price-type bg-gray-200 px-4 py-2 rounded-r-md dark:bg-gray-600 dark:text-gray-300" data-type="limit">
                      Limit
                    </button>
                  </div>
                </div>
                
                <div id="limit-price-container" class="hidden">
                  <label for="limit-price" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Limit Price</label>
                  <input
                    id="limit-price"
                    type="number"
                    step="0.01"
                    min="0"
                    placeholder="e.g., 235.50"
                    class="w-full p-3 mt-1 border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-600 dark:text-white"
                  />
                </div>
              </div>
              
              <div class="pt-2">
                <button
                  type="submit"
                  class="w-full bg-blue-600 text-white p-3 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:bg-blue-700 dark:hover:bg-blue-800 dark:focus:ring-blue-600 dark:focus:ring-offset-gray-800 transition-colors"
                >
                  <i class="fas fa-paper-plane mr-2"></i>Place Order
                </button>
              </div>
            </form>
            <p id="trade-result" class="mt-4 text-center text-lg text-gray-700 dark:text-gray-300 fade-in" role="alert"></p>
          </div>
          
          <!-- Order Preview -->
          <div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
            <h4 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">
              <i class="fas fa-eye mr-2"></i>Order Preview
            </h4>
            <div id="order-preview" class="bg-gray-50 dark:bg-gray-600 rounded-lg p-4">
              <div class="text-center text-gray-500 dark:text-gray-400 py-8">
                <i class="fas fa-search-dollar text-3xl mb-2"></i>
                <p>Search for an asset to see order details</p>
              </div>
              <div id="preview-details" class="hidden space-y-4">
                <div class="flex justify-between">
                  <span class="text-gray-600 dark:text-gray-300">Asset:</span>
                  <span id="preview-asset" class="font-medium text-gray-800 dark:text-white"></span>
                </div>
                <div class="flex justify-between">
                  <span class="text-gray-600 dark:text-gray-300">Action:</span>
                  <span id="preview-action" class="font-medium"></span>
                </div>
                <div class="flex justify-between">
                  <span class="text-gray-600 dark:text-gray-300">Price Type:</span>
                  <span id="preview-price-type" class="font-medium"></span>
                </div>
                <div id="preview-limit-price-container" class="flex justify-between hidden">
                  <span class="text-gray-600 dark:text-gray-300">Limit Price:</span>
                  <span id="preview-limit-price" class="font-medium"></span>
                </div>
                <div class="flex justify-between">
                  <span class="text-gray-600 dark:text-gray-300">Quantity:</span>
                  <span id="preview-quantity" class="font-medium text-gray-800 dark:text-white"></span>
                </div>
                <div class="border-t border-gray-200 dark:border-gray-600 pt-2 mt-2">
                  <div class="flex justify-between">
                    <span class="text-gray-600 dark:text-gray-300">Estimated Cost:</span>
                    <span id="preview-cost" class="font-bold text-lg text-gray-800 dark:text-white"></span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Features Section -->
    <section class="py-12 bg-blue-50 dark:bg-gray-800">
      <div class="container mx-auto px-6">
        <h3 class="text-2xl font-bold text-gray-800 dark:text-white text-center mb-8">
          <i class="fas fa-star mr-2"></i>Why Choose TradePulse?
        </h3>
        <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
          <div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow text-center">
            <div class="text-blue-600 dark:text-blue-400 text-4xl mb-4">
              <i class="fas fa-dollar-sign"></i>
            </div>
            <h4 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">Zero Commissions</h4>
            <p class="text-gray-600 dark:text-gray-300">
              Trade stocks, ETFs, and options with no commission fees. Keep more of your profits.
            </p>
          </div>
          <div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow text-center">
            <div class="text-blue-600 dark:text-blue-400 text-4xl mb-4">
              <i class="fas fa-bolt"></i>
            </div>
            <h4 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">Real-Time Data</h4>
            <p class="text-gray-600 dark:text-gray-300">
              Get real-time market data and lightning-fast execution on all your trades.
            </p>
          </div>
          <div class="bg-white dark:bg-gray-700 p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow text-center">
            <div class="text-blue-600 dark:text-blue-400 text-4xl mb-4">
              <i class="fas fa-lock"></i>
            </div>
            <h4 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">Secure Platform</h4>
            <p class="text-gray-600 dark:text-gray-300">
              Bank-level security and encryption to protect your account and personal information.
            </p>
          </div>
        </div>
      </div>
    </section>

    <!-- Footer -->
    <footer class="bg-blue-800 dark:bg-gray-800 text-white py-8 mt-auto">
      <div class="container mx-auto px-6">
        <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
          <div>
            <h5 class="text-lg font-semibold mb-4 flex items-center">
              <i class="fas fa-chart-line mr-2"></i> TradePulse
            </h5>
            <p class="text-sm text-blue-200 dark:text-gray-300">
              Empowering investors with powerful tools and zero-commission trading.
            </p>
          </div>
          <div>
            <h5 class="text-lg font-semibold mb-4">Trading</h5>
            <ul class="space-y-2 text-sm text-blue-200 dark:text-gray-300">
              <li><a href="#" class="hover:underline">Stocks</a></li>
              <li><a href="#" class="hover:underline">ETFs</a></li>
              <li><a href="#" class="hover:underline">Options</a></li>
              <li><a href="#" class="hover:underline">Crypto</a></li>
            </ul>
          </div>
          <div>
            <h5 class="text-lg font-semibold mb-4">Resources</h5>
            <ul class="space-y-2 text-sm text-blue-200 dark:text-gray-300">
              <li><a href="#" class="hover:underline">Learning Center</a></li>
              <li><a href="#" class="hover:underline">Market Research</a></li>
              <li><a href="#" class="hover:underline">Investment Tools</a></li>
              <li><a href="#" class="hover:underline">API</a></li>
            </ul>
          </div>
          <div>
            <h5 class="text-lg font-semibold mb-4">Company</h5>
            <ul class="space-y-2 text-sm text-blue-200 dark:text-gray-300">
              <li><a href="#" class="hover:underline">About Us</a></li>
              <li><a href="#" class="hover:underline">Careers</a></li>
              <li><a href="#" class="hover:underline">Contact</a></li>
              <li><a href="#" class="hover:underline">Legal</a></li>
            </ul>
          </div>
        </div>
        <div class="border-t border-blue-700 dark:border-gray-700 mt-8 pt-6 text-center">
          <p class="text-sm text-blue-200 dark:text-gray-300">
            TradePulse is a demo brokerage platform for educational purposes. Investing involves risks, including loss of principal. Consult a financial advisor.
          </p>
          <p class="text-sm mt-2 text-blue-200 dark:text-gray-300">
            © 2025 TradePulse. All rights reserved.
          </p>
        </div>
      </div>
    </footer>

    <!-- JavaScript -->
    <script>
      // DOM Elements
      const tradeForm = document.getElementById('trade-form');
      const inputs = {
        asset: document.getElementById('asset-search'),
        quantity: document.getElementById('quantity'),
        limitPrice: document.getElementById('limit-price')
      };
      const errors = {
        asset: document.getElementById('asset-error'),
        quantity: document.getElementById('quantity-error')
      };
      const orderType = document.getElementById('order-type');
      const tradeResult = document.getElementById('trade-result');
      const suggestions = document.getElementById('autocomplete-suggestions');
      const themeBody = document.getElementById('theme-body');
      const themeToggle = document.getElementById('theme-toggle');
      const themeToggleMobile = document.getElementById('theme-toggle-mobile');
      const mobileMenuButton = document.getElementById('mobile-menu-button');
      const mobileMenu = document.getElementById('mobile-menu');
      const priceTypeButtons = document.querySelectorAll('.order-price-type');
      const limitPriceContainer = document.getElementById('limit-price-container');
      const previewDetails = document.getElementById('preview-details');
      const previewAsset = document.getElementById('preview-asset');
      const previewAction = document.getElementById('preview-action');
      const previewPriceType = document.getElementById('preview-price-type');
      const previewLimitPrice = document.getElementById('preview-limit-price');
      const previewLimitPriceContainer = document.getElementById('preview-limit-price-container');
      const previewQuantity = document.getElementById('preview-quantity');
      const previewCost = document.getElementById('preview-cost');
      const marqueeContent = document.querySelector('.marquee-content');
      let chartInstance = null;
      let currentPriceType = 'market';
      let isDark = localStorage.getItem('theme') === 'dark';

      // Mock asset data
      const assets = [
        { ticker: 'aapl', name: 'Apple', price: 235.4, change: 1.2 },
        { ticker: 'tsla', name: 'Tesla', price: 420.15, change: -0.8 },
        { ticker: 'btc', name: 'Bitcoin', price: 65200.0, change: 3.5 },
        { ticker: 'spy', name: 'SPDR S&P 500 ETF', price: 550.2, change: 0.0 },
        { ticker: 'msft', name: 'Microsoft', price: 420.5, change: 0.7 },
        { ticker: 'amzn', name: 'Amazon', price: 185.75, change: -1.2 },
        { ticker: 'googl', name: 'Alphabet', price: 175.3, change: 0.5 },
        { ticker: 'eth', name: 'Ethereum', price: 3500.0, change: 2.1 }
      ];

      // Market tickers data
      const marketTickers = [
        { symbol: '^GSPC', name: 'S&P 500', price: 5502.34, change: 0.23 },
        { symbol: '^DJI', name: 'Dow 30', price: 39231.23, change: -0.12 },
        { symbol: '^IXIC', name: 'Nasdaq', price: 16382.34, change: 0.45 },
        { symbol: '^RUT', name: 'Russell 2000', price: 2034.56, change: -0.34 },
        { symbol: 'CL=F', name: 'Crude Oil', price: 78.45, change: 1.23 },
        { symbol: 'GC=F', name: 'Gold', price: 2345.67, change: 0.56 },
        { symbol: 'EURUSD=X', name: 'EUR/USD', price: 1.0823, change: -0.12 },
        { symbol: 'BTC-USD', name: 'Bitcoin', price: 65200.0, change: 3.45 }
      ];

      // Initialize marquee with market tickers
      function initMarquee() {
        marketTickers.forEach(ticker => {
          const changeClass = ticker.change > 0 ? 'price-up' : ticker.change < 0 ? 'price-down' : 'price-neutral';
          const changeIcon = ticker.change > 0 ? 'fa-arrow-up' : ticker.change < 0 ? 'fa-arrow-down' : 'fa-minus';
          
          const tickerElement = document.createElement('div');
          tickerElement.className = 'flex items-center whitespace-nowrap';
          tickerElement.innerHTML = `
            <span class="font-medium mr-1">${ticker.symbol}</span>
            <span class="mr-2">${ticker.price.toFixed(2)}</span>
            <span class="${changeClass}">
              <i class="fas ${changeIcon} mr-1"></i>${Math.abs(ticker.change)}%
            </span>
          `;
          marqueeContent.appendChild(tickerElement);
        });

        // Clone content for seamless looping
        const clone = marqueeContent.cloneNode(true);
        marqueeContent.parentNode.appendChild(clone);
      }

      // Input validation
      function validateInput(id, value) {
        if (id === 'asset') {
          const asset = value.toLowerCase().trim();
          return !asset || !assets.some(a => a.ticker === asset) ? 'Please enter a valid asset (e.g., AAPL, TSLA, BTC, SPY).' : '';
        }
        if (!value || value <= 0) {
          return 'Please enter a positive number.';
        }
        return '';
      }

      // Update error display
      function updateError(id, message) {
        errors[id].textContent = message;
        errors[id].classList.toggle('hidden', !message);
        inputs[id].classList.toggle('error', !!message);
      }

      // Simulate trade
      function simulateTrade(asset, quantity, type, priceType, limitPrice) {
        try {
          const assetData = assets.find(a => a.ticker === asset.toLowerCase());
          if (!assetData) throw new Error('Unknown asset.');
          
          let price = assetData.price;
          let priceNote = '';
          
          if (priceType === 'limit') {
            if (limitPrice) {
              priceNote = ` at limit price $${limitPrice}`;
              price = parseFloat(limitPrice);
            } else {
              throw new Error('Limit price required for limit orders.');
            }
          }
          
          const total = (price * quantity).toFixed(2);
          return `Order placed: ${type.toUpperCase()} ${quantity} ${assetData.name} (${asset.toUpperCase()})${priceNote} for $${total}`;
        } catch (error) {
          console.error('Trade error:', error);
          return null;
        }
      }

      // Update order preview
      function updateOrderPreview() {
        const asset = inputs.asset.value.trim();
        const quantity = parseFloat(inputs.quantity.value);
        const type = orderType.value;
        const assetData = assets.find(a => a.ticker === asset.toLowerCase());
        
        if (!asset || !assetData || isNaN(quantity) || quantity <= 0) {
          previewDetails.classList.add('hidden');
          return;
        }
        
        previewDetails.classList.remove('hidden');
        previewAsset.textContent = `${assetData.name} (${asset.toUpperCase()})`;
        previewAction.textContent = type === 'buy' ? 'Buy' : 'Sell';
        previewAction.className = type === 'buy' ? 'font-medium price-up' : 'font-medium price-down';
        previewPriceType.textContent = currentPriceType === 'market' ? 'Market' : 'Limit';
        
        if (currentPriceType === 'limit' && inputs.limitPrice.value) {
          previewLimitPrice.textContent = `$${parseFloat(inputs.limitPrice.value).toFixed(2)}`;
          previewLimitPriceContainer.classList.remove('hidden');
        } else {
          previewLimitPriceContainer.classList.add('hidden');
        }
        
        previewQuantity.textContent = quantity;
        
        let price = assetData.price;
        if (currentPriceType === 'limit' && inputs.limitPrice.value) {
          price = parseFloat(inputs.limitPrice.value);
        }
        
        const total = (price * quantity).toFixed(2);
        previewCost.textContent = `$${total}`;
      }

      // Autocomplete suggestions
      function showSuggestions(value) {
        suggestions.innerHTML = '';
        if (!value) {
          suggestions.classList.add('hidden');
          return;
        }
        
        const matches = assets.filter(a => 
          a.ticker.includes(value.toLowerCase()) || 
          a.name.toLowerCase().includes(value.toLowerCase())
        );
        
        if (matches.length === 0) {
          suggestions.classList.add('hidden');
          return;
        }
        
        matches.forEach(asset => {
          const div = document.createElement('div');
          div.className = 'flex justify-between items-center';
          div.innerHTML = `
            <div>
              <div class="font-medium">${asset.name}</div>
              <div class="text-xs text-gray-500">${asset.ticker.toUpperCase()}</div>
            </div>
            <div class="text-right">
              <div class="font-medium">$${asset.price.toFixed(2)}</div>
              <div class="text-xs ${asset.change > 0 ? 'price-up' : asset.change < 0 ? 'price-down' : 'price-neutral'}">
                <i class="fas ${asset.change > 0 ? 'fa-arrow-up' : asset.change < 0 ? 'fa-arrow-down' : 'fa-minus'} mr-1"></i>
                ${Math.abs(asset.change)}%
              </div>
            </div>
          `;
          
          div.onclick = () => {
            inputs.asset.value = asset.ticker;
            suggestions.classList.add('hidden');
            updateError('asset', validateInput('asset', asset.ticker));
            updateOrderPreview();
          };
          
          suggestions.appendChild(div);
        });
        
        suggestions.classList.remove('hidden');
      }

      // Handle price type selection
      function handlePriceTypeSelection(type) {
        currentPriceType = type;
        priceTypeButtons.forEach(btn => {
          if (btn.dataset.type === type) {
            btn.classList.remove('bg-gray-200', 'dark:bg-gray-600', 'dark:text-gray-300');
            btn.classList.add('bg-blue-600', 'text-white', 'dark:bg-blue-700');
          } else {
            btn.classList.remove('bg-blue-600', 'text-white', 'dark:bg-blue-700');
            btn.classList.add('bg-gray-200', 'dark:bg-gray-600', 'dark:text-gray-300');
          }
        });
        
        if (type === 'limit') {
          limitPriceContainer.classList.remove('hidden');
          previewLimitPriceContainer.classList.remove('hidden');
        } else {
          limitPriceContainer.classList.add('hidden');
          previewLimitPriceContainer.classList.add('hidden');
        }
        
        updateOrderPreview();
      }

      // Render portfolio chart
      function renderPortfolioChart() {
        if (chartInstance) chartInstance.destroy();
        
        const ctx = document.getElementById('portfolio-chart').getContext('2d');
        chartInstance = new Chart(ctx, {
          type: 'doughnut',
          data: {
            labels: ['Stocks', 'ETFs', 'Crypto', 'Cash'],
            datasets: [{
              data: [6500, 3200, 645.67, 5000],
              backgroundColor: [
                '#1d4ed8', 
                '#3b82f6', 
                '#93c5fd',
                '#dbeafe'
              ],
              borderWidth: 0
            }]
          },
          options: {
            responsive: true,
            maintainAspectRatio: false,
            plugins: {
              legend: {
                position: 'bottom',
                labels: {
                  color: isDark ? '#e5e7eb' : '#4b5563',
                  font: {
                    family: "'Inter', sans-serif"
                  }
                }
              },
              tooltip: {
                callbacks: {
                  label: function(context) {
                    const label = context.label || '';
                    const value = context.raw || 0;
                    const total = context.dataset.data.reduce((a, b) => a + b, 0);
                    const percentage = Math.round((value / total) * 100);
                    return `${label}: $${value.toLocaleString()} (${percentage}%)`;
                  }
                }
              }
            },
            cutout: '70%'
          }
        });
      }

      // Theme toggle
      function updateTheme() {
        themeBody.classList.toggle('dark', isDark);
        themeToggle.innerHTML = isDark 
          ? '<i class="fas fa-sun mr-2"></i><span>Light Mode</span>' 
          : '<i class="fas fa-moon mr-2"></i><span>Dark Mode</span>';
          
        if (themeToggleMobile) {
          themeToggleMobile.innerHTML = isDark 
            ? '<i class="fas fa-sun mr-2"></i><span>Light Mode</span>' 
            : '<i class="fas fa-moon mr-2"></i><span>Dark Mode</span>';
        }
        
        localStorage.setItem('theme', isDark ? 'dark' : 'light');
        
        // Re-render chart with updated theme colors
        if (chartInstance) {
          chartInstance.options.plugins.legend.labels.color = isDark ? '#e5e7eb' : '#4b5563';
          chartInstance.update();
        }
      }

      // Initialize
      function init() {
        // Set initial theme
        updateTheme();
        
        // Initialize marquee
        initMarquee();
        
        // Render portfolio chart
        renderPortfolioChart();
        
        // Set default price type
        handlePriceTypeSelection('market');
        
        // Event listeners
        themeToggle.addEventListener('click', () => {
          isDark = !isDark;
          updateTheme();
        });
        
        if (themeToggleMobile) {
          themeToggleMobile.addEventListener('click', () => {
            isDark = !isDark;
            updateTheme();
          });
        }
        
        mobileMenuButton.addEventListener('click', () => {
          mobileMenu.classList.toggle('hidden');
        });
        
        priceTypeButtons.forEach(btn => {
          btn.addEventListener('click', () => {
            handlePriceTypeSelection(btn.dataset.type);
          });
        });
        
        // Form submission
        tradeForm.addEventListener('submit', (event) => {
          event.preventDefault();
          const asset = inputs.asset.value.trim();
          const quantity = parseFloat(inputs.quantity.value);
          const type = orderType.value;
          
          const assetError = validateInput('asset', asset);
          const quantityError = validateInput('quantity', quantity);
          
          updateError('asset', assetError);
          updateError('quantity', quantityError);
          
          if (!assetError && !quantityError) {
            const limitPrice = currentPriceType === 'limit' ? inputs.limitPrice.value : null;
            const result = simulateTrade(asset, quantity, type, currentPriceType, limitPrice);
            
            if (result) {
              tradeResult.textContent = result;
              tradeResult.classList.remove('text-red-500');
              tradeResult.classList.add('text-gray-700', 'dark:text-gray-300', 'fade-in');
              suggestions.classList.add('hidden');
              
              // Reset form
              setTimeout(() => {
                tradeForm.reset();
                tradeResult.textContent = '';
                handlePriceTypeSelection('market');
                updateOrderPreview();
              }, 3000);
            } else {
              tradeResult.textContent = 'Error placing order. Please try again.';
              tradeResult.classList.remove('text-gray-700', 'dark:text-gray-300');
              tradeResult.classList.add('text-red-500');
            }
          } else {
            tradeResult.textContent = '';
          }
        });
        
        // Real-time validation and autocomplete
        const debounce = (fn, delay) => {
          let timeout;
          return (...args) => {
            clearTimeout(timeout);
            timeout = setTimeout(() => fn(...args), delay);
          };
        };
        
        inputs.asset.addEventListener('input', debounce(() => {
          const value = inputs.asset.value;
          updateError('asset', validateInput('asset', value));
          showSuggestions(value);
          updateOrderPreview();
        }, 300));
        
        inputs.quantity.addEventListener('input', debounce(() => {
          const value = parseFloat(inputs.quantity.value);
          updateError('quantity', validateInput('quantity', value));
          updateOrderPreview();
        }, 300));
        
        inputs.limitPrice.addEventListener('input', debounce(() => {
          updateOrderPreview();
        }, 300));
        
        orderType.addEventListener('change', () => {
          updateOrderPreview();
        });
        
        // Close suggestions when clicking outside
        document.addEventListener('click', (event) => {
          if (!inputs.asset.contains(event.target) && !suggestions.contains(event.target)) {
            suggestions.classList.add('hidden');
          }
        });
      }
      
      // Initialize when DOM is loaded
      document.addEventListener('DOMContentLoaded', init);
    </script>
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Davidpascal/first-project" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>