File size: 17,688 Bytes
eb66d76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Discovery - SparkMeet</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .btn-primary {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        }
        .btn-primary:hover {
            background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
        }
        .profile-card {
            transition: all 0.3s ease;
            cursor: grab;
        }
        .profile-card:active {
            cursor: grabbing;
        }
        .swipe-left {
            transform: translateX(-150%) rotate(-30deg);
            opacity: 0;
        }
        .swipe-right {
            transform: translateX(150%) rotate(30deg);
            opacity: 0;
        }
        .swipe-up {
            transform: translateY(-150%) scale(0.8);
            opacity: 0;
        }
        .match-modal {
            backdrop-filter: blur(10px);
        }
        .spark-animation {
            animation: sparkle 1.5s ease-in-out infinite;
        }
        @keyframes sparkle {
            0%, 100% { transform: scale(1) rotate(0deg); }
            50% { transform: scale(1.2) rotate(180deg); }
        }
        .action-button {
            transition: all 0.2s ease;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }
        .action-button:hover {
            transform: scale(1.1);
            box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        }
        .action-button:active {
            transform: scale(0.95);
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- Navigation -->
    <nav class="bg-white shadow-sm sticky top-0 z-40">
        <div class="max-w-6xl mx-auto px-4">
            <div class="flex justify-between items-center py-3">
                <a href="index.html" class="flex items-center space-x-2">
                    <span class="text-2xl font-bold bg-gradient-to-r from-purple-600 to-pink-500 bg-clip-text text-transparent">SparkMeet</span>
                </a>
                <div class="flex items-center space-x-4">
                    <button class="p-2 text-gray-600 hover:text-purple-600 rounded-full hover:bg-gray-100">
                        <i data-feather="filter" class="w-5 h-5"></i>
                    </button>
                    <button class="p-2 text-gray-600 hover:text-purple-600 rounded-full hover:bg-gray-100">
                        <i data-feather="message-circle" class="w-5 h-5"></i>
                    </button>
                    <button class="relative p-2 text-gray-600 hover:text-purple-600 rounded-full hover:bg-gray-100">
                        <i data-feather="bell" class="w-5 h-5"></i>
                        <span class="absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"></span>
                    </button>
                    <a href="profile-builder.html" class="w-8 h-8 rounded-full bg-gradient-to-r from-purple-400 to-pink-400 flex items-center justify-center text-white font-semibold">
                        A
                    </a>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Discovery Area -->
    <div class="max-w-md mx-auto px-4 py-6">
        <div class="relative h-[70vh] mb-6">
            <!-- Profile Cards Stack -->
            <div id="card-stack" class="relative w-full h-full">
                <!-- Card 1 -->
                <div class="profile-card absolute inset-0 bg-white rounded-2xl shadow-lg overflow-hidden" data-user-id="1">
                    <div class="relative h-3/4">
                        <img src="http://static.photos/people/640x360/123" alt="Sarah" class="w-full h-full object-cover">
                        <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent"></div>
                        <div class="absolute bottom-4 left-4 text-white">
                            <h3 class="text-2xl font-bold">Sarah, 22</h3>
                            <p class="text-sm opacity-90">✨ Photography & Coffee</p>
                            <div class="flex items-center mt-2 space-x-2">
                                <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Creative</span>
                                <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Adventurous</span>
                            </div>
                        </div>
                        <button class="info-btn absolute top-4 right-4 w-10 h-10 bg-white/20 backdrop-blur rounded-full flex items-center justify-center text-white hover:bg-white/30">
                            <i data-feather="info" class="w-5 h-5"></i>
                        </button>
                    </div>
                    <div class="p-4">
                        <p class="text-gray-700 text-sm">"Capturing moments and chasing sunsets. Let's grab coffee and see where the conversation goes!"</p>
                    </div>
                </div>

                <!-- Card 2 -->
                <div class="profile-card absolute inset-0 bg-white rounded-2xl shadow-lg overflow-hidden" data-user-id="2">
                    <div class="relative h-3/4">
                        <img src="http://static.photos/people/640x360/456" alt="Alex" class="w-full h-full object-cover">
                        <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent"></div>
                        <div class="absolute bottom-4 left-4 text-white">
                            <h3 class="text-2xl font-bold">Alex, 24</h3>
                            <p class="text-sm opacity-90">🎵 Music & Hiking</p>
                            <div class="flex items-center mt-2 space-x-2">
                                <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Musician</span>
                                <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Outdoors</span>
                            </div>
                        </div>
                        <button class="info-btn absolute top-4 right-4 w-10 h-10 bg-white/20 backdrop-blur rounded-full flex items-center justify-center text-white hover:bg-white/30">
                            <i data-feather="info" class="w-5 h-5"></i>
                        </button>
                    </div>
                    <div class="p-4">
                        <p class="text-gray-700 text-sm">"Guitar, mountains, and good vibes. Looking for someone to share playlists and trail views."</p>
                    </div>
                </div>

                <!-- Card 3 -->
                <div class="profile-card absolute inset-0 bg-white rounded-2xl shadow-lg overflow-hidden" data-user-id="3">
                    <div class="relative h-3/4">
                        <img src="http://static.photos/people/640x360/789" alt="Jordan" class="w-full h-full object-cover">
                        <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent"></div>
                        <div class="absolute bottom-4 left-4 text-white">
                            <h3 class="text-2xl font-bold">Jordan, 21</h3>
                            <p class="text-sm opacity-90">🎮 Gaming & Tech</p>
                            <div class="flex items-center mt-2 space-x-2">
                                <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Gamer</span>
                                <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Techie</span>
                            </div>
                        </div>
                        <button class="info-btn absolute top-4 right-4 w-10 h-10 bg-white/20 backdrop-blur rounded-full flex items-center justify-center text-white hover:bg-white/30">
                            <i data-feather="info" class="w-5 h-5"></i>
                        </button>
                    </div>
                    <div class="p-4">
                        <p class="text-gray-700 text-sm">"Coding by day, gaming by night. Let's team up in life and in co-op games!"</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Action Buttons -->
        <div class="flex justify-center items-center space-x-6">
            <button id="pass-btn" class="action-button w-16 h-16 bg-gray-200 rounded-full flex items-center justify-center text-gray-600 hover:bg-gray-300" aria-label="Pass">
                <i data-feather="x" class="w-8 h-8"></i>
            </button>
            <button id="like-btn" class="action-button w-16 h-16 bg-red-500 rounded-full flex items-center justify-center text-white hover:bg-red-600" aria-label="Like">
                <i data-feather="heart" class="w-8 h-8"></i>
            </button>
            <button id="superspark-btn" class="action-button w-16 h-16 bg-purple-500 rounded-full flex items-center justify-center text-white hover:bg-purple-600 relative" aria-label="Super Spark">
                <i data-feather="zap" class="w-8 h-8 spark-animation"></i>
                <span class="absolute -top-1 -right-1 w-5 h-5 bg-yellow-400 rounded-full text-xs flex items-center justify-center font-bold">3</span>
            </button>
        </div>
    </div>

    <!-- Match Modal -->
    <div id="match-modal" class="match-modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-2xl max-w-sm w-full p-6 text-center relative overflow-hidden">
            <div class="absolute inset-0 bg-gradient-to-r from-purple-400 to-pink-400 opacity-10"></div>
            <div class="relative z-10">
                <div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-gradient-to-r from-purple-400 to-pink-400 mb-4">
                    <i data-feather="heart" class="h-8 w-8 text-white"></i>
                </div>
                <h2 class="text-2xl font-bold mb-2">It's a Match! 🔥</h2>
                <p class="text-gray-600 mb-6">You and Sarah both liked each other. Ready to spark a convo?</p>
                <div class="flex space-x-3">
                    <button id="send-message-btn" class="flex-1 px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
                        Send Message
                    </button>
                    <button id="keep-swiping-btn" class="flex-1 px-6 py-3 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors">
                        Keep Swiping
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Profile Info Modal -->
    <div id="info-modal" class="match-modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-2xl max-w-sm w-full max-h-[80vh] overflow-y-auto">
            <div class="p-6">
                <div class="flex justify-between items-start mb-4">
                    <div>
                        <h3 id="info-name" class="text-xl font-bold"></h3>
                        <p id="info-bio" class="text-gray-600 mt-1"></p>
                    </div>
                    <button id="close-info-btn" class="text-gray-400 hover:text-gray-600">
                        <i data-feather="x" class="w-6 h-6"></i>
                    </button>
                </div>
                <div id="info-details" class="space-y-3">
                    <!-- Dynamic content will be inserted here -->
                </div>
                <div class="mt-6 flex space-x-3">
                    <button class="flex-1 px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
                        <i data-feather="message-circle" class="w-4 h-4 inline mr-2"></i>Message
                    </button>
                    <button class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors">
                        <i data-feather="share" class="w-4 h-4"></i>
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Initialize Feather Icons
        feather.replace();

        // Card stack management
        let currentCardIndex = 0;
        const cards = document.querySelectorAll('.profile-card');
        const totalCards = cards.length;

        // Analytics tracking
        function trackEvent(eventName, properties = {}) {
            console.log('Analytics:', eventName, properties);
            // In production, send to Mixpanel/Amplitude
        }

        // Card interaction functions
        function handleSwipe(direction) {
            const currentCard = cards[currentCardIndex];
            if (!currentCard) return;

            const userId = currentCard.dataset.userId;
            
            // Add swipe animation class
            currentCard.classList.add(`swipe-${direction}`);
            
            // Track event
            trackEvent(`discovery_${direction}`, { 
                userId, 
                method: direction === 'up' ? 'superspark' : direction 
            });

            // Remove card after animation
            setTimeout(() => {
                currentCard.style.display = 'none';
                currentCardIndex++;
                
                // Check if we need to load more cards
                if (currentCardIndex >= totalCards) {
                    // In production, load more profiles
                    console.log('No more profiles to show');
                }
            }, 300);

            // Check for match (simulated)
            if (direction === 'right' || direction === 'up') {
                setTimeout(() => {
                    if (Math.random() > 0.7) { // 30% chance of match
                        showMatchModal();
                    }
                }, 500);
            }
        }

        function showMatchModal() {
            const modal = document.getElementById('match-modal');
            modal.classList.remove('hidden');
            trackEvent('match_created', { matchId: 'match_123' });
            
            // Animate match modal
            anime({
                targets: '#match-modal > div',
                scale: [0.8, 1],
                opacity: [0, 1],
                duration: 500,
                easing: 'easeOutElastic(1, .5)'
            });
        }

        function showInfoModal(card) {
            const modal = document.getElementById('info-modal');
            const name = card.querySelector('h3').textContent;
            const bio = card.querySelector('p').textContent;
            const tags = Array.from(card.querySelectorAll('span')).map(span => span.textContent);
            
            document.getElementById('info-name').textContent = name;
            document.getElementById('info-bio').textContent = bio;
            
            const detailsHtml = `
                <div class="flex flex-wrap gap-2 mb-4">
                    ${tags.map(tag => `<span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">${tag}</span>`).join('')}
                </div>
                <div class="space-y-2 text-sm">
                    <div class="flex items-center">
                        <i data-feather="map-pin" class="w-4 h-4 mr-2 text-gray-400"></i>
                        <span>2 miles away</span>
                    </div>
                    <div class="flex items-center">
                        <i data-feather="briefcase" class="w-4 h-4 mr-2 text-gray-400"></i>
                        <span>Student at University</span>
                    </div>
                    <div class="flex items-center">
                        <i data-feather="music" class="w-4 h-4 mr-2 text-gray-400"></i>
                        <span>Indie, Alternative</span>
                    </div>
                </div>
            `;
            
            document.getElementById('info-details').innerHTML = detailsHtml;
            modal.classList.remove('hidden');
            trackEvent('discovery_info_open', { userId: card.dataset.userId });
            
            // Re-render feather icons in modal
            feather.replace();
        }

        // Button event listeners
        document.getElementById('pass-btn').addEventListener('click', () => handleSwipe('left'));
        document.getElementById('like-btn').addEventListener('click', () => handleSwipe('right'));
        document.getElementById('superspark-btn').addEventListener('click', () => handleSwipe('up'));

        // Match modal buttons
        document.getElementById('send-message-btn').addEventListener('click', () => {
            trackEvent('profile_message_open', { matchId: 'match_123' });
            window.location.href = 'chat.html?matchId=match_123';
        });

        document.getElementById('keep-swiping-btn').addEventListener('click', () => {
            document.getElementById('match-modal').classList.add('hidden');
        });

        // Info modal
        document.querySelectorAll('.info-btn').forEach(btn => {
            btn.addEventListener('click', (e) => {
                e.stopPropagation();
                const card = btn.closest('.profile-card');
                show