File size: 25,548 Bytes
64e4c58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Playlists - GrooveWave</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/howler@2.2.3/dist/howler.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
            color: #f7fafc;
            overflow-x: hidden;
        }
        .player-bar {
            background: rgba(26, 32, 44, 0.95);
            backdrop-filter: blur(10px);
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
        .track-progress {
            appearance: none;
            height: 4px;
            border-radius: 2px;
            background: rgba(255, 255, 255, 0.2);
        }
        .track-progress::-webkit-slider-thumb {
            appearance: none;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #6366f1;
            cursor: pointer;
        }
        .album-art {
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            transition: transform 0.3s ease;
        }
        .album-art:hover {
            transform: scale(1.05);
        }
        .playlist-item:hover {
            background: rgba(79, 70, 229, 0.2);
        }
        .nav-item.active {
            background: rgba(79, 70, 229, 0.3);
            border-left: 3px solid #6366f1;
        }
        .pulse {
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
            100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
        }
    </style>
</head>
<body class="h-screen flex flex-col">
    <!-- Main Content -->
    <div class="flex flex-1 overflow-hidden">
        <!-- Sidebar -->
        <div class="w-64 bg-gray-900 p-5 flex flex-col hidden md:flex">
            <div class="mb-10">
                <h1 class="text-2xl font-bold text-indigo-400 flex items-center">
                    <i data-feather="music" class="mr-2"></i> GrooveWave
                </h1>
            </div>
            
            <nav class="flex-1">
                <ul class="space-y-2">
                    <li>
                        <a href="index.html" class="nav-item flex items-center p-3 rounded-lg text-gray-400 hover:text-white">
                            <i data-feather="home" class="mr-3"></i> Home
                        </a>
                    </li>
                    <li>
                        <a href="search.html" class="nav-item flex items-center p-3 rounded-lg text-gray-400 hover:text-white">
                            <i data-feather="search" class="mr-3"></i> Search
                        </a>
                    </li>
                    <li>
                        <a href="favorites.html" class="nav-item flex items-center p-3 rounded-lg text-gray-400 hover:text-white">
                            <i data-feather="heart" class="mr-3"></i> Favorites
                        </a>
                    </li>
                    <li>
                        <a href="playlists.html" class="nav-item active flex items-center p-3 rounded-lg text-indigo-300">
                            <i data-feather="book" class="mr-3"></i> Playlists
                        </a>
                    </li>
                    <li>
                        <a href="radio.html" class="nav-item flex items-center p-3 rounded-lg text-gray-400 hover:text-white">
                            <i data-feather="radio" class="mr-3"></i> Radio
                        </a>
                    </li>
                </ul>
                
                <div class="mt-10">
                    <h3 class="text-gray-500 text-sm uppercase font-semibold mb-3">Your Playlists</h3>
                    <ul class="space-y-2">
                        <li>
                            <a href="playlist.html?id=1" class="text-gray-400 hover:text-white block py-2">Chill Vibes</a>
                        </li>
                        <li>
                            <a href="playlist.html?id=2" class="text-gray-400 hover:text-white block py-2">Workout Mix</a>
                        </li>
                        <li>
                            <a href="playlist.html?id=3" class="text-gray-400 hover:text-white block py-2">Road Trip</a>
                        </li>
                        <li>
                            <a href="playlist.html?id=4" class="text-gray-400 hover:text-white block py-2">Focus Time</a>
                        </li>
                    </ul>
                </div>
            </nav>
            
            <div class="mt-auto pt-5 border-t border-gray-800">
                <div class="flex items-center">
                    <div class="bg-gray-200 border-2 border-dashed rounded-xl w-10 h-10" />
                    <div class="ml-3">
                        <p class="text-sm font-medium">Alex Morgan</p>
                        <p class="text-xs text-gray-500">Premium User</p>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Main Content Area -->
        <div class="flex-1 flex flex-col overflow-hidden">
            <!-- Top Bar -->
            <div class="p-5 bg-gray-800 flex items-center justify-between">
                <div class="flex items-center">
                    <button class="md:hidden mr-4 text-gray-400">
                        <i data-feather="menu"></i>
                    </button>
                    <div class="relative">
                        <input 
                            type="text" 
                            placeholder="Search music, artists, albums..." 
                            class="bg-gray-700 rounded-full py-2 px-4 pl-10 text-sm w-64 focus:outline-none focus:ring-2 focus:ring-indigo-500"
                            id="search-input"
                        >
                        <i data-feather="search" class="absolute left-3 top-2.5 text-gray-500"></i>
                    </div>
                </div>
                
                <div class="flex items-center space-x-4">
                    <button class="bg-indigo-600 hover:bg-indigo-700 px-4 py-2 rounded-full text-sm font-medium flex items-center">
                        <i data-feather="plus" class="mr-2"></i> Create Playlist
                    </button>
                    <div class="flex items-center">
                        <div class="bg-gray-200 border-2 border-dashed rounded-xl w-8 h-8" />
                        <span class="ml-2 text-sm font-medium hidden md:inline">Alex</span>
                    </div>
                </div>
            </div>
            
            <!-- Content -->
            <div class="flex-1 overflow-y-auto p-5">
                <!-- Playlists Header -->
                <div class="flex justify-between items-center mb-8">
                    <h1 class="text-3xl font-bold">Playlists</h1>
                    <button class="bg-indigo-600 hover:bg-indigo-700 px-4 py-2 rounded-full text-sm font-medium flex items-center">
                        <i data-feather="plus" class="mr-2"></i> Create Playlist
                    </button>
                </div>
                
                <!-- Featured Playlists -->
                <section class="mb-10">
                    <h2 class="text-2xl font-bold mb-5">Featured Playlists</h2>
                    <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-5">
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/21" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Top Charts</h3>
                            <p class="text-gray-500 text-sm">The hottest tracks right now</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/22" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">New Releases</h3>
                            <p class="text-gray-500 text-sm">Fresh tracks this week</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/23" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Mood Booster</h3>
                            <p class="text-gray-500 text-sm">Feel-good tracks to lift your spirits</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/24" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Chill Vibes</h3>
                            <p class="text-gray-500 text-sm">Relaxing beats for your downtime</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/25" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Workout Mix</h3>
                            <p class="text-gray-500 text-sm">High-energy tracks for your workout</p>
                        </div>
                    </div>
                </section>
                
                <!-- Your Playlists -->
                <section>
                    <h2 class="text-2xl font-bold mb-5">Your Playlists</h2>
                    <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-5">
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/1" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Chill Vibes</h3>
                            <p class="text-gray-500 text-sm">Alex Morgan • 24 songs</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/2" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Workout Mix</h3>
                            <p class="text-gray-500 text-sm">Alex Morgan • 18 songs</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/3" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Road Trip</h3>
                            <p class="text-gray-500 text-sm">Alex Morgan • 32 songs</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/4" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Focus Time</h3>
                            <p class="text-gray-500 text-sm">Alex Morgan • 15 songs</p>
                        </div>
                        
                        <div class="bg-gray-800 rounded-lg p-4 hover:bg-gray-700 transition cursor-pointer">
                            <div class="relative mb-3">
                                <img src="http://static.photos/music/320x240/5" alt="Playlist" class="w-full rounded-lg album-art">
                                <button class="absolute bottom-2 right-2 bg-indigo-600 rounded-full p-2">
                                    <i data-feather="play" class="text-white w-4 h-4"></i>
                                </button>
                            </div>
                            <h3 class="font-semibold">Party Mix</h3>
                            <p class="text-gray-500 text-sm">Alex Morgan • 28 songs</p>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>
    
    <!-- Player Bar -->
    <div class="player-bar p-4">
        <div class="max-w-7xl mx-auto">
            <div class="flex items-center justify-between">
                <div class="flex items-center w-1/4">
                    <img id="now-playing-art" src="http://static.photos/music/320x240/8" alt="Now Playing" class="w-16 h-16 rounded-lg">
                    <div class="ml-3">
                        <h4 id="now-playing-title" class="font-semibold">Blinding Lights</h4>
                        <p id="now-playing-artist" class="text-gray-400 text-sm">The Weeknd</p>
                    </div>
                    <button class="ml-4 text-gray-400 hover:text-white" onclick="toggleFavorite()">
                        <i data-feather="heart" id="favorite-icon"></i>
                    </button>
                </div>
                
                <div class="flex-1 flex flex-col items-center w-2/4">
                    <div class="flex items-center space-x-6">
                        <button class="text-gray-400 hover:text-white" onclick="toggleShuffle()">
                            <i data-feather="shuffle" id="shuffle-icon"></i>
                        </button>
                        <button class="text-gray-400 hover:text-white" onclick="previousTrack()">
                            <i data-feather="skip-back"></i>
                        </button>
                        <button class="bg-white text-gray-900 rounded-full p-2 hover:bg-gray-200" onclick="togglePlayPause()">
                            <i data-feather="play" id="play-pause-icon"></i>
                        </button>
                        <button class="text-gray-400 hover:text-white" onclick="nextTrack()">
                            <i data-feather="skip-forward"></i>
                        </button>
                        <button class="text-gray-400 hover:text-white" onclick="toggleRepeat()">
                            <i data-feather="repeat" id="repeat-icon"></i>
                        </button>
                    </div>
                    <div class="w-full flex items-center mt-2">
                        <span id="current-time" class="text-xs text-gray-500 mr-2">0:00</span>
                        <input type="range" min="0" max="100" value="0" class="track-progress flex-1" id="progress-bar">
                        <span id="total-time" class="text-xs text-gray-500 ml-2">0:00</span>
                    </div>
                </div>
                
                <div class="flex items-center justify-end space-x-4 w-1/4">
                    <button class="text-gray-400 hover:text-white">
                        <i data-feather="list"></i>
                    </button>
                    <button class="text-gray-400 hover:text-white">
                        <i data-feather="volume-2"></i>
                    </button>
                    <input type="range" min="0" max="100" value="80" class="track-progress w-24" id="volume-control">
                </div>
            </div>
        </div>
    </div>
    
    <script>
        feather.replace();
        
        // Player functionality
        let isPlaying = false;
        let isShuffle = false;
        let isRepeat = false;
        let currentTrack = null;
        let sound = null;
        
        // Update player display
        function updatePlayerDisplay(title, artist, artUrl) {
            document.getElementById('now-playing-title').textContent = title;
            document.getElementById('now-playing-artist').textContent = artist;
            document.getElementById('now-playing-art').src = artUrl;
        }
        
        // Play a track
        function playTrack(title, artist, artUrl) {
            // Stop current sound if playing
            if (sound) {
                sound.stop();
            }
            
            // Update player display
            updatePlayerDisplay(title, artist, artUrl);
            
            // Create new sound (using a placeholder audio file)
            sound = new Howl({
                src: ['https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'],
                autoplay: true,
                onplay: function() {
                    isPlaying = true;
                    updatePlayPauseIcon();
                    updateProgress();
                },
                onpause: function() {
                    isPlaying = false;
                    updatePlayPauseIcon();
                },
                onend: function() {
                    isPlaying = false;
                    updatePlayPauseIcon();
                }
            });
            
            sound.play();
            currentTrack = { title, artist, artUrl };
        }
        
        // Toggle play/pause
        function togglePlayPause() {
            if (!sound) return;
            
            if (isPlaying) {
                sound.pause();
            } else {
                sound.play();
            }
        }
        
        // Update play/pause icon
        function updatePlayPauseIcon() {
            const icon = document.getElementById('play-pause-icon');
            if (isPlaying) {
                icon.setAttribute('data-feather', 'pause');
            } else {
                icon.setAttribute('data-feather', 'play');
            }
            feather.replace();
        }
        
        // Toggle shuffle
        function toggleShuffle() {
            isShuffle = !isShuffle;
            const icon = document.getElementById('shuffle-icon');
            if (isShuffle) {
                icon.classList.add('text-indigo-400');
            } else {
                icon.classList.remove('text-indigo-400');
            }
        }
        
        // Toggle repeat
        function toggleRepeat() {
            isRepeat = !isRepeat;
            const icon = document.getElementById('repeat-icon');
            if (isRepeat) {
                icon.classList.add('text-indigo-400');
            } else {
                icon.classList.remove('text-indigo-400');
            }
        }
        
        // Toggle favorite
        function toggleFavorite() {
            const icon = document.getElementById('favorite-icon');
            if (icon.getAttribute('data-feather') === 'heart') {
                icon.setAttribute('data-feather', 'heart-fill');
                icon.classList.add('text-red-500');
            } else {
                icon.setAttribute('data-feather', 'heart');
                icon.classList.remove('text-red-500');
            }
            feather.replace();
        }
        
        // Next track
        function nextTrack() {
            // For demo purposes, just restart the current track
            if (sound) {
                sound.seek(0);
            }
        }
        
        // Previous track
        function previousTrack() {
            // For demo purposes, just restart the current track
            if (sound) {
                sound.seek(0);
            }
        }
        
        // Update progress bar
        function updateProgress() {
            if (!sound) return;
            
            const progressBar = document.getElementById('progress-bar');
            const currentTime = document.getElementById('current-time');
            const totalTime = document.getElementById('total-time');
            
            // Format time helper
            function formatTime(seconds) {
                const min = Math.floor(seconds / 60);
                const sec = Math.floor(seconds % 60);
                return `${min}:${sec < 10 ? '0' : ''}${sec}`;
            }
            
            // Update progress while playing
            const update = () => {
                if (sound.playing()) {
                    const seek = sound.seek() || 0;
                    const duration = sound.duration();
                    progressBar.value = (seek / duration) * 100 || 0;
                    currentTime.textContent = formatTime(seek);
                    totalTime.textContent = formatTime(duration);
                    requestAnimationFrame(update);
                }
            };
            
            requestAnimationFrame(update);
            
            // Allow seeking
            progressBar.addEventListener('change', function() {
                const duration = sound.duration();
                sound.seek(duration * (this.value / 100));
            });
        }
        
        // Volume control
        document.getElementById('volume-control').addEventListener('change', function() {
            if (sound) {
                sound.volume(this.value / 100);
            }
        });
        
        // Search functionality
        document.getElementById('search-input').addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                alert(`Searching for: ${this.value}`);
                // In a real app, this would redirect to a search results page
            }
        });
        
        // Initialize with a track
        window.addEventListener('load', function() {
            playTrack('Blinding Lights', 'The Weeknd', 'http://static.photos/music/320x240/8');
        });
    </script>
</body>
</html>