samirerty commited on
Commit
077dc78
·
verified ·
1 Parent(s): bc8d80b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +945 -814
index.html CHANGED
@@ -1,844 +1,975 @@
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, viewport-fit=cover">
6
- <title>پیام رسان مینیمال | MinimalChat</title>
7
-
8
- <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap" rel="stylesheet">
9
-
10
- <style>
11
- :root {
12
- --primary: #3b82f6;
13
- --primary-dark: #2563eb;
14
- --bg-dark: #0f172a;
15
- --bg-card: rgba(30, 41, 59, 0.8);
16
- --glass: rgba(255, 255, 255, 0.08);
17
- --glass-border: rgba(255, 255, 255, 0.1);
18
- --text-primary: #f8fafc;
19
- --text-secondary: rgba(248, 250, 252, 0.6);
20
- --text-muted: rgba(248, 250, 252, 0.4);
21
- --success: #22c55e;
22
- --error: #ef4444;
23
- --warning: #f59e0b;
24
- }
25
-
26
- * {
27
- margin: 0;
28
- padding: 0;
29
- box-sizing: border-box;
30
- }
31
-
32
- body {
33
- font-family: 'Vazirmatn', sans-serif;
34
- background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
35
- background-attachment: fixed;
36
- color: var(--text-primary);
37
- height: 100vh;
38
- height: 100dvh;
39
- overflow: hidden;
40
- -webkit-tap-highlight-color: transparent;
41
- }
42
-
43
- /* Utility Classes */
44
- .glass-panel {
45
- background: var(--glass);
46
- backdrop-filter: blur(12px);
47
- -webkit-backdrop-filter: blur(12px);
48
- border: 1px solid var(--glass-border);
49
- }
50
-
51
- .hidden { display: none !important; }
52
- .flex { display: flex; }
53
- .flex-col { flex-direction: column; }
54
- .flex-1 { flex: 1; }
55
- .items-center { align-items: center; }
56
- .justify-center { justify-content: center; }
57
- .justify-between { justify-content: space-between; }
58
- .gap-2 { gap: 0.5rem; }
59
- .gap-3 { gap: 0.75rem; }
60
- .gap-4 { gap: 1rem; }
61
-
62
- .w-full { width: 100%; }
63
- .h-full { height: 100%; }
64
- .min-w-0 { min-width: 0; }
65
-
66
- .p-2 { padding: 0.5rem; }
67
- .p-3 { padding: 0.75rem; }
68
- .p-4 { padding: 1rem; }
69
- .p-6 { padding: 1.5rem; }
70
- .px-4 { padding-left: 1rem; padding-right: 1rem; }
71
- .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
72
- .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
73
-
74
- .m-0 { margin: 0; }
75
- .mb-1 { margin-bottom: 0.25rem; }
76
- .mb-2 { margin-bottom: 0.5rem; }
77
- .mb-3 { margin-bottom: 0.75rem; }
78
- .mb-4 { margin-bottom: 1rem; }
79
- .mb-6 { margin-bottom: 1.5rem; }
80
- .mb-8 { margin-bottom: 2rem; }
81
- .mt-1 { margin-top: 0.25rem; }
82
- .mt-2 { margin-top: 0.5rem; }
83
- .mt-4 { margin-top: 1rem; }
84
- .mt-6 { margin-top: 1.5rem; }
85
- .mt-8 { margin-top: 2rem; }
86
- .mt-10 { margin-top: 2.5rem; }
87
- .mr-1 { margin-right: 0.25rem; }
88
- .mr-2 { margin-right: 0.5rem; }
89
- .ml-1 { margin-left: 0.25rem; }
90
- .ml-2 { margin-left: 0.5rem; }
91
- .mx-auto { margin-left: auto; margin-right: auto; }
92
-
93
- .text-center { text-align: center; }
94
- .text-xs { font-size: 0.75rem; }
95
- .text-sm { font-size: 0.875rem; }
96
- .text-base { font-size: 1rem; }
97
- .text-lg { font-size: 1.125rem; }
98
- .text-xl { font-size: 1.25rem; }
99
- .text-2xl { font-size: 1.5rem; }
100
- .text-3xl { font-size: 1.875rem; }
101
-
102
- .font-light { font-weight: 300; }
103
- .font-medium { font-weight: 500; }
104
- .font-bold { font-weight: 700; }
105
-
106
- .truncate {
107
- overflow: hidden;
108
- text-overflow: ellipsis;
109
- white-space: nowrap;
110
- }
111
-
112
- .rounded-full { border-radius: 9999px; }
113
- .rounded-lg { border-radius: 0.5rem; }
114
- .rounded-xl { border-radius: 0.75rem; }
115
- .rounded-2xl { border-radius: 1rem; }
116
-
117
- .border-b { border-bottom: 1px solid; }
118
- .border-t { border-top: 1px solid; }
119
- .border { border: 1px solid; }
120
- .border-dashed { border-style: dashed; }
121
-
122
- .border-white\/10 { border-color: rgba(255,255,255,0.1); }
123
- .border-white\/20 { border-color: rgba(255,255,255,0.2); }
124
-
125
- .bg-white { background-color: #fff; }
126
- .bg-white\/5 { background-color: rgba(255,255,255,0.05); }
127
- .bg-white\/10 { background-color: rgba(255,255,255,0.1); }
128
- .bg-blue-600 { background-color: var(--primary); }
129
- .bg-green-500\/20 { background-color: rgba(34,197,94,0.2); }
130
- .bg-red-500\/20 { background-color: rgba(239,68,68,0.2); }
131
- .bg-slate-900 { background-color: #0f172a; }
132
- .bg-slate-900\/20 { background-color: rgba(15,23,42,0.2); }
133
- .bg-slate-900\/90 { background-color: rgba(15,23,42,0.9); }
134
- .bg-slate-900\/95 { background-color: rgba(15,23,42,0.95); }
135
-
136
- .text-white { color: #fff; }
137
- .text-white\/30 { color: rgba(255,255,255,0.3); }
138
- .text-white\/40 { color: rgba(255,255,255,0.4); }
139
- .text-white\/50 { color: rgba(255,255,255,0.5); }
140
- .text-white\/60 { color: rgba(255,255,255,0.6); }
141
- .text-white\/70 { color: rgba(255,255,255,0.7); }
142
- .text-white\/80 { color: rgba(255,255,255,0.8); }
143
- .text-slate-900 { color: #0f172a; }
144
- .text-blue-300 { color: #93c5fd; }
145
- .text-indigo-300 { color: #a5b4fc; }
146
- .text-green-200 { color: #bbf7d0; }
147
- .text-green-500 { color: #22c55e; }
148
- .text-red-200 { color: #fecaca; }
149
- .text-red-400 { color: #f87171; }
150
-
151
- .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
152
-
153
- .cursor-pointer { cursor: pointer; }
154
- .pointer-events-none { pointer-events: none; }
155
- .pointer-events-auto { pointer-events: auto; }
156
-
157
- .overflow-hidden { overflow: hidden; }
158
- .overflow-y-auto { overflow-y: auto; }
159
- .overflow-x-hidden { overflow-x: hidden; }
160
-
161
- .relative { position: relative; }
162
- .absolute { position: absolute; }
163
- .fixed { position: fixed; }
164
- .inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
165
- .top-0 { top: 0; }
166
- .top-4 { top: 1rem; }
167
- .right-0 { right: 0; }
168
- .bottom-0 { bottom: 0; }
169
- .left-0 { left: 0; }
170
- .left-1\/2 { left: 50%; }
171
- .z-20 { z-index: 20; }
172
- .z-30 { z-index: 30; }
173
- .z-35 { z-index: 35; }
174
- .z-40 { z-index: 40; }
175
- .z-50 { z-index: 50; }
176
-
177
- .transform { transform: translateX(-50%); }
178
-
179
- /* Custom Styles */
180
- .input-minimal {
181
- background: transparent;
182
- border: none;
183
- border-bottom: 1px solid rgba(255,255,255,0.2);
184
- transition: all 0.3s;
185
- width: 100%;
186
- color: #fff;
187
- padding: 0.75rem 0;
188
- }
189
-
190
- .input-minimal:focus {
191
- border-color: rgba(255,255,255,0.6);
192
- outline: none;
193
- }
194
-
195
- .input-minimal::placeholder {
196
- color: rgba(255,255,255,0.3);
197
- }
198
-
199
- .message-bubble-me {
200
- background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
201
- border-radius: 16px 16px 4px 16px;
202
- }
203
-
204
- .message-bubble-other {
205
- background: rgba(255,255,255,0.12);
206
- border-radius: 16px 16px 16px 4px;
207
- }
208
-
209
- .fade-in {
210
- animation: fadeIn 0.3s ease-out;
211
- }
212
-
213
- @keyframes fadeIn {
214
- from { opacity: 0; transform: translateY(10px); }
215
- to { opacity: 1; transform: translateY(0); }
216
- }
217
-
218
- .message-enter {
219
- animation: messagePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
220
- }
221
-
222
- @keyframes messagePop {
223
- 0% { opacity: 0; transform: scale(0.8) translateY(20px); }
224
- 100% { opacity: 1; transform: scale(1) translateY(0); }
225
- }
226
-
227
- .slide-in {
228
- animation: slideIn 0.3s ease-out;
229
- }
230
-
231
- @keyframes slideIn {
232
- from { transform: translateX(100%); }
233
- to { transform: translateX(0); }
234
- }
235
-
236
- /* Scrollbar */
237
- ::-webkit-scrollbar {
238
- width: 4px;
239
- height: 4px;
240
- }
241
-
242
- ::-webkit-scrollbar-track {
243
- background: transparent;
244
- }
245
-
246
- ::-webkit-scrollbar-thumb {
247
- background: rgba(255,255,255,0.2);
248
- border-radius: 4px;
249
- }
250
-
251
- ::-webkit-scrollbar-thumb:hover {
252
- background: rgba(255,255,255,0.3);
253
- }
254
-
255
- /* Touch targets */
256
- .touch-target {
257
- min-height: 44px;
258
- min-width: 44px;
259
- }
260
-
261
- /* Mobile optimizations */
262
- @media (max-width: 768px) {
263
- .mobile-sidebar {
264
- position: fixed;
265
- top: 0;
266
- right: 0;
267
- height: 100vh;
268
- height: 100dvh;
269
- width: 85%;
270
- max-width: 300px;
271
- z-index: 40;
272
- transform: translateX(100%);
273
- transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
274
- }
275
-
276
- .mobile-sidebar.open {
277
- transform: translateX(0);
278
- }
279
-
280
- .sidebar-overlay {
281
- position: fixed;
282
- inset: 0;
283
- background: rgba(0,0,0,0.5);
284
- backdrop-filter: blur(4px);
285
- z-index: 35;
286
- opacity: 0;
287
- pointer-events: none;
288
- transition: opacity 0.3s;
289
- }
290
-
291
- .sidebar-overlay.active {
292
- opacity: 1;
293
- pointer-events: auto;
294
- }
295
-
296
- .chat-container {
297
- position: fixed;
298
- inset: 0;
299
- z-index: 30;
300
- }
301
-
302
- .safe-bottom {
303
- padding-bottom: env(safe-area-inset-bottom, 20px);
304
- }
305
-
306
- input, textarea, select {
307
- font-size: 16px;
308
- }
309
- }
310
-
311
- /* Sticker Picker */
312
- .sticker-picker {
313
- position: absolute;
314
- bottom: 100%;
315
- left: 0;
316
- right: 0;
317
- background: rgba(15, 23, 42, 0.95);
318
- backdrop-filter: blur(12px);
319
- border-top: 1px solid rgba(255,255,255,0.1);
320
- border-radius: 16px 16px 0 0;
321
- max-height: 280px;
322
- overflow-y: auto;
323
- transform: translateY(100%);
324
- transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
325
- }
326
-
327
- .sticker-picker.open {
328
- transform: translateY(0);
329
- }
330
-
331
- .sticker-item {
332
- width: 64px;
333
- height: 64px;
334
- display: flex;
335
- align-items: center;
336
- justify-content: center;
337
- cursor: pointer;
338
- border-radius: 8px;
339
- transition: all 0.2s;
340
- font-size: 32px;
341
- }
342
-
343
- .sticker-item:hover {
344
- background: rgba(255,255,255,0.1);
345
- transform: scale(1.1);
346
- }
347
-
348
- /* Avatar colors */
349
- .avatar-red { background: #ef444420; color: #fca5a5; }
350
- .avatar-blue { background: #3b82f620; color: #93c5fd; }
351
- .avatar-green { background: #22c55e20; color: #86efac; }
352
- .avatar-yellow { background: #eab30820; color: #fde047; }
353
- .avatar-purple { background: #a855f720; color: #d8b4fe; }
354
- .avatar-pink { background: #ec489920; color: #f9a8d4; }
355
- .avatar-orange { background: #f9731620; color: #fdba74; }
356
- .avatar-cyan { background: #06b6d420; color: #67e8f9; }
357
-
358
- /* Room avatar */
359
- .room-avatar {
360
- width: 80px;
361
- height: 80px;
362
- border-radius: 50%;
363
- display: flex;
364
- align-items: center;
365
- justify-content: center;
366
- font-size: 2rem;
367
- font-weight: bold;
368
- border: 3px solid rgba(255,255,255,0.2);
369
- }
370
-
371
- /* Button hover effects */
372
- .btn-hover:hover {
373
- background: rgba(255,255,255,0.1);
374
- }
375
-
376
- .btn-active:active {
377
- transform: scale(0.95);
378
- }
379
-
380
- /* Loading shimmer */
381
- .shimmer {
382
- background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
383
- background-size: 200% 100%;
384
- animation: shimmer 1.5s infinite;
385
- }
386
-
387
- @keyframes shimmer {
388
- 0% { background-position: 200% 0; }
389
- 100% { background-position: -200% 0; }
390
- }
391
-
392
- /* Menu dropdown */
393
- .menu-dropdown {
394
- position: absolute;
395
- top: 100%;
396
- left: 0;
397
- background: rgba(15, 23, 42, 0.95);
398
- backdrop-filter: blur(12px);
399
- border: 1px solid rgba(255,255,255,0.1);
400
- border-radius: 12px;
401
- min-width: 160px;
402
- padding: 0.5rem;
403
- opacity: 0;
404
- visibility: hidden;
405
- transform: translateY(-10px);
406
- transition: all 0.2s;
407
- z-index: 100;
408
- }
409
-
410
- .menu-dropdown.open {
411
- opacity: 1;
412
- visibility: visible;
413
- transform: translateY(0);
414
- }
415
-
416
- .menu-item {
417
- padding: 0.75rem 1rem;
418
- border-radius: 8px;
419
- cursor: pointer;
420
- display: flex;
421
- align-items: center;
422
- gap: 0.75rem;
423
- transition: all 0.2s;
424
- }
425
-
426
- .menu-item:hover {
427
- background: rgba(255,255,255,0.1);
428
- }
429
-
430
- .menu-item.danger {
431
- color: #f87171;
432
- }
433
-
434
- .menu-item.danger:hover {
435
- background: rgba(239,68,68,0.2);
436
- }
437
-
438
- /* Color picker */
439
- .color-option {
440
- width: 40px;
441
- height: 40px;
442
- border-radius: 50%;
443
- cursor: pointer;
444
- border: 3px solid transparent;
445
- transition: all 0.2s;
446
- }
447
-
448
- .color-option:hover {
449
- transform: scale(1.1);
450
- }
451
-
452
- .color-option.selected {
453
- border-color: #fff;
454
- box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
455
- }
456
-
457
- /* Built with badge */
458
- .built-with {
459
- position: fixed;
460
- top: 12px;
461
- left: 12px;
462
- z-index: 1000;
463
- background: rgba(255,255,255,0.1);
464
- backdrop-filter: blur(8px);
465
- padding: 6px 12px;
466
- border-radius: 20px;
467
- font-size: 11px;
468
- color: rgba(255,255,255,0.7);
469
- text-decoration: none;
470
- border: 1px solid rgba(255,255,255,0.1);
471
- transition: all 0.2s;
472
- }
473
-
474
- .built-with:hover {
475
- background: rgba(255,255,255,0.15);
476
- color: #fff;
477
- }
478
-
479
- /* Sticker display in chat */
480
- .sticker-message {
481
- font-size: 48px;
482
- line-height: 1;
483
- padding: 8px;
484
- }
485
-
486
- /* Profile avatar options */
487
- .avatar-option {
488
- width: 56px;
489
- height: 56px;
490
- border-radius: 50%;
491
- display: flex;
492
- align-items: center;
493
- justify-content: center;
494
- font-size: 24px;
495
- cursor: pointer;
496
- border: 3px solid transparent;
497
- transition: all 0.2s;
498
- }
499
-
500
- .avatar-option:hover {
501
- transform: scale(1.05);
502
- }
503
-
504
- .avatar-option.selected {
505
- border-color: #3b82f6;
506
- }
507
- </style>
508
  </head>
509
- <body>
510
 
511
- <!-- Built with badge -->
512
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">Built with anycoder</a>
513
 
514
  <!-- Toast Container -->
515
- <div id="toast-container" class="fixed top-4 left-1/2 z-50 flex flex-col gap-2 w-full max-w-sm px-4 pointer-events-none" style="transform: translateX(-50%);">
516
  </div>
517
 
518
  <!-- Auth View -->
519
  <div id="auth-view" class="h-full w-full flex items-center justify-center p-4 overflow-y-auto">
520
- <div class="glass-panel p-6 rounded-2xl w-full max-w-md fade-in my-auto">
521
- <div class="text-center mb-8">
522
- <div class="w-16 h-16 bg-white/10 rounded-full mx-auto flex items-center justify-center mb-4">
523
- <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
524
- <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
525
- </svg>
526
- </div>
527
- <h1 class="text-2xl font-bold">پیام رسان مینیمال</h1>
528
- <p class="text-white/50 text-sm mt-1">پیام رسان مینیمال با JavaScript</p>
529
- </div>
530
-
531
- <!-- Tabs -->
532
- <div class="flex gap-4 mb-6 border-b border-white/10 pb-1">
533
- <button onclick="switchAuthTab('login')" id="tab-login" class="flex-1 pb-2 text-sm font-medium border-b-2 border-white text-white transition-colors touch-target flex items-center justify-center">ورود</button>
534
- <button onclick="switchAuthTab('register')" id="tab-register" class="flex-1 pb-2 text-sm font-medium border-b-2 border-transparent text-white/50 hover:text-white transition-colors touch-target flex items-center justify-center">ثبت نام</button>
535
- </div>
536
-
537
- <!-- Login Form -->
538
- <form id="login-form" class="space-y-5" onsubmit="handleLogin(event)">
539
- <div>
540
- <label class="block text-xs text-white/60 mb-2">شماره موبایل</label>
541
- <input type="tel" id="login-phone" placeholder="09XXXXXXXXX" inputmode="tel" class="input-minimal touch-target" required>
542
- </div>
543
- <div>
544
- <label class="block text-xs text-white/60 mb-2">رمز عبور</label>
545
- <input type="password" id="login-password" placeholder="••••••••" class="input-minimal touch-target" required>
546
- </div>
547
- <button type="submit" class="w-full bg-white text-slate-900 font-bold py-3 rounded-lg hover:bg-white/90 transition-colors mt-4 touch-target btn-active">
548
- ورود
549
- </button>
550
- </form>
551
 
552
- <!-- Register Form -->
553
- <form id="register-form" class="space-y-5 hidden" onsubmit="handleRegister(event)">
554
- <div>
555
- <label class="block text-xs text-white/60 mb-2">نام کامل</label>
556
- <input type="text" id="reg-name" placeholder="نام شما" class="input-minimal touch-target" required>
557
- </div>
558
- <div>
559
- <label class="block text-xs text-white/60 mb-2">شماره موبایل</label>
560
- <input type="tel" id="reg-phone" placeholder="09XXXXXXXXX" inputmode="tel" class="input-minimal touch-target" required>
561
- </div>
562
- <div>
563
- <label class="block text-xs text-white/60 mb-2">رمز عبور</label>
564
- <input type="password" id="reg-password" placeholder="حداقل ۴ کاراکتر" class="input-minimal touch-target" required>
565
- </div>
566
- <button type="submit" class="w-full bg-white text-slate-900 font-bold py-3 rounded-lg hover:bg-white/90 transition-colors mt-4 touch-target btn-active">
567
- ثبت نام
568
- </button>
569
- </form>
570
 
571
- <div class="mt-6 text-center">
572
- <p class="text-xs text-white/40">
573
- ساخته شده با JavaScript و LocalStorage
574
- </p>
575
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  </div>
 
577
  </div>
578
 
579
  <!-- Dashboard View -->
580
- <div id="dashboard-view" class="hidden h-full w-full flex flex-col md:flex-row relative">
581
-
582
- <!-- Mobile Sidebar Overlay -->
583
- <div id="sidebar-overlay" class="sidebar-overlay md:hidden" onclick="toggleSidebar()"></div>
584
-
585
- <!-- Sidebar -->
586
- <aside id="sidebar" class="mobile-sidebar md:relative md:transform-none md:w-72 md:h-full glass-panel border-l border-white/10 flex flex-col bg-slate-900/95 md:bg-transparent">
587
- <!-- Profile -->
588
- <div class="p-4 md:p-6 border-b border-white/10 flex items-center justify-between">
589
- <div class="flex items-center gap-3 flex-1">
590
- <div id="user-avatar" class="w-10 h-10 md:w-12 md:h-12 rounded-full flex items-center justify-center text-lg font-bold avatar-blue">
591
- <span id="user-avatar-initial">U</span>
592
- </div>
593
- <div class="flex-1 min-w-0">
594
- <h2 id="user-name-display" class="font-bold text-sm truncate">کاربر</h2>
595
- <p id="user-phone-display" class="text-xs text-white/50 font-mono">09XXXXXXXXX</p>
596
- </div>
597
- </div>
598
- <div class="relative">
599
- <button onclick="toggleUserMenu(event)" class="text-white/40 hover:text-white transition-colors p-2 touch-target mr-2">
600
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
601
- <circle cx="12" cy="12" r="1"></circle>
602
- <circle cx="12" cy="5" r="1"></circle>
603
- <circle cx="12" cy="19" r="1"></circle>
604
- </svg>
605
- </button>
606
- <!-- User Menu -->
607
- <div id="user-menu" class="menu-dropdown">
608
- <div class="menu-item" onclick="openEditProfileModal()">
609
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
610
- <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
611
- <circle cx="12" cy="7" r="4"></circle>
612
- </svg>
613
- ویرایش پروفایل
614
- </div>
615
- <div class="menu-item danger" onclick="logout()">
616
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
617
- <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
618
- <polyline points="16,17 21,12 16,7"></polyline>
619
- <line x1="21" y1="12" x2="9" y2="12"></line>
620
- </svg>
621
- خروج
622
- </div>
623
- </div>
624
- </div>
625
  </div>
626
-
627
- <!-- Create Room -->
628
- <div class="p-4 border-b border-white/10">
629
- <div class="flex justify-between items-center mb-3">
630
- <span class="text-xs font-medium text-white/60">اتاق‌های من</span>
631
- <span id="room-count-badge" class="text-xs bg-white/10 px-2 py-0.5 rounded-full">۰/۳</span>
632
- </div>
633
- <button onclick="openCreateRoomModal()" id="btn-create-room" class="w-full py-3 border border-dashed border-white/20 rounded-lg text-sm text-white/70 hover:border-white/40 hover:text-white transition-colors touch-target">
634
- <span class="ml-1">+</span> اتاق جدید
635
- </button>
636
- <p id="room-limit-msg" class="text-xs text-red-400 mt-2 hidden">حداکثر ۳ اتاق مجاز است</p>
637
  </div>
 
 
 
 
 
638
 
639
- <!-- Room List -->
640
- <div class="flex-1 overflow-y-auto p-2 space-y-1" id="room-list-container">
641
- <div class="text-center mt-8 text-white/30 text-sm">
642
- <p>اتاقی وجود ندارد</p>
643
- </div>
644
- </div>
 
 
 
 
 
645
 
646
- <!-- Mobile Safe Area -->
647
- <div class="h-safe-bottom md:hidden"></div>
648
- </aside>
649
-
650
- <!-- Main Content -->
651
- <main class="flex-1 flex flex-col h-full relative bg-slate-900/20 w-full">
652
-
653
- <!-- Mobile Header -->
654
- <header class="h-14 glass-panel border-b border-white/10 flex items-center justify-between px-4 md:hidden">
655
- <button onclick="toggleSidebar()" class="touch-target flex items-center justify-center w-10 h-10 -mr-2 text-white/80">
656
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
657
- <line x1="3" y1="12" x2="21" y2="12"></line>
658
- <line x1="3" y1="6" x2="21" y2="6"></line>
659
- <line x1="3" y1="18" x2="21" y2="18"></line>
660
- </svg>
661
- </button>
662
- <span class="text-sm font-medium text-white/60">پیام رسان مینیمال</span>
663
- <div class="w-10"></div>
664
- </header>
665
-
666
- <!-- Desktop Header -->
667
- <header class="hidden md:flex h-14 glass-panel border-b border-white/10 items-center justify-between px-6">
668
- <span class="text-sm font-medium text-white/60">داشبورد</span>
669
- <div class="flex items-center gap-2 text-xs text-white/40">
670
- <span class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></span>
671
- آنلاین
672
- </div>
673
- </header>
674
-
675
- <!-- Welcome Screen -->
676
- <div id="welcome-screen" class="flex-1 flex flex-col items-center justify-center p-8 text-center">
677
- <div class="w-20 h-20 bg-white/5 rounded-full flex items-center justify-center mb-4">
678
- <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" class="text-white/40">
679
- <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
680
- </svg>
681
- </div>
682
- <h2 class="text-xl font-bold mb-2">به پیام رسان خوش آمدید</h2>
683
- <p class="text-white/50 text-sm max-w-md">اتاق جدید بسازید یا یکی را انتخاب کنید</p>
684
- <button onclick="openCreateRoomModal()" class="mt-6 md:hidden bg-white/10 px-6 py-3 rounded-full text-sm font-medium touch-target">
685
- <span class="ml-2">+</span>ساخت اتاق جدید
686
- </button>
687
- </div>
 
 
688
 
689
- <!-- Chat Interface -->
690
- <div id="chat-interface" class="hidden absolute inset-0 bg-slate-900 flex flex-col fade-in z-20">
691
- <!-- Chat Header -->
692
- <div class="h-14 glass-panel border-b border-white/10 flex items-center justify-between px-4" style="padding-top: env(safe-area-inset-top, 0);">
693
- <div class="flex items-center gap-3 flex-1 min-w-0">
694
- <button onclick="closeChat()" class="md:hidden text-white/60 hover:text-white touch-target w-10 h-10 flex items-center justify-center -mr-2">
695
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
696
- <line x1="19" y1="12" x2="5" y2="12"></line>
697
- <polyline points="12,19 5,12 12,5"></polyline>
698
- </svg>
699
- </button>
700
- <div id="chat-room-avatar" class="w-10 h-10 rounded-full flex items-center justify-center shrink-0 avatar-purple">
701
- <span id="chat-room-initial">#</span>
702
- </div>
703
- <div class="min-w-0 flex-1">
704
- <h3 id="chat-room-name" class="font-bold text-sm truncate">اتاق</h3>
705
- <span id="chat-user-count" class="text-xs text-white/50">۲ عضو</span>
706
- </div>
707
- </div>
708
- <div class="flex items-center gap-1">
709
- <button onclick="copyRoomLink()" class="text-white/40 hover:text-white text-sm touch-target w-10 h-10 flex items-center justify-center" title="کپی لینک">
710
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
711
- <circle cx="18" cy="5" r="3"></circle>
712
- <circle cx="6" cy="12" r="3"></circle>
713
- <circle cx="18" cy="19" r="3"></circle>
714
- <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
715
- <line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
716
- </svg>
717
- </button>
718
- <div class="relative">
719
- <button onclick="toggleRoomMenu(event)" class="text-white/40 hover:text-white text-sm touch-target w-10 h-10 flex items-center justify-center">
720
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
721
- <circle cx="12" cy="12" r="1"></circle>
722
- <circle cx="12" cy="5" r="1"></circle>
723
- <circle cx="12" cy="19" r="1"></circle>
724
- </svg>
725
- </button>
726
- <!-- Room Menu -->
727
- <div id="room-menu" class="menu-dropdown">
728
- <div class="menu-item" onclick="openEditRoomModal()">
729
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
730
- <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
731
- <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
732
- </svg>
733
- ویرایش گروه
734
- </div>
735
- <div class="menu-item danger" onclick="deleteCurrentRoom()">
736
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
737
- <polyline points="3,6 5,6 21,6"></polyline>
738
- <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
739
- </svg>
740
- حذف گروه
741
- </div>
742
- </div>
743
- </div>
744
- </div>
745
- </div>
746
-
747
- <!-- Messages -->
748
- <div id="messages-container" class="flex-1 overflow-y-auto p-4 space-y-3 pb-32 md:pb-4">
749
- <!-- Messages injected here -->
750
- </div>
751
-
752
- <!-- Sticker Picker -->
753
- <div id="sticker-picker" class="sticker-picker">
754
- <div class="p-3 border-b border-white/10 flex justify-between items-center">
755
- <span class="text-sm font-medium">استیکرها</span>
756
- <button onclick="toggleStickerPicker()" class="text-white/50 hover:text-white">
757
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
758
- <line x1="18" y1="6" x2="6" y2="18"></line>
759
- <line x1="6" y1="6" x2="18" y2="18"></line>
760
- </svg>
761
- </button>
762
- </div>
763
- <div class="p-3 grid grid-cols-5 gap-2" id="sticker-grid">
764
- <!-- Stickers injected here -->
765
- </div>
766
- </div>
767
-
768
- <!-- Input -->
769
- <div class="absolute bottom-0 left-0 right-0 p-3 md:p-4 glass-panel border-t border-white/10 safe-bottom bg-slate-900/90" style="backdrop-filter: blur(20px);">
770
- <form onsubmit="sendMessage(event)" class="flex gap-2 max-w-4xl mx-auto items-end">
771
- <button type="button" onclick="toggleStickerPicker()" class="text-white/40 hover:text-white w-11 h-11 rounded-full flex items-center justify-center transition-colors touch-target shrink-0" title="استیکر">
772
- <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
773
- <circle cx="12" cy="12" r="10"></circle>
774
- <path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
775
- <line x1="9" y1="9" x2="9.01" y2="9"></line>
776
- <line x1="15" y1="9" x2="15.01" y2="9"></line>
777
- </svg>
778
- </button>
779
- <input type="text" id="message-input" placeholder="پیام خود را بنویسید..." class="flex-1 bg-white/10 border border-white/10 rounded-full px-4 py-3 text-sm text-white placeholder-white/30 focus:outline-none focus:border-white/30 focus:bg-white/15 transition-all touch-target" autocomplete="off">
780
- <button type="submit" class="bg-blue-600 hover:bg-blue-500 text-white w-11 h-11 rounded-full flex items-center justify-center transition-colors touch-target btn-active shadow-lg shrink-0">
781
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
782
- <line x1="22" y1="2" x2="11" y2="13"></line>
783
- <polygon points="22,2 15,22 11,13 2,9 22,2"></polygon>
784
- </svg>
785
- </button>
786
- </form>
787
- </div>
788
  </div>
789
- </main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  </div>
791
 
792
  <!-- Create Room Modal -->
793
- <div id="create-room-modal" class="fixed inset-0 z-50 hidden flex items-end md:items-center justify-center p-0 md:p-4 bg-black/60 backdrop-blur-sm transition-opacity">
794
- <div class="glass-panel w-full md:max-w-sm rounded-t-2xl md:rounded-2xl p-6 fade-in bg-slate-900 border-t md:border border-white/10">
795
- <div class="flex justify-between items-center mb-4">
796
- <h3 class="font-bold text-lg">اتاق جدید</h3>
797
- <button onclick="closeCreateRoomModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center">
798
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
799
- <line x1="18" y1="6" x2="6" y2="18"></line>
800
- <line x1="6" y1="6" x2="18" y2="18"></line>
801
- </svg>
802
- </button>
803
- </div>
804
- <form onsubmit="handleCreateRoom(event)" class="space-y-4">
805
- <div>
806
- <label class="block text-xs text-white/60 mb-2">نام اتاق</label>
807
- <input type="text" id="new-room-name" placeholder="مثلاً: گروه دوستان" class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target" required>
808
- </div>
809
- <div class="flex gap-3 pt-2">
810
- <button type="button" onclick="closeCreateRoomModal()" class="flex-1 py-3 rounded-xl border border-white/10 text-sm hover:bg-white/5 transition-colors touch-target">
811
- انصراف
812
- </button>
813
- <button type="submit" class="flex-1 py-3 rounded-xl bg-white text-slate-900 text-sm font-bold hover:bg-white/90 transition-colors touch-target btn-active">
814
- ساختن
815
- </button>
816
- </div>
817
- </form>
818
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
819
  </div>
820
 
821
- <!-- Edit Room Modal -->
822
- <div id="edit-room-modal" class="fixed inset-0 z-50 hidden flex items-end md:items-center justify-center p-0 md:p-4 bg-black/60 backdrop-blur-sm">
823
- <div class="glass-panel w-full md:max-w-sm rounded-t-2xl md:rounded-2xl p-6 fade-in bg-slate-900 border-t md:border border-white/10">
824
- <div class="flex justify-between items-center mb-4">
825
- <h3 class="font-bold text-lg">ویرایش گروه</h3>
826
- <button onclick="closeEditRoomModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center">
827
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
828
- <line x1="18" y1="6" x2="6" y2="18"></line>
829
- <line x1="6" y1="6" x2="18" y2="18"></line>
830
- </svg>
831
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
832
  </div>
833
- <form onsubmit="handleEditRoom(event)" class="space-y-4">
834
- <div class="flex justify-center mb-4">
835
- <div id="edit-room-avatar-preview" class="room-avatar avatar-purple">
836
- <span id="edit-room-initial-preview">G</span>
837
- </div>
838
- </div>
839
- <div>
840
- <label class="block text-xs text-white/60 mb-2">نام گروه</label>
841
- <input type="text" id="edit-room-name" class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target" required>
842
- </div>
843
- <div>
844
- <label class="block text-xs text-white/60 mb-2">رنگ آ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, viewport-fit=cover">
6
+ <title>پیام رسان مینیمال | MinimalChat</title>
7
+
8
+ <style>
9
+ body {
10
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
11
+ background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
12
+ background-attachment: fixed;
13
+ -webkit-tap-highlight-color: transparent;
14
+ margin: 0;
15
+ padding: 0;
16
+ color: white;
17
+ }
18
+
19
+ .glass-panel {
20
+ background: rgba(255, 255, 255, 0.08);
21
+ backdrop-filter: blur(12px);
22
+ -webkit-backdrop-filter: blur(12px);
23
+ border: 1px solid rgba(255, 255, 255, 0.1);
24
+ }
25
+
26
+ .input-minimal {
27
+ background: transparent;
28
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
29
+ transition: all 0.3s;
30
+ }
31
+
32
+ .input-minimal:focus {
33
+ border-color: rgba(255, 255, 255, 0.6);
34
+ outline: none;
35
+ }
36
+
37
+ .message-bubble-me {
38
+ background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
39
+ border-radius: 16px 16px 4px 16px;
40
+ }
41
+
42
+ .message-bubble-other {
43
+ background: rgba(255, 255, 255, 0.12);
44
+ border-radius: 16px 16px 16px 4px;
45
+ }
46
+
47
+ .fade-in {
48
+ animation: fadeIn 0.3s ease-out;
49
+ }
50
+
51
+ @keyframes fadeIn {
52
+ from {
53
+ opacity: 0;
54
+ transform: translateY(10px);
55
+ }
56
+ to {
57
+ opacity: 1;
58
+ transform: translateY(0);
59
+ }
60
+ }
61
+
62
+ .slide-in {
63
+ animation: slideIn 0.3s ease-out;
64
+ }
65
+
66
+ @keyframes slideIn {
67
+ from {
68
+ transform: translateX(100%);
69
+ }
70
+ to {
71
+ transform: translateX(0);
72
+ }
73
+ }
74
+
75
+ .slide-out {
76
+ animation: slideOut 0.3s ease-out;
77
+ }
78
+
79
+ @keyframes slideOut {
80
+ from {
81
+ transform: translateX(0);
82
+ }
83
+ to {
84
+ transform: translateX(100%);
85
+ }
86
+ }
87
+
88
+ /* Custom Scrollbar */
89
+ ::-webkit-scrollbar {
90
+ width: 4px;
91
+ height: 4px;
92
+ }
93
+
94
+ ::-webkit-scrollbar-track {
95
+ background: transparent;
96
+ }
97
+
98
+ ::-webkit-scrollbar-thumb {
99
+ background: rgba(255, 255, 255, 0.2);
100
+ border-radius: 4px;
101
+ }
102
+
103
+ ::-webkit-scrollbar-thumb:hover {
104
+ background: rgba(255, 255, 255, 0.3);
105
+ }
106
+
107
+ /* Mobile Optimizations */
108
+ @media (max-width: 768px) {
109
+ .mobile-sidebar {
110
+ position: fixed;
111
+ top: 0;
112
+ right: 0;
113
+ height: 100vh;
114
+ height: 100dvh;
115
+ width: 85%;
116
+ max-width: 300px;
117
+ z-index: 40;
118
+ transform: translateX(100%);
119
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
120
+ }
121
+
122
+ .mobile-sidebar.open {
123
+ transform: translateX(0);
124
+ }
125
+
126
+ .sidebar-overlay {
127
+ position: fixed;
128
+ inset: 0;
129
+ background: rgba(0, 0, 0, 0.5);
130
+ backdrop-filter: blur(4px);
131
+ z-index: 35;
132
+ opacity: 0;
133
+ pointer-events: none;
134
+ transition: opacity 0.3s;
135
+ }
136
+
137
+ .sidebar-overlay.active {
138
+ opacity: 1;
139
+ pointer-events: auto;
140
+ }
141
+
142
+ .chat-container {
143
+ position: fixed;
144
+ inset: 0;
145
+ z-index: 30;
146
+ }
147
+
148
+ .safe-bottom {
149
+ padding-bottom: env(safe-area-inset-bottom, 20px);
150
+ }
151
+ }
152
+
153
+ /* Touch friendly buttons */
154
+ .touch-target {
155
+ min-height: 44px;
156
+ min-width: 44px;
157
+ }
158
+
159
+ /* Prevent zoom on input focus for iOS */
160
+ @media screen and (max-width: 768px) {
161
+ input,
162
+ textarea,
163
+ select {
164
+ font-size: 16px;
165
+ }
166
+ }
167
+
168
+ /* Message animations */
169
+ .message-enter {
170
+ animation: messagePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
171
+ }
172
+
173
+ @keyframes messagePop {
174
+ 0% {
175
+ opacity: 0;
176
+ transform: scale(0.8) translateY(20px);
177
+ }
178
+ 100% {
179
+ opacity: 1;
180
+ transform: scale(1) translateY(0);
181
+ }
182
+ }
183
+
184
+ /* Loading shimmer */
185
+ .shimmer {
186
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
187
+ background-size: 200% 100%;
188
+ animation: shimmer 1.5s infinite;
189
+ }
190
+
191
+ @keyframes shimmer {
192
+ 0% {
193
+ background-position: 200% 0;
194
+ }
195
+ 100% {
196
+ background-position: -200% 0;
197
+ }
198
+ }
199
+
200
+ /* Sticker picker styles */
201
+ .sticker-picker {
202
+ position: absolute;
203
+ bottom: 70px;
204
+ right: 0;
205
+ width: 100%;
206
+ max-height: 300px;
207
+ background: rgba(30, 27, 75, 0.95);
208
+ border-radius: 12px 12px 0 0;
209
+ border: 1px solid rgba(255, 255, 255, 0.1);
210
+ overflow-y: auto;
211
+ padding: 10px;
212
+ display: none;
213
+ z-index: 100;
214
+ }
215
+
216
+ .sticker-picker.active {
217
+ display: block;
218
+ }
219
+
220
+ .sticker-category {
221
+ margin-bottom: 10px;
222
+ }
223
+
224
+ .sticker-category-title {
225
+ font-size: 12px;
226
+ color: rgba(255, 255, 255, 0.6);
227
+ margin-bottom: 5px;
228
+ padding-right: 5px;
229
+ }
230
+
231
+ .sticker-grid {
232
+ display: grid;
233
+ grid-template-columns: repeat(5, 1fr);
234
+ gap: 5px;
235
+ }
236
+
237
+ .sticker-item {
238
+ width: 100%;
239
+ aspect-ratio: 1;
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ cursor: pointer;
244
+ border-radius: 8px;
245
+ transition: background 0.2s;
246
+ }
247
+
248
+ .sticker-item:hover {
249
+ background: rgba(255, 255, 255, 0.1);
250
+ }
251
+
252
+ .sticker-item img {
253
+ max-width: 80%;
254
+ max-height: 80%;
255
+ }
256
+
257
+ /* Profile edit modal */
258
+ .profile-edit-modal {
259
+ position: fixed;
260
+ top: 0;
261
+ left: 0;
262
+ right: 0;
263
+ bottom: 0;
264
+ background: rgba(0, 0, 0, 0.7);
265
+ display: flex;
266
+ align-items: center;
267
+ justify-content: center;
268
+ z-index: 100;
269
+ opacity: 0;
270
+ pointer-events: none;
271
+ transition: opacity 0.3s;
272
+ }
273
+
274
+ .profile-edit-modal.active {
275
+ opacity: 1;
276
+ pointer-events: auto;
277
+ }
278
+
279
+ .profile-edit-content {
280
+ background: #1e1b4b;
281
+ border-radius: 16px;
282
+ padding: 20px;
283
+ width: 90%;
284
+ max-width: 400px;
285
+ border: 1px solid rgba(255, 255, 255, 0.1);
286
+ }
287
+
288
+ .avatar-grid {
289
+ display: grid;
290
+ grid-template-columns: repeat(4, 1fr);
291
+ gap: 10px;
292
+ margin-top: 15px;
293
+ }
294
+
295
+ .avatar-option {
296
+ width: 100%;
297
+ aspect-ratio: 1;
298
+ border-radius: 50%;
299
+ display: flex;
300
+ align-items: center;
301
+ justify-content: center;
302
+ font-weight: bold;
303
+ cursor: pointer;
304
+ transition: transform 0.2s;
305
+ }
306
+
307
+ .avatar-option:hover {
308
+ transform: scale(1.1);
309
+ }
310
+
311
+ .avatar-option.selected {
312
+ border: 3px solid #3b82f6;
313
+ }
314
+
315
+ /* Room settings modal */
316
+ .room-settings-modal {
317
+ position: fixed;
318
+ top: 0;
319
+ left: 0;
320
+ right: 0;
321
+ bottom: 0;
322
+ background: rgba(0, 0, 0, 0.7);
323
+ display: flex;
324
+ align-items: center;
325
+ justify-content: center;
326
+ z-index: 100;
327
+ opacity: 0;
328
+ pointer-events: none;
329
+ transition: opacity 0.3s;
330
+ }
331
+
332
+ .room-settings-modal.active {
333
+ opacity: 1;
334
+ pointer-events: auto;
335
+ }
336
+
337
+ .room-settings-content {
338
+ background: #1e1b4b;
339
+ border-radius: 16px;
340
+ padding: 20px;
341
+ width: 90%;
342
+ max-width: 400px;
343
+ border: 1px solid rgba(255, 255, 255, 0.1);
344
+ }
345
+
346
+ .danger-zone {
347
+ border-top: 1px solid rgba(255, 0, 0, 0.3);
348
+ padding-top: 15px;
349
+ margin-top: 15px;
350
+ }
351
+
352
+ .danger-button {
353
+ background: rgba(255, 0, 0, 0.2);
354
+ color: #ff6b6b;
355
+ border: 1px solid rgba(255, 0, 0, 0.3);
356
+ }
357
+
358
+ .danger-button:hover {
359
+ background: rgba(255, 0, 0, 0.3);
360
+ }
361
+ </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  </head>
 
363
 
364
+ <body class="text-white h-screen h-[100dvh] overflow-hidden selection:bg-blue-500/30 bg-slate-900">
 
365
 
366
  <!-- Toast Container -->
367
+ <div id="toast-container" class="fixed top-4 left-1/2 transform -translate-x-1/2 z-50 flex flex-col gap-2 w-full max-w-sm px-4 pointer-events-none">
368
  </div>
369
 
370
  <!-- Auth View -->
371
  <div id="auth-view" class="h-full w-full flex items-center justify-center p-4 overflow-y-auto">
372
+ <div class="glass-panel p-6 md:p-8 rounded-2xl w-full max-w-md fade-in my-auto">
373
+ <div class="text-center mb-6 md:mb-8">
374
+ <div class="w-14 h-14 md:w-16 md:h-16 bg-white/10 rounded-full mx-auto flex items-center justify-center mb-4">
375
+ <span style="font-size: 24px;">💬</span>
376
+ </div>
377
+ <h1 class="text-xl md:text-2xl font-bold">پیام رسان مینیمال</h1>
378
+ <p class="text-white/50 text-xs md:text-sm mt-1">پیام رسان مینیمال با PHP</p>
379
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
 
381
+ <!-- Tabs -->
382
+ <div class="flex gap-4 mb-6 border-b border-white/10 pb-1">
383
+ <button onclick="switchAuthTab('login')" id="tab-login" class="flex-1 pb-2 text-sm font-medium border-b-2 border-white text-white transition-colors touch-target flex items-center justify-center">ورود</button>
384
+ <button onclick="switchAuthTab('register')" id="tab-register" class="flex-1 pb-2 text-sm font-medium border-b-2 border-transparent text-white/50 hover:text-white transition-colors touch-target flex items-center justify-center">ثبت نام</button>
385
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
386
 
387
+ <!-- Login Form -->
388
+ <form id="login-form" class="space-y-4 md:space-y-5" onsubmit="handleLogin(event)">
389
+ <div>
390
+ <label class="block text-xs text-white/60 mb-2">شماره موبایل</label>
391
+ <input type="tel" id="login-phone" placeholder="09XXXXXXXXX" inputmode="tel" class="w-full input-minimal py-3 text-white placeholder-white/30 touch-target" required>
392
+ </div>
393
+ <div>
394
+ <label class="block text-xs text-white/60 mb-2">رمز عبور</label>
395
+ <input type="password" id="login-password" placeholder="••••••••" class="w-full input-minimal py-3 text-white placeholder-white/30 touch-target" required>
396
+ </div>
397
+ <button type="submit" class="w-full bg-white text-slate-900 font-bold py-3 rounded-lg hover:bg-white/90 transition-colors mt-4 touch-target active:scale-95 transform transition-transform">
398
+ ورود
399
+ </button>
400
+ </form>
401
+
402
+ <!-- Register Form -->
403
+ <form id="register-form" class="space-y-4 md:space-y-5 hidden" onsubmit="handleRegister(event)">
404
+ <div>
405
+ <label class="block text-xs text-white/60 mb-2">نام کامل</label>
406
+ <input type="text" id="reg-name" placeholder="نام شما" class="w-full input-minimal py-3 text-white placeholder-white/30 touch-target" required>
407
+ </div>
408
+ <div>
409
+ <label class="block text-xs text-white/60 mb-2">شماره موبایل</label>
410
+ <input type="tel" id="reg-phone" placeholder="09XXXXXXXXX" inputmode="tel" class="w-full input-minimal py-3 text-white placeholder-white/30 touch-target" required>
411
+ </div>
412
+ <div>
413
+ <label class="block text-xs text-white/60 mb-2">رمز عبور</label>
414
+ <input type="password" id="reg-password" placeholder="حداقل ۴ کاراکتر" class="w-full input-minimal py-3 text-white placeholder-white/30 touch-target" required>
415
+ </div>
416
+ <button type="submit" class="w-full bg-white text-slate-900 font-bold py-3 rounded-lg hover:bg-white/90 transition-colors mt-4 touch-target active:scale-95 transform transition-transform">
417
+ ثبت نام
418
+ </button>
419
+ </form>
420
+
421
+ <div class="mt-6 text-center">
422
+ <p class="text-xs text-white/40">
423
+ ساخته شده با PHP و MySQL
424
+ </p>
425
  </div>
426
+ </div>
427
  </div>
428
 
429
  <!-- Dashboard View -->
430
+ <div id="dashboard-view" class="h-full w-full flex flex-col md:flex-row relative hidden">
431
+
432
+ <!-- Mobile Sidebar Overlay -->
433
+ <div id="sidebar-overlay" class="sidebar-overlay md:hidden" onclick="toggleSidebar()"></div>
434
+
435
+ <!-- Sidebar -->
436
+ <aside id="sidebar"
437
+ class="mobile-sidebar md:relative md:transform-none md:w-72 md:h-full glass-panel border-l border-white/10 flex flex-col bg-slate-900/95 md:bg-transparent">
438
+ <!-- Profile -->
439
+ <div class="p-4 md:p-6 border-b border-white/10 flex items-center justify-between">
440
+ <div class="flex items-center gap-3 flex-1">
441
+ <div id="user-avatar" class="w-10 h-10 md:w-12 md:h-12 rounded-full flex items-center justify-center text-blue-300 font-bold text-lg">
442
+ <span id="user-avatar-initial">U</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  </div>
444
+ <div class="flex-1 min-w-0">
445
+ <h2 id="user-name-display" class="font-bold text-sm truncate">کاربر</h2>
446
+ <p id="user-phone-display" class="text-xs text-white/50 font-mono">09123456789</p>
 
 
 
 
 
 
 
 
447
  </div>
448
+ </div>
449
+ <button onclick="logout()" class="text-white/40 hover:text-white transition-colors p-2 touch-target mr-2">
450
+ <span style="font-size: 18px;">🚪</span>
451
+ </button>
452
+ </div>
453
 
454
+ <!-- Create Room -->
455
+ <div class="p-4 border-b border-white/10">
456
+ <div class="flex justify-between items-center mb-3">
457
+ <span class="text-xs font-medium text-white/60">اتاق‌های من</span>
458
+ <span id="room-count-badge" class="text-xs bg-white/10 px-2 py-0.5 rounded-full">۰/۳</span>
459
+ </div>
460
+ <button onclick="openCreateRoomModal()" id="btn-create-room" class="w-full py-3 border border-dashed border-white/20 rounded-lg text-sm text-white/70 hover:border-white/40 hover:text-white transition-colors touch-target">
461
+ <span style="font-size: 14px;">➕</span> اتاق جدید
462
+ </button>
463
+ <p id="room-limit-msg" class="text-xs text-red-400 mt-2 hidden">حداکثر ۳ اتاق مجاز است</p>
464
+ </div>
465
 
466
+ <!-- Room List -->
467
+ <div class="flex-1 overflow-y-auto p-2 space-y-1" id="room-list-container">
468
+ <div class="text-center mt-8 text-white/30 text-sm">
469
+ <p>اتاقی وجود ندارد</p>
470
+ </div>
471
+ </div>
472
+
473
+ <!-- Mobile Safe Area -->
474
+ <div class="h-safe-bottom md:hidden"></div>
475
+ </aside>
476
+
477
+ <!-- Main Content -->
478
+ <main class="flex-1 flex flex-col h-full relative bg-slate-900/20 w-full">
479
+
480
+ <!-- Mobile Header -->
481
+ <header
482
+ class="h-14 glass-panel border-b border-white/10 flex items-center justify-between px-4 md:px-6 md:hidden">
483
+ <button onclick="toggleSidebar()" class="touch-target flex items-center justify-center w-10 h-10 -mr-2 text-white/80">
484
+ <span style="font-size: 18px;">☰</span>
485
+ </button>
486
+ <span class="text-sm font-medium text-white/60">پیام رسان مینیمال</span>
487
+ <div class="w-10"></div> <!-- Spacer for balance -->
488
+ </header>
489
+
490
+ <!-- Desktop Header -->
491
+ <header class="hidden md:flex h-14 glass-panel border-b border-white/10 items-center justify-between px-6">
492
+ <span class="text-sm font-medium text-white/60">داشبورد</span>
493
+ <div class="flex items-center gap-2 text-xs text-white/40">
494
+ <span class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></span>
495
+ آنلاین
496
+ </div>
497
+ </header>
498
+
499
+ <!-- Welcome Screen -->
500
+ <div id="welcome-screen" class="flex-1 flex flex-col items-center justify-center p-8 text-center">
501
+ <div class="w-16 h-16 md:w-20 md:h-20 bg-white/5 rounded-full flex items-center justify-center mb-4">
502
+ <span style="font-size: 28px;">💬</span>
503
+ </div>
504
+ <h2 class="text-lg md:text-xl font-bold mb-2">به پیام رسان خوش آمدید</h2>
505
+ <p class="text-white/50 text-sm max-w-md">اتاق جدید بسازید یا یکی را انتخاب کنید</p>
506
+ <button onclick="openCreateRoomModal()" class="mt-6 md:hidden bg-white/10 px-6 py-3 rounded-full text-sm font-medium touch-target">
507
+ <span style="font-size: 14px;">➕</span> ساخت اتاق جدید
508
+ </button>
509
+ </div>
510
 
511
+ <!-- Chat Interface -->
512
+ <div id="chat-interface" class="hidden absolute inset-0 bg-slate-900 flex flex-col fade-in z-20">
513
+ <!-- Chat Header -->
514
+ <div class="h-14 glass-panel border-b border-white/10 flex items-center justify-between px-4 safe-top">
515
+ <div class="flex items-center gap-3 flex-1 min-w-0">
516
+ <button onclick="closeChat()" class="md:hidden text-white/60 hover:text-white touch-target w-10 h-10 flex items-center justify-center -mr-2">
517
+ <span style="font-size: 18px;">←</span>
518
+ </button>
519
+ <div
520
+ class="w-9 h-9 md:w-10 md:h-10 rounded-full bg-indigo-500/20 flex items-center justify-center shrink-0">
521
+ <span style="font-size: 14px;">#</span>
522
+ </div>
523
+ <div class="min-w-0 flex-1">
524
+ <h3 id="chat-room-name" class="font-bold text-sm truncate">اتاق</h3>
525
+ <span id="chat-user-count" class="text-xs text-white/50">۲ عضو</span>
526
+ </div>
527
+ </div>
528
+ <button onclick="openRoomSettings()" class="text-white/40 hover:text-white text-sm touch-target w-10 h-10 flex items-center justify-center">
529
+ <span style="font-size: 18px;">⚙️</span>
530
+ </button>
531
+ </div>
532
+
533
+ <!-- Messages -->
534
+ <div id="messages-container" class="flex-1 overflow-y-auto p-4 space-y-3 pb-20 md:pb-4">
535
+ <!-- Messages injected here -->
536
+ </div>
537
+
538
+ <!-- Sticker Picker -->
539
+ <div id="sticker-picker" class="sticker-picker">
540
+ <div class="sticker-category">
541
+ <div class="sticker-category-title">خنده</div>
542
+ <div class="sticker-grid">
543
+ <div class="sticker-item" onclick="insertSticker('😂')">😂</div>
544
+ <div class="sticker-item" onclick="insertSticker('😆')">😆</div>
545
+ <div class="sticker-item" onclick="insertSticker('😅')">😅</div>
546
+ <div class="sticker-item" onclick="insertSticker('🤣')">🤣</div>
547
+ <div class="sticker-item" onclick="insertSticker('😁')">😁</div>
548
+ </div>
549
+ </div>
550
+ <div class="sticker-category">
551
+ <div class="sticker-category-title">احساسات</div>
552
+ <div class="sticker-grid">
553
+ <div class="sticker-item" onclick="insertSticker('😍')">😍</div>
554
+ <div class="sticker-item" onclick="insertSticker('😘')">😘</div>
555
+ <div class="sticker-item" onclick="insertSticker('🥰')">🥰</div>
556
+ <div class="sticker-item" onclick="insertSticker('😊')">😊</div>
557
+ <div class="sticker-item" onclick="insertSticker('😢')">😢</div>
558
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  </div>
560
+ <div class="sticker-category">
561
+ <div class="sticker-category-title">دیگر</div>
562
+ <div class="sticker-grid">
563
+ <div class="sticker-item" onclick="insertSticker('👍')">👍</div>
564
+ <div class="sticker-item" onclick="insertSticker('👎')">👎</div>
565
+ <div class="sticker-item" onclick="insertSticker('❤️')">❤️</div>
566
+ <div class="sticker-item" onclick="insertSticker('🔥')">🔥</div>
567
+ <div class="sticker-item" onclick="insertSticker('🎉')">🎉</div>
568
+ </div>
569
+ </div>
570
+ </div>
571
+
572
+ <!-- Input -->
573
+ <div
574
+ class="absolute bottom-0 left-0 right-0 p-3 md:p-4 glass-panel border-t border-white/10 safe-bottom bg-slate-900/90 backdrop-blur-xl">
575
+ <form onsubmit="sendMessage(event)" class="flex gap-2 max-w-4xl mx-auto">
576
+ <button type="button" onclick="toggleStickerPicker()" class="bg-white/10 border border-white/10 rounded-full w-11 h-11 flex items-center justify-center transition-colors touch-target active:scale-95 transform shrink-0">
577
+ <span style="font-size: 18px;">😊</span>
578
+ </button>
579
+ <input type="text" id="message-input" placeholder="پیام خود را بنویسید..."
580
+ class="flex-1 bg-white/10 border border-white/10 rounded-full px-4 py-3 text-sm text-white placeholder-white/30 focus:outline-none focus:border-white/30 focus:bg-white/15 transition-all touch-target"
581
+ autocomplete="off">
582
+ <button type="submit" class="bg-blue-600 hover:bg-blue-500 text-white w-11 h-11 rounded-full flex items-center justify-center transition-colors touch-target active:scale-95 transform shadow-lg shadow-blue-600/30 shrink-0">
583
+ <span style="font-size: 18px;">📤</span>
584
+ </button>
585
+ </form>
586
+ </div>
587
+ </div>
588
+ </main>
589
  </div>
590
 
591
  <!-- Create Room Modal -->
592
+ <div id="create-room-modal"
593
+ class="fixed inset-0 z-50 hidden flex items-end md:items-center justify-center p-0 md:p-4 bg-black/60 backdrop-blur-sm transition-opacity">
594
+ <div
595
+ class="glass-panel w-full md:max-w-sm rounded-t-2xl md:rounded-2xl p-6 fade-in bg-slate-900 border-t md:border border-white/10">
596
+ <div class="flex justify-between items-center mb-4">
597
+ <h3 class="font-bold text-lg">اتاق جدید</h3>
598
+ <button onclick="closeCreateRoomModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center">
599
+ <span style="font-size: 20px;"></span>
600
+ </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  </div>
602
+ <form onsubmit="handleCreateRoom(event)" class="space-y-4">
603
+ <div>
604
+ <label class="block text-xs text-white/60 mb-2">نام اتاق</label>
605
+ <input type="text" id="new-room-name" placeholder="مثلاً: گروه دوستان"
606
+ class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target"
607
+ required>
608
+ </div>
609
+ <div class="flex gap-3 pt-2">
610
+ <button type="button" onclick="closeCreateRoomModal()" class="flex-1 py-3 rounded-xl border border-white/10 text-sm hover:bg-white/5 transition-colors touch-target">
611
+ انصراف
612
+ </button>
613
+ <button type="submit" class="flex-1 py-3 rounded-xl bg-white text-slate-900 text-sm font-bold hover:bg-white/90 transition-colors touch-target active:scale-95 transform">
614
+ ساختن
615
+ </button>
616
+ </div>
617
+ </form>
618
+ </div>
619
  </div>
620
 
621
+ <!-- Profile Edit Modal -->
622
+ <div id="profile-edit-modal" class="profile-edit-modal">
623
+ <div class="profile-edit-content">
624
+ <div class="flex justify-between items-center mb-4">
625
+ <h3 class="font-bold text-lg">ویرایش پروفایل</h3>
626
+ <button onclick="closeProfileEditModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center">
627
+ <span style="font-size: 20px;">✕</span>
628
+ </button>
629
+ </div>
630
+ <form onsubmit="saveProfile(event)" class="space-y-4">
631
+ <div>
632
+ <label class="block text-xs text-white/60 mb-2">نام کامل</label>
633
+ <input type="text" id="edit-profile-name" placeholder="نام شما"
634
+ class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target"
635
+ required>
636
+ </div>
637
+ <div>
638
+ <label class="block text-xs text-white/60 mb-2">رنگ آواتار</label>
639
+ <div class="avatar-grid">
640
+ <div class="avatar-option" style="background-color: #3b82f620;" onclick="selectAvatarColor('#3b82f6')">A</div>
641
+ <div class="avatar-option" style="background-color: #ef444420;" onclick="selectAvatarColor('#ef4444')">B</div>
642
+ <div class="avatar-option" style="background-color: #10b98120;" onclick="selectAvatarColor('#10b981')">C</div>
643
+ <div class="avatar-option" style="background-color: #f59e0b20;" onclick="selectAvatarColor('#f59e0b')">D</div>
644
+ <div class="avatar-option" style="background-color: #8b5cf620;" onclick="selectAvatarColor('#8b5cf6')">E</div>
645
+ <div class="avatar-option" style="background-color: #ec489920;" onclick="selectAvatarColor('#ec4899')">F</div>
646
+ <div class="avatar-option" style="background-color: #14b8a620;" onclick="selectAvatarColor('#14b8a6')">G</div>
647
+ <div class="avatar-option" style="background-color: #f9731620;" onclick="selectAvatarColor('#f97316')">H</div>
648
  </div>
649
+ <input type="hidden" id="edit-profile-color" value="#3b82f6">
650
+ </div>
651
+ <div class="flex gap-3 pt-2">
652
+ <button type="button" onclick="closeProfileEditModal()" class="flex-1 py-3 rounded-xl border border-white/10 text-sm hover:bg-white/5 transition-colors touch-target">
653
+ انصراف
654
+ </button>
655
+ <button type="submit" class="flex-1 py-3 rounded-xl bg-white text-slate-900 text-sm font-bold hover:bg-white/90 transition-colors touch-target active:scale-95 transform">
656
+ ذخیره
657
+ </button>
658
+ </div>
659
+ </form>
660
+ </div>
661
+ </div>
662
+
663
+ <!-- Room Settings Modal -->
664
+ <div id="room-settings-modal" class="room-settings-modal">
665
+ <div class="room-settings-content">
666
+ <div class="flex justify-between items-center mb-4">
667
+ <h3 class="font-bold text-lg">تنظیمات اتاق</h3>
668
+ <button onclick="closeRoomSettingsModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center">
669
+ <span style="font-size: 20px;">✕</span>
670
+ </button>
671
+ </div>
672
+ <form onsubmit="updateRoomSettings(event)" class="space-y-4">
673
+ <div>
674
+ <label class="block text-xs text-white/60 mb-2">نام اتاق</label>
675
+ <input type="text" id="edit-room-name" placeholder="نام اتاق"
676
+ class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-white/30 focus:outline-none focus:border-white/30 touch-target"
677
+ required>
678
+ </div>
679
+ <div>
680
+ <label class="block text-xs text-white/60 mb-2">رنگ آواتار اتاق</label>
681
+ <div class="avatar-grid">
682
+ <div class="avatar-option" style="background-color: #3b82f620;" onclick="selectRoomColor('#3b82f6')">#</div>
683
+ <div class="avatar-option" style="background-color: #ef444420;" onclick="selectRoomColor('#ef4444')">#</div>
684
+ <div class="avatar-option" style="background-color: #10b98120;" onclick="selectRoomColor('#10b981')">#</div>
685
+ <div class="avatar-option" style="background-color: #f59e0b20;" onclick="selectRoomColor('#f59e0b')">#</div>
686
+ <div class="avatar-option" style="background-color: #8b5cf620;" onclick="selectRoomColor('#8b5cf6')">#</div>
687
+ <div class="avatar-option" style="background-color: #ec489920;" onclick="selectRoomColor('#ec4899')">#</div>
688
+ <div class="avatar-option" style="background-color: #14b8a620;" onclick="selectRoomColor('#14b8a6')">#</div>
689
+ <div class="avatar-option" style="background-color: #f9731620;" onclick="selectRoomColor('#f97316')">#</div>
690
+ </div>
691
+ <input type="hidden" id="edit-room-color" value="#3b82f6">
692
+ </div>
693
+ <div class="danger-zone">
694
+ <h4 class="text-xs font-medium text-red-400 mb-2">منطقه خطر</h4>
695
+ <button type="button" onclick="confirmDeleteRoom()" class="w-full py-3 rounded-xl text-sm font-medium transition-colors touch-target danger-button">
696
+ حذف اتاق
697
+ </button>
698
+ </div>
699
+ <div class="flex gap-3 pt-2">
700
+ <button type="button" onclick="closeRoomSettingsModal()" class="flex-1 py-3 rounded-xl border border-white/10 text-sm hover:bg-white/5 transition-colors touch-target">
701
+ انصراف
702
+ </button>
703
+ <button type="submit" class="flex-1 py-3 rounded-xl bg-white text-slate-900 text-sm font-bold hover:bg-white/90 transition-colors touch-target active:scale-95 transform">
704
+ ذخیره
705
+ </button>
706
+ </div>
707
+ </form>
708
+ </div>
709
+ </div>
710
+
711
+ <!-- Confirmation Modal -->
712
+ <div id="confirm-modal" class="profile-edit-modal">
713
+ <div class="profile-edit-content">
714
+ <div class="flex justify-between items-center mb-4">
715
+ <h3 class="font-bold text-lg" id="confirm-title">تایید حذف</h3>
716
+ <button onclick="closeConfirmModal()" class="text-white/40 hover:text-white touch-target w-10 h-10 flex items-center justify-center">
717
+ <span style="font-size: 20px;">✕</span>
718
+ </button>
719
+ </div>
720
+ <p id="confirm-message" class="mb-6">آیا مطمئن هستید که می‌خواهید این اتاق را حذف کنید؟ این عمل قابل بازگشت نیست.</p>
721
+ <div class="flex gap-3">
722
+ <button onclick="closeConfirmModal()" class="flex-1 py-3 rounded-xl border border-white/10 text-sm hover:bg-white/5 transition-colors touch-target">
723
+ انصراف
724
+ </button>
725
+ <button onclick="executeConfirmedAction()" class="flex-1 py-3 rounded-xl bg-red-600 text-white text-sm font-bold hover:bg-red-500 transition-colors touch-target active:scale-95 transform">
726
+ حذف
727
+ </button>
728
+ </div>
729
+ </div>
730
+ </div>
731
+
732
+ <script>
733
+ // ========== Global Variables ==========
734
+ let currentUser = {
735
+ id: 1,
736
+ name: "کاربر تست",
737
+ phone: "09123456789",
738
+ avatar_color: "#3b82f6"
739
+ };
740
+ let currentRoomId = null;
741
+ let isSidebarOpen = false;
742
+ let messagePollInterval = null;
743
+ let stickerPickerOpen = false;
744
+ let pendingAction = null;
745
+
746
+ // ========== Helper Functions ==========
747
+
748
+ // Show toast notification
749
+ function showToast(message, type = 'info') {
750
+ const container = document.getElementById('toast-container');
751
+ const toast = document.createElement('div');
752
+
753
+ let bgClass = 'bg-white/10';
754
+ let icon = 'ℹ️';
755
+
756
+ if (type === 'success') { bgClass = 'bg-green-500/20 text-green-200 border border-green-500/30'; icon = '✅'; }
757
+ if (type === 'error') { bgClass = 'bg-red-500/20 text-red-200 border border-red-500/30'; icon = '❌'; }
758
+
759
+ toast.className = `${bgClass} px-4 py-3 rounded-xl flex items-center gap-3 text-sm backdrop-blur-md fade-in shadow-lg`;
760
+ toast.innerHTML = `<span>${icon}</span><span class="font-medium">${message}</span>`;
761
+
762
+ container.appendChild(toast);
763
+
764
+ setTimeout(() => {
765
+ toast.style.opacity = '0';
766
+ toast.style.transform = 'translateY(-10px)';
767
+ setTimeout(() => toast.remove(), 300);
768
+ }, 3000);
769
+ }
770
+
771
+ // Simulate API call
772
+ async function apiCall(endpoint, data = null, method = 'POST') {
773
+ // Simulate network delay
774
+ await new Promise(resolve => setTimeout(resolve, 300));
775
+
776
+ // Mock responses for demo purposes
777
+ if (endpoint.includes('auth.php?action=login')) {
778
+ return {
779
+ success: true,
780
+ message: "ورود موفقیت‌آمیز بود",
781
+ data: {
782
+ id: 1,
783
+ name: data.phone === "09123456789" ? "کاربر تست" : "کاربر جدید",
784
+ phone: data.phone,
785
+ avatar_color: "#3b82f6"
786
+ }
787
+ };
788
+ }
789
+
790
+ if (endpoint.includes('auth.php?action=register')) {
791
+ return {
792
+ success: true,
793
+ message: "ثبت‌نام موفقیت‌آمیز بود",
794
+ data: {
795
+ id: 2,
796
+ name: data.name,
797
+ phone: data.phone,
798
+ avatar_color: "#" + Math.floor(Math.random()*16777215).toString(16)
799
+ }
800
+ };
801
+ }
802
+
803
+ if (endpoint.includes('rooms.php?action=list')) {
804
+ return {
805
+ success: true,
806
+ data: {
807
+ created_rooms: [
808
+ { id: 1, name: "گروه دوستان", creator_id: 1, member_count: 3 },
809
+ { id: 2, name: "گروه خانواده", creator_id: 1, member_count: 5 }
810
+ ],
811
+ member_rooms: [
812
+ { id: 3, name: "گروه کاری", creator_id: 2, member_count: 8 }
813
+ ],
814
+ created_count: 2
815
+ }
816
+ };
817
+ }
818
+
819
+ if (endpoint.includes('rooms.php?action=create')) {
820
+ return {
821
+ success: true,
822
+ message: "اتاق با موفقیت ایجاد شد",
823
+ data: {
824
+ id: Math.floor(Math.random() * 1000) + 3,
825
+ name: data.name,
826
+ creator_id: currentUser.id,
827
+ member_count: 1
828
+ }
829
+ };
830
+ }
831
+
832
+ if (endpoint.includes('rooms.php?action=get')) {
833
+ return {
834
+ success: true,
835
+ data: {
836
+ id: parseInt(endpoint.split('=')[1]),
837
+ name: "اتاق تست",
838
+ creator_id: currentUser.id,
839
+ member_count: 3,
840
+ avatar_color: "#3b82f6"
841
+ }
842
+ };
843
+ }
844
+
845
+ if (endpoint.includes('messages.php?action=get')) {
846
+ return {
847
+ success: true,
848
+ data: [
849
+ { id: 1, room_id: 1, user_id: 1, sender_name: "کاربر تست", message: "سلام به همه!", created_at: "2023-05-15 10:30:00" },
850
+ { id: 2, room_id: 1, user_id: 2, sender_name: "کاربر دیگر", message: "سلام! چطوری؟", created_at: "2023-05-15 10:32:00" },
851
+ { id: 3, room_id: 1, user_id: 1, sender_name: "کاربر تست", message: "خوبم ممنون! 😊", created_at: "2023-05-15 10:33:00" }
852
+ ]
853
+ };
854
+ }
855
+
856
+ if (endpoint.includes('messages.php?action=send')) {
857
+ return {
858
+ success: true,
859
+ data: {
860
+ id: Math.floor(Math.random() * 1000) + 10,
861
+ room_id: data.room_id,
862
+ user_id: currentUser.id,
863
+ sender_name: currentUser.name,
864
+ message: data.message,
865
+ created_at: new Date().toISOString()
866
+ }
867
+ };
868
+ }
869
+
870
+ if (endpoint.includes('auth.php?action=logout')) {
871
+ return { success: true };
872
+ }
873
+
874
+ if (endpoint.includes('rooms.php?action=delete')) {
875
+ return { success: true, message: "اتاق با موفقیت حذف شد" };
876
+ }
877
+
878
+ if (endpoint.includes('rooms.php?action=update')) {
879
+ return { success: true, message: "اتاق با موفقیت به‌روزرسانی شد" };
880
+ }
881
+
882
+ if (endpoint.includes('profile.php?action=update')) {
883
+ return { success: true, message: "پروفایل با موفقیت به‌روزرسانی شد" };
884
+ }
885
+
886
+ return { success: false, message: "خطا در ارتباط با سرور" };
887
+ }
888
+
889
+ // Escape HTML
890
+ function escapeHtml(text) {
891
+ const div = document.createElement('div');
892
+ div.textContent = text;
893
+ return div.innerHTML;
894
+ }
895
+
896
+ // Scroll to bottom of messages
897
+ function scrollToBottom() {
898
+ const container = document.getElementById('messages-container');
899
+ if (container) {
900
+ container.scrollTop = container.scrollHeight;
901
+ }
902
+ }
903
+
904
+ // Check if user is near bottom of messages
905
+ function isUserNearBottom() {
906
+ const container = document.getElementById('messages-container');
907
+ if (!container) return false;
908
+ const threshold = 100;
909
+ return container.scrollHeight - container.scrollTop - container.clientHeight < threshold;
910
+ }
911
+
912
+ // ========== Auth Functions ==========
913
+
914
+ async function handleRegister(e) {
915
+ e.preventDefault();
916
+
917
+ const name = document.getElementById('reg-name').value.trim();
918
+ const phone = document.getElementById('reg-phone').value.trim();
919
+ const password = document.getElementById('reg-password').value;
920
+
921
+ if (phone.length < 11) {
922
+ showToast('شماره موبایل صحیح نیست', 'error');
923
+ return;
924
+ }
925
+
926
+ try {
927
+ const result = await apiCall('auth.php?action=register', {
928
+ name: name,
929
+ phone: phone,
930
+ password: password
931
+ });
932
+
933
+ showToast(result.message, 'success');
934
+
935
+ // Simulate login after registration
936
+ currentUser = result.data;
937
+ document.getElementById('auth-view').classList.add('hidden');
938
+ document.getElementById('dashboard-view').classList.remove('hidden');
939
+ updateUserProfile();
940
+ await renderRoomList();
941
+
942
+ } catch (error) {
943
+ showToast(error.message || 'خطا در ثبت‌نام', 'error');
944
+ }
945
+ }
946
+
947
+ async function handleLogin(e) {
948
+ e.preventDefault();
949
+
950
+ const phone = document.getElementById('login-phone').value.trim();
951
+ const password = document.getElementById('login-password').value;
952
+
953
+ try {
954
+ const result = await apiCall('auth.php?action=login', {
955
+ phone: phone,
956
+ password: password
957
+ });
958
+
959
+ currentUser = result.data;
960
+ document.getElementById('auth-view').classList.add('hidden');
961
+ document.getElementById('dashboard-view').classList.remove('hidden');
962
+ updateUserProfile();
963
+ await renderRoomList();
964
+
965
+ showToast(`خوش آمدید ${result.data.name}`, 'success');
966
+
967
+ } catch (error) {
968
+ showToast(error.message || 'خطا در ورود', 'error');
969
+ }
970
+ }
971
+
972
+ async function logout() {
973
+ try {
974
+ await apiCall('auth.php?action=logout');
975
+ document.getElementById('dashboard-view').classList.add('