samirerty commited on
Commit
0dce550
·
verified ·
1 Parent(s): 8ab97c9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +901 -19
index.html CHANGED
@@ -1,19 +1,901 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fa" dir="rtl">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>چت روم مینیمال | Minimal Chat Room</title>
7
+
8
+ <!-- Tailwind CSS -->
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+
11
+ <!-- Vazirmatn Font -->
12
+ <link rel="preconnect" href="https://fonts.googleapis.com">
13
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
14
+ <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
15
+
16
+ <!-- Phosphor Icons -->
17
+ <script src="https://unpkg.com/@phosphor-icons/web"></script>
18
+
19
+ <!-- Confetti for effects -->
20
+ <script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
21
+
22
+ <script>
23
+ tailwind.config = {
24
+ theme: {
25
+ extend: {
26
+ fontFamily: {
27
+ sans: ['Vazirmatn', 'sans-serif'],
28
+ },
29
+ colors: {
30
+ glass: {
31
+ 100: 'rgba(255, 255, 255, 0.1)',
32
+ 200: 'rgba(255, 255, 255, 0.2)',
33
+ 300: 'rgba(255, 255, 255, 0.3)',
34
+ 400: 'rgba(255, 255, 255, 0.4)',
35
+ 800: 'rgba(0, 0, 0, 0.3)',
36
+ 900: 'rgba(0, 0, 0, 0.6)',
37
+ },
38
+ primary: {
39
+ 50: '#f0fdfa',
40
+ 100: '#ccfbf1',
41
+ 200: '#99f6e4',
42
+ 300: '#5eead4',
43
+ 400: '#2dd4bf',
44
+ 500: '#14b8a6',
45
+ 600: '#0d9488',
46
+ 700: '#0f766e',
47
+ 800: '#115e59',
48
+ 900: '#134e4a',
49
+ }
50
+ },
51
+ animation: {
52
+ 'float': 'float 6s ease-in-out infinite',
53
+ 'pulse-slow': 'pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite',
54
+ 'slide-up': 'slideUp 0.5s ease-out',
55
+ 'slide-down': 'slideDown 0.5s ease-out',
56
+ 'fade-in': 'fadeIn 0.3s ease-out',
57
+ 'bounce-gentle': 'bounceGentle 2s ease-in-out infinite',
58
+ 'shake': 'shake 0.5s ease-in-out',
59
+ 'spin-slow': 'spin 3s linear infinite',
60
+ },
61
+ keyframes: {
62
+ float: {
63
+ '0%, 100%': { transform: 'translateY(0)' },
64
+ '50%': { transform: 'translateY(-20px)' },
65
+ },
66
+ slideUp: {
67
+ '0%': { transform: 'translateY(100%)', opacity: '0' },
68
+ '100%': { transform: 'translateY(0)', opacity: '1' },
69
+ },
70
+ slideDown: {
71
+ '0%': { transform: 'translateY(-100%)', opacity: '0' },
72
+ '100%': { transform: 'translateY(0)', opacity: '1' },
73
+ },
74
+ fadeIn: {
75
+ '0%': { opacity: '0' },
76
+ '100%': { opacity: '1' },
77
+ },
78
+ bounceGentle: {
79
+ '0%, 100%': { transform: 'translateY(0)' },
80
+ '50%': { transform: 'translateY(-10px)' },
81
+ },
82
+ shake: {
83
+ '0%, 100%': { transform: 'translateX(0)' },
84
+ '25%': { transform: 'translateX(-5px)' },
85
+ '75%': { transform: 'translateX(5px)' },
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ </script>
92
+
93
+ <style>
94
+ /* CSS Custom Properties for theming */
95
+ :root {
96
+ --glass-blur: 20px;
97
+ --glass-saturation: 180%;
98
+ --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
99
+ --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
100
+ --dark-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
101
+ }
102
+
103
+ /* Global Reset */
104
+ * {
105
+ -webkit-tap-highlight-color: transparent;
106
+ -webkit-touch-callout: none;
107
+ }
108
+
109
+ /* Smooth Scrolling */
110
+ html {
111
+ scroll-behavior: smooth;
112
+ }
113
+
114
+ /* Custom Scrollbar */
115
+ ::-webkit-scrollbar {
116
+ width: 6px;
117
+ height: 6px;
118
+ }
119
+
120
+ ::-webkit-scrollbar-track {
121
+ background: rgba(255, 255, 255, 0.05);
122
+ border-radius: 3px;
123
+ }
124
+
125
+ ::-webkit-scrollbar-thumb {
126
+ background: rgba(255, 255, 255, 0.2);
127
+ border-radius: 3px;
128
+ }
129
+
130
+ ::-webkit-scrollbar-thumb:hover {
131
+ background: rgba(255, 255, 255, 0.3);
132
+ }
133
+
134
+ /* Glassmorphism Base */
135
+ .glass {
136
+ background: rgba(255, 255, 255, 0.08);
137
+ backdrop-filter: blur(var(--glass-blur));
138
+ -webkit-backdrop-filter: blur(var(--glass-blur));
139
+ border: 1px solid rgba(255, 255, 255, 0.1);
140
+ }
141
+
142
+ .glass-dark {
143
+ background: rgba(0, 0, 0, 0.3);
144
+ backdrop-filter: blur(var(--glass-blur));
145
+ -webkit-backdrop-filter: blur(var(--glass-blur));
146
+ border: 1px solid rgba(255, 255, 255, 0.05);
147
+ }
148
+
149
+ .glass-card {
150
+ background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
151
+ backdrop-filter: blur(var(--glass-blur));
152
+ -webkit-backdrop-filter: blur(var(--glass-blur));
153
+ border: 1px solid rgba(255, 255, 255, 0.15);
154
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
155
+ }
156
+
157
+ /* Animated Background */
158
+ .aurora-bg {
159
+ background: var(--dark-gradient);
160
+ position: fixed;
161
+ inset: 0;
162
+ z-index: -1;
163
+ overflow: hidden;
164
+ }
165
+
166
+ .aurora-bg::before {
167
+ content: '';
168
+ position: absolute;
169
+ width: 200%;
170
+ height: 200%;
171
+ top: -50%;
172
+ left: -50%;
173
+ background:
174
+ radial-gradient(ellipse at 20% 20%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
175
+ radial-gradient(ellipse at 80% 80%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
176
+ radial-gradient(ellipse at 40% 60%, rgba(99, 102, 241, 0.2) 0%, transparent 50%);
177
+ animation: aurora 20s ease-in-out infinite;
178
+ }
179
+
180
+ @keyframes aurora {
181
+ 0%, 100% { transform: translate(0, 0) rotate(0deg); }
182
+ 33% { transform: translate(30px, -50px) rotate(120deg); }
183
+ 66% { transform: translate(-20px, 20px) rotate(240deg); }
184
+ }
185
+
186
+ /* Floating Particles */
187
+ .particle {
188
+ position: absolute;
189
+ border-radius: 50%;
190
+ opacity: 0.5;
191
+ animation: float 15s ease-in-out infinite;
192
+ }
193
+
194
+ /* Message Bubbles */
195
+ .message-bubble {
196
+ position: relative;
197
+ max-width: 80%;
198
+ word-wrap: break-word;
199
+ }
200
+
201
+ .message-bubble.sent {
202
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
203
+ border-radius: 20px 20px 4px 20px;
204
+ }
205
+
206
+ .message-bubble.received {
207
+ background: rgba(255, 255, 255, 0.1);
208
+ border-radius: 20px 20px 20px 4px;
209
+ }
210
+
211
+ /* Typing Indicator */
212
+ .typing-indicator {
213
+ display: flex;
214
+ gap: 4px;
215
+ padding: 12px 16px;
216
+ }
217
+
218
+ .typing-indicator span {
219
+ width: 8px;
220
+ height: 8px;
221
+ background: rgba(255, 255, 255, 0.6);
222
+ border-radius: 50%;
223
+ animation: typingBounce 1.4s ease-in-out infinite both;
224
+ }
225
+
226
+ .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
227
+ .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
228
+
229
+ @keyframes typingBounce {
230
+ 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
231
+ 40% { transform: scale(1); opacity: 1; }
232
+ }
233
+
234
+ /* Input Focus Effects */
235
+ .input-glow:focus {
236
+ box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
237
+ }
238
+
239
+ /* Button Ripple Effect */
240
+ .btn-ripple {
241
+ position: relative;
242
+ overflow: hidden;
243
+ }
244
+
245
+ .btn-ripple::after {
246
+ content: '';
247
+ position: absolute;
248
+ inset: 0;
249
+ background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
250
+ transform: scale(0);
251
+ opacity: 0;
252
+ transition: transform 0.5s, opacity 0.3s;
253
+ }
254
+
255
+ .btn-ripple:active::after {
256
+ transform: scale(2);
257
+ opacity: 1;
258
+ transition: 0s;
259
+ }
260
+
261
+ /* Mobile Optimizations */
262
+ @media (max-width: 768px) {
263
+ .mobile-safe-bottom {
264
+ padding-bottom: env(safe-area-inset-bottom, 20px);
265
+ }
266
+
267
+ .mobile-touch-target {
268
+ min-height: 44px;
269
+ min-width: 44px;
270
+ }
271
+
272
+ .message-bubble {
273
+ max-width: 90%;
274
+ }
275
+ }
276
+
277
+ /* Dark Mode Support */
278
+ @media (prefers-color-scheme: dark) {
279
+ :root {
280
+ color-scheme: dark;
281
+ }
282
+ }
283
+
284
+ /* Reduced Motion */
285
+ @media (prefers-reduced-motion: reduce) {
286
+ *, *::before, *::after {
287
+ animation-duration: 0.01ms !important;
288
+ animation-iteration-count: 1 !important;
289
+ transition-duration: 0.01ms !important;
290
+ }
291
+ }
292
+
293
+ /* Utility Classes */
294
+ .text-gradient {
295
+ background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
296
+ -webkit-background-clip: text;
297
+ -webkit-text-fill-color: transparent;
298
+ background-clip: text;
299
+ }
300
+
301
+ .glow-effect {
302
+ box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
303
+ }
304
+
305
+ /* Room Card Hover */
306
+ .room-card {
307
+ transition: all 0.3s ease;
308
+ }
309
+
310
+ .room-card:hover {
311
+ transform: translateY(-4px) scale(1.02);
312
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
313
+ }
314
+
315
+ .room-card.active {
316
+ background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
317
+ border-color: rgba(102, 126, 234, 0.5);
318
+ }
319
+
320
+ /* Swipe Indicator */
321
+ .swipe-hint {
322
+ animation: swipeHint 2s ease-in-out infinite;
323
+ }
324
+
325
+ @keyframes swipeHint {
326
+ 0%, 100% { transform: translateX(0); opacity: 0.5; }
327
+ 50% { transform: translateX(-10px); opacity: 1; }
328
+ }
329
+
330
+ /* Loading Shimmer */
331
+ .shimmer {
332
+ background: linear-gradient(90deg,
333
+ rgba(255,255,255,0) 0%,
334
+ rgba(255,255,255,0.1) 50%,
335
+ rgba(255,255,255,0) 100%);
336
+ background-size: 200% 100%;
337
+ animation: shimmer 1.5s infinite;
338
+ }
339
+
340
+ @keyframes shimmer {
341
+ 0% { background-position: -200% 0; }
342
+ 100% { background-position: 200% 0; }
343
+ }
344
+ </style>
345
+ </head>
346
+ <body class="font-sans text-white min-h-screen overflow-hidden">
347
+
348
+ <!-- Animated Background -->
349
+ <div class="aurora-bg" id="auroraBg"></div>
350
+
351
+ <!-- Floating Particles Container -->
352
+ <div id="particles" class="fixed inset-0 pointer-events-none"></div>
353
+
354
+ <!-- Main App Container -->
355
+ <div id="app" class="relative h-screen flex flex-col">
356
+
357
+ <!-- Header with Built with anycoder -->
358
+ <header class="glass-dark px-4 py-3 flex items-center justify-between z-50">
359
+ <div class="flex items-center gap-3">
360
+ <div class="w-10 h-10 rounded-xl bg-gradient-to-br from-primary-400 to-primary-600 flex items-center justify-center">
361
+ <i class="ph ph-chat-circle-text text-xl"></i>
362
+ </div>
363
+ <div>
364
+ <h1 class="font-bold text-lg">چت روم مینیمال</h1>
365
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="text-xs text-primary-300 hover:text-primary-200 transition-colors">
366
+ Built with anycoder
367
+ </a>
368
+ </div>
369
+ </div>
370
+ <button id="themeToggle" class="p-2 rounded-lg hover:bg-white/10 transition-colors mobile-touch-target">
371
+ <i class="ph ph-moon text-xl"></i>
372
+ </button>
373
+ </header>
374
+
375
+ <!-- Auth Screen -->
376
+ <div id="authScreen" class="flex-1 flex items-center justify-center p-4">
377
+ <div class="glass-card rounded-3xl p-8 w-full max-w-md animate-slide-up">
378
+ <div class="text-center mb-8">
379
+ <div class="w-20 h-20 mx-auto rounded-2xl bg-gradient-to-br from-primary-400 to-purple-600 flex items-center justify-center mb-4 animate-bounce-gentle">
380
+ <i class="ph ph-chat-teardrop-text text-4xl"></i>
381
+ </div>
382
+ <h2 class="text-2xl font-bold mb-2">خوش آمدید</h2>
383
+ <p class="text-gray-400">برای ورود شماره موبایل خود را وارد کنید</p>
384
+ </div>
385
+
386
+ <form id="authForm" class="space-y-4">
387
+ <div class="relative">
388
+ <i class="ph ph-device-mobile absolute right-4 top-1/2 -translate-y-1/2 text-gray-400"></i>
389
+ <input
390
+ type="tel"
391
+ id="phoneInput"
392
+ placeholder="۰۹۱۲۳۴۵۶۷۸۹"
393
+ class="w-full bg-glass-100 border border-glass-200 rounded-xl py-4 pr-12 pl-4 text-left placeholder:text-gray-500 focus:outline-none focus:border-primary-400 input-glow transition-all"
394
+ maxlength="11"
395
+ dir="ltr"
396
+ >
397
+ </div>
398
+
399
+ <div id="otpSection" class="hidden space-y-4 animate-fade-in">
400
+ <div class="relative">
401
+ <i class="ph ph-lock-key absolute right-4 top-1/2 -translate-y-1/2 text-gray-400"></i>
402
+ <input
403
+ type="text"
404
+ id="otpInput"
405
+ placeholder="کد تأیید"
406
+ class="w-full bg-glass-100 border border-glass-200 rounded-xl py-4 pr-12 pl-4 text-center text-2xl tracking-[0.5em] placeholder:text-gray-500 placeholder:tracking-normal placeholder:text-base focus:outline-none focus:border-primary-400 input-glow transition-all"
407
+ maxlength="6"
408
+ dir="ltr"
409
+ >
410
+ </div>
411
+ <div class="flex items-center justify-between text-sm">
412
+ <span id="timer" class="text-gray-400">۰۲:۰۰</span>
413
+ <button type="button" id="resendBtn" class="text-primary-400 hover:text-primary-300 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
414
+ ارسال مجدد
415
+ </button>
416
+ </div>
417
+ </div>
418
+
419
+ <button
420
+ type="submit"
421
+ id="authBtn"
422
+ class="w-full bg-gradient-to-r from-primary-500 to-purple-600 hover:from-primary-600 hover:to-purple-700 text-white font-semibold py-4 rounded-xl btn-ripple transition-all transform hover:scale-[1.02] active:scale-[0.98] flex items-center justify-center gap-2"
423
+ >
424
+ <span id="authBtnText">دریافت کد تأیید</span>
425
+ <i id="authBtnIcon" class="ph ph-arrow-left"></i>
426
+ <div id="authLoading" class="hidden w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"></div>
427
+ </button>
428
+ </form>
429
+
430
+ <div class="mt-6 text-center">
431
+ <p class="text-sm text-gray-500">
432
+ با ورود، <a href="#" class="text-primary-400 hover:underline">قوانین و مقررات</a> را می‌پذیرم
433
+ </p>
434
+ </div>
435
+ </div>
436
+ </div>
437
+
438
+ <!-- Main Chat Interface (Hidden initially) -->
439
+ <div id="chatInterface" class="hidden flex-1 flex overflow-hidden">
440
+
441
+ <!-- Sidebar - Room List -->
442
+ <aside id="sidebar" class="w-80 glass-dark flex flex-col transition-transform duration-300 absolute md:relative z-40 h-full -translate-x-full md:translate-x-0">
443
+ <!-- User Profile -->
444
+ <div class="p-4 border-b border-glass-200">
445
+ <div class="flex items-center gap-3">
446
+ <div class="relative">
447
+ <img src="https://api.dicebear.com/7.x/avataaars/svg?seed=user123" alt="Profile" class="w-12 h-12 rounded-full bg-glass-200">
448
+ <div class="absolute -bottom-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-gray-900"></div>
449
+ </div>
450
+ <div class="flex-1">
451
+ <h3 id="userName" class="font-semibold">کاربر مهمان</h3>
452
+ <p class="text-xs text-gray-400">آنلاین</p>
453
+ </div>
454
+ <button class="p-2 rounded-lg hover:bg-white/10">
455
+ <i class="ph ph-gear text-lg"></i>
456
+ </button>
457
+ </div>
458
+ </div>
459
+
460
+ <!-- Search -->
461
+ <div class="p-4">
462
+ <div class="relative">
463
+ <i class="ph ph-magnifying-glass absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
464
+ <input
465
+ type="text"
466
+ placeholder="جستجوی اتاق..."
467
+ class="w-full bg-glass-100 rounded-xl py-2.5 pr-10 pl-4 text-sm placeholder:text-gray-500 focus:outline-none focus:bg-glass-200 transition-all"
468
+ >
469
+ </div>
470
+ </div>
471
+
472
+ <!-- Room List -->
473
+ <div class="flex-1 overflow-y-auto p-2 space-y-2" id="roomList">
474
+ <!-- Rooms will be populated by JS -->
475
+ </div>
476
+
477
+ <!-- Create Room Button -->
478
+ <div class="p-4 border-t border-glass-200">
479
+ <button onclick="app.createRoom()" class="w-full glass-card rounded-xl py-3 flex items-center justify-center gap-2 hover:bg-white/10 transition-all btn-ripple">
480
+ <i class="ph ph-plus-circle text-primary-400"></i>
481
+ <span>ایجاد اتاق جدید</span>
482
+ </button>
483
+ </div>
484
+ </aside>
485
+
486
+ <!-- Overlay for mobile sidebar -->
487
+ <div id="sidebarOverlay" class="fixed inset-0 bg-black/50 z-30 hidden md:hidden backdrop-blur-sm" onclick="app.toggleSidebar()"></div>
488
+
489
+ <!-- Chat Area -->
490
+ <main class="flex-1 flex flex-col min-w-0">
491
+ <!-- Chat Header -->
492
+ <div class="glass px-4 py-3 flex items-center justify-between">
493
+ <div class="flex items-center gap-3">
494
+ <button onclick="app.toggleSidebar()" class="md:hidden p-2 rounded-lg hover:bg-white/10 mobile-touch-target">
495
+ <i class="ph ph-list text-xl"></i>
496
+ </button>
497
+ <div class="relative">
498
+ <img id="currentRoomAvatar" src="" alt="Room" class="w-10 h-10 rounded-xl bg-glass-200">
499
+ <div id="roomOnlineIndicator" class="absolute -bottom-1 -right-1 w-3 h-3 bg-green-500 rounded-full border-2 border-gray-900 hidden"></div>
500
+ </div>
501
+ <div class="min-w-0">
502
+ <h3 id="currentRoomName" class="font-semibold truncate">انتخاب اتاق</h3>
503
+ <p id="currentRoomStatus" class="text-xs text-gray-400 truncate">یک اتاق را انتخاب کنید</p>
504
+ </div>
505
+ </div>
506
+ <div class="flex items-center gap-2">
507
+ <button class="p-2 rounded-lg hover:bg-white/10 mobile-touch-target" onclick="app.toggleSearch()">
508
+ <i class="ph ph-magnifying-glass text-lg"></i>
509
+ </button>
510
+ <button class="p-2 rounded-lg hover:bg-white/10 mobile-touch-target relative" onclick="app.showMembers()">
511
+ <i class="ph ph-users text-lg"></i>
512
+ <span id="memberCount" class="absolute -top-1 -right-1 w-5 h-5 bg-primary-500 rounded-full text-xs flex items-center justify-center hidden">0</span>
513
+ </button>
514
+ <button class="p-2 rounded-lg hover:bg-white/10 mobile-touch-target">
515
+ <i class="ph ph-dots-three-vertical text-lg"></i>
516
+ </button>
517
+ </div>
518
+ </div>
519
+
520
+ <!-- Messages Container -->
521
+ <div id="messagesContainer" class="flex-1 overflow-y-auto p-4 space-y-4 mobile-safe-bottom">
522
+ <div class="flex flex-col items-center justify-center h-full text-gray-400">
523
+ <i class="ph ph-chat-circle-dots text-6xl mb-4 opacity-50"></i>
524
+ <p>پیامی وجود ندارد</p>
525
+ <p class="text-sm mt-2">اولین پیام را ارسال کنید!</p>
526
+ </div>
527
+ </div>
528
+
529
+ <!-- Typing Indicator -->
530
+ <div id="typingIndicator" class="hidden px-4 py-2">
531
+ <div class="glass rounded-2xl rounded-tr-sm inline-flex">
532
+ <div class="typing-indicator">
533
+ <span></span>
534
+ <span></span>
535
+ <span></span>
536
+ </div>
537
+ </div>
538
+ <span class="text-xs text-gray-400 mr-2" id="typingName">درحال تایپ...</span>
539
+ </div>
540
+
541
+ <!-- Input Area -->
542
+ <div class="glass-dark p-4 mobile-safe-bottom">
543
+ <div class="flex items-end gap-2 max-w-4xl mx-auto">
544
+ <button class="p-3 rounded-xl hover:bg-white/10 transition-colors mobile-touch-target flex-shrink-0" onclick="app.attachFile()">
545
+ <i class="ph ph-paperclip text-xl text-gray-400"></i>
546
+ </button>
547
+
548
+ <div class="flex-1 relative">
549
+ <textarea
550
+ id="messageInput"
551
+ placeholder="پیام خود را بنویسید..."
552
+ class="w-full bg-glass-100 rounded-2xl py-3 px-4 pr-12 resize-none focus:outline-none focus:bg-glass-200 transition-all max-h-32"
553
+ rows="1"
554
+ oninput="app.autoResize(this)"
555
+ onkeydown="app.handleEnter(event)"
556
+ ></textarea>
557
+ <button class="absolute left-3 bottom-3 p-1.5 rounded-lg hover:bg-white/10 transition-colors" onclick="app.insertEmoji()">
558
+ <i class="ph ph-smiley text-xl text-gray-400"></i>
559
+ </button>
560
+ </div>
561
+
562
+ <button
563
+ id="sendBtn"
564
+ onclick="app.sendMessage()"
565
+ class="p-3 rounded-xl bg-gradient-to-r from-primary-500 to-purple-600 hover:from-primary-600 hover:to-purple-700 transition-all btn-ripple mobile-touch-target flex-shrink-0 disabled:opacity-50 disabled:cursor-not-allowed"
566
+ disabled
567
+ >
568
+ <i class="ph ph-paper-plane-right text-xl"></i>
569
+ </button>
570
+ </div>
571
+ </div>
572
+ </main>
573
+ </div>
574
+
575
+ <!-- Create Room Modal -->
576
+ <div id="createRoomModal" class="fixed inset-0 z-50 hidden items-center justify-center p-4">
577
+ <div class="absolute inset-0 bg-black/60 backdrop-blur-sm" onclick="app.closeCreateRoom()"></div>
578
+ <div class="glass-card rounded-2xl p-6 w-full max-w-md relative animate-slide-up">
579
+ <button onclick="app.closeCreateRoom()" class="absolute top-4 left-4 p-2 rounded-lg hover:bg-white/10">
580
+ <i class="ph ph-x text-xl"></i>
581
+ </button>
582
+ <h3 class="text-xl font-bold mb-6">ایجاد اتاق جدید</h3>
583
+ <form onsubmit="app.submitCreateRoom(event)" class="space-y-4">
584
+ <div>
585
+ <label class="block text-sm text-gray-400 mb-2">نام اتاق</label>
586
+ <input type="text" id="newRoomName" required class="w-full bg-glass-100 rounded-xl py-3 px-4 focus:outline-none focus:border-primary-400 border border-transparent input-glow" placeholder="مثال: گفتگوی عمومی">
587
+ </div>
588
+ <div>
589
+ <label class="block text-sm text-gray-400 mb-2">توضیحات</label>
590
+ <textarea id="newRoomDesc" rows="3" class="w-full bg-glass-100 rounded-xl py-3 px-4 focus:outline-none focus:border-primary-400 border border-transparent input-glow resize-none" placeholder="توضیحات اتاق..."></textarea>
591
+ </div>
592
+ <div>
593
+ <label class="block text-sm text-gray-400 mb-2">رنگ تم</label>
594
+ <div class="flex gap-3">
595
+ <button type="button" onclick="app.selectColor('blue')" class="w-10 h-10 rounded-xl bg-blue-500 ring-2 ring-offset-2 ring-offset-gray-900 ring-transparent hover:ring-white transition-all color-select selected" data-color="blue"></button>
596
+ <button type="button" onclick="app.selectColor('purple')" class="w-10 h-10 rounded-xl bg-purple-500 ring-2 ring-offset-2 ring-offset-gray-900 ring-transparent hover:ring-white transition-all color-select" data-color="purple"></button>
597
+ <button type="button" onclick="app.selectColor('pink')" class="w-10 h-10 rounded-xl bg-pink-500 ring-2 ring-offset-2 ring-offset-gray-900 ring-transparent hover:ring-white transition-all color-select" data-color="pink"></button>
598
+ <button type="button" onclick="app.selectColor('green')" class="w-10 h-10 rounded-xl bg-green-500 ring-2 ring-offset-2 ring-offset-gray-900 ring-transparent hover:ring-white transition-all color-select" data-color="green"></button>
599
+ <button type="button" onclick="app.selectColor('orange')" class="w-10 h-10 rounded-xl bg-orange-500 ring-2 ring-offset-2 ring-offset-gray-900 ring-transparent hover:ring-white transition-all color-select" data-color="orange"></button>
600
+ </div>
601
+ </div>
602
+ <button type="submit" class="w-full bg-gradient-to-r from-primary-500 to-purple-600 hover:from-primary-600 hover:to-purple-700 text-white font-semibold py-3 rounded-xl btn-ripple transition-all">
603
+ ایجاد اتاق
604
+ </button>
605
+ </form>
606
+ </div>
607
+ </div>
608
+
609
+ <!-- Members Modal -->
610
+ <div id="membersModal" class="fixed inset-0 z-50 hidden items-center justify-end md:justify-center">
611
+ <div class="absolute inset-0 bg-black/60 backdrop-blur-sm" onclick="app.closeMembers()"></div>
612
+ <div class="glass-card h-full md:h-auto md:max-h-[80vh] md:rounded-2xl w-full md:w-80 relative animate-slide-up md:animate-fade-in flex flex-col">
613
+ <div class="p-4 border-b border-glass-200 flex items-center justify-between">
614
+ <h3 class="font-bold">اعضای اتاق</h3>
615
+ <button onclick="app.closeMembers()" class="p-2 rounded-lg hover:bg-white/10">
616
+ <i class="ph ph-x text-xl"></i>
617
+ </button>
618
+ </div>
619
+ <div id="membersList" class="flex-1 overflow-y-auto p-2 space-y-1">
620
+ <!-- Members populated by JS -->
621
+ </div>
622
+ </div>
623
+ </div>
624
+
625
+ <!-- Emoji Picker -->
626
+ <div id="emojiPicker" class="fixed bottom-20 left-4 right-4 md:left-auto md:right-20 md:w-80 glass-card rounded-2xl p-4 hidden z-40">
627
+ <div class="grid grid-cols-8 gap-2">
628
+ <!-- Emojis populated by JS -->
629
+ </div>
630
+ </div>
631
+
632
+ <!-- Toast Container -->
633
+ <div id="toastContainer" class="fixed top-20 left-4 right-4 md:left-auto md:right-4 md:w-80 space-y-2 z-50 pointer-events-none"></div>
634
+
635
+ </div>
636
+
637
+ <script>
638
+ // Application State
639
+ const state = {
640
+ user: null,
641
+ currentRoom: null,
642
+ rooms: [],
643
+ messages: {},
644
+ typingTimeout: null,
645
+ selectedColor: 'blue',
646
+ isSidebarOpen: false
647
+ };
648
+
649
+ // Sample Data
650
+ const sampleRooms = [
651
+ { id: 1, name: 'گفتگوی عمومی', desc: 'بحث آزاد درباره هر موضوعی', color: 'blue', members: 234, online: 45, avatar: 'https://api.dicebear.com/7.x/identicon/svg?seed=general' },
652
+ { id: 2, name: 'برنامه‌نویسی', desc: 'بحث‌های فنی و کدنویسی', color: 'purple', members: 156, online: 23, avatar: 'https://api.dicebear.com/7.x/identicon/svg?seed=code' },
653
+ { id: 3, name: 'طراحی UI/UX', desc: 'طراحی رابط کاربری و تجربه کاربری', color: 'pink', members: 89, online: 12, avatar: 'https://api.dicebear.com/7.x/identicon/svg?seed=design' },
654
+ { id: 4, name: 'بازی و سرگرمی', desc: 'گیمینگ و بحث‌های مرتبط', color: 'green', members: 312, online: 78, avatar: 'https://api.dicebear.com/7.x/identicon/svg?seed=game' },
655
+ ];
656
+
657
+ const sampleMembers = [
658
+ { id: 1, name: 'علی محمدی', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=ali', online: true },
659
+ { id: 2, name: 'سارا احمدی', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=sara', online: true },
660
+ { id: 3, name: 'محمد رضایی', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=mohammad', online: false },
661
+ { id: 4, name: 'مریم کریمی', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=maryam', online: true },
662
+ { id: 5, name: 'حسن نوری', avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=hassan', online: false },
663
+ ];
664
+
665
+ const emojis = ['😀', '😂', '🥰', '😎', '🤔', '👍', '❤️', '🔥', '🎉', '✨', '😊', '😉', '😋', '🤗', '🤩', '😴', '😭', '😤', '💪', '🙏', '👏', '🎊', '💯', '🚀', '💡', '🌟', '🍕', '🎮', '📱', '💻', '⌨️', '🖱️'];
666
+
667
+ // Application Controller
668
+ const app = {
669
+ init() {
670
+ this.createParticles();
671
+ this.populateEmojiPicker();
672
+ this.setupEventListeners();
673
+ this.loadRooms();
674
+ },
675
+
676
+ createParticles() {
677
+ const container = document.getElementById('particles');
678
+ const colors = ['rgba(102, 126, 234, 0.3)', 'rgba(118, 75, 162, 0.3)', 'rgba(240, 147, 251, 0.2)'];
679
+
680
+ for (let i = 0; i < 20; i++) {
681
+ const particle = document.createElement('div');
682
+ particle.className = 'particle';
683
+ particle.style.width = Math.random() * 100 + 50 + 'px';
684
+ particle.style.height = particle.style.width;
685
+ particle.style.left = Math.random() * 100 + '%';
686
+ particle.style.top = Math.random() * 100 + '%';
687
+ particle.style.background = colors[Math.floor(Math.random() * colors.length)];
688
+ particle.style.animationDelay = Math.random() * 15 + 's';
689
+ particle.style.animationDuration = (Math.random() * 10 + 15) + 's';
690
+ container.appendChild(particle);
691
+ }
692
+ },
693
+
694
+ populateEmojiPicker() {
695
+ const grid = document.querySelector('#emojiPicker .grid');
696
+ emojis.forEach(emoji => {
697
+ const btn = document.createElement('button');
698
+ btn.className = 'p-2 rounded-lg hover:bg-white/10 transition-colors text-2xl';
699
+ btn.textContent = emoji;
700
+ btn.onclick = () => this.insertEmojiToInput(emoji);
701
+ grid.appendChild(btn);
702
+ });
703
+ },
704
+
705
+ setupEventListeners() {
706
+ // Phone input formatting
707
+ const phoneInput = document.getElementById('phoneInput');
708
+ phoneInput.addEventListener('input', (e) => {
709
+ let value = e.target.value.replace(/\D/g, '');
710
+ if (value.length > 11) value = value.slice(0, 11);
711
+ e.target.value = this.toPersianNumber(value);
712
+ });
713
+
714
+ // OTP input
715
+ const otpInput = document.getElementById('otpInput');
716
+ otpInput.addEventListener('input', (e) => {
717
+ e.target.value = e.target.value.replace(/\D/g, '');
718
+ });
719
+
720
+ // Auth form
721
+ document.getElementById('authForm').addEventListener('submit', (e) => this.handleAuth(e));
722
+
723
+ // Message input
724
+ const messageInput = document.getElementById('messageInput');
725
+ messageInput.addEventListener('input', () => {
726
+ document.getElementById('sendBtn').disabled = !messageInput.value.trim();
727
+ this.handleTyping();
728
+ });
729
+
730
+ // Click outside to close emoji picker
731
+ document.addEventListener('click', (e) => {
732
+ const emojiPicker = document.getElementById('emojiPicker');
733
+ if (!e.target.closest('#emojiPicker') && !e.target.closest('[onclick="app.insertEmoji()"]')) {
734
+ emojiPicker.classList.add('hidden');
735
+ }
736
+ });
737
+
738
+ // Keyboard shortcuts
739
+ document.addEventListener('keydown', (e) => {
740
+ if (e.key === 'Escape') {
741
+ this.closeCreateRoom();
742
+ this.closeMembers();
743
+ document.getElementById('emojiPicker').classList.add('hidden');
744
+ }
745
+ });
746
+ },
747
+
748
+ toPersianNumber(num) {
749
+ const persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
750
+ return num.toString().replace(/\d/g, d => persian[d]);
751
+ },
752
+
753
+ toEnglishNumber(num) {
754
+ return num.replace(/[۰-۹]/g, d => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d));
755
+ },
756
+
757
+ handleAuth(e) {
758
+ e.preventDefault();
759
+ const phoneInput = document.getElementById('phoneInput');
760
+ const otpSection = document.getElementById('otpSection');
761
+ const authBtn = document.getElementById('authBtn');
762
+ const authBtnText = document.getElementById('authBtnText');
763
+ const authLoading = document.getElementById('authLoading');
764
+
765
+ const phone = this.toEnglishNumber(phoneInput.value);
766
+
767
+ if (!otpSection.classList.contains('hidden')) {
768
+ // Verify OTP
769
+ const otp = document.getElementById('otpInput').value;
770
+ if (otp.length === 6) {
771
+ this.completeAuth(phone);
772
+ } else {
773
+ this.showToast('لطفاً کد ۶ رقمی را وارد کنید', 'error');
774
+ document.getElementById('otpInput').parentElement.classList.add('animate-shake');
775
+ setTimeout(() => document.getElementById('otpInput').parentElement.classList.remove('animate-shake'), 500);
776
+ }
777
+ } else {
778
+ // Send OTP
779
+ if (phone.length === 11 && phone.startsWith('09')) {
780
+ authBtn.disabled = true;
781
+ authBtnText.textContent = 'در حال ارسال...';
782
+ authLoading.classList.remove('hidden');
783
+ document.getElementById('authBtnIcon').classList.add('hidden');
784
+
785
+ setTimeout(() => {
786
+ otpSection.classList.remove('hidden');
787
+ authBtnText.textContent = 'ورود';
788
+ authLoading.classList.add('hidden');
789
+ document.getElementById('authBtnIcon').classList.remove('hidden');
790
+ authBtn.disabled = false;
791
+ document.getElementById('otpInput').focus();
792
+ this.startTimer();
793
+ this.showToast('کد تأیید ارسال شد: ۱۲۳۴۵۶', 'success');
794
+ }, 1500);
795
+ } else {
796
+ this.showToast('شماره موبایل معتبر نیست', 'error');
797
+ phoneInput.parentElement.classList.add('animate-shake');
798
+ setTimeout(() => phoneInput.parentElement.classList.remove('animate-shake'), 500);
799
+ }
800
+ }
801
+ },
802
+
803
+ startTimer() {
804
+ let seconds = 120;
805
+ const timerEl = document.getElementById('timer');
806
+ const resendBtn = document.getElementById('resendBtn');
807
+
808
+ const interval = setInterval(() => {
809
+ seconds--;
810
+ const mins = Math.floor(seconds / 60);
811
+ const secs = seconds % 60;
812
+ timerEl.textContent = this.toPersianNumber(`${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`);
813
+
814
+ if (seconds <= 0) {
815
+ clearInterval(interval);
816
+ resendBtn.disabled = false;
817
+ timerEl.textContent = '۰۰:۰۰';
818
+ }
819
+ }, 1000);
820
+ },
821
+
822
+ completeAuth(phone) {
823
+ const authBtn = document.getElementById('authBtn');
824
+ const authBtnText = document.getElementById('authBtnText');
825
+ const authLoading = document.getElementById('authLoading');
826
+
827
+ authBtn.disabled = true;
828
+ authBtnText.textContent = 'در حال ورود...';
829
+ authLoading.classList.remove('hidden');
830
+ document.getElementById('authBtnIcon').classList.add('hidden');
831
+
832
+ setTimeout(() => {
833
+ state.user = {
834
+ phone: phone,
835
+ name: 'کاربر ' + phone.slice(-4),
836
+ avatar: `https://api.dicebear.com/7.x/avataaars/svg?seed=${phone}`
837
+ };
838
+
839
+ document.getElementById('userName').textContent = state.user.name;
840
+ document.querySelector('#sidebar img').src = state.user.avatar;
841
+
842
+ // Confetti effect
843
+ confetti({
844
+ particleCount: 100,
845
+ spread: 70,
846
+ origin: { y: 0.6 },
847
+ colors: ['#667eea', '#764ba2', '#f093fb']
848
+ });
849
+
850
+ document.getElementById('authScreen').classList.add('hidden');
851
+ document.getElementById('chatInterface').classList.remove('hidden');
852
+ document.getElementById('chatInterface').classList.add('animate-fade-in');
853
+
854
+ this.selectRoom(state.rooms[0].id);
855
+ this.showToast(`خوش آمدید ${state.user.name}!`, 'success');
856
+ }, 1500);
857
+ },
858
+
859
+ loadRooms() {
860
+ state.rooms = [...sampleRooms];
861
+ this.renderRooms();
862
+ },
863
+
864
+ renderRooms() {
865
+ const container = document.getElementById('roomList');
866
+ container.innerHTML = state.rooms.map(room => `
867
+ <div class="room-card p-3 rounded-xl cursor-pointer flex items-center gap-3 ${state.currentRoom?.id === room.id ? 'active' : ''}"
868
+ onclick="app.selectRoom(${room.id})" data-room-id="${room.id}">
869
+ <div class="relative">
870
+ <img src="${room.avatar}" alt="${room.name}" class="w-12 h-12 rounded-xl bg-glass-200">
871
+ ${room.online > 0 ? `<div class="absolute -bottom-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-gray-900 flex items-center justify-center">
872
+ <span class="text-[8px] font-bold">${room.online > 99 ? '99+' : room.online}</span>
873
+ </div>` : ''}
874
+ </div>
875
+ <div class="flex-1 min-w-0">
876
+ <div class="flex items-center justify-between">
877
+ <h4 class="font-semibold truncate">${room.name}</h4>
878
+ <span class="text-xs text-gray-500">۱۲:۳۰</span>
879
+ </div>
880
+ <p class="text-sm text-gray-400 truncate">${room.desc}</p>
881
+ </div>
882
+ ${Math.random() > 0.5 ? `<div class="w-5 h-5 bg-primary-500 rounded-full flex items-center justify-center text-xs font-bold">${Math.floor(Math.random() * 5) + 1}</div>` : ''}
883
+ </div>
884
+ `).join('');
885
+ },
886
+
887
+ selectRoom(roomId) {
888
+ const room = state.rooms.find(r => r.id === roomId);
889
+ if (!room) return;
890
+
891
+ state.currentRoom = room;
892
+
893
+ // Update UI
894
+ document.getElementById('currentRoomName').textContent = room.name;
895
+ document.getElementById('currentRoomStatus').textContent = `${this.toPersianNumber(room.members.toString())} عضو • ${this.toPersianNumber(room.online.toString())} آنلاین`;
896
+ document.getElementById('currentRoomAvatar').src = room.avatar;
897
+ document.getElementById('roomOnlineIndicator').classList.remove('hidden');
898
+ document.getElementById('memberCount').textContent = room.online;
899
+ document.getElementById('memberCount').classList.remove('hidden');
900
+
901
+ // Update active state in sidebar