File size: 29,308 Bytes
9a6a0c8
 
 
 
 
 
 
 
 
32d03a3
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c887af6
 
 
 
 
 
 
 
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32d03a3
 
 
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
32d03a3
 
 
 
f5d33cd
32d03a3
 
 
 
 
 
 
 
 
f5d33cd
32d03a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32d03a3
9a6a0c8
 
 
 
 
 
 
 
 
 
 
6b2c51b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994da7d
da7c69a
9a6a0c8
da7c69a
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b2c51b
 
 
 
 
 
9a6a0c8
 
 
 
 
 
 
 
 
 
6b2c51b
9a6a0c8
 
 
 
 
 
 
14f1f7e
9a6a0c8
6b2c51b
 
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
14f1f7e
fe6a4ea
9a6a0c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b2c51b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a6a0c8
 
 
 
6b2c51b
9a6a0c8
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Discover - BeatFridge Music Platform</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/lucide@latest"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="responsive.css">
    <style>
        * {
            font-family: 'Inter', sans-serif;
        }
        
        body {
            background-color: #0a0a0a;
            color: #ffffff;
        }

        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-track {
            background: #0a0a0a;
        }
        ::-webkit-scrollbar-thumb {
            background: #2d2d2d;
            border-radius: 4px;
        }

        .glass {
            background: rgba(20, 20, 20, 0.6);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.08);
        }

        .glass-panel {
            background: rgba(30, 30, 30, 0.4);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.05);
        }

        .neon-text {
            background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .track-card {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .track-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 40px -10px rgba(0, 212, 255, 0.15);
        }

        .glow-cyan {
            box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
        }

        .sticky-player {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 50;
        }

        .avatar-ring {
            box-shadow: 0 0 0 4px #0a0a0a, 0 0 0 6px rgba(0, 212, 255, 0.5);
        }

        .genre-card {
            transition: all 0.3s ease;
        }
        .genre-card:hover {
            transform: scale(1.05);
        }
    </style>
</head>
<body class="bg-black text-white overflow-x-hidden pb-24">

    <!-- Navigation -->
    <nav class="fixed top-0 left-0 right-0 z-40 glass border-b border-white/5">
        <div class="max-w-[1600px] mx-auto px-6 h-16 flex items-center justify-between">
            <!-- Logo -->
            <div class="flex items-center gap-8">
                <a href="index.html" class="flex items-center gap-2 cursor-pointer hover:opacity-80 transition">
                    <div class="w-8 h-8 rounded-lg flex items-center justify-center bg-white/10 border border-white/20">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-5 h-5 text-white">
                            <rect x="4" y="2" width="16" height="20" rx="2"/>
                            <line x1="4" y1="9" x2="20" y2="9"/>
                            <line x1="15" y1="5" x2="15" y2="7"/>
                            <line x1="15" y1="12" x2="15" y2="18"/>
                        </svg>
                    </div>
                    <span class="text-xl font-bold tracking-tight">BeatFridge</span>
                </a>
                
                <!-- Nav Links -->
                <div class="hidden md:flex items-center gap-6 text-sm font-medium text-gray-400">
                    <a href="index.html" class="hover:text-cyan-400 transition">Home</a>
                    <a href="discover.html" class="text-cyan-400">Discover</a>
                    <a href="library.html" class="hover:text-cyan-400 transition">Library</a>
                    <a href="upload.html" class="hover:text-cyan-400 transition flex items-center gap-1">
                        <i data-lucide="upload-cloud" class="w-4 h-4"></i>
                        Upload
                    </a>
                    <a href="analytics.html" class="hover:text-orange-400 transition flex items-center gap-1">
                        <i data-lucide="bar-chart-2" class="w-4 h-4"></i>
                        Analytics
                    </a>
                </div>
            </div>

            <!-- Search & Profile -->
            <div class="flex items-center gap-4">
                <div class="relative hidden sm:block">
                    <input type="text" placeholder="Search artists, tracks..." 
                        class="w-64 bg-white/5 border border-white/10 rounded-full px-4 py-2 pl-10 text-sm focus:outline-none focus:border-cyan-500/50 focus:bg-white/10 transition">
                    <i data-lucide="search" class="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
                </div>
                
                <button id="mobileMenuBtn" class="md:hidden w-10 h-10 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition" onclick="toggleMobileMenu()">
                    <i data-lucide="menu" class="w-5 h-5 text-gray-300"></i>
                </button>
                <button class="w-10 h-10 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition relative">
                    <i data-lucide="bell" class="w-5 h-5 text-gray-300"></i>
                    <span class="absolute top-2 right-2 w-2 h-2 bg-orange-500 rounded-full"></span>
                </button>

                <div class="w-10 h-10 rounded-full bg-gradient-to-br from-cyan-400 to-purple-600 cursor-pointer hover:scale-105 transition avatar-ring">
                    <img src="http://static.photos/people/200x200/42" alt="Profile" class="w-full h-full rounded-full object-cover">
                </div>
            </div>
        </div>
    </nav>

    <!-- Mobile Nav Overlay -->
    <div id="mobileNavOverlay" class="mobile-nav-overlay" onclick="closeMobileMenu()"></div>
    <div id="mobileNavPanel" class="mobile-nav-panel">
        <div class="flex items-center justify-between mb-8">
            <a href="index.html" class="flex items-center gap-2 hover:opacity-80 transition">
                <div class="w-8 h-8 rounded-lg flex items-center justify-center bg-white/10 border border-white/20">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-5 h-5 text-white">
                        <rect x="4" y="2" width="16" height="20" rx="2"/>
                        <line x1="4" y1="9" x2="20" y2="9"/>
                        <line x1="15" y1="5" x2="15" y2="7"/>
                        <line x1="15" y1="12" x2="15" y2="18"/>
                    </svg>
                </div>
                <span class="text-xl font-bold">BeatFridge</span>
            </a>
            <button onclick="closeMobileMenu()" class="w-10 h-10 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition">
                <i data-lucide="x" class="w-5 h-5"></i>
            </button>
        </div>
        <nav class="space-y-1">
            <a href="index.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
                <i data-lucide="home" class="w-5 h-5"></i> Home
            </a>
            <a href="discover.html" class="flex items-center gap-3 px-4 py-3 rounded-xl bg-white/5 text-cyan-400 font-medium">
                <i data-lucide="compass" class="w-5 h-5"></i> Discover
            </a>
            <a href="library.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
                <i data-lucide="library" class="w-5 h-5"></i> Library
            </a>
            <a href="upload.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
                <i data-lucide="upload-cloud" class="w-5 h-5"></i> Upload
            </a>
            <a href="analytics.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
                <i data-lucide="bar-chart-2" class="w-5 h-5"></i> Analytics
            </a>
        </nav>
    </div>

    <!-- Main Content -->
    <div class="max-w-[1600px] mx-auto pt-20 pb-12 px-6 min-h-screen">
        
        <!-- Header -->
        <div class="mb-8">
            <h1 class="text-3xl font-bold mb-2 neon-text">Discover</h1>
            <p class="text-gray-400">Explore new music, trending tracks, and genres</p>
        </div>

        <!-- Genres Grid -->
        <div class="mb-8">
            <h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
                <i data-lucide="grid" class="w-5 h-5 text-cyan-400"></i>
                Browse by Genre
            </h2>
            <div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
                <div class="genre-card glass-panel rounded-xl p-6 text-center cursor-pointer hover:bg-white/5">
                    <div class="w-12 h-12 rounded-full bg-cyan-500/20 flex items-center justify-center mx-auto mb-3">
                        <i data-lucide="waves" class="w-6 h-6 text-cyan-400"></i>
                    </div>
                    <p class="font-medium text-white">Techno</p>
                    <p class="text-xs text-gray-500 mt-1">2.4K tracks</p>
                </div>
                <div class="genre-card glass-panel rounded-xl p-6 text-center cursor-pointer hover:bg-white/5">
                    <div class="w-12 h-12 rounded-full bg-purple-500/20 flex items-center justify-center mx-auto mb-3">
                        <i data-lucide="cloud" class="w-6 h-6 text-purple-400"></i>
                    </div>
                    <p class="font-medium text-white">Ambient</p>
                    <p class="text-xs text-gray-500 mt-1">1.8K tracks</p>
                </div>
                <div class="genre-card glass-panel rounded-xl p-6 text-center cursor-pointer hover:bg-white/5">
                    <div class="w-12 h-12 rounded-full bg-orange-500/20 flex items-center justify-center mx-auto mb-3">
                        <i data-lucide="flame" class="w-6 h-6 text-orange-400"></i>
                    </div>
                    <p class="font-medium text-white">House</p>
                    <p class="text-xs text-gray-500 mt-1">3.2K tracks</p>
                </div>
                <div class="genre-card glass-panel rounded-xl p-6 text-center cursor-pointer hover:bg-white/5">
                    <div class="w-12 h-12 rounded-full bg-pink-500/20 flex items-center justify-center mx-auto mb-3">
                        <i data-lucide="zap" class="w-6 h-6 text-pink-400"></i>
                    </div>
                    <p class="font-medium text-white">Synthwave</p>
                    <p class="text-xs text-gray-500 mt-1">956 tracks</p>
                </div>
                <div class="genre-card glass-panel rounded-xl p-6 text-center cursor-pointer hover:bg-white/5">
                    <div class="w-12 h-12 rounded-full bg-green-500/20 flex items-center justify-center mx-auto mb-3">
                        <i data-lucide="leaf" class="w-6 h-6 text-green-400"></i>
                    </div>
                    <p class="font-medium text-white">Lo-Fi</p>
                    <p class="text-xs text-gray-500 mt-1">4.1K tracks</p>
                </div>
                <div class="genre-card glass-panel rounded-xl p-6 text-center cursor-pointer hover:bg-white/5">
                    <div class="w-12 h-12 rounded-full bg-red-500/20 flex items-center justify-center mx-auto mb-3">
                        <i data-lucide="activity" class="w-6 h-6 text-red-400"></i>
                    </div>
                    <p class="font-medium text-white">Drum & Bass</p>
                    <p class="text-xs text-gray-500 mt-1">1.2K tracks</p>
                </div>
            </div>
        </div>

        <!-- Trending Tracks -->
        <div class="mb-8">
            <div class="flex items-center justify-between mb-6">
                <h2 class="text-lg font-semibold flex items-center gap-2">
                    <i data-lucide="trending-up" class="w-5 h-5 text-cyan-400"></i>
                    Trending Now
                </h2>
                <div class="flex flex-wrap items-center gap-2">
                    <button class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm hover:bg-white/10 transition text-cyan-400">Today</button>
                    <button class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm hover:bg-white/10 transition text-gray-400">This Week</button>
                    <button class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm hover:bg-white/10 transition text-gray-400">This Month</button>
                </div>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" id="trendingGrid">
                <!-- Tracks will be rendered here -->
            </div>
        </div>

        <!-- Rising Beats -->
        <div class="mb-8" id="risingBeatsDiscoverSection">
            <div class="flex items-center justify-between mb-6">
                <h2 class="text-lg font-semibold flex items-center gap-2">
                    <i data-lucide="flame" class="w-5 h-5 text-orange-500"></i>
                    Rising Beats
                    <span class="text-xs text-orange-400/60 font-normal ml-1">πŸ”₯ Fastest growing tracks</span>
                </h2>
                <button class="text-xs text-gray-500 hover:text-cyan-400 transition flex items-center gap-1" onclick="refreshDiscoverRising()">
                    <i data-lucide="refresh-cw" class="w-3.5 h-3.5"></i> Refresh
                </button>
            </div>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" id="risingBeatsGrid"></div>
        </div>

        <!-- New Releases -->
        <div>
            <h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
                <i data-lucide="clock" class="w-5 h-5 text-cyan-400"></i>
                Fresh Uploads
            </h2>
            <div class="space-y-2" id="newReleasesList">
                <!-- List items rendered here -->
            </div>
        </div>
    </div>

    <!-- Sticky Bottom Player -->
    <div class="sticky-player glass border-t border-white/10 px-4 py-3">
        <div class="max-w-[1600px] mx-auto flex items-center gap-4">
            
            <!-- Track Info -->
            <div class="flex items-center gap-3 w-64 flex-shrink-0">
                <div class="w-14 h-14 rounded-lg overflow-hidden relative group cursor-pointer">
                    <img id="playerArt" src="http://static.photos/technology/200x200/1" class="w-full h-full object-cover">
                    <div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
                        <i data-lucide="maximize-2" class="w-5 h-5"></i>
                    </div>
                </div>
                <div class="min-w-0 flex-1">
                    <p id="playerTitle" class="text-sm font-medium text-white truncate">Midnight Synthesis</p>
                    <p id="playerArtist" class="text-xs text-gray-400 truncate">Aurora Void</p>
                </div>
                <button class="text-gray-400 hover:text-cyan-400 transition">
                    <i data-lucide="heart" class="w-5 h-5"></i>
                </button>
            </div>

            <!-- Controls -->
            <div class="flex-1 flex flex-col items-center max-w-2xl mx-auto">
                <div class="flex items-center gap-6 mb-2">
                    <button class="text-gray-400 hover:text-white transition" onclick="toggleShuffle(this)">
                        <i data-lucide="shuffle" class="w-4 h-4"></i>
                    </button>
                    <button class="text-gray-300 hover:text-white transition" onclick="previousTrack()">
                        <i data-lucide="skip-back" class="w-5 h-5 fill-current"></i>
                    </button>
                    <button class="w-10 h-10 rounded-full bg-white text-black flex items-center justify-center hover:scale-105 transition" onclick="togglePlay()" id="playPauseBtn">
                        <i data-lucide="play" class="w-5 h-5 fill-current ml-0.5" id="playIcon"></i>
                    </button>
                    <button class="text-gray-300 hover:text-white transition" onclick="nextTrack()">
                        <i data-lucide="skip-forward" class="w-5 h-5 fill-current"></i>
                    </button>
                    <button class="text-gray-400 hover:text-white transition" onclick="toggleRepeat(this)">
                        <i data-lucide="repeat" class="w-4 h-4"></i>
                    </button>
                </div>
                
                <!-- Progress -->
                <div class="w-full flex items-center gap-3">
                    <span class="text-xs text-gray-400 w-10 text-right" id="currentTime">1:24</span>
                    <div class="flex-1 h-8 flex items-center cursor-pointer group" id="progressContainer">
                        <div class="w-full h-1.5 bg-white/10 rounded-full overflow-hidden relative">
                            <div class="absolute inset-y-0 left-0 bg-gradient-to-r from-cyan-400 to-purple-500 w-[30%] rounded-full group-hover:h-2 transition-all"></div>
                            <div class="absolute top-1/2 -translate-y-1/2 left-[30%] w-3 h-3 bg-white rounded-full opacity-0 group-hover:opacity-100 transition shadow-lg"></div>
                        </div>
                    </div>
                    <span class="text-xs text-gray-400 w-10" id="duration">4:32</span>
                </div>
            </div>

            <!-- Volume & Extra -->
            <div class="flex items-center gap-3 w-64 justify-end">
                <button class="text-gray-400 hover:text-white transition">
                    <i data-lucide="mic-2" class="w-4 h-4"></i>
                </button>
                <button class="text-gray-400 hover:text-white transition">
                    <i data-lucide="list-music" class="w-4 h-4"></i>
                </button>
                <div class="flex items-center gap-2 group">
                    <button class="text-gray-400 hover:text-white transition" onclick="toggleMute()">
                        <i data-lucide="volume-2" class="w-5 h-5" id="volumeIcon"></i>
                    </button>
                    <div class="w-24 h-1 bg-white/10 rounded-full overflow-hidden cursor-pointer">
                        <div class="h-full bg-cyan-400 w-[70%] rounded-full"></div>
                    </div>
                </div>
                <button class="text-gray-400 hover:text-white transition ml-2">
                    <i data-lucide="cast" class="w-4 h-4"></i>
                </button>
            </div>
        </div>
    </div>

    <script src="mobile-nav.js"></script>
    <script src="app.js"></script>
    <script>
        BF.init('search');
        lucide.createIcons();

        // Sample tracks data
        const trendingTracks = [
            {id: 1, title: "Neon Horizons", artist: "Aurora Void", plays: "12.5K", duration: "4:32", image: "http://static.photos/technology/400x400/1"},
            {id: 2, title: "Digital Rain", artist: "Cyber Dreams", plays: "8.2K", duration: "3:45", image: "http://static.photos/technology/400x400/2"},
            {id: 3, title: "Cybernetic Dreams", artist: "Neon Prophet", plays: "24.1K", duration: "5:18", image: "http://static.photos/technology/400x400/3"},
            {id: 4, title: "Analog Heart", artist: "Synth Wanderer", plays: "15.3K", duration: "3:22", image: "http://static.photos/technology/400x400/4"},
            {id: 5, title: "Midnight Synthesis", artist: "Aurora Void", plays: "32.7K", duration: "4:08", image: "http://static.photos/technology/400x400/5"},
            {id: 6, title: "Void Walker", artist: "Deep Frequencies", plays: "9.8K", duration: "6:14", image: "http://static.photos/technology/400x400/6"},
            {id: 7, title: "Electric Soul", artist: "NeonWave", plays: "18.4K", duration: "3:55", image: "http://static.photos/technology/400x400/7"},
            {id: 8, title: "Digital Horizon", artist: "Cyber Dreams", plays: "11.2K", duration: "4:15", image: "http://static.photos/technology/400x400/8"}
        ];

        let isPlaying = false;
        let isMuted = false;

        function renderTrending() {
            const grid = document.getElementById('trendingGrid');
            // Use enhanced trending algorithm
            const enhancedTrending = BF.getTrendingTracks().slice(0, 8);
            grid.innerHTML = enhancedTrending.map((track, i) => {
                const trend = BF.getTrackTrendIndicator(track.id);
                return `
                <div class="track-card glass-panel rounded-2xl p-4 group cursor-pointer" onclick="BF.playTrack(${JSON.stringify(track).replace(/"/g, '&quot;')})">
                    <div class="relative aspect-square rounded-xl overflow-hidden mb-4">
                        <img src="${track.image}" class="w-full h-full object-cover transition duration-500 group-hover:scale-110">
                        <div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition flex items-center justify-center backdrop-blur-[2px]">
                            <div class="w-12 h-12 rounded-full bg-cyan-500 text-black flex items-center justify-center glow-cyan">
                                <i data-lucide="play" class="w-6 h-6 fill-current ml-1"></i>
                            </div>
                        </div>
                        <div class="absolute top-2 left-2 px-2 py-1 rounded bg-black/70 text-xs font-bold text-white">
                            #${i + 1}
                        </div>
                        ${trend.direction !== 'stable' ? `<div class="absolute top-2 right-2 px-1.5 py-0.5 rounded text-[9px] font-bold ${trend.cssClass} bg-black/60 backdrop-blur-sm">${trend.arrow} ${trend.label}</div>` : ''}
                    </div>
                    <h3 class="font-semibold text-white truncate group-hover:text-cyan-400 transition">${track.title}</h3>
                    <p class="text-sm text-gray-400 truncate">${track.artist}</p>
                    <p class="text-xs text-gray-500 mt-2 flex items-center gap-1">
                        <i data-lucide="play-circle" class="w-3 h-3"></i>
                        ${track.plays}
                    </p>
                    ${BF.renderDL(track.id, track.title, track.artist)}
                </div>
                `;
            }).join('');
            lucide.createIcons();
        }

        function renderNewReleases() {
            const list = document.getElementById('newReleasesList');
            list.innerHTML = trendingTracks.slice(0, 4).map(track => `
                <div class="flex items-center gap-4 p-3 rounded-xl bg-white/5 hover:bg-white/10 transition cursor-pointer group">
                    <img src="${track.image}" class="w-16 h-16 rounded-lg object-cover">
                    <div class="flex-1 min-w-0">
                        <h4 class="font-medium text-white truncate group-hover:text-cyan-400 transition">${track.title}</h4>
                        <p class="text-sm text-gray-500">${track.artist}</p>
                    </div>
                    <span class="text-xs text-gray-500">${track.duration}</span>
                    ${BF.renderDL(track.id, track.title, track.artist)}
                    ${BF.renderShare(track.id, track.title, track.artist)}
                    <button class="w-8 h-8 rounded-full bg-white/10 flex items-center justify-center opacity-0 group-hover:opacity-100 transition hover:bg-cyan-500/20 hover:text-cyan-400">
                        <i data-lucide="play" class="w-4 h-4"></i>
                    </button>
                </div>
            `).join('');
            lucide.createIcons();
        }

        function togglePlay() {
            isPlaying = !isPlaying;
            const icon = document.getElementById('playIcon');
            icon.setAttribute('data-lucide', isPlaying ? 'pause' : 'play');
            lucide.createIcons();
        }

        function toggleShuffle(btn) {
            btn.classList.toggle('text-cyan-400');
        }

        function toggleRepeat(btn) {
            btn.classList.toggle('text-cyan-400');
        }

        function toggleMute() {
            isMuted = !isMuted;
            const icon = document.getElementById('volumeIcon');
            icon.setAttribute('data-lucide', isMuted ? 'volume-x' : 'volume-2');
            lucide.createIcons();
        }

        function previousTrack() {}
        function nextTrack() {}

        // ===== RISING BEATS =====
        // Initialize activity simulation
        if (!JSON.parse(localStorage.getItem('bf_recent_activity') || '{}')._simulated) {
            BF.simulateRecentActivity();
        }

        function renderDiscoverRising() {
            const rising = BF.getRisingBeats().slice(0, 8);
            const grid = document.getElementById('risingBeatsGrid');
            if (!grid) return;

            if (!rising.length) {
                const section = document.getElementById('risingBeatsDiscoverSection');
                if (section) section.style.display = 'none';
                return;
            }

            grid.innerHTML = rising.map((track, i) => {
                const velocity = track._velocity || 0;
                const hotness = velocity > 200 ? 'πŸ”₯πŸ”₯πŸ”₯' : velocity > 100 ? 'πŸ”₯πŸ”₯' : velocity > 30 ? 'πŸ”₯' : 'πŸ“ˆ';
                const recentPlays = track._recentPlays || 0;
                const recentUnlocks = track._recentUnlocks || 0;
                const trend = BF.getTrackTrendIndicator(track.id);

                return `
                <div class="track-card glass-panel rounded-2xl p-4 group cursor-pointer" onclick="BF.playTrack(${JSON.stringify(track).replace(/"/g, '&quot;')})">
                    <div class="relative aspect-square rounded-xl overflow-hidden mb-4">
                        <img src="${track.image}" class="w-full h-full object-cover transition duration-500 group-hover:scale-110">
                        <div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition flex items-center justify-center backdrop-blur-[2px]">
                            <div class="w-12 h-12 rounded-full bg-orange-500 text-white flex items-center justify-center" style="box-shadow:0 0 20px rgba(249,115,22,0.3)">
                                <i data-lucide="play" class="w-6 h-6 fill-current ml-1"></i>
                            </div>
                        </div>
                        <div class="absolute top-2 left-2 px-2 py-1 rounded bg-black/70 text-xs font-bold flex items-center gap-1">
                            <span>${hotness}</span>
                            <span>#${i + 1}</span>
                        </div>
                        <div class="absolute top-2 right-2 px-1.5 py-0.5 rounded text-[9px] font-bold ${trend.cssClass} bg-black/60 backdrop-blur-sm flex items-center gap-0.5">
                            ${trend.arrow} ${trend.label}
                        </div>
                    </div>
                    <h3 class="font-semibold text-white truncate group-hover:text-orange-400 transition">${track.title}</h3>
                    <p class="text-sm text-gray-400 truncate">${track.artist}</p>
                    <div class="mt-2 flex items-center justify-between text-xs text-gray-500">
                        <span class="flex items-center gap-1">
                            <i data-lucide="play-circle" class="w-3 h-3"></i>
                            +${recentPlays} plays
                        </span>
                        <span class="flex items-center gap-1 text-cyan-400">
                            <i data-lucide="download" class="w-3 h-3"></i>
                            ${recentUnlocks} unlocks
                        </span>
                    </div>
                    <div class="mt-2">${BF.renderDL(track.id, track.title, track.artist)}</div>
                </div>
                `;
            }).join('');
            lucide.createIcons();
        }

        function refreshDiscoverRising() {
            BF.simulateRecentActivity();
            renderDiscoverRising();
            BF.showToast('Rankings refreshed πŸ”₯');
        }

        // Initialize
        try {
            renderTrending();
            renderNewReleases();
            renderDiscoverRising();
        } catch (e) {
            console.error('Error initializing discover page:', e);
        }
    </script>
</body>
</html>