File size: 54,332 Bytes
0dff816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Inventory - Japanese Motors</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <link rel="stylesheet" href="assets/css/1b.css">
</head>
<body class="bg-gray-100 font-sans">
    <!-- Navigation -->
    <nav class="bg-white shadow-lg fixed w-full z-10">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <a href="gallery.html" class="flex-shrink-0 flex items-center">
                        <i data-feather="zap" class="h-8 w-8 text-red-500"></i>
                        <span class="ml-2 text-xl font-bold text-gray-900">JAPANESE MOTORS</span>
                    </a>
                </div>
                <div class="hidden md:flex items-center space-x-8">
                    <a href="../index.html" class="nav-link text-gray-700 hover:text-red-500 px-3 py-2 rounded-md text-sm font-medium">Home</a>
                    <a href="gallery.html" class="nav-link text-gray-700 hover:text-red-500 px-3 py-2 rounded-md text-sm font-medium">Inventory</a>
                    <a href="services.html" class="nav-link text-gray-700 hover:text-red-500 px-3 py-2 rounded-md text-sm font-medium">Services</a>
                    <a href="about.html" class="nav-link text-red-500 px-3 py-2 rounded-md text-sm font-medium">About</a>
                    <a href="contact.html" class="bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-md text-sm font-medium transition duration-300">Contact</a>
                </div>
                <div class="md:hidden flex items-center">
                    <button class="text-gray-500 hover:text-gray-900 focus:outline-none">
                        <i data-feather="menu"></i>
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Hero Section -->
    <div class="relative pt-32 pb-20 bg-gray-900">
        <div class="absolute inset-0 bg-black opacity-50"></div>
        <div class="absolute inset-0 bg-center bg-cover" style="background-image: url('https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?ixlib=rb-4.0.3&auto=format&fit=crop&w=1600&q=80');"></div>
        <div class="container mx-auto px-4 relative">
            <div class="text-center">
                <h1 class="text-4xl font-bold text-white mb-4" data-aos="fade-up">Our Premium Inventory</h1>
                <p class="text-xl text-gray-300 max-w-2xl mx-auto" data-aos="fade-up" data-aos-delay="100">Explore our exclusive collection of Japanese performance vehicles</p>
            </div>
        </div>
    </div>

    <!-- Motor Type Selection -->
    <section class="py-8 bg-white">
        <div class="container mx-auto px-4">
            <h2 class="text-xl font-bold text-gray-800 mb-6 text-center">Select Motor Type</h2>
            <div class="flex flex-wrap justify-center gap-4">
                <button class="motor-type-btn active px-6 py-3 rounded-full border border-gray-300 hover:bg-red-500 hover:text-white transition duration-300" data-type="all">
                    All Types
                </button>
                <button class="motor-type-btn px-6 py-3 rounded-full border border-gray-300 hover:bg-red-500 hover:text-white transition duration-300" data-type="sports">
                    Sports Cars
                </button>
                <button class="motor-type-btn px-6 py-3 rounded-full border border-gray-300 hover:bg-red-500 hover:text-white transition duration-300" data-type="sedan">
                    Sedans
                </button>
                <button class="motor-type-btn px-6 py-3 rounded-full border border-gray-300 hover:bg-red-500 hover:text-white transition duration-300" data-type="suv">
                    SUVs
                </button>
                <button class="motor-type-btn px-6 py-3 rounded-full border border-gray-300 hover:bg-red-500 hover:text-white transition duration-300" data-type="jdm">
                    JDM Classics
                </button>
            </div>
        </div>
    </section>

    <!-- Inventory Filters -->
    <section class="py-12 bg-white">
        <div class="container mx-auto px-4">
            <div class="bg-gray-100 p-6 rounded-lg">
                <h2 class="text-xl font-bold text-gray-800 mb-6">Find Your Perfect Vehicle</h2>
                <form class="grid grid-cols-1 md:grid-cols-4 gap-4">
                    <div>
                        <label for="make" class="block text-sm font-medium text-gray-700 mb-1">Make</label>
                        <select id="make" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500">
                            <option value="">All Makes</option>
                            <option value="toyota">Toyota</option>
                            <option value="nissan">Nissan</option>
                            <option value="honda">Honda</option>
                            <option value="mazda">Mazda</option>
                            <option value="subaru">Subaru</option>
                            <option value="mitsubishi">Mitsubishi</option>
                            <option value="lexus">Lexus</option>
                            <option value="acura">Acura</option>
                        </select>
                    </div>
                    <div>
                        <label for="model" class="block text-sm font-medium text-gray-700 mb-1">Model</label>
                        <select id="model" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500">
                            <option value="">All Models</option>
                        </select>
                    </div>
                    <div>
                        <label for="price" class="block text-sm font-medium text-gray-700 mb-1">Price Range</label>
                        <select id="price" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500">
                            <option value="">All Prices</option>
                            <option value="0-50000">Under $50,000</option>
                            <option value="50000-100000">$50,000 - $100,000</option>
                            <option value="100000-150000">$100,000 - $150,000</option>
                            <option value="150000+">Over $150,000</option>
                        </select>
                    </div>
                    <div>
                        <label for="year" class="block text-sm font-medium text-gray-700 mb-1">Year</label>
                        <select id="year" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500">
                            <option value="">All Years</option>
                            <option value="2023">2023</option>
                            <option value="2022">2022</option>
                            <option value="2021">2021</option>
                            <option value="2020">2020</option>
                            <option value="2019">2019</option>
                            <option value="2018">2018</option>
                            <option value="2017">2017</option>
                        </select>
                    </div>
                    <div class="md:col-span-4 flex justify-end space-x-3">
                        <button type="reset" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-100">Reset</button>
                        <button type="submit" class="px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600">Search</button>
                    </div>
                </form>
            </div>
        </div>
    </section>

    <!-- Inventory Grid -->
    <section class="py-12 bg-gray-100">
        <div class="container mx-auto px-4">
            <div class="flex justify-between items-center mb-8">
                <h2 class="text-2xl font-bold text-gray-800">Available Vehicles</h2>
                <div class="flex items-center">
                    <span class="text-sm text-gray-600 mr-2">Sort by:</span>
                    <select id="sortBy" class="px-3 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500 text-sm">
                        <option value="newest">Newest First</option>
                        <option value="price-low">Price: Low to High</option>
                        <option value="price-high">Price: High to Low</option>
                        <option value="mileage">Mileage: Low to High</option>
                    </select>
                </div>
            </div>
            
            <div id="inventoryGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
                <!-- Cars will be dynamically loaded here -->
            </div>
            
            <!-- Pagination -->
            <div class="mt-12 flex justify-center">
                <nav id="pagination" class="flex items-center space-x-2">
                    <!-- Pagination will be dynamically generated -->
                </nav>
            </div>
        </div>
    </section>

    <!-- VR Showroom -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-4">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">Virtual Showroom</h2>
                <div class="w-20 h-1 bg-red-500 mx-auto"></div>
                <p class="mt-4 text-gray-600 max-w-2xl mx-auto">Experience our vehicles in immersive 360° virtual reality</p>
            </div>
            
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                <div class="vr-container rounded-lg overflow-hidden shadow-lg">
                    <iframe class="vr-iframe" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="Virtual Showroom" allowfullscreen></iframe>
                </div>
                <div>
                    <h3 class="text-xl font-bold text-gray-800 mb-4">Explore From Anywhere</h3>
                    <p class="text-gray-600 mb-6">Our virtual showroom allows you to examine every detail of our vehicles as if you were standing right next to them. Rotate, zoom, and explore interiors and exteriors with our cutting-edge VR technology.</p>
                    <ul class="space-y-3 mb-6">
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-500 mr-2 mt-1"></i>
                            <span class="text-gray-700">360° exterior and interior views</span>
                        </li>
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-500 mr-2 mt-1"></i>
                            <span class="text-gray-700">Interactive features and specifications</span>
                        </li>
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-500 mr-2 mt-1"></i>
                            <span class="text-gray-700">Available on desktop and mobile</span>
                        </li>
                        <li class="flex items-start">
                            <i data-feather="check-circle" class="text-green-500 mr-2 mt-1"></i>
                            <span class="text-gray-700">VR headset compatible for full immersion</span>
                        </li>
                    </ul>
                    <a href="../vr-showroom/index.php" class="inline-block bg-red-500 hover:bg-red-600 text-white px-6 py-3 rounded-md font-medium transition duration-300">
                        <i data-feather="vr-chart" class="w-5 h-5 inline mr-2"></i> Enter VR Showroom
                    </a>
                </div>
            </div>
        </div>
    </section>

    <!-- Call to Action -->
    <section class="py-16 bg-red-500 text-white">
        <div class="container mx-auto px-4 text-center">
            <h2 class="text-3xl font-bold mb-6">Can't Find What You're Looking For?</h2>
            <p class="text-xl mb-8 max-w-2xl mx-auto">Contact our sales team for assistance with special requests or custom orders.</p>
            <div class="flex flex-col sm:flex-row justify-center gap-4">
                <a href="tel:+254794330243" class="bg-white text-red-500 px-8 py-3 rounded-md font-bold transition duration-300 hover:bg-gray-100">
                    <i data-feather="phone" class="w-5 h-5 inline mr-2"></i> Call Now
                </a>
                <a href="https://wa.me/254794330243?text=Hello%20Japanese%20Motors,%20I'm%20interested%20in%20your%20vehicles" class="border-2 border-white text-white px-8 py-3 rounded-md font-bold transition duration-300 hover:bg-white hover:text-red-500" target="_blank">
                    <i data-feather="message-circle" class="w-5 h-5 inline mr-2"></i> WhatsApp
                </a>
            </div>
        </div>
    </section>

    <!-- Newsletter -->
    <section class="py-16 bg-gray-800 text-white">
        <div class="container mx-auto px-4">
            <div class="max-w-3xl mx-auto text-center">
                <h2 class="text-3xl font-bold mb-6">Get Notified About New Arrivals</h2>
                <p class="mb-8 text-gray-300">Be the first to know when we add new vehicles to our inventory. Sign up for our exclusive newsletter.</p>
                <form class="flex flex-col sm:flex-row gap-4">
                    <input type="email" placeholder="Your email address" class="flex-grow px-4 py-3 rounded-md text-gray-800 focus:outline-none focus:ring-2 focus:ring-red-500">
                    <button type="submit" class="bg-red-500 hover:bg-red-600 text-white px-6 py-3 rounded-md font-medium transition duration-300">Subscribe</button>
                </form>
            </div>
        </div>
    </section>

    <!-- Vehicle Detail Modal -->
    <div id="vehicleModal" class="modal">
        <div class="modal-content">
            <span class="close-modal text-white">&times;</span>
            <div id="modalContent" class="p-6">
                <!-- Content will be loaded here by JavaScript -->
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h3 class="text-xl font-bold mb-4">Japanese Motors</h3>
                    <p class="text-gray-400">Premium Japanese performance vehicles imported directly from Japan.</p>
                </div>
                <div>
                    <h3 class="text-lg font-bold mb-4">Quick Links</h3>
                    <ul class="space-y-2">
                        <li><a href="../index.html" class="text-gray-400 hover:text-red-500">Home</a></li>
                        <li><a href="gallery.html" class="text-gray-400 hover:text-red-500">Inventory</a></li>
                        <li><a href="services.html" class="text-gray-400 hover:text-red-500">Services</a></li>
                        <li><a href="about.html" class="text-gray-400 hover:text-red-500">About Us</a></li>
                        <li><a href="contact.html" class="text-gray-400 hover:text-red-500">Contact</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-bold mb-4">Contact Info</h3>
                    <ul class="space-y-2">
                        <li class="flex items-center">
                            <i data-feather="map-pin" class="mr-2 w-4 h-4"></i>
                            <span class="text-gray-400">123 Automotive Way, Tokyo, Japan</span>
                        </li>
                        <li class="flex items-center">
                            <i data-feather="phone" class="mr-2 w-4 h-4"></i>
                            <span class="text-gray-400">+254 794 330 243</span>
                        </li>
                        <li class="flex items-center">
                            <i data-feather="mail" class="mr-2 w-4 h-4"></i>
                            <span class="text-gray-400">info@japanesemotors.com</span>
                        </li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-bold mb-4">Follow Us</h3>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-red-500"><i data-feather="facebook" class="w-6 h-6"></i></a>
                        <a href="#" class="text-gray-400 hover:text-red-500"><i data-feather="instagram" class="w-6 h-6"></i></a>
                        <a href="#" class="text-gray-400 hover:text-red-500"><i data-feather="twitter" class="w-6 h-6"></i></a>
                        <a href="#" class="text-gray-400 hover:text-red-500"><i data-feather="youtube" class="w-6 h-6"></i></a>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-400">
                <p>&copy; 2023 Japanese Motors. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Feather Icons and AOS
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            AOS.init();
            
            // Vehicle data with more cars
            const vehicleData = {
                1: {
                    title: "Toyota Supra",
                    price: "$52,000",
                    discount: "$3,000 OFF",
                    deposit: "$5,200 (10%)",
                    type: "sports",
                    year: "2023",
                    location: "Osaka",
                    engine: "382HP Turbocharged I6",
                    images: [
                        "https://images.unsplash.com/photo-1617814076367-b759c7d7e738?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1626668893636-424a8d2c7e0d?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1620746616760-b52632e1c4af?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80"
                    ],
                    description: "The Toyota Supra is a legendary sports car that combines breathtaking performance with head-turning style. This 2023 model features a 3.0-liter turbocharged inline-6 engine producing 382 horsepower, delivering exhilarating acceleration and precise handling.",
                    features: ["3.0L Turbocharged Inline-6 Engine", "382 Horsepower", "8-Speed Automatic Transmission", "Adaptive Variable Suspension", "19-inch Alloy Wheels", "Leather Sports Seats", "8.8-inch Touchscreen Display", "Apple CarPlay & Android Auto"],
                    specifications: {
                        "Engine": "3.0L Turbocharged I6",
                        "Horsepower": "382 HP",
                        "Torque": "368 lb-ft",
                        "Transmission": "8-Speed Automatic",
                        "0-60 mph": "3.9 seconds",
                        "Top Speed": "155 mph (electronically limited)",
                        "Fuel Economy": "24 MPG combined"
                    }
                },
                2: {
                    title: "Nissan GT-R Nismo",
                    price: "$135,000",
                    discount: "Limited Stock",
                    deposit: "$13,500 (10%)",
                    type: "sports",
                    year: "2023",
                    location: "Tokyo",
                    engine: "600HP Twin-Turbo V6",
                    images: [
                        "https://i.pinimg.com/1200x/83/b9/94/83b99420acbce687f2b13921da41c80e.jpg",
                        "https://i.pinimg.com/1200x/0c/09/e3/0c09e31d9d586670f49009efa58512e2.jpg",
                        "https://i.pinimg.com/736x/c6/5d/0d/c65d0dc9beffbfe51c33f9d09fa39961.jpg"
                    ],
                    description: "The Nissan GT-R Nismo represents the pinnacle of Nissan's engineering excellence. With a hand-built 3.8-liter twin-turbo V6 producing 600 horsepower, this track-focused supercar delivers unparalleled performance and precision.",
                    features: ["3.8L Twin-Turbo V6 Engine", "600 Horsepower", "6-Speed Dual-Clutch Transmission", "ATTESA E-TS All-Wheel Drive", "Carbon Fiber Rear Spoiler", "Recaro Racing Seats", "Nismo-tuned Suspension", "Carbon Ceramic Brakes"],
                    specifications: {
                        "Engine": "3.8L Twin-Turbo V6",
                        "Horsepower": "600 HP",
                        "Torque": "481 lb-ft",
                        "Transmission": "6-Speed Dual-Clutch",
                        "0-60 mph": "2.5 seconds",
                        "Top Speed": "205 mph",
                        "Fuel Economy": "19 MPG combined"
                    }
                },
                3: {
                    title: "Honda NSX Type S",
                    price: "$175,000",
                    discount: "Arriving Soon",
                    deposit: "$17,500 (10%)",
                    type: "sports",
                    year: "2023",
                    location: "Yokohama",
                    engine: "600HP Hybrid V6",
                    images: [
                        "https://images.unsplash.com/photo-1549399542-7e82138aae82?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1549399542-7e82138aae83?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1549399542-7e82138aae84?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80"
                    ],
                    description: "The Honda NSX Type S is a limited-production hybrid supercar that combines cutting-edge technology with exceptional performance. With its twin-turbo V6 and three electric motors, it delivers 600 horsepower with instant response and incredible efficiency.",
                    features: ["3.5L Twin-Turbo V6 Hybrid", "600 Total Horsepower", "9-Speed Dual-Clutch Transmission", "Sport Hybrid SH-AWD", "Carbon Fiber Roof", "Semi-Aniline Leather Seats", "Custom Drive Mode", "Lightweight Forged Wheels"],
                    specifications: {
                        "Engine": "3.5L Twin-Turbo V6 + 3 Electric Motors",
                        "Total Power": "600 HP",
                        "Torque": "492 lb-ft",
                        "Transmission": "9-Speed Dual-Clutch",
                        "0-60 mph": "2.7 seconds",
                        "Top Speed": "191 mph",
                        "Fuel Economy": "21 MPG combined"
                    }
                },
                4: {
                    title: "Mazda RX-7 FD",
                    price: "$65,000",
                    discount: "Collector's Item",
                    deposit: "$6,500 (10%)",
                    type: "jdm",
                    year: "1995",
                    location: "Hiroshima",
                    engine: "276HP Twin-Rotor",
                    images: [
                        "https://i.pinimg.com/1200x/bc/4a/ef/bc4aefd8503bb0df01e990485634c7a3.jpg",
                        "https://i.pinimg.com/1200x/89/b1/93/89b193af5e69a308d02c4b797483504e.jpg",
                        "https://i.pinimg.com/736x/bf/c4/37/bfc4375ab7595b8f89a5ed8df38b5a7a.jpg"
                    ],
                    description: "The Mazda RX-7 FD is a legendary Japanese sports car renowned for its unique rotary engine and exceptional handling. This 1995 model has been meticulously maintained and represents one of the finest examples of this iconic vehicle.",
                    features: ["1.3L Twin-Rotor Rotary Engine", "276 Horsepower", "5-Speed Manual Transmission", "Sequential Twin-Turbo System", "Lightweight Body Construction", "Pop-Up Headlights", "Leather Recaro Seats", "Bose Sound System"],
                    specifications: {
                        "Engine": "1.3L Twin-Rotor Rotary",
                        "Horsepower": "276 HP",
                        "Torque": "231 lb-ft",
                        "Transmission": "5-Speed Manual",
                        "0-60 mph": "4.9 seconds",
                        "Top Speed": "156 mph",
                        "Fuel Economy": "18 MPG combined"
                    }
                },
                5: {
                    title: "Subaru WRX STI S209",
                    price: "$48,500",
                    discount: "$2,500 OFF",
                    deposit: "$4,850 (10%)",
                    type: "sedan",
                    year: "2020",
                    location: "Gunma",
                    engine: "341HP Turbocharged H4",
                    images: [
                        "https://i.pinimg.com/1200x/ac/08/98/ac08981ca5b2e9a8d849cf183b77f418.jpg",
                        "https://i.pinimg.com/1200x/13/84/ce/1384ce690731a69ef3385544744e617c.jpg",
                        "https://i.pinimg.com/736x/ce/cd/54/cecd54fe7c82eaff661a2cc4d38cc0bf.jpg"
                    ],
                    description: "The Subaru WRX STI S209 is a limited-edition high-performance sedan that represents the pinnacle of Subaru's motorsport technology. With its enhanced 2.5-liter turbocharged boxer engine and race-bred suspension, it delivers exceptional performance in all conditions.",
                    features: ["2.5L Turbocharged Boxer Engine", "341 Horsepower", "6-Speed Manual Transmission", "Symmetrical All-Wheel Drive", "Brembo Brakes", "Recaro Sport Seats", "Wider Bodywork", "Enhanced Aerodynamics"],
                    specifications: {
                        "Engine": "2.5L Turbocharged H4",
                        "Horsepower": "341 HP",
                        "Torque": "330 lb-ft",
                        "Transmission": "6-Speed Manual",
                        "0-60 mph": "4.5 seconds",
                        "Top Speed": "155 mph (electronically limited)",
                        "Fuel Economy": "19 MPG combined"
                    }
                },
                6: {
                    title: "Toyota GR Yaris",
                    price: "$38,000",
                    discount: "Almost Gone",
                    deposit: "$3,800 (10%)",
                    type: "sports",
                    year: "2023",
                    location: "Nagoya",
                    engine: "268HP Turbocharged I3",
                    images: [
                        "https://images.unsplash.com/photo-1617814076367-b759c7d7e738?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://i.pinimg.com/736x/3d/99/8d/3d998d4c8f4cff0461bab252c574a8b7.jpg",
                        "https://i.pinimg.com/1200x/68/49/a4/6849a43c2034f2f5f495fc40310e9448.jpg"
                    ],
                    description: "The Toyota GR Yaris is a rally-bred hot hatch that brings World Rally Championship technology to the road. With its turbocharged three-cylinder engine and GR-FOUR all-wheel-drive system, it delivers exceptional performance and agility.",
                    features: ["1.6L Turbocharged I3 Engine", "268 Horsepower", "6-Speed Manual Transmission", "GR-FOUR All-Wheel Drive", "Lightweight Body Construction", "Sports Seats", "Dual-Zone Climate Control", "Toyota Safety Sense"],
                    specifications: {
                        "Engine": "1.6L Turbocharged I3",
                        "Horsepower": "268 HP",
                        "Torque": "273 lb-ft",
                        "Transmission": "6-Speed Manual",
                        "0-60 mph": "5.2 seconds",
                        "Top Speed": "143 mph",
                        "Fuel Economy": "28 MPG combined"
                    }
                },
                7: {
                    title: "Lexus LC 500",
                    price: "$95,000",
                    discount: "Premium Edition",
                    deposit: "$9,500 (10%)",
                    type: "sports",
                    year: "2023",
                    location: "Kyoto",
                    engine: "471HP V8",
                    images: [
                        "https://images.unsplash.com/photo-1580273916554-8b7e9ee5f50d?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1580273916554-8b7e9ee5f50e?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1580273916554-8b7e9ee5f50f?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80"
                    ],
                    description: "The Lexus LC 500 is a luxury grand tourer that combines stunning design with exhilarating performance. Its naturally aspirated 5.0-liter V8 engine delivers a thrilling driving experience with a symphony of exhaust notes.",
                    features: ["5.0L V8 Engine", "471 Horsepower", "10-Speed Automatic Transmission", "Rear-Wheel Drive", "Carbon Fiber Roof", "Semi-Aniline Leather Interior", "Mark Levinson Sound System", "Adaptive Variable Suspension"],
                    specifications: {
                        "Engine": "5.0L V8",
                        "Horsepower": "471 HP",
                        "Torque": "398 lb-ft",
                        "Transmission": "10-Speed Automatic",
                        "0-60 mph": "4.4 seconds",
                        "Top Speed": "168 mph",
                        "Fuel Economy": "19 MPG combined"
                    }
                },
                8: {
                    title: "Nissan 370Z Nismo",
                    price: "$42,000",
                    discount: "Special Offer",
                    deposit: "$4,200 (10%)",
                    type: "sports",
                    year: "2022",
                    location: "Yokohama",
                    engine: "350HP V6",
                    images: [
                        "https://images.unsplash.com/photo-1601268859287-9cec8a74e9f8?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1601268859287-9cec8a74e9f9?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1601268859287-9cec8a74e9fa?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80"
                    ],
                    description: "The Nissan 370Z Nismo is a pure sports car that delivers thrilling performance with its 3.7-liter V6 engine and sharp handling. The Nismo edition adds aggressive styling and enhanced performance features.",
                    features: ["3.7L V6 Engine", "350 Horsepower", "6-Speed Manual Transmission", "Rear-Wheel Drive", "Nismo Body Kit", "Recaro Sport Seats", "Brembo Brakes", "Viscous Limited-Slip Differential"],
                    specifications: {
                        "Engine": "3.7L V6",
                        "Horsepower": "350 HP",
                        "Torque": "276 lb-ft",
                        "Transmission": "6-Speed Manual",
                        "0-60 mph": "4.5 seconds",
                        "Top Speed": "155 mph",
                        "Fuel Economy": "22 MPG combined"
                    }
                },
                9: {
                    title: "Toyota Land Cruiser",
                    price: "$85,000",
                    discount: "Adventure Ready",
                    deposit: "$8,500 (10%)",
                    type: "suv",
                    year: "2023",
                    location: "Osaka",
                    engine: "409HP Twin-Turbo V6",
                    images: [
                        "https://images.unsplash.com/photo-1580274437636-1c384e567539?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1580274437636-1c384e56753a?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80",
                        "https://images.unsplash.com/photo-1580274437636-1c384e56753b?ixlib=rb-4.0.3&auto=format&fit=crop&w=1080&q=80"
                    ],
                    description: "The Toyota Land Cruiser is the ultimate luxury SUV built for both on-road comfort and off-road capability. With its powerful twin-turbo V6 engine and advanced four-wheel drive system, it can conquer any terrain.",
                    features: ["3.5L Twin-Turbo V6 Hybrid", "409 Horsepower", "10-Speed Automatic", "Full-Time 4WD", "Multi-Terrain Select", "Crawl Control", "Premium Leather Interior", "12.3-inch Touchscreen"],
                    specifications: {
                        "Engine": "3.5L Twin-Turbo V6 Hybrid",
                        "Horsepower": "409 HP",
                        "Torque": "479 lb-ft",
                        "Transmission": "10-Speed Automatic",
                        "0-60 mph": "5.7 seconds",
                        "Towing Capacity": "8,100 lbs",
                        "Fuel Economy": "22 MPG combined"
                    }
                }
            };

            // Pagination variables
            const itemsPerPage = 6;
            let currentPage = 1;
            let filteredCars = Object.keys(vehicleData);
            let currentType = 'all';
            let currentSort = 'newest';

            // Function to render cars based on current page and filters
            function renderCars() {
                const inventoryGrid = document.getElementById('inventoryGrid');
                inventoryGrid.innerHTML = '';
                
                // Calculate start and end index for current page
                const startIndex = (currentPage - 1) * itemsPerPage;
                const endIndex = Math.min(startIndex + itemsPerPage, filteredCars.length);
                
                // Get cars for current page
                const currentCars = filteredCars.slice(startIndex, endIndex);
                
                // Render each car
                currentCars.forEach(carId => {
                    const car = vehicleData[carId];
                    const carCard = document.createElement('div');
                    carCard.className = 'car-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300';
                    carCard.setAttribute('data-type', car.type);
                    carCard.setAttribute('data-aos', 'fade-up');
                    
                    let badgeHtml = '';
                    if (car.discount.includes('NEW')) {
                        badgeHtml = `<div class="absolute top-4 right-4 bg-red-500 text-white px-3 py-1 rounded-full text-xs font-bold">NEW</div>`;
                    } else if (car.discount.includes('LIMITED')) {
                        badgeHtml = `<div class="absolute top-4 right-4 bg-red-500 text-white px-3 py-1 rounded-full text-xs font-bold">LIMITED</div>`;
                    }
                    
                    let statusHtml = '';
                    if (car.discount.includes('OFF')) {
                        statusHtml = `<div class="text-sm bg-green-100 text-green-800 px-2 py-1 rounded">
                            <i data-feather="tag" class="w-3 h-3 inline mr-1"></i> ${car.discount}
                        </div>`;
                    } else if (car.discount.includes('Limited')) {
                        statusHtml = `<div class="text-sm bg-yellow-100 text-yellow-800 px-2 py-1 rounded">
                            <i data-feather="clock" class="w-3 h-3 inline mr-1"></i> ${car.discount}
                        </div>`;
                    } else if (car.discount.includes('Arriving')) {
                        statusHtml = `<div class="text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded">
                            <i data-feather="truck" class="w-3 h-3 inline mr-1"></i> ${car.discount}
                        </div>`;
                    } else if (car.discount.includes('Collector')) {
                        statusHtml = `<div class="text-sm bg-purple-100 text-purple-800 px-2 py-1 rounded">
                            <i data-feather="star" class="w-3 h-3 inline mr-1"></i> ${car.discount}
                        </div>`;
                    } else if (car.discount.includes('Almost')) {
                        statusHtml = `<div class="text-sm bg-red-100 text-red-800 px-2 py-1 rounded">
                            <i data-feather="alert-circle" class="w-3 h-3 inline mr-1"></i> ${car.discount}
                        </div>`;
                    } else {
                        statusHtml = `<div class="text-sm bg-gray-100 text-gray-800 px-2 py-1 rounded">
                            ${car.discount}
                        </div>`;
                    }
                    
                    carCard.innerHTML = `
                        <div class="relative overflow-hidden h-64">
                            <img class="w-full h-full object-cover car-image" src="${car.images[0]}" alt="${car.title}" data-car-id="${carId}">
                            ${badgeHtml}
                            <div class="absolute bottom-4 left-4">
                                <button class="bg-black bg-opacity-70 text-white px-3 py-1 rounded-full text-xs flex items-center hover:bg-opacity-90">
                                    <i data-feather="maximize-2" class="w-3 h-3 mr-1"></i> 360° View
                                </button>
                            </div>
                        </div>
                        <div class="p-6">
                            <h3 class="text-xl font-bold text-gray-800 mb-2">${car.title}</h3>
                            <div class="flex items-center text-gray-600 mb-4">
                                <i data-feather="clock" class="mr-2"></i>
                                <span>${car.year} Model</span>
                                <i data-feather="map-pin" class="ml-4 mr-2"></i>
                                <span>${car.location}</span>
                            </div>
                            <div class="flex items-center text-gray-600 mb-4">
                                <i data-feather="zap" class="mr-2"></i>
                                <span>${car.engine}</span>
                            </div>
                            <div class="flex justify-between items-center mb-4">
                                <div class="flex items-center">
                                    <i data-feather="dollar-sign" class="text-red-500 mr-1"></i>
                                    <span class="text-2xl font-bold text-gray-900">${car.price}</span>
                                </div>
                                ${statusHtml}
                            </div>
                            <div class="flex justify-between">
                                <button class="view-details-btn bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-md text-sm font-medium transition duration-300 flex-1 mr-2 text-center" data-car-id="${carId}">Details</button>
                                <button class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-4 py-2 rounded-md text-sm font-medium transition duration-300 flex-1 ml-2">
                                    <i data-feather="heart" class="w-4 h-4 inline"></i>
                                </button>
                            </div>
                        </div>
                    `;
                    
                    inventoryGrid.appendChild(carCard);
                });
                
                // Reinitialize feather icons
                feather.replace();
                
                // Add event listeners to new elements
                addCarEventListeners();
                
                // Update pagination
                updatePagination();
            }
            
            // Function to update pagination
            function updatePagination() {
                const pagination = document.getElementById('pagination');
                const totalPages = Math.ceil(filteredCars.length / itemsPerPage);
                
                let paginationHtml = '';
                
                // Previous button
                if (currentPage > 1) {
                    paginationHtml += `<button class="pagination-btn px-3 py-1 rounded border border-gray-300 text-gray-700 hover:bg-gray-100" data-page="${currentPage - 1}">
                        <i data-feather="chevron-left" class="w-4 h-4"></i>
                    </button>`;
                } else {
                    paginationHtml += `<button class="px-3 py-1 rounded border border-gray-300 text-gray-500 hover:bg-gray-100 disabled" disabled>
                        <i data-feather="chevron-left" class="w-4 h-4"></i>
                    </button>`;
                }
                
                // Page numbers
                const maxVisiblePages = 5;
                let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2));
                let endPage = Math.min(totalPages, startPage + maxVisiblePages - 1);
                
                if (endPage - startPage + 1 < maxVisiblePages) {
                    startPage = Math.max(1, endPage - maxVisiblePages + 1);
                }
                
                for (let i = startPage; i <= endPage; i++) {
                    if (i === currentPage) {
                        paginationHtml += `<button class="pagination-btn active px-3 py-1 rounded bg-red-500 text-white" data-page="${i}">${i}</button>`;
                    } else {
                        paginationHtml += `<button class="pagination-btn px-3 py-1 rounded border border-gray-300 text-gray-700 hover:bg-gray-100" data-page="${i}">${i}</button>`;
                    }
                }
                
                // Next button
                if (currentPage < totalPages) {
                    paginationHtml += `<button class="pagination-btn px-3 py-1 rounded border border-gray-300 text-gray-700 hover:bg-gray-100" data-page="${currentPage + 1}">
                        <i data-feather="chevron-right" class="w-4 h-4"></i>
                    </button>`;
                } else {
                    paginationHtml += `<button class="px-3 py-1 rounded border border-gray-300 text-gray-500 hover:bg-gray-100 disabled" disabled>
                        <i data-feather="chevron-right" class="w-4 h-4"></i>
                    </button>`;
                }
                
                pagination.innerHTML = paginationHtml;
                
                // Add event listeners to pagination buttons
                document.querySelectorAll('.pagination-btn').forEach(button => {
                    button.addEventListener('click', function() {
                        currentPage = parseInt(this.getAttribute('data-page'));
                        renderCars();
                        window.scrollTo({ top: document.getElementById('inventoryGrid').offsetTop - 100, behavior: 'smooth' });
                    });
                });
            }
            
            // Function to add event listeners to car elements
            function addCarEventListeners() {
                // Add event listeners to view details buttons
                document.querySelectorAll('.view-details-btn').forEach(button => {
                    button.addEventListener('click', function() {
                        const carId = this.getAttribute('data-car-id');
                        openModal(carId);
                    });
                });
                
                // Add event listeners to car images
                document.querySelectorAll('.car-image').forEach(image => {
                    image.addEventListener('click', function() {
                        const carId = this.getAttribute('data-car-id');
                        openModal(carId);
                    });
                });
            }
            
            // Motor type filtering
            const motorTypeButtons = document.querySelectorAll('.motor-type-btn');
            
            motorTypeButtons.forEach(button => {
                button.addEventListener('click', function() {
                    // Remove active class from all buttons
                    motorTypeButtons.forEach(btn => btn.classList.remove('active', 'bg-red-500', 'text-white'));
                    
                    // Add active class to clicked button
                    this.classList.add('active', 'bg-red-500', 'text-white');
                    
                    currentType = this.getAttribute('data-type');
                    currentPage = 1;
                    
                    // Filter cars
                    if (currentType === 'all') {
                        filteredCars = Object.keys(vehicleData);
                    } else {
                        filteredCars = Object.keys(vehicleData).filter(id => vehicleData[id].type === currentType);
                    }
                    
                    // Apply sorting
                    applySorting();
                    
                    // Render cars
                    renderCars();
                });
            });
            
            // Sort functionality
            const sortSelect = document.getElementById('sortBy');
            sortSelect.addEventListener('change', function() {
                currentSort = this.value;
                applySorting();
                renderCars();
            });
            
            // Function to apply sorting
            function applySorting() {
                switch(currentSort) {
                    case 'price-low':
                        filteredCars.sort((a, b) => {
                            const priceA = parseFloat(vehicleData[a].price.replace(/[^0-9.]/g, ''));
                            const priceB = parseFloat(vehicleData[b].price.replace(/[^0-9.]/g, ''));
                            return priceA - priceB;
                        });
                        break;
                    case 'price-high':
                        filteredCars.sort((a, b) => {
                            const priceA = parseFloat(vehicleData[a].price.replace(/[^0-9.]/g, ''));
                            const priceB = parseFloat(vehicleData[b].price.replace(/[^0-9.]/g, ''));
                            return priceB - priceA;
                        });
                        break;
                    case 'newest':
                    default:
                        // Default sorting (by year descending)
                        filteredCars.sort((a, b) => {
                            const yearA = parseInt(vehicleData[a].year);
                            const yearB = parseInt(vehicleData[b].year);
                            return yearB - yearA;
                        });
                        break;
                }
            }
            
            // Modal functionality
            const modal = document.getElementById('vehicleModal');
            const modalContent = document.getElementById('modalContent');
            const closeModal = document.querySelector('.close-modal');
            
            // Function to open modal with car details
            function openModal(carId) {
                const car = vehicleData[carId];
                if (!car) return;
                
                let featuresHtml = '';
                car.features.forEach(feature => {
                    featuresHtml += `<li class="flex items-start">
                        <i data-feather="check" class="text-green-500 mr-2 mt-1"></i>
                        <span>${feature}</span>
                    </li>`;
                });
                
                let specificationsHtml = '';
                for (const [key, value] of Object.entries(car.specifications)) {
                    specificationsHtml += `<tr>
                        <td class="py-2 px-4 border-b border-gray-200 font-medium">${key}</td>
                        <td class="py-2 px-4 border-b border-gray-200">${value}</td>
                    </tr>`;
                }
                
                let imagesHtml = '';
                car.images.forEach((img, index) => {
                    imagesHtml += `<div class="car-thumbnail ${index === 0 ? 'border-2 border-red-500' : 'border border-gray-300'}" data-index="${index}">
                        <img src="${img}" alt="${car.title}" class="h-16 w-full object-cover">
                    </div>`;
                });
                
                modalContent.innerHTML = `
                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                        <div>
                            <div class="mb-4">
                                <img id="mainCarImage" src="${car.images[0]}" alt="${car.title}" class="w-full h-80 object-cover rounded-lg">
                            </div>
                            <div class="grid grid-cols-3 gap-2">
                                ${imagesHtml}
                            </div>
                        </div>
                        <div>
                            <h2 class="text-3xl font-bold text-gray-800 mb-2">${car.title}</h2>
                            <div class="flex items-center mb-4">
                                <span class="text-2xl font-bold text-red-500">${car.price}</span>
                                <span class="ml-4 bg-green-100 text-green-800 px-2 py-1 rounded text-sm">${car.discount}</span>
                            </div>
                            <p class="text-gray-600 mb-6">${car.description}</p>
                            
                            <div class="mb-6">
                                <h3 class="text-xl font-bold text-gray-800 mb-3">Key Features</h3>
                                <ul class="space-y-2">
                                    ${featuresHtml}
                                </ul>
                            </div>
                            
                            <div class="mb-6">
                                <h3 class="text-xl font-bold text-gray-800 mb-3">Specifications</h3>
                                <table class="w-full">
                                    <tbody>
                                        ${specificationsHtml}
                                    </tbody>
                                </table>
                            </div>
                            
                            <div class="bg-gray-100 p-4 rounded-lg mb-6">
                                <h3 class="text-lg font-bold text-gray-800 mb-2">Financial Details</h3>
                                <p class="text-gray-600">Minimum Deposit: <span class="font-bold">${car.deposit}</span></p>
                                <p class="text-gray-600">Financing options available with approved credit</p>
                            </div>
                            
                            <div class="flex space-x-4">
                                <button class="bg-red-500 hover:bg-red-600 text-white px-6 py-3 rounded-md font-medium transition duration-300 flex-1">
                                    <i data-feather="dollar-sign" class="w-5 h-5 inline mr-2"></i> Apply for Financing
                                </button>
                                <a href="tel:+254794330243" class="bg-gray-800 hover:bg-gray-900 text-white px-6 py-3 rounded-md font-medium transition duration-300 flex-1 text-center">
                                    <i data-feather="phone" class="w-5 h-5 inline mr-2"></i> Contact Sales
                                </a>
                            </div>
                        </div>
                    </div>
                `;
                
                // Re-initialize feather icons in modal
                feather.replace();
                
                // Add event listeners to thumbnail images
                const thumbnails = document.querySelectorAll('.car-thumbnail');
                const mainImage = document.getElementById('mainCarImage');
                
                thumbnails.forEach(thumb => {
                    thumb.addEventListener('click', function() {
                        const index = this.getAttribute('data-index');
                        mainImage.src = car.images[index];
                        
                        // Update active thumbnail
                        thumbnails.forEach(t => t.classList.remove('border-2', 'border-red-500'));
                        thumbnails.forEach(t => t.classList.add('border', 'border-gray-300'));
                        this.classList.remove('border', 'border-gray-300');
                        this.classList.add('border-2', 'border-red-500');
                    });
                });
                
                modal.style.display = 'block';
                document.body.style.overflow = 'hidden';
            }
            
            // Close modal when clicking on X
            closeModal.addEventListener('click', function() {
                modal.style.display = 'none';
                document.body.style.overflow = 'auto';
            });
            
            // Close modal when clicking outside of content
            window.addEventListener('click', function(event) {
                if (event.target === modal) {
                    modal.style.display = 'none';
                    document.body.style.overflow = 'auto';
                }
            });
            
            // Initial render
            applySorting();
            renderCars();
        });
    </script>
</body>
</html>