File size: 56,919 Bytes
6a89e6f
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c5c200
 
 
 
 
 
 
6a89e6f
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c5c200
 
 
 
 
 
 
 
 
 
6a89e6f
 
 
 
 
f3888ac
 
6a89e6f
 
 
 
 
 
 
4c5c200
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
f3888ac
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
4c5c200
 
 
 
 
 
 
 
6a89e6f
 
 
 
 
 
f3888ac
 
6a89e6f
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
 
6a89e6f
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
6a89e6f
 
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
 
6a89e6f
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
6a89e6f
 
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
 
6a89e6f
f3888ac
 
 
 
 
 
 
 
 
 
6a89e6f
 
f3888ac
6a89e6f
f3888ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a89e6f
 
f3888ac
6a89e6f
f3888ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a89e6f
f3888ac
 
 
 
 
 
 
6a89e6f
 
f3888ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a89e6f
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
4c5c200
 
6a89e6f
 
 
 
4c5c200
 
 
6a89e6f
 
 
 
f3888ac
6a89e6f
 
 
 
f3888ac
6a89e6f
 
f3888ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a89e6f
 
 
 
f3888ac
 
 
 
 
 
 
6a89e6f
f3888ac
 
 
 
 
 
6a89e6f
f3888ac
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
 
 
6a89e6f
f3888ac
 
 
6a89e6f
 
 
 
 
 
f3888ac
6a89e6f
f3888ac
 
 
 
 
6a89e6f
 
 
 
 
 
f3888ac
 
6a89e6f
f3888ac
 
 
 
6a89e6f
 
 
 
 
 
f3888ac
 
 
6a89e6f
f3888ac
 
 
6a89e6f
 
 
 
 
 
f3888ac
6a89e6f
 
 
f3888ac
 
6a89e6f
f3888ac
 
6a89e6f
f3888ac
6a89e6f
 
 
 
f3888ac
 
 
 
 
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3888ac
 
 
 
 
 
 
 
 
 
 
 
 
6a89e6f
 
f3888ac
6a89e6f
 
 
f3888ac
6a89e6f
f3888ac
6a89e6f
 
 
 
f3888ac
 
6a89e6f
f3888ac
6a89e6f
f3888ac
6a89e6f
f3888ac
6a89e6f
f3888ac
6a89e6f
 
 
f3888ac
 
6a89e6f
 
 
 
 
 
 
 
 
 
 
f3888ac
6a89e6f
 
 
 
 
f3888ac
6a89e6f
f3888ac
6a89e6f
f3888ac
 
6a89e6f
 
 
 
 
 
 
f3888ac
 
 
 
 
 
 
6a89e6f
 
f3888ac
6a89e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c5c200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a89e6f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
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
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CardX - Smart Credit Card Platform for India</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
        }
        .card-shadow {
            box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.2);
        }
        .chat-container {
            height: 400px;
            overflow-y: auto;
            scrollbar-width: thin;
        }
        .chat-container::-webkit-scrollbar {
            width: 6px;
        }
        .chat-container::-webkit-scrollbar-thumb {
            background-color: rgba(0,0,0,0.2);
            border-radius: 3px;
        }
        .fade-in {
            animation: fadeIn 0.3s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .pulse {
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        .autocomplete {
            position: relative;
            display: inline-block;
            width: 100%;
        }
        .autocomplete-items {
            position: absolute;
            border: 1px solid #d4d4d4;
            border-bottom: none;
            border-top: none;
            z-index: 99;
            top: 100%;
            left: 0;
            right: 0;
            max-height: 200px;
            overflow-y: auto;
        }
        .autocomplete-items div {
            padding: 10px;
            cursor: pointer;
            background-color: #fff; 
            border-bottom: 1px solid #d4d4d4; 
        }
        .autocomplete-items div:hover {
            background-color: #e9e9e9; 
        }
        .autocomplete-active {
            background-color: #6e8efb !important; 
            color: #ffffff; 
        }
        .rotate {
            animation: rotate 1s linear infinite;
        }
        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <!-- Header -->
    <header class="gradient-bg text-white">
        <div class="container mx-auto px-4 py-6">
            <div class="flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <i class="fas fa-credit-card text-3xl"></i>
                    <h1 class="text-2xl font-bold">CardX India</h1>
                </div>
                <nav>
                    <ul class="flex space-x-6">
                        <li><a href="#" class="hover:underline">My Cards</a></li>
                        <li><a href="#" class="hover:underline">Explore</a></li>
                        <li><a href="#" class="hover:underline">Card Chat</a></li>
                        <li><a href="#" class="hover:underline">Profile</a></li>
                    </ul>
                </nav>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="container mx-auto px-4 py-8">
        <!-- Sync Status Bar -->
        <div id="syncStatus" class="hidden bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4 mb-6 rounded">
            <div class="flex items-center">
                <div id="syncSpinner" class="mr-3 rotate">
                    <i class="fas fa-sync-alt text-blue-500"></i>
                </div>
                <p id="syncMessage">Syncing your cards from connected banks...</p>
            </div>
        </div>

        <!-- Hero Section -->
        <section class="mb-12">
            <div class="bg-white rounded-xl p-8 card-shadow">
                <div class="flex flex-col md:flex-row items-center">
                    <div class="md:w-1/2 mb-6 md:mb-0">
                        <h2 class="text-3xl md:text-4xl font-bold text-gray-800 mb-4">Find the Perfect Indian Credit Card for Your Lifestyle</h2>
                        <p class="text-gray-600 mb-6">CardX analyzes your spending habits and recommends the best Indian credit cards to maximize rewards and minimize fees.</p>
                        <div class="flex space-x-4">
                            <button id="addCardBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-6 py-3 rounded-lg font-medium transition duration-300 flex items-center">
                                <i class="fas fa-plus-circle mr-2"></i> Add Your Card
                            </button>
                            <button id="exploreBtn" class="border border-purple-600 text-purple-600 hover:bg-purple-50 px-6 py-3 rounded-lg font-medium transition duration-300 flex items-center">
                                <i class="fas fa-search mr-2"></i> Explore Cards
                            </button>
                            <button id="syncCardsBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-medium transition duration-300 flex items-center">
                                <i class="fas fa-sync-alt mr-2"></i> Sync Cards
                            </button>
                        </div>
                    </div>
                    <div class="md:w-1/2 flex justify-center">
                        <img src="https://illustrations.popsy.co/amber/credit-card-payment.svg" alt="Credit Card Illustration" class="w-full max-w-md">
                    </div>
                </div>
            </div>
        </section>

        <!-- Add Card Modal -->
        <div id="addCardModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
            <div class="bg-white rounded-xl p-6 w-full max-w-md fade-in">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="text-xl font-bold text-gray-800">Add Your Indian Credit Card</h3>
                    <button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
                        <i class="fas fa-times"></i>
                    </button>
                </div>
                <form id="cardForm">
                    <div class="mb-4">
                        <label for="cardName" class="block text-gray-700 mb-2">Card Name</label>
                        <div class="autocomplete">
                            <input type="text" id="cardName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Start typing card name..." required autocomplete="off">
                        </div>
                    </div>
                    <button type="submit" class="w-full bg-purple-600 hover:bg-purple-700 text-white py-3 rounded-lg font-medium transition duration-300">
                        Add Card
                    </button>
                </form>
            </div>
        </div>

        <!-- My Cards Section -->
        <section class="mb-12">
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-2xl font-bold text-gray-800">My Credit Cards</h2>
                <div class="flex space-x-4">
                    <button id="refreshCardsBtn" class="text-purple-600 hover:text-purple-800 flex items-center">
                        <i class="fas fa-sync-alt mr-2"></i> Refresh
                    </button>
                    <button id="bankSyncBtn" class="text-blue-600 hover:text-blue-800 flex items-center">
                        <i class="fas fa-university mr-2"></i> Sync with Banks
                    </button>
                </div>
            </div>
            <div id="myCardsContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <!-- Cards will be added here dynamically -->
                <div class="bg-white rounded-xl p-6 card-shadow">
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <h3 class="text-xl font-bold text-gray-800">HDFC Regalia</h3>
                            <span class="inline-block bg-purple-100 text-purple-800 text-xs px-2 py-1 rounded-full mt-1">Premium</span>
                        </div>
                        <div class="bg-blue-500 text-white p-2 rounded-lg">
                            <i class="fas fa-star"></i>
                        </div>
                    </div>
                    <div class="mb-4">
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Annual Fee</span>
                            <span class="font-medium">₹2,500</span>
                        </div>
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Rewards Rate</span>
                            <span class="font-medium">4 RP/₹100</span>
                        </div>
                    </div>
                    <div class="mb-4">
                        <h4 class="text-sm font-semibold text-gray-700 mb-2">Key Benefits</h4>
                        <ul class="text-sm text-gray-600 space-y-1">
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> Airport lounge access</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> Complimentary golf games</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> Movie ticket discounts</li>
                        </ul>
                    </div>
                    <div class="flex justify-between pt-4 border-t border-gray-200">
                        <button class="text-purple-600 hover:text-purple-800 flex items-center">
                            <i class="fas fa-chart-line mr-2"></i> Analyze
                        </button>
                        <button class="text-red-500 hover:text-red-700 flex items-center">
                            <i class="fas fa-trash-alt mr-2"></i> Remove
                        </button>
                    </div>
                </div>
            </div>
        </section>

        <!-- Card Chat Section -->
        <section class="mb-12">
            <h2 class="text-2xl font-bold text-gray-800 mb-6">Card Chat Assistant</h2>
            <div class="bg-white rounded-xl card-shadow overflow-hidden">
                <div class="p-4 border-b border-gray-200 bg-gray-50">
                    <div class="flex items-center">
                        <div class="w-10 h-10 rounded-full bg-purple-600 flex items-center justify-center text-white mr-3">
                            <i class="fas fa-robot"></i>
                        </div>
                        <div>
                            <h3 class="font-medium">CardX Assistant</h3>
                            <p class="text-xs text-gray-500">Ask me anything about Indian credit cards</p>
                        </div>
                    </div>
                </div>
                <div id="chatContainer" class="chat-container p-4 bg-white">
                    <div class="flex mb-4">
                        <div class="w-10 h-10 rounded-full bg-purple-600 flex items-center justify-center text-white mr-3 flex-shrink-0">
                            <i class="fas fa-robot"></i>
                        </div>
                        <div class="bg-gray-100 rounded-lg p-3 max-w-3/4">
                            <p class="text-gray-800">Namaste! I'm your CardX assistant for Indian credit cards. I can help you find the best credit card based on your spending habits, or analyze your current cards to maximize rewards. What would you like to know?</p>
                        </div>
                    </div>
                </div>
                <div class="p-4 border-t border-gray-200 bg-gray-50">
                    <div class="flex">
                        <input type="text" id="chatInput" placeholder="Type your question here..." class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:outline-none focus:ring-2 focus:ring-purple-500">
                        <button id="sendChatBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-r-lg transition duration-300">
                            <i class="fas fa-paper-plane"></i>
                        </button>
                    </div>
                    <div class="mt-2 flex flex-wrap gap-2">
                        <button class="quick-question-btn bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded-full text-sm transition duration-300">
                            Best travel card?
                        </button>
                        <button class="quick-question-btn bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded-full text-sm transition duration-300">
                            Maximize cashback
                        </button>
                        <button class="quick-question-btn bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded-full text-sm transition duration-300">
                            Low annual fee options
                        </button>
                        <button class="quick-question-btn bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded-full text-sm transition duration-300">
                            Compare my cards
                        </button>
                    </div>
                </div>
            </div>
        </section>

        <!-- Recommended Cards Section -->
        <section>
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-2xl font-bold text-gray-800">Recommended For You</h2>
                <button class="text-purple-600 hover:text-purple-800 flex items-center">
                    <i class="fas fa-sliders-h mr-2"></i> Filter
                </button>
            </div>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="bg-white rounded-xl p-6 card-shadow pulse">
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <h3 class="text-xl font-bold text-gray-800">Axis Magnus</h3>
                            <span class="inline-block bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full mt-1">Premium Travel</span>
                        </div>
                        <div class="bg-yellow-400 text-white p-2 rounded-lg">
                            <i class="fas fa-crown"></i>
                        </div>
                    </div>
                    <div class="mb-4">
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Annual Fee</span>
                            <span class="font-medium">₹10,000</span>
                        </div>
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Rewards Rate</span>
                            <span class="font-medium">12 RP/₹200</span>
                        </div>
                    </div>
                    <div class="mb-4">
                        <h4 class="text-sm font-semibold text-gray-700 mb-2">Key Benefits</h4>
                        <ul class="text-sm text-gray-600 space-y-1">
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> 5x rewards on travel & dining</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> Complimentary Taj Epicure membership</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> Unlimited airport lounge access</li>
                        </ul>
                    </div>
                    <div class="flex justify-between pt-4 border-t border-gray-200">
                        <button class="text-blue-600 hover:text-blue-800 flex items-center">
                            <i class="fas fa-info-circle mr-2"></i> Details
                        </button>
                        <button class="text-green-600 hover:text-green-800 flex items-center">
                            <i class="fas fa-plus-circle mr-2"></i> Add to My Cards
                        </button>
                    </div>
                </div>

                <div class="bg-white rounded-xl p-6 card-shadow">
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <h3 class="text-xl font-bold text-gray-800">SBI SimplyCLICK</h3>
                            <span class="inline-block bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full mt-1">Online Shopping</span>
                        </div>
                        <div class="bg-green-500 text-white p-2 rounded-lg">
                            <i class="fas fa-shopping-cart"></i>
                        </div>
                    </div>
                    <div class="mb-4">
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Annual Fee</span>
                            <span class="font-medium">₹499</span>
                        </div>
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Rewards Rate</span>
                            <span class="font-medium">10x rewards</span>
                        </div>
                    </div>
                    <div class="mb-4">
                        <h4 class="text-sm font-semibold text-gray-700 mb-2">Key Benefits</h4>
                        <ul class="text-sm text-gray-600 space-y-1">
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> 10x rewards on Amazon, BookMyShow</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> 5x rewards on other online spends</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> E-vouchers worth ₹2,000 annually</li>
                        </ul>
                    </div>
                    <div class="flex justify-between pt-4 border-t border-gray-200">
                        <button class="text-blue-600 hover:text-blue-800 flex items-center">
                            <i class="fas fa-info-circle mr-2"></i> Details
                        </button>
                        <button class="text-green-600 hover:text-green-800 flex items-center">
                            <i class="fas fa-plus-circle mr-2"></i> Add to My Cards
                        </button>
                    </div>
                </div>

                <div class="bg-white rounded-xl p-6 card-shadow">
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <h3 class="text-xl font-bold text-gray-800">ICICI Amazon Pay</h3>
                            <span class="inline-block bg-amber-100 text-amber-800 text-xs px-2 py-1 rounded-full mt-1">Cashback</span>
                        </div>
                        <div class="bg-amber-500 text-white p-2 rounded-lg">
                            <i class="fab fa-amazon"></i>
                        </div>
                    </div>
                    <div class="mb-4">
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Annual Fee</span>
                            <span class="font-medium">₹0</span>
                        </div>
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Rewards Rate</span>
                            <span class="font-medium">5% cashback</span>
                        </div>
                    </div>
                    <div class="mb-4">
                        <h4 class="text-sm font-semibold text-gray-700 mb-2">Key Benefits</h4>
                        <ul class="text-sm text-gray-600 space-y-1">
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> 5% cashback on Amazon</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> 2% cashback on other spends</li>
                            <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> No annual fee</li>
                        </ul>
                    </div>
                    <div class="flex justify-between pt-4 border-t border-gray-200">
                        <button class="text-blue-600 hover:text-blue-800 flex items-center">
                            <i class="fas fa-info-circle mr-2"></i> Details
                        </button>
                        <button class="text-green-600 hover:text-green-800 flex items-center">
                            <i class="fas fa-plus-circle mr-2"></i> Add to My Cards
                        </button>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-800 text-white py-8 mt-12">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h3 class="text-lg font-bold mb-4">CardX India</h3>
                    <p class="text-gray-400">The smart way to manage and optimize your Indian credit cards for maximum rewards.</p>
                </div>
                <div>
                    <h4 class="text-md font-semibold mb-4">Features</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">My Cards</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Card Analysis</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Card Chat</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Recommendations</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-md font-semibold mb-4">Resources</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Credit Card Guide</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Rewards Calculator</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">FAQ</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-md font-semibold mb-4">Connect</h4>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter text-xl"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook text-xl"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram text-xl"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin text-xl"></i></a>
                    </div>
                    <div class="mt-4">
                        <p class="text-gray-400">Subscribe to our newsletter</p>
                        <div class="flex mt-2">
                            <input type="email" placeholder="Your email" class="px-3 py-2 bg-gray-700 text-white rounded-l focus:outline-none">
                            <button class="bg-purple-600 hover:bg-purple-700 px-3 py-2 rounded-r">
                                <i class="fas fa-paper-plane"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-8 pt-6 text-center text-gray-400">
                <p>&copy; 2023 CardX India. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <script>
        // Database of Indian credit cards
        const indianCreditCards = [
            {
                name: "HDFC Regalia",
                type: "premium",
                annualFee: 2500,
                rewardsRate: "4 RP/₹100",
                benefits: [
                    "Airport lounge access",
                    "Complimentary golf games",
                    "Movie ticket discounts",
                    "Reward points on spends"
                ]
            },
            {
                name: "Axis Magnus",
                type: "premium travel",
                annualFee: 10000,
                rewardsRate: "12 RP/₹200",
                benefits: [
                    "5x rewards on travel & dining",
                    "Complimentary Taj Epicure membership",
                    "Unlimited airport lounge access",
                    "Golf benefits"
                ]
            },
            {
                name: "SBI SimplyCLICK",
                type: "online shopping",
                annualFee: 499,
                rewardsRate: "10x rewards",
                benefits: [
                    "10x rewards on Amazon, BookMyShow",
                    "5x rewards on other online spends",
                    "E-vouchers worth ₹2,000 annually",
                    "Discounts on partner brands"
                ]
            },
            {
                name: "ICICI Amazon Pay",
                type: "cashback",
                annualFee: 0,
                rewardsRate: "5% cashback",
                benefits: [
                    "5% cashback on Amazon",
                    "2% cashback on other spends",
                    "No annual fee",
                    "Instant discounts on Amazon"
                ]
            },
            {
                name: "Citibank PremierMiles",
                type: "travel",
                annualFee: 3000,
                rewardsRate: "4 miles/₹150",
                benefits: [
                    "Air miles on all spends",
                    "Complimentary airport transfers",
                    "Discounts on hotel bookings",
                    "Priority pass membership"
                ]
            },
            {
                name: "Standard Chartered Ultimate",
                type: "cashback",
                annualFee: 3000,
                rewardsRate: "3.3% cashback",
                benefits: [
                    "Flat cashback on all spends",
                    "Complimentary movie tickets",
                    "Dining discounts",
                    "Fuel surcharge waiver"
                ]
            },
            {
                name: "Kotak League",
                type: "lifestyle",
                annualFee: 999,
                rewardsRate: "5 RP/₹100",
                benefits: [
                    "Discounts on movie tickets",
                    "Complimentary OTT subscriptions",
                    "Dining benefits",
                    "Fuel surcharge waiver"
                ]
            },
            {
                name: "American Express Platinum Travel",
                type: "travel",
                annualFee: 5000,
                rewardsRate: "1 MR/₹50",
                benefits: [
                    "Complimentary Taj vouchers",
                    "Airport lounge access",
                    "Travel vouchers on spends",
                    "Hotel membership benefits"
                ]
            },
            {
                name: "IDFC First Wow",
                type: "secured",
                annualFee: 0,
                rewardsRate: "1.5% cashback",
                benefits: [
                    "No credit check required",
                    "Secured against FD",
                    "Fuel surcharge waiver",
                    "Contactless payments"
                ]
            },
            {
                name: "RBL Bank Edition",
                type: "lifestyle",
                annualFee: 1499,
                rewardsRate: "5 RP/₹100",
                benefits: [
                    "Discounts on dining & movies",
                    "Complimentary airport lounge access",
                    "Fuel surcharge waiver",
                    "Reward points on all spends"
                ]
            }
        ];

        // User's cards
        let myCards = [
            {
                name: "HDFC Regalia",
                type: "premium",
                annualFee: 2500,
                rewardsRate: "4 RP/₹100",
                benefits: [
                    "Airport lounge access",
                    "Complimentary golf games",
                    "Movie ticket discounts"
                ]
            }
        ];

        // DOM Elements
        const addCardBtn = document.getElementById('addCardBtn');
        const closeModalBtn = document.getElementById('closeModalBtn');
        const addCardModal = document.getElementById('addCardModal');
        const cardForm = document.getElementById('cardForm');
        const cardNameInput = document.getElementById('cardName');
        const myCardsContainer = document.getElementById('myCardsContainer');
        const refreshCardsBtn = document.getElementById('refreshCardsBtn');
        const bankSyncBtn = document.getElementById('bankSyncBtn');
        const syncCardsBtn = document.getElementById('syncCardsBtn');
        const chatContainer = document.getElementById('chatContainer');
        const chatInput = document.getElementById('chatInput');
        const sendChatBtn = document.getElementById('sendChatBtn');
        const quickQuestionBtns = document.querySelectorAll('.quick-question-btn');
        const syncStatus = document.getElementById('syncStatus');
        const syncMessage = document.getElementById('syncMessage');
        const syncSpinner = document.getElementById('syncSpinner');

        // Modal toggle
        addCardBtn.addEventListener('click', () => {
            addCardModal.classList.remove('hidden');
            cardNameInput.focus();
        });

        closeModalBtn.addEventListener('click', () => {
            addCardModal.classList.add('hidden');
            closeAllLists();
        });

        // Autocomplete functionality
        function autocomplete(inp, arr) {
            let currentFocus;
            
            inp.addEventListener("input", function(e) {
                let val = this.value;
                closeAllLists();
                if (!val) { return false; }
                currentFocus = -1;
                
                const list = document.createElement("div");
                list.setAttribute("id", this.id + "autocomplete-list");
                list.setAttribute("class", "autocomplete-items");
                this.parentNode.appendChild(list);
                
                let count = 0;
                for (let i = 0; i < arr.length; i++) {
                    if (arr[i].name.toLowerCase().includes(val.toLowerCase())) {
                        count++;
                        const item = document.createElement("div");
                        item.innerHTML = "<strong>" + arr[i].name.substring(0, val.length) + "</strong>";
                        item.innerHTML += arr[i].name.substring(val.length);
                        item.innerHTML += "<input type='hidden' value='" + arr[i].name + "'>";
                        item.addEventListener("click", function(e) {
                            inp.value = this.getElementsByTagName("input")[0].value;
                            closeAllLists();
                        });
                        list.appendChild(item);
                        
                        if (count >= 5) break; // Limit to 5 suggestions
                    }
                }
            });
            
            inp.addEventListener("keydown", function(e) {
                let x = document.getElementById(this.id + "autocomplete-list");
                if (x) x = x.getElementsByTagName("div");
                if (e.keyCode == 40) { // Down arrow
                    currentFocus++;
                    addActive(x);
                } else if (e.keyCode == 38) { // Up arrow
                    currentFocus--;
                    addActive(x);
                } else if (e.keyCode == 13) { // Enter
                    e.preventDefault();
                    if (currentFocus > -1) {
                        if (x) x[currentFocus].click();
                    }
                }
            });
            
            function addActive(x) {
                if (!x) return false;
                removeActive(x);
                if (currentFocus >= x.length) currentFocus = 0;
                if (currentFocus < 0) currentFocus = (x.length - 1);
                x[currentFocus].classList.add("autocomplete-active");
            }
            
            function removeActive(x) {
                for (let i = 0; i < x.length; i++) {
                    x[i].classList.remove("autocomplete-active");
                }
            }
            
            function closeAllLists(elmnt) {
                const x = document.getElementsByClassName("autocomplete-items");
                for (let i = 0; i < x.length; i++) {
                    if (elmnt != x[i] && elmnt != inp) {
                        x[i].parentNode.removeChild(x[i]);
                    }
                }
            }
            
            document.addEventListener("click", function(e) {
                closeAllLists(e.target);
            });
        }

        // Initialize autocomplete
        autocomplete(cardNameInput, indianCreditCards);

        // Add new card
        cardForm.addEventListener('submit', (e) => {
            e.preventDefault();
            
            const cardName = cardNameInput.value.trim();
            const cardData = indianCreditCards.find(card => card.name === cardName);
            
            if (!cardData) {
                addChatMessage('assistant', `I couldn't find details for "${cardName}". Please make sure you've entered the correct card name.`);
                return;
            }
            
            // Check if card already exists
            if (myCards.some(card => card.name === cardName)) {
                addChatMessage('assistant', `You already have ${cardName} in your wallet! Would you like me to analyze it for you?`);
                addCardModal.classList.add('hidden');
                return;
            }
            
            // Add to user's cards
            myCards.push(cardData);
            
            // Render cards
            renderCards();
            
            // Close modal and reset form
            addCardModal.classList.add('hidden');
            cardForm.reset();
            
            // Show success message
            addChatMessage('assistant', `Successfully added ${cardName} to your cards! Would you like me to analyze it for you?`);
        });

        // Render cards
        function renderCards() {
            myCardsContainer.innerHTML = '';
            
            myCards.forEach(card => {
                const cardTypeClass = getCardTypeClass(card.type);
                const cardTypeText = getCardTypeText(card.type);
                const cardIcon = getCardIcon(card.type);
                
                const cardElement = document.createElement('div');
                cardElement.className = 'bg-white rounded-xl p-6 card-shadow fade-in';
                cardElement.innerHTML = `
                    <div class="flex justify-between items-start mb-4">
                        <div>
                            <h3 class="text-xl font-bold text-gray-800">${card.name}</h3>
                            <span class="inline-block ${cardTypeClass} text-xs px-2 py-1 rounded-full mt-1">${cardTypeText}</span>
                        </div>
                        <div class="${getCardIconBgClass(card.type)} text-white p-2 rounded-lg">
                            <i class="${cardIcon}"></i>
                        </div>
                    </div>
                    <div class="mb-4">
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Annual Fee</span>
                            <span class="font-medium">₹${card.annualFee}</span>
                        </div>
                        <div class="flex justify-between mb-2">
                            <span class="text-gray-600">Rewards Rate</span>
                            <span class="font-medium">${card.rewardsRate}</span>
                        </div>
                    </div>
                    <div class="mb-4">
                        <h4 class="text-sm font-semibold text-gray-700 mb-2">Key Benefits</h4>
                        <ul class="text-sm text-gray-600 space-y-1">
                            ${card.benefits.map(benefit => `
                                <li class="flex items-center"><i class="fas fa-check-circle text-green-500 mr-2"></i> ${benefit}</li>
                            `).join('')}
                        </ul>
                    </div>
                    <div class="flex justify-between pt-4 border-t border-gray-200">
                        <button class="analyze-btn text-purple-600 hover:text-purple-800 flex items-center" data-card="${card.name}">
                            <i class="fas fa-chart-line mr-2"></i> Analyze
                        </button>
                        <button class="remove-btn text-red-500 hover:text-red-700 flex items-center" data-card="${card.name}">
                            <i class="fas fa-trash-alt mr-2"></i> Remove
                        </button>
                    </div>
                `;
                
                myCardsContainer.appendChild(cardElement);
            });
            
            // Add event listeners to new buttons
            document.querySelectorAll('.analyze-btn').forEach(btn => {
                btn.addEventListener('click', (e) => {
                    const cardName = e.target.getAttribute('data-card');
                    analyzeCard(cardName);
                });
            });
            
            document.querySelectorAll('.remove-btn').forEach(btn => {
                btn.addEventListener('click', (e) => {
                    const cardName = e.target.getAttribute('data-card');
                    removeCard(cardName);
                });
            });
        }

        // Helper functions for card rendering
        function getCardTypeClass(type) {
            switch(type) {
                case 'premium': return 'bg-purple-100 text-purple-800';
                case 'premium travel': return 'bg-blue-100 text-blue-800';
                case 'travel': return 'bg-indigo-100 text-indigo-800';
                case 'cashback': return 'bg-green-100 text-green-800';
                case 'online shopping': return 'bg-amber-100 text-amber-800';
                case 'lifestyle': return 'bg-pink-100 text-pink-800';
                case 'secured': return 'bg-gray-100 text-gray-800';
                default: return 'bg-purple-100 text-purple-800';
            }
        }

        function getCardTypeText(type) {
            switch(type) {
                case 'premium': return 'Premium';
                case 'premium travel': return 'Premium Travel';
                case 'travel': return 'Travel';
                case 'cashback': return 'Cashback';
                case 'online shopping': return 'Online Shopping';
                case 'lifestyle': return 'Lifestyle';
                case 'secured': return 'Secured';
                default: return type.charAt(0).toUpperCase() + type.slice(1);
            }
        }

        function getCardIcon(type) {
            switch(type) {
                case 'premium': return 'fas fa-star';
                case 'premium travel': return 'fas fa-plane';
                case 'travel': return 'fas fa-plane';
                case 'cashback': return 'fas fa-rupee-sign';
                case 'online shopping': return 'fas fa-shopping-cart';
                case 'lifestyle': return 'fas fa-film';
                case 'secured': return 'fas fa-lock';
                default: return 'fas fa-credit-card';
            }
        }

        function getCardIconBgClass(type) {
            switch(type) {
                case 'premium': return 'bg-purple-500';
                case 'premium travel': return 'bg-blue-500';
                case 'travel': return 'bg-indigo-500';
                case 'cashback': return 'bg-green-500';
                case 'online shopping': return 'bg-amber-500';
                case 'lifestyle': return 'bg-pink-500';
                case 'secured': return 'bg-gray-500';
                default: return 'bg-purple-500';
            }
        }

        // Analyze card
        function analyzeCard(cardName) {
            const card = myCards.find(c => c.name === cardName);
            if (!card) return;
            
            let analysis = `Analyzing ${cardName}...\n\n`;
            analysis += `Annual Fee: ₹${card.annualFee}\n`;
            analysis += `Rewards Rate: ${card.rewardsRate}\n\n`;
            
            if (card.annualFee > 5000) {
                analysis += `This is a premium card with a high annual fee. You should be spending at least ₹${Math.round(card.annualFee * 100 / 5)} annually to justify the fee.\n`;
            } else if (card.annualFee > 0) {
                analysis += `This card has a moderate annual fee. Make sure you're utilizing all the benefits to offset this cost.\n`;
            } else {
                analysis += `Great! This card has no annual fee, making it easy to keep in your wallet.\n`;
            }
            
            if (card.type.includes('travel')) {
                analysis += `As a travel card, it's best used for flight bookings, hotel stays, and other travel expenses.\n`;
            } else if (card.type.includes('cashback')) {
                analysis += `This cashback card gives you direct money back on your spends - great for everyday use.\n`;
            } else if (card.type.includes('shopping')) {
                analysis += `Maximize this card's benefits by using it for online shopping on partner platforms.\n`;
            }
            
            analysis += `\nKey Benefits:\n`;
            card.benefits.forEach(benefit => {
                analysis += `- ${benefit}\n`;
            });
            
            addChatMessage('assistant', analysis);
            
            // Scroll to chat section
            document.querySelector('#chatContainer').scrollIntoView({ behavior: 'smooth' });
        }

        // Remove card
        function removeCard(cardName) {
            const index = myCards.findIndex(c => c.name === cardName);
            if (index !== -1) {
                myCards.splice(index, 1);
                renderCards();
                addChatMessage('assistant', `${cardName} has been removed from your cards.`);
            }
        }

        // Chat functionality
        function addChatMessage(sender, message) {
            const messageDiv = document.createElement('div');
            messageDiv.className = 'flex mb-4 fade-in';
            
            if (sender === 'user') {
                messageDiv.className += ' justify-end';
                messageDiv.innerHTML = `
                    <div class="bg-purple-600 text-white rounded-lg p-3 max-w-3/4">
                        <p>${message}</p>
                    </div>
                    <div class="w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-gray-600 ml-3 flex-shrink-0">
                        <i class="fas fa-user"></i>
                    </div>
                `;
            } else {
                messageDiv.innerHTML = `
                    <div class="w-10 h-10 rounded-full bg-purple-600 flex items-center justify-center text-white mr-3 flex-shrink-0">
                        <i class="fas fa-robot"></i>
                    </div>
                    <div class="bg-gray-100 rounded-lg p-3 max-w-3/4">
                        <p class="text-gray-800">${message.replace(/\n/g, '<br>')}</p>
                    </div>
                `;
            }
            
            chatContainer.appendChild(messageDiv);
            chatContainer.scrollTop = chatContainer.scrollHeight;
        }

        sendChatBtn.addEventListener('click', sendMessage);
        chatInput.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') sendMessage();
        });

        function sendMessage() {
            const message = chatInput.value.trim();
            if (message) {
                addChatMessage('user', message);
                chatInput.value = '';
                
                // Simulate assistant response after a short delay
                setTimeout(() => {
                    let response;
                    
                    if (message.toLowerCase().includes('best') && message.toLowerCase().includes('card')) {
                        if (myCards.length === 0) {
                            response = `You don't have any cards added yet. Would you like me to recommend some?`;
                        } else {
                            // Find card with highest rewards
                            const bestCard = myCards.reduce((prev, current) => {
                                const prevRate = parseFloat(prev.rewardsRate);
                                const currentRate = parseFloat(current.rewardsRate);
                                return (prevRate > currentRate) ? prev : current;
                            });
                            
                            response = `Based on rewards rate, your best card is ${bestCard.name} with ${bestCard.rewardsRate} rewards. `;
                            response += `It's great for ${bestCard.type} spending. Would you like me to analyze it in more detail?`;
                        }
                    } 
                    else if (message.toLowerCase().includes('travel') || message.toLowerCase().includes('flight') || message.toLowerCase().includes('hotel')) {
                        const travelCards = myCards.filter(card => card.type.includes('travel'));
                        if (travelCards.length > 0) {
                            response = `For travel spending, consider these cards:\n`;
                            travelCards.forEach(card => {
                                response += `- ${card.name}: ${card.rewardsRate} on travel (₹${card.annualFee} annual fee)\n`;
                            });
                            response += `\nThe ${travelCards[0].name} would be best for your upcoming trip.`;
                        } else {
                            response = `You don't have any travel cards. Would you like me to recommend some?`;
                        }
                    }
                    else if (message.toLowerCase().includes('cashback') || message.toLowerCase().includes('cash back')) {
                        const cashbackCards = myCards.filter(card => card.type.includes('cashback'));
                        if (cashbackCards.length > 0) {
                            response = `For cashback, these are your options:\n`;
                            cashbackCards.forEach(card => {
                                response += `- ${card.name}: ${card.rewardsRate} cashback (₹${card.annualFee} annual fee)\n`;
                            });
                            response += `\nUse these for everyday spending to maximize your returns.`;
                        } else {
                            response = `You don't have any dedicated cashback cards. The ICICI Amazon Pay (5% cashback) is a great option to consider.`;
                        }
                    }
                    else if (message.toLowerCase().includes('fee') || message.toLowerCase().includes('annual')) {
                        const noFeeCards = myCards.filter(card => card.annualFee === 0);
                        const feeCards = myCards.filter(card => card.annualFee > 0);
                        
                        if (noFeeCards.length > 0) {
                            response = `You have ${noFeeCards.length} cards with no annual fee:\n`;
                            noFeeCards.forEach(card => {
                                response += `- ${card.name}\n`;
                            });
                        }
                        
                        if (feeCards.length > 0) {
                            response += `\nCards with annual fees:\n`;
                            feeCards.forEach(card => {
                                response += `- ${card.name}: ₹${card.annualFee}\n`;
                            });
                            response += `\nMake sure the rewards from these cards outweigh their annual fees.`;
                        }
                    }
                    else if (message.toLowerCase().includes('compare')) {
                        if (myCards.length >= 2) {
                            response = `Comparing your cards:\n\n`;
                            myCards.forEach(card => {
                                response += `${card.name} (${card.type}):\n`;
                                response += `- Annual Fee: ₹${card.annualFee}\n`;
                                response += `- Rewards Rate: ${card.rewardsRate}\n`;
                                response += `- Best for: ${card.benefits[0]}\n\n`;
                            });
                            response += `To maximize rewards, use each card for its strongest category.`;
                        } else {
                            response = `You need at least 2 cards to compare. Would you like to add another card?`;
                        }
                    }
                    else if (message.toLowerCase().includes('recommend')) {
                        response = `Based on your spending habits, I recommend these Indian credit cards:\n\n`;
                        response += `1. Axis Magnus (Premium Travel) - Best for frequent travelers\n`;
                        response += `2. ICICI Amazon Pay - Best for Amazon shoppers\n`;
                        response += `3. SBI SimplyCLICK - Best for online shopping\n`;
                        response += `\nWould you like me to add any of these for you?`;
                    }
                    else {
                        response = `I can help you analyze your cards, compare them, or find the best card for specific spending categories. `;
                        response += `Try asking about "best travel card", "maximize cashback", or "compare my cards".`;
                    }
                    
                    addChatMessage('assistant', response);
                }, 1000);
            }
        }

        // Quick question buttons
        quickQuestionBtns.forEach(btn => {
            btn.addEventListener('click', (e) => {
                chatInput.value = e.target.textContent;
                sendMessage();
            });
        });

        // Refresh cards
        refreshCardsBtn.addEventListener('click', () => {
            renderCards();
            addChatMessage('assistant', 'Your cards have been refreshed!');
        });

        // Simulate syncing with banks
        function syncWithBanks() {
            syncStatus.classList.remove('hidden');
            syncMessage.textContent = "Connecting to your bank accounts...";
            
            // Simulate API calls to different banks
            setTimeout(() => {
                syncMessage.textContent = "Fetching cards from HDFC Bank...";
                
                setTimeout(() => {
                    syncMessage.textContent = "Fetching cards from ICICI Bank...";
                    
                    setTimeout(() => {
                        syncMessage.textContent = "Fetching cards from SBI...";
                        
                        setTimeout(() => {
                            // Simulate finding new cards
                            const newCards = [
                                {
                                    name: "ICICI Amazon Pay",
                                    type: "cashback",
                                    annualFee: 0,
                                    rewardsRate: "5% cashback",
                                    benefits: [
                                        "5% cashback on Amazon",
                                        "2% cashback on other spends",
                                        "No annual fee"
                                    ]
                                },
                                {
                                    name: "SBI SimplyCLICK",
                                    type: "online shopping",
                                    annualFee: 499,
                                    rewardsRate: "10x rewards",
                                    benefits: [
                                        "10x rewards on Amazon, BookMyShow",
                                        "5x rewards on other online spends",
                                        "E-vouchers worth ₹2,000 annually"
                                    ]
                                }
                            ];
                            
                            // Only add cards that don't already exist
                            newCards.forEach(newCard => {
                                if (!myCards.some(card => card.name === newCard.name)) {
                                    myCards.push(newCard);
                                }
                            });
                            
                            renderCards();
                            
                            syncMessage.textContent = "Sync complete! Found 2 new cards.";
                            syncSpinner.classList.remove('rotate');
                            syncSpinner.innerHTML = '<i class="fas fa-check-circle text-green-500"></i>';
                            
                            setTimeout(() => {
                                syncStatus.classList.add('hidden');
                                syncSpinner.innerHTML = '<i class="fas fa-sync-alt text-blue-500"></i>';
                                syncSpinner.classList.add('rotate');
                                
                                if (newCards.length > 0) {
                                    addChatMessage('assistant', `I've found ${newCards.length} new cards in your bank accounts! They've been added to your wallet.`);
                                } else {
                                    addChatMessage('assistant', "Your cards are up to date. No new cards found in your bank accounts.");
                                }
                            }, 2000);
                            
                        }, 1500);
                    }, 1500);
                }, 1500);
            }, 1000);
        }

        // Sync buttons
        bankSyncBtn.addEventListener('click', syncWithBanks);
        syncCardsBtn.addEventListener('click', syncWithBanks);

        // Initial render
        renderCards();
    </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=vs4vijay/autocodetest" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html>