samirerty commited on
Commit
29f19ce
·
verified ·
1 Parent(s): d026f9a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +415 -667
index.html CHANGED
@@ -3,26 +3,24 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>چت‌روم شیشه‌ای مات | Modern Liquid Glass</title>
7
 
8
- <!-- Importing Vazirmatn Font for Persian -->
9
- <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
10
- <!-- Importing FontAwesome for Icons -->
 
11
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
12
 
13
  <style>
14
  :root {
15
- --bg-dark: #0f172a;
16
- --glass-bg: rgba(30, 41, 59, 0.4);
17
  --glass-border: rgba(255, 255, 255, 0.1);
18
- --glass-shine: rgba(255, 255, 255, 0.05);
19
- --primary: #3b82f6;
20
- --primary-hover: #2563eb;
21
- --text-main: #f8fafc;
22
- --text-muted: #94a3b8;
23
- --danger: #ef4444;
24
- --success: #10b981;
25
- --blur-amount: 24px;
26
  }
27
 
28
  * {
@@ -35,223 +33,175 @@
35
  }
36
 
37
  body {
38
- background-color: var(--bg-dark);
39
- color: var(--text-main);
40
- height: 100vh;
41
- width: 100vw;
42
- overflow: hidden;
43
  display: flex;
44
  justify-content: center;
45
  align-items: center;
 
46
  position: relative;
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
- /* --- Animated Background Orbs --- */
50
- .orb {
51
  position: absolute;
52
  border-radius: 50%;
53
  filter: blur(80px);
54
- z-index: -1;
55
- animation: float 10s infinite ease-in-out alternate;
56
  opacity: 0.6;
 
57
  }
58
 
59
- .orb-1 {
60
- width: 400px;
61
- height: 400px;
62
- background: #4f46e5;
63
- top: -100px;
64
- left: -100px;
 
65
  }
66
 
67
- .orb-2 {
68
- width: 300px;
69
- height: 300px;
70
- background: #ec4899;
71
- bottom: -50px;
72
- right: -50px;
73
  animation-delay: -5s;
74
  }
75
 
76
- .orb-3 {
77
- width: 200px;
78
- height: 200px;
79
- background: #06b6d4;
80
  top: 40%;
81
- left: 50%;
82
- transform: translate(-50%, -50%);
83
- animation: pulse 8s infinite;
 
 
84
  }
85
 
86
  @keyframes float {
87
- 0% { transform: translate(0, 0); }
88
- 100% { transform: translate(30px, 50px); }
89
- }
90
-
91
- @keyframes pulse {
92
- 0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
93
- 50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.6; }
94
- 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
95
- }
96
-
97
- /* --- Glassmorphism Base Class --- */
98
- .glass-panel {
99
- background: var(--glass-bg);
100
- backdrop-filter: blur(var(--blur-amount));
101
- -webkit-backdrop-filter: blur(var(--blur-amount));
102
- border: 1px solid var(--glass-border);
103
- box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
104
- }
105
-
106
- /* --- Header / Brand --- */
107
- .header-brand {
108
- position: absolute;
109
- top: 20px;
110
- left: 20px;
111
- z-index: 100;
112
- font-size: 0.9rem;
113
- color: var(--text-muted);
114
- text-decoration: none;
115
- transition: color 0.3s;
116
  }
117
- .header-brand:hover { color: var(--text-main); }
118
 
119
- /* --- Login Container --- */
120
  .login-container {
121
- width: 100%;
122
  max-width: 420px;
123
- padding: 2.5rem;
 
 
 
124
  border-radius: 24px;
 
 
125
  text-align: center;
126
- transition: all 0.4s ease;
127
- display: flex; /* Initially visible */
128
- flex-direction: column;
129
- gap: 1.5rem;
130
  position: relative;
131
- z-index: 10;
132
  }
133
 
134
- .app-logo {
135
- font-size: 3rem;
136
- background: linear-gradient(135deg, #60a5fa, #c084fc);
137
- -webkit-background-clip: text;
138
- -webkit-text-fill-color: transparent;
139
- margin-bottom: 0.5rem;
140
  }
141
 
142
- .title {
143
- font-size: 1.5rem;
144
  font-weight: 700;
145
- margin-bottom: 0.5rem;
 
 
 
146
  }
147
 
148
- .subtitle {
149
- font-size: 0.9rem;
150
  color: var(--text-muted);
 
151
  }
152
 
153
- /* --- Forms & Inputs --- */
154
  .input-group {
 
155
  position: relative;
156
- margin-bottom: 1rem;
157
  text-align: right;
158
  }
159
 
160
  .input-group i {
161
  position: absolute;
162
- right: 16px;
163
  top: 50%;
 
164
  transform: translateY(-50%);
165
  color: var(--text-muted);
166
  transition: color 0.3s;
167
  }
168
 
169
- .input-field {
170
  width: 100%;
171
- padding: 14px 45px 14px 16px;
172
- background: rgba(15, 23, 42, 0.4);
173
  border: 1px solid var(--glass-border);
174
  border-radius: 12px;
175
- color: white;
 
176
  font-size: 1rem;
177
- transition: all 0.3s;
178
  }
179
 
180
- .input-field:focus {
181
- border-color: var(--primary);
182
- background: rgba(15, 23, 42, 0.6);
183
- box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
184
  }
185
 
186
- .input-field:focus + i {
187
- color: var(--primary);
188
  }
189
 
190
- /* --- Custom Checkbox / Captcha --- */
191
- .captcha-container {
192
  display: flex;
193
  align-items: center;
194
  justify-content: space-between;
195
- background: rgba(0,0,0,0.2);
196
- padding: 10px 15px;
197
- border-radius: 12px;
198
- margin-bottom: 1.5rem;
199
  border: 1px solid var(--glass-border);
200
- cursor: pointer;
201
- user-select: none;
202
- transition: background 0.3s;
203
- }
204
- .captcha-container:hover { background: rgba(0,0,0,0.3); }
205
-
206
- .captcha-checkbox {
207
- width: 24px;
208
- height: 24px;
209
- border: 2px solid var(--text-muted);
210
- border-radius: 6px;
211
- display: flex;
212
- align-items: center;
213
- justify-content: center;
214
- margin-left: 10px;
215
- transition: all 0.3s;
216
- }
217
-
218
- .captcha-checkbox.checked {
219
- background: var(--success);
220
- border-color: var(--success);
221
- }
222
-
223
- .captcha-checkbox i {
224
- font-size: 14px;
225
- color: white;
226
- transform: scale(0);
227
- transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
228
  }
229
-
230
- .captcha-checkbox.checked i {
231
- transform: scale(1);
 
 
 
 
232
  }
233
 
234
- .captcha-text {
235
- flex-grow: 1;
236
- font-size: 0.9rem;
237
- display: flex;
238
- align-items: center;
239
- gap: 8px;
 
 
240
  }
241
 
242
- .captcha-spinner {
243
- width: 20px;
244
- height: 20px;
245
- border: 2px solid var(--text-muted);
246
- border-top-color: transparent;
247
- border-radius: 50%;
248
- animation: spin 1s linear infinite;
249
- display: none;
250
  }
251
 
252
- @keyframes spin { to { transform: rotate(360deg); } }
253
-
254
- /* --- Buttons --- */
255
  .btn {
256
  width: 100%;
257
  padding: 14px;
@@ -260,273 +210,91 @@
260
  font-size: 1rem;
261
  font-weight: 600;
262
  cursor: pointer;
263
- transition: all 0.3s;
264
  display: flex;
265
  align-items: center;
266
  justify-content: center;
267
- gap: 8px;
268
  }
269
 
270
  .btn-primary {
271
- background: linear-gradient(135deg, var(--primary), #6366f1);
272
  color: white;
273
- box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
274
  }
275
 
276
  .btn-primary:hover {
277
  transform: translateY(-2px);
278
- box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
 
 
 
 
279
  }
280
 
281
- .btn-primary:active { transform: translateY(0); }
282
- .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
 
 
 
 
 
283
 
284
- .btn-ghost {
285
  background: transparent;
286
  color: var(--text-muted);
287
- font-size: 0.85rem;
288
- padding: 5px;
289
  }
290
- .btn-ghost:hover { color: var(--primary); text-decoration: underline; }
291
 
292
- /* --- Auth Steps Transitions --- */
293
- .auth-step {
 
 
 
 
 
294
  display: none;
295
- animation: fadeIn 0.4s ease;
 
 
 
 
296
  }
297
- .auth-step.active { display: block; }
298
 
299
  @keyframes fadeIn {
300
  from { opacity: 0; transform: translateY(10px); }
301
  to { opacity: 1; transform: translateY(0); }
302
  }
303
 
 
304
  .timer-text {
305
  font-size: 0.85rem;
306
  color: var(--text-muted);
307
- margin-top: 10px;
308
- display: flex;
309
- justify-content: space-between;
310
- align-items: center;
311
- }
312
-
313
- /* --- Chat Room Layout --- */
314
- #chat-room {
315
- display: none; /* Hidden initially */
316
- width: 95vw;
317
- height: 90vh;
318
- border-radius: 24px;
319
- overflow: hidden;
320
- flex-direction: row;
321
- position: relative;
322
- animation: scaleUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
323
- }
324
-
325
- @keyframes scaleUp {
326
- from { opacity: 0; transform: scale(0.95); }
327
- to { opacity: 1; transform: scale(1); }
328
- }
329
-
330
- /* Sidebar */
331
- .sidebar {
332
- width: 280px;
333
- border-left: 1px solid var(--glass-border);
334
- display: flex;
335
- flex-direction: column;
336
- background: rgba(0,0,0,0.2);
337
- }
338
-
339
- .sidebar-header {
340
- padding: 20px;
341
- border-bottom: 1px solid var(--glass-border);
342
- display: flex;
343
- align-items: center;
344
- justify-content: space-between;
345
- }
346
-
347
- .user-profile-mini {
348
- display: flex;
349
- align-items: center;
350
- gap: 10px;
351
- }
352
-
353
- .avatar {
354
- width: 40px;
355
- height: 40px;
356
- border-radius: 50%;
357
- object-fit: cover;
358
- border: 2px solid var(--primary);
359
- }
360
-
361
- .search-bar {
362
- padding: 15px;
363
- }
364
- .search-input {
365
- width: 100%;
366
- background: rgba(255,255,255,0.05);
367
- border: none;
368
- padding: 10px 15px;
369
- border-radius: 10px;
370
- color: white;
371
- font-size: 0.9rem;
372
- }
373
-
374
- .chat-list {
375
- flex-grow: 1;
376
- overflow-y: auto;
377
- padding: 10px;
378
  }
379
 
380
- /* Custom Scrollbar */
381
- ::-webkit-scrollbar { width: 6px; }
382
- ::-webkit-scrollbar-track { background: transparent; }
383
- ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
384
- ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
385
-
386
- .chat-item {
387
- display: flex;
388
- align-items: center;
389
- gap: 12px;
390
- padding: 12px;
391
- border-radius: 12px;
392
- cursor: pointer;
393
- transition: background 0.2s;
394
- margin-bottom: 5px;
395
- }
396
-
397
- .chat-item:hover, .chat-item.active {
398
- background: rgba(255,255,255,0.08);
399
- }
400
-
401
- .chat-info h4 { font-size: 0.95rem; margin-bottom: 4px; }
402
- .chat-info p { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
403
-
404
- /* Main Chat Area */
405
- .chat-area {
406
- flex-grow: 1;
407
- display: flex;
408
- flex-direction: column;
409
- position: relative;
410
- }
411
-
412
- .chat-top-bar {
413
- padding: 15px 25px;
414
- border-bottom: 1px solid var(--glass-border);
415
- display: flex;
416
- align-items: center;
417
- justify-content: space-between;
418
- background: rgba(30, 41, 59, 0.2);
419
- }
420
-
421
- .chat-top-info {
422
- display: flex;
423
- flex-direction: column;
424
- }
425
- .chat-top-name { font-weight: 700; }
426
- .chat-top-status { font-size: 0.75rem; color: var(--success); }
427
-
428
- .messages-container {
429
- flex-grow: 1;
430
- padding: 20px;
431
- overflow-y: auto;
432
- display: flex;
433
- flex-direction: column;
434
- gap: 15px;
435
  }
436
 
437
- .message {
438
- max-width: 70%;
439
- padding: 12px 16px;
440
- border-radius: 18px;
441
- font-size: 0.95rem;
442
- line-height: 1.5;
443
- position: relative;
444
- animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
445
  }
446
 
447
  @keyframes popIn {
448
- from { transform: scale(0.8); opacity: 0; }
449
- to { transform: scale(1); opacity: 1; }
450
- }
451
-
452
- .message.received {
453
- align-self: flex-start;
454
- background: rgba(255, 255, 255, 0.1);
455
- color: var(--text-main);
456
- border-bottom-right-radius: 4px;
457
- }
458
-
459
- .message.sent {
460
- align-self: flex-end;
461
- background: var(--primary);
462
- color: white;
463
- border-bottom-left-radius: 4px;
464
- box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
465
- }
466
-
467
- .message-time {
468
- font-size: 0.7rem;
469
- margin-top: 5px;
470
- opacity: 0.7;
471
- text-align: left;
472
- }
473
-
474
- .input-area {
475
- padding: 20px;
476
- background: rgba(15, 23, 42, 0.3);
477
- border-top: 1px solid var(--glass-border);
478
- display: flex;
479
- align-items: center;
480
- gap: 15px;
481
- }
482
-
483
- .attach-btn {
484
- width: 40px;
485
- height: 40px;
486
- border-radius: 50%;
487
- border: none;
488
- background: rgba(255,255,255,0.05);
489
- color: var(--text-muted);
490
- cursor: pointer;
491
- transition: all 0.2s;
492
- display: flex;
493
- align-items: center;
494
- justify-content: center;
495
- }
496
- .attach-btn:hover { background: rgba(255,255,255,0.1); color: white; }
497
-
498
- .message-input {
499
- flex-grow: 1;
500
- background: rgba(255,255,255,0.05);
501
- border: 1px solid var(--glass-border);
502
- padding: 12px 20px;
503
- border-radius: 25px;
504
- color: white;
505
- resize: none;
506
- height: 45px;
507
- line-height: 20px;
508
- transition: all 0.3s;
509
  }
510
-
511
- .message-input:focus { background: rgba(0,0,0,0.2); border-color: var(--primary); }
512
 
513
- .send-btn {
514
- width: 45px;
515
- height: 45px;
516
- border-radius: 50%;
517
- border: none;
518
- background: var(--primary);
519
- color: white;
520
- cursor: pointer;
521
- display: flex;
522
- align-items: center;
523
- justify-content: center;
524
- transition: transform 0.2s;
525
- }
526
- .send-btn:hover { transform: scale(1.1); background: var(--primary-hover); }
527
- .send-btn:active { transform: scale(0.95); }
528
-
529
- /* --- Toast Notification --- */
530
  .toast-container {
531
  position: fixed;
532
  top: 20px;
@@ -539,372 +307,352 @@
539
  }
540
 
541
  .toast {
 
 
 
542
  padding: 12px 24px;
543
  border-radius: 50px;
544
- color: white;
545
- font-size: 0.9rem;
546
- box-shadow: 0 4px 12px rgba(0,0,0,0.3);
547
  display: flex;
548
  align-items: center;
549
  gap: 10px;
550
- animation: slideDown 0.3s ease;
 
 
 
 
 
 
 
 
551
  }
552
 
553
- .toast.error { background: rgba(239, 68, 68, 0.9); }
554
- .toast.success { background: rgba(16, 185, 129, 0.9); }
555
- .toast.info { background: rgba(59, 130, 246, 0.9); }
556
 
557
- @keyframes slideDown {
558
- from { transform: translateY(-20px); opacity: 0; }
559
- to { transform: translateY(0); opacity: 1; }
 
 
 
 
 
 
 
560
  }
561
 
562
- /* --- Responsive Design --- */
563
- @media (max-width: 768px) {
564
- .login-container { padding: 1.5rem; width: 90%; }
565
- .sidebar { display: none; /* Hide sidebar on mobile for simplicity */ }
566
- #chat-room { width: 100%; height: 100%; border-radius: 0; }
567
- .top-bar-back-btn { display: block; }
568
  }
569
-
570
- .top-bar-back-btn { display: none; background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; }
571
 
 
 
 
 
 
 
 
 
 
 
572
  </style>
573
  </head>
574
  <body>
575
 
576
- <!-- Background Orbs -->
577
- <div class="orb orb-1"></div>
578
- <div class="orb orb-2"></div>
579
- <div class="orb orb-3"></div>
580
-
581
- <!-- Branding Link -->
582
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="header-brand">
583
- Built with anycoder <i class="fas fa-external-link-alt" style="font-size: 0.7em;"></i>
584
  </a>
585
 
586
- <!-- Toast Container -->
 
 
 
 
 
 
 
587
  <div class="toast-container" id="toastContainer"></div>
588
 
589
- <!-- LOGIN / AUTH SECTION -->
590
- <div class="glass-panel login-container" id="loginSection">
591
- <div class="app-logo"><i class="fas fa-comment-dots"></i></div>
592
- <h1 class="title">ورود به حساب</h1>
593
- <p class="subtitle">به چت‌روم شیشه‌ای خوش آمدید</p>
594
-
595
- <!-- Step 1: Phone & Captcha -->
596
- <div id="step1" class="auth-step active">
597
- <div class="captcha-container" id="captchaBox" onclick="toggleCaptcha()">
598
- <div class="captcha-checkbox" id="captchaCheck">
599
- <i class="fas fa-check"></i>
600
  </div>
601
- <div class="captcha-text">
602
- <spanن ربات نیستم</span>
603
- <div class="captcha-spinner" id="captchaSpinner"></div>
 
 
 
 
 
604
  </div>
605
- <i class="fas fa-robot" style="color: var(--text-muted);"></i>
606
- </div>
607
 
608
- <div class="input-group">
609
- <input type="tel" id="phoneInput" class="input-field" placeholder="شماره موبایل (مثال: 09123456789)" maxlength="11">
610
- <i class="fas fa-mobile-alt"></i>
611
- </div>
 
612
 
613
- <button class="btn btn-primary" onclick="sendCode()">
614
- دریافت کد تایید <i class="fas fa-paper-plane"></i>
615
- </button>
 
 
616
  </div>
617
 
618
- <!-- Step 2: Verify Code -->
619
- <div id="step2" class="auth-step">
620
- <div class="input-group">
621
- <input type="text" id="otpInput" class="input-field" placeholder="کد ۵ رقمی را وارد کنید" maxlength="5" style="letter-spacing: 5px; text-align: center; direction: ltr;">
622
- <i class="fas fa-shield-alt"></i>
623
- </div>
 
 
 
 
 
 
 
 
 
624
 
625
- <button class="btn btn-primary" id="verifyBtn" onclick="verifyCode()">
626
- تایید و ورود <i class="fas fa-sign-in-alt"></i>
627
- </button>
 
 
628
 
629
- <div class="timer-text">
630
- <span id="timerDisplay">02:00</span>
631
- <button class="btn-ghost" id="resendBtn" onclick="sendCode()" disabled>ارسال مجدد کد</button>
632
  </div>
633
 
634
- <button class="btn-ghost" onclick="resetAuth()" style="margin-top: 10px;">
635
- <i class="fas fa-arrow-right"></i> تغییر شماره
 
 
 
 
636
  </button>
637
  </div>
638
- </div>
639
 
640
- <!-- CHAT ROOM SECTION -->
641
- <div class="glass-panel" id="chat-room">
642
- <!-- Sidebar -->
643
- <aside class="sidebar">
644
- <div class="sidebar-header">
645
- <div class="user-profile-mini">
646
- <img src="https://picsum.photos/seed/user1/100/100" class="avatar" alt="User">
647
- <div style="font-size: 0.9rem; font-weight: bold;">کاربر من</div>
648
- </div>
649
- <div style="display: flex; gap: 10px;">
650
- <i class="fas fa-cog" style="color: var(--text-muted); cursor: pointer;"></i>
651
- <i class="fas fa-edit" style="color: var(--text-muted); cursor: pointer;"></i>
652
- </div>
653
  </div>
 
 
654
 
655
- <div class="search-bar">
656
- <input type="text" class="search-input" placeholder="جستجو...">
657
- </div>
658
-
659
- <div class="chat-list">
660
- <div class="chat-item active">
661
- <img src="https://picsum.photos/seed/tech/100/100" class="avatar" style="border-color: var(--success);">
662
- <div class="chat-info">
663
- <h4>گروه برنامه‌نویسی</h4>
664
- <p>علی: پروژه جدید کی شروع میشه؟</p>
665
- </div>
666
- <span style="font-size: 0.7rem; color: var(--text-muted); margin-right: auto;">10:30</span>
667
- </div>
668
- <div class="chat-item">
669
- <img src="https://picsum.photos/seed/friend/100/100" class="avatar">
670
- <div class="chat-info">
671
- <h4>سارا احمدی</h4>
672
- <p>سلام، چطوری؟</p>
673
- </div>
674
- </div>
675
- <div class="chat-item">
676
- <img src="https://picsum.photos/seed/work/100/100" class="avatar">
677
- <div class="chat-info">
678
- <h4>اتاق گفتگوی عمومی</h4>
679
- <p>پیام جدیدی وجود ندارد</p>
680
- </div>
681
- </div>
682
- </div>
683
- </aside>
684
-
685
- <!-- Main Chat -->
686
- <main class="chat-area">
687
- <div class="chat-top-bar">
688
- <div style="display: flex; align-items: center; gap: 15px;">
689
- <button class="top-bar-back-btn"><i class="fas fa-arrow-right"></i></button>
690
- <img src="https://picsum.photos/seed/tech/100/100" class="avatar" style="width: 35px; height: 35px; border-color: var(--success);">
691
- <div class="chat-top-info">
692
- <span class="chat-top-name">گروه برنامه‌نویسی</span>
693
- <span class="chat-top-status"><i class="fas fa-circle" style="font-size: 8px;"></i> آنلاین</span>
694
- </div>
695
- </div>
696
- <div>
697
- <i class="fas fa-phone" style="margin-left: 15px; cursor: pointer; color: var(--text-muted);"></i>
698
- <i class="fas fa-video" style="margin-left: 15px; cursor: pointer; color: var(--text-muted);"></i>
699
- <i class="fas fa-ellipsis-v" style="cursor: pointer; color: var(--text-muted);"></i>
700
- </div>
701
- </div>
702
-
703
- <div class="messages-container" id="messagesList">
704
- <div style="text-align: center; font-size: 0.8rem; color: var(--text-muted); margin: 10px 0;">امروز</div>
705
- <div class="message received">
706
- سلام به همه! خوشحالم که اینجا هستید.
707
- <div class="message-time">09:15</div>
708
- </div>
709
- <div class="message sent">
710
- سلام وقت بخیر، منم خوشحالم.
711
- <div class="message-time">09:16</div>
712
- </div>
713
- <div class="message received">
714
- کسی درباره استایل جدید Liquid Glass چیزی می‌دونه؟
715
- <div class="message-time">09:18</div>
716
- </div>
717
- <div class="message sent">
718
- آره، خیلی ترند شده. توی همین صفحه هم داریم ازش استفاده می‌کنیم!
719
- <div class="message-time">09:20</div>
720
- </div>
721
- </div>
722
 
723
- <div class="input-area">
724
- <button class="attach-btn"><i class="fas fa-paperclip"></i></button>
725
- <button class="attach-btn"><i class="far fa-smile"></i></button>
726
- <input type="text" class="message-input" id="msgInput" placeholder="پیام خود را بنویسید..." onkeypress="handleEnter(event)">
727
- <button class="send-btn" onclick="sendMessage()"><i class="fas fa-paper-plane"></i></button>
728
- </div>
729
- </main>
730
- </div>
731
 
732
  <script>
733
- // --- State Management ---
734
- let captchaVerified = false;
735
- let phoneNumber = "";
736
  let countdownInterval;
737
- const RESEND_TIME = 120; // 2 minutes in seconds
738
-
739
- // --- DOM Elements ---
740
- const loginSection = document.getElementById('loginSection');
741
- const chatRoom = document.getElementById('chat-room');
742
- const step1 = document.getElementById('step1');
743
- const step2 = document.getElementById('step2');
744
- const captchaBox = document.getElementById('captchaBox');
745
- const captchaCheck = document.getElementById('captchaCheck');
746
- const captchaSpinner = document.getElementById('captchaSpinner');
747
  const phoneInput = document.getElementById('phoneInput');
 
 
 
748
  const otpInput = document.getElementById('otpInput');
749
- const timerDisplay = document.getElementById('timerDisplay');
 
750
  const resendBtn = document.getElementById('resendBtn');
751
- const messagesList = document.getElementById('messagesList');
752
- const msgInput = document.getElementById('msgInput');
753
 
754
- // --- Functions ---
 
 
 
755
 
 
 
 
756
  function showToast(message, type = 'info') {
757
  const container = document.getElementById('toastContainer');
758
  const toast = document.createElement('div');
759
  toast.className = `toast ${type}`;
760
 
761
- let icon = 'info-circle';
762
- if (type === 'success') icon = 'check-circle';
763
- if (type === 'error') icon = 'exclamation-circle';
764
 
765
- toast.innerHTML = `<i class="fas fa-${icon}"></i> ${message}`;
 
766
  container.appendChild(toast);
 
 
 
 
 
767
 
 
768
  setTimeout(() => {
769
- toast.style.opacity = '0';
770
  setTimeout(() => toast.remove(), 300);
771
  }, 3000);
772
  }
773
 
774
- function toggleCaptcha() {
775
- if (captchaVerified) return; // Already verified
 
 
 
 
 
 
776
 
777
- captchaSpinner.style.display = 'block';
778
-
779
- // Simulate API check delay
780
- setTimeout(() => {
781
- captchaSpinner.style.display = 'none';
782
- captchaCheck.classList.add('checked');
783
- captchaVerified = true;
784
- showToast('ربات نبودن شما تایید شد', 'success');
785
- }, 800);
786
  }
787
 
788
- function sendCode() {
789
- // Validation Step 1
790
- if (!captchaVerified) {
791
- showToast('لطفاً تیک "من ربات نیستم" را بزنید', 'error');
792
- return;
793
- }
 
794
 
 
 
 
 
795
  const phone = phoneInput.value.trim();
796
- const phoneRegex = /^09\d{9}$/;
797
 
798
- if (!phoneRegex.test(phone)) {
799
- showToast('شماره موبایل نامعتبر است (۱۰ رقمی با ۰۹)', 'error');
 
 
800
  return;
801
  }
802
 
803
- phoneNumber = phone;
804
-
805
- // Simulate Sending Code
806
- showToast(`کد تایید برای ${phoneNumber} ارسال شد`, 'success');
807
-
808
- // Switch Step
809
- step1.classList.remove('active');
810
- step2.classList.add('active');
 
 
 
 
811
 
 
812
  startTimer();
813
- }
814
-
815
- function startTimer() {
816
- let timeLeft = RESEND_TIME;
817
- resendBtn.disabled = true;
818
- resendBtn.style.opacity = '0.5';
819
- resendBtn.style.cursor = 'not-allowed';
820
-
821
- clearInterval(countdownInterval);
822
 
823
- countdownInterval = setInterval(() => {
824
- const minutes = Math.floor(timeLeft / 60);
825
- const seconds = timeLeft % 60;
826
-
827
- timerDisplay.textContent = `0${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
828
-
829
- if (timeLeft <= 0) {
830
- clearInterval(countdownInterval);
831
- timerDisplay.textContent = "ارسال مجدد";
832
- resendBtn.disabled = false;
833
- resendBtn.style.opacity = '1';
834
- resendBtn.style.cursor = 'pointer';
835
- }
836
- timeLeft--;
837
- }, 1000);
838
  }
839
 
840
- function verifyCode() {
 
 
841
  const code = otpInput.value.trim();
842
-
843
  if (code.length < 4) {
844
  showToast('کد تایید نامعتبر است', 'error');
845
  return;
846
  }
847
 
848
- // Simulate Verification Success
849
- showToast('ورود موفقیت‌آمیز!', 'success');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
 
851
- // Transition to Chat
852
- setTimeout(() => {
853
- loginSection.style.display = 'none';
854
- chatRoom.style.display = 'flex';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
855
  }, 1000);
856
  }
857
 
858
- function resetAuth() {
859
- step2.classList.remove('active');
860
- step1.classList.add('active');
861
- clearInterval(countdownInterval);
862
- otpInput.value = '';
863
- }
864
 
865
- // --- Chat Functions ---
 
 
 
 
866
 
867
- function handleEnter(e) {
868
- if (e.key === 'Enter') sendMessage();
 
 
 
869
  }
870
 
871
- function sendMessage() {
872
- const text = msgInput.value.trim();
873
- if (!text) return;
 
874
 
875
- // Add User Message
876
- addMessage(text, 'sent');
877
- msgInput.value = '';
 
878
 
879
- // Simulate Auto Reply
880
- setTimeout(() => {
881
- const replies = [
882
- "جالب بود!",
883
- "می‌شه بیشتر توضیح بدی؟",
884
- "باشه، حتما.",
885
- "من موافقم.",
886
- "الان سرم شلوغه، بعدا صحبت می‌کنیم."
887
- ];
888
- const randomReply = replies[Math.floor(Math.random() * replies.length)];
889
- addMessage(randomReply, 'received');
890
- }, 2000 + Math.random() * 2000);
891
- }
892
-
893
- function addMessage(text, type) {
894
- const msgDiv = document.createElement('div');
895
- msgDiv.className = `message ${type}`;
896
-
897
- const now = new Date();
898
- const timeString = `${now.getHours()}:${now.getMinutes() < 10 ? '0' : ''}${now.getMinutes()}`;
899
-
900
- msgDiv.innerHTML = `
901
- ${text}
902
- <div class="message-time">${timeString}</div>
903
- `;
904
-
905
- messagesList.appendChild(msgDiv);
906
- messagesList.scrollTop = messagesList.scrollHeight;
907
- }
908
 
909
  </script>
910
  </body>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ورود با شیشه مایع</title>
7
 
8
+ <!-- فونت وزیرمتن برای ظاهر فارسی زیبا -->
9
+ <link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet" type="text/css" />
10
+
11
+ <!-- آیکون‌های FontAwesome -->
12
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
13
 
14
  <style>
15
  :root {
16
+ --glass-bg: rgba(255, 255, 255, 0.05);
 
17
  --glass-border: rgba(255, 255, 255, 0.1);
18
+ --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
19
+ --primary-color: #0a84ff;
20
+ --text-color: #ffffff;
21
+ --text-muted: #a1a1aa;
22
+ --error-color: #ff453a;
23
+ --success-color: #30d158;
 
 
24
  }
25
 
26
  * {
 
33
  }
34
 
35
  body {
36
+ background-color: #000;
37
+ min-height: 100vh;
 
 
 
38
  display: flex;
39
  justify-content: center;
40
  align-items: center;
41
+ overflow: hidden;
42
  position: relative;
43
+ color: var(--text-color);
44
+ }
45
+
46
+ /* پس‌زمینه متحرک و گرادینت دارک */
47
+ .background-blobs {
48
+ position: absolute;
49
+ top: 0;
50
+ left: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ z-index: -1;
54
+ overflow: hidden;
55
  }
56
 
57
+ .blob {
 
58
  position: absolute;
59
  border-radius: 50%;
60
  filter: blur(80px);
 
 
61
  opacity: 0.6;
62
+ animation: float 10s infinite ease-in-out;
63
  }
64
 
65
+ .blob-1 {
66
+ top: -10%;
67
+ left: -10%;
68
+ width: 50vw;
69
+ height: 50vw;
70
+ background: radial-gradient(circle, #4f2d7f, #000);
71
+ animation-delay: 0s;
72
  }
73
 
74
+ .blob-2 {
75
+ bottom: -10%;
76
+ right: -10%;
77
+ width: 60vw;
78
+ height: 60vw;
79
+ background: radial-gradient(circle, #0f4c75, #000);
80
  animation-delay: -5s;
81
  }
82
 
83
+ .blob-3 {
 
 
 
84
  top: 40%;
85
+ left: 40%;
86
+ width: 30vw;
87
+ height: 30vw;
88
+ background: radial-gradient(circle, #1a1a2e, #000);
89
+ animation-duration: 15s;
90
  }
91
 
92
  @keyframes float {
93
+ 0%, 100% { transform: translate(0, 0) scale(1); }
94
+ 50% { transform: translate(20px, -20px) scale(1.1); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
 
96
 
97
+ /* کانتینر اصلی شیشه‌ای */
98
  .login-container {
99
+ width: 90%;
100
  max-width: 420px;
101
+ background: var(--glass-bg);
102
+ backdrop-filter: blur(20px);
103
+ -webkit-backdrop-filter: blur(20px);
104
+ border: 1px solid var(--glass-border);
105
  border-radius: 24px;
106
+ box-shadow: var(--glass-shadow);
107
+ padding: 40px 30px;
108
  text-align: center;
109
+ transition: height 0.3s ease;
 
 
 
110
  position: relative;
111
+ overflow: hidden;
112
  }
113
 
114
+ /* هدر */
115
+ .header {
116
+ margin-bottom: 30px;
 
 
 
117
  }
118
 
119
+ .header h1 {
120
+ font-size: 1.8rem;
121
  font-weight: 700;
122
+ margin-bottom: 10px;
123
+ background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
124
+ -webkit-background-clip: text;
125
+ -webkit-text-fill-color: transparent;
126
  }
127
 
128
+ .header p {
 
129
  color: var(--text-muted);
130
+ font-size: 0.9rem;
131
  }
132
 
133
+ /* استایل فرم‌ها و ورودی‌ها */
134
  .input-group {
135
+ margin-bottom: 20px;
136
  position: relative;
 
137
  text-align: right;
138
  }
139
 
140
  .input-group i {
141
  position: absolute;
 
142
  top: 50%;
143
+ right: 15px;
144
  transform: translateY(-50%);
145
  color: var(--text-muted);
146
  transition: color 0.3s;
147
  }
148
 
149
+ .input-group input {
150
  width: 100%;
151
+ background: rgba(0, 0, 0, 0.2);
 
152
  border: 1px solid var(--glass-border);
153
  border-radius: 12px;
154
+ padding: 14px 45px 14px 15px;
155
+ color: #fff;
156
  font-size: 1rem;
157
+ transition: all 0.3s ease;
158
  }
159
 
160
+ .input-group input:focus {
161
+ border-color: var(--primary-color);
162
+ background: rgba(0, 0, 0, 0.4);
163
+ box-shadow: 0 0 15px rgba(10, 132, 255, 0.2);
164
  }
165
 
166
+ .input-group input:focus + i {
167
+ color: var(--primary-color);
168
  }
169
 
170
+ /* بخش کپچا */
171
+ .captcha-box {
172
  display: flex;
173
  align-items: center;
174
  justify-content: space-between;
175
+ background: rgba(255, 255, 255, 0.03);
 
 
 
176
  border: 1px solid var(--glass-border);
177
+ border-radius: 12px;
178
+ padding: 10px 15px;
179
+ margin-bottom: 25px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
181
+
182
+ .captcha-question {
183
+ font-size: 1.1rem;
184
+ font-weight: bold;
185
+ letter-spacing: 2px;
186
+ user-select: none;
187
+ color: #d1d5db;
188
  }
189
 
190
+ .captcha-input {
191
+ background: transparent;
192
+ border: none;
193
+ color: white;
194
+ width: 60px;
195
+ text-align: center;
196
+ font-size: 1.1rem;
197
+ border-bottom: 1px solid var(--glass-border);
198
  }
199
 
200
+ .captcha-input:focus {
201
+ border-bottom-color: var(--primary-color);
 
 
 
 
 
 
202
  }
203
 
204
+ /* دکمه‌ها */
 
 
205
  .btn {
206
  width: 100%;
207
  padding: 14px;
 
210
  font-size: 1rem;
211
  font-weight: 600;
212
  cursor: pointer;
213
+ transition: all 0.3s ease;
214
  display: flex;
215
  align-items: center;
216
  justify-content: center;
217
+ gap: 10px;
218
  }
219
 
220
  .btn-primary {
221
+ background: linear-gradient(135deg, var(--primary-color), #0062cc);
222
  color: white;
223
+ box-shadow: 0 4px 15px rgba(10, 132, 255, 0.3);
224
  }
225
 
226
  .btn-primary:hover {
227
  transform: translateY(-2px);
228
+ box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
229
+ }
230
+
231
+ .btn-primary:active {
232
+ transform: translateY(0);
233
  }
234
 
235
+ .btn-primary:disabled {
236
+ background: #333;
237
+ color: #666;
238
+ cursor: not-allowed;
239
+ transform: none;
240
+ box-shadow: none;
241
+ }
242
 
243
+ .btn-link {
244
  background: transparent;
245
  color: var(--text-muted);
246
+ margin-top: 15px;
247
+ font-size: 0.9rem;
248
  }
 
249
 
250
+ .btn-link:hover {
251
+ color: white;
252
+ text-decoration: underline;
253
+ }
254
+
255
+ /* مدیریت مراحل (Steps) */
256
+ .step {
257
  display: none;
258
+ animation: fadeIn 0.5s ease;
259
+ }
260
+
261
+ .step.active {
262
+ display: block;
263
  }
 
264
 
265
  @keyframes fadeIn {
266
  from { opacity: 0; transform: translateY(10px); }
267
  to { opacity: 1; transform: translateY(0); }
268
  }
269
 
270
+ /* تایمر ارسال مجدد کد */
271
  .timer-text {
272
  font-size: 0.85rem;
273
  color: var(--text-muted);
274
+ margin-top: 15px;
275
+ min-height: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  }
277
 
278
+ .timer-text span {
279
+ color: var(--primary-color);
280
+ font-weight: bold;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
282
 
283
+ /* صفحه موفقیت */
284
+ .success-icon {
285
+ font-size: 4rem;
286
+ color: var(--success-color);
287
+ margin-bottom: 20px;
288
+ animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
 
 
289
  }
290
 
291
  @keyframes popIn {
292
+ 0% { transform: scale(0); }
293
+ 80% { transform: scale(1.2); }
294
+ 100% { transform: scale(1); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
 
 
296
 
297
+ /* Toast Notification */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  .toast-container {
299
  position: fixed;
300
  top: 20px;
 
307
  }
308
 
309
  .toast {
310
+ background: rgba(20, 20, 20, 0.9);
311
+ backdrop-filter: blur(10px);
312
+ color: white;
313
  padding: 12px 24px;
314
  border-radius: 50px;
315
+ box-shadow: 0 5px 15px rgba(0,0,0,0.5);
316
+ border: 1px solid var(--glass-border);
 
317
  display: flex;
318
  align-items: center;
319
  gap: 10px;
320
+ font-size: 0.9rem;
321
+ opacity: 0;
322
+ transform: translateY(-20px);
323
+ transition: all 0.3s ease;
324
+ }
325
+
326
+ .toast.show {
327
+ opacity: 1;
328
+ transform: translateY(0);
329
  }
330
 
331
+ .toast.error i { color: var(--error-color); }
332
+ .toast.success i { color: var(--success-color); }
333
+ .toast.info i { color: var(--primary-color); }
334
 
335
+ /* لینک اجباری AnyCoder */
336
+ .anycoder-link {
337
+ position: absolute;
338
+ top: 15px;
339
+ left: 15px;
340
+ font-size: 0.8rem;
341
+ color: rgba(255, 255, 255, 0.3);
342
+ text-decoration: none;
343
+ transition: color 0.3s;
344
+ z-index: 10;
345
  }
346
 
347
+ .anycoder-link:hover {
348
+ color: var(--primary-color);
 
 
 
 
349
  }
 
 
350
 
351
+ /* ریسپانسیو */
352
+ @media (max-width: 480px) {
353
+ .login-container {
354
+ width: 95%;
355
+ padding: 30px 20px;
356
+ }
357
+ .header h1 {
358
+ font-size: 1.5rem;
359
+ }
360
+ }
361
  </style>
362
  </head>
363
  <body>
364
 
365
+ <!-- لینک اجباری -->
366
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
367
+ Built with anycoder
 
 
 
 
 
368
  </a>
369
 
370
+ <!-- پس‌زمینه متحرک -->
371
+ <div class="background-blobs">
372
+ <div class="blob blob-1"></div>
373
+ <div class="blob blob-2"></div>
374
+ <div class="blob blob-3"></div>
375
+ </div>
376
+
377
+ <!-- کانتینر اعلان‌ها -->
378
  <div class="toast-container" id="toastContainer"></div>
379
 
380
+ <!-- کارت اصلی لاگین -->
381
+ <main class="login-container">
382
+
383
+ <!-- مرحله ۱: ورود شماره موبایل و کپچا -->
384
+ <div id="step1" class="step active">
385
+ <header class="header">
386
+ <div class="icon-circle" style="font-size: 2.5rem; margin-bottom: 15px; color: var(--primary-color);">
387
+ <i class="fa-solid fa-user-astronaut"></i>
 
 
 
388
  </div>
389
+ <h1>خوش آمدید</h1>
390
+ <p>برای ادامه شماره موبایل خود را وارد کنید</p>
391
+ </header>
392
+
393
+ <form id="phoneForm" onsubmit="handleSendCode(event)">
394
+ <div class="input-group">
395
+ <i class="fa-solid fa-mobile-screen"></i>
396
+ <input type="tel" id="phoneInput" placeholder="شماره موبایل (مثال: 09123456789)" maxlength="11" autocomplete="off">
397
  </div>
 
 
398
 
399
+ <!-- کپچا ساده -->
400
+ <div class="captcha-box">
401
+ <span class="captcha-question" id="captchaQuestion">5 + 3 = ?</span>
402
+ <input type="number" id="captchaInput" class="captcha-input" placeholder="?" autocomplete="off">
403
+ </div>
404
 
405
+ <button type="submit" class="btn btn-primary" id="sendCodeBtn">
406
+ <span>دریافت کد تایید</span>
407
+ <i class="fa-solid fa-arrow-left"></i>
408
+ </button>
409
+ </form>
410
  </div>
411
 
412
+ <!-- مرحله ۲: تایید کد -->
413
+ <div id="step2" class="step">
414
+ <header class="header">
415
+ <div style="font-size: 2.5rem; margin-bottom: 15px; color: var(--primary-color);">
416
+ <i class="fa-solid fa-shield-halved"></i>
417
+ </div>
418
+ <h1>تایید شماره</h1>
419
+ <p>کد ارسال شده به <span id="displayPhone" style="color: white; direction: ltr;"></span> را وارد کنید</p>
420
+ </header>
421
+
422
+ <form id="otpForm" onsubmit="handleVerifyCode(event)">
423
+ <div class="input-group">
424
+ <i class="fa-solid fa-key"></i>
425
+ <input type="tel" id="otpInput" placeholder="کد ۵ رقمی" maxlength="5" inputmode="numeric" autocomplete="one-time-code">
426
+ </div>
427
 
428
+ <button type="submit" class="btn btn-primary" id="verifyBtn">
429
+ <span>تایید و ورود</span>
430
+ <i class="fa-solid fa-check"></i>
431
+ </button>
432
+ </form>
433
 
434
+ <div class="timer-text" id="timerArea">
435
+ ارسال مجدد کد تا <span id="timerCount">120</span> ثانیه دیگر امکان‌پذیر است.
 
436
  </div>
437
 
438
+ <button class="btn btn-link" id="resendBtn" onclick="resendCode()" style="display: none;">
439
+ ارسال مجدد کد تایید
440
+ </button>
441
+
442
+ <button class="btn btn-link" onclick="goBack()">
443
+ <i class="fa-solid fa-arrow-right"></i> تغییر شماره
444
  </button>
445
  </div>
 
446
 
447
+ <!-- مرحله ۳: ورود موفق -->
448
+ <div id="step3" class="step">
449
+ <div class="success-icon">
450
+ <i class="fa-solid fa-circle-check"></i>
 
 
 
 
 
 
 
 
 
451
  </div>
452
+ <h1>ورود موفقیت‌آمیز!</h1>
453
+ <p style="margin-bottom: 30px; color: var(--text-muted);">شما با موفقیت احراز هویت شدید.</p>
454
 
455
+ <button class="btn btn-primary" onclick="window.location.reload()">
456
+ <span>بازگشت به خانه</span>
457
+ <i class="fa-solid fa-house"></i>
458
+ </button>
459
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
 
461
+ </main>
 
 
 
 
 
 
 
462
 
463
  <script>
464
+ // --- متغیرهای وضعیت ---
465
+ let currentCaptchaAnswer = 0;
 
466
  let countdownInterval;
467
+ const RESEND_TIME = 120; // 2 دقیقه به ثانیه
468
+
469
+ // --- المان‌های DOM ---
470
+ const steps = {
471
+ 1: document.getElementById('step1'),
472
+ 2: document.getElementById('step2'),
473
+ 3: document.getElementById('step3')
474
+ };
 
 
475
  const phoneInput = document.getElementById('phoneInput');
476
+ const captchaQuestion = document.getElementById('captchaQuestion');
477
+ const captchaInput = document.getElementById('captchaInput');
478
+ const displayPhone = document.getElementById('displayPhone');
479
  const otpInput = document.getElementById('otpInput');
480
+ const timerArea = document.getElementById('timerArea');
481
+ const timerCount = document.getElementById('timerCount');
482
  const resendBtn = document.getElementById('resendBtn');
 
 
483
 
484
+ // --- راه‌اندازی اولیه ---
485
+ window.onload = () => {
486
+ generateCaptcha();
487
+ };
488
 
489
+ // --- توابع کمکی ---
490
+
491
+ // نمایش اعلان (Toast)
492
  function showToast(message, type = 'info') {
493
  const container = document.getElementById('toastContainer');
494
  const toast = document.createElement('div');
495
  toast.className = `toast ${type}`;
496
 
497
+ let iconClass = 'fa-circle-info';
498
+ if (type === 'error') iconClass = 'fa-circle-xmark';
499
+ if (type === 'success') iconClass = 'fa-circle-check';
500
 
501
+ toast.innerHTML = `<i class="fa-solid ${iconClass}"></i> <span>${message}</span>`;
502
+
503
  container.appendChild(toast);
504
+
505
+ // انیمیشن ورود
506
+ requestAnimationFrame(() => {
507
+ toast.classList.add('show');
508
+ });
509
 
510
+ // حذف خودکار
511
  setTimeout(() => {
512
+ toast.classList.remove('show');
513
  setTimeout(() => toast.remove(), 300);
514
  }, 3000);
515
  }
516
 
517
+ // تولید کپچای ریاضی
518
+ function generateCaptcha() {
519
+ const num1 = Math.floor(Math.random() * 10);
520
+ const num2 = Math.floor(Math.random() * 10);
521
+ currentCaptchaAnswer = num1 + num2;
522
+ captchaQuestion.innerText = `${num1} + ${num2} = ?`;
523
+ captchaInput.value = '';
524
+ }
525
 
526
+ // اعتبارسنجی شماره موبایل ایران
527
+ function isValidPhone(phone) {
528
+ const regex = /^09[0-9]{9}$/;
529
+ return regex.test(phone);
 
 
 
 
 
530
  }
531
 
532
+ // تغییر مراحل
533
+ function showStep(stepNumber) {
534
+ Object.values(steps).forEach(el => el.classList.remove('active'));
535
+ steps[stepNumber].classList.add('active');
536
+ }
537
+
538
+ // --- منطق اصلی ---
539
 
540
+ // هندل کردن ارسال کد (مرحله 1)
541
+ function handleSendCode(e) {
542
+ e.preventDefault();
543
+
544
  const phone = phoneInput.value.trim();
545
+ const captchaUserAnswer = parseInt(captchaInput.value);
546
 
547
+ // 1. اعتبارسنجی شماره
548
+ if (!isValidPhone(phone)) {
549
+ showToast('لطفاً شماره موبایل معتبر وارد کنید (با 09 شروع شود)', 'error');
550
+ phoneInput.focus();
551
  return;
552
  }
553
 
554
+ // 2. اعتبارسنجی کپچا
555
+ if (isNaN(captchaUserAnswer) || captchaUserAnswer !== currentCaptchaAnswer) {
556
+ showToast('جمع صحیح نیست!', 'error');
557
+ captchaInput.value = '';
558
+ generateCaptcha(); // ریست کردن کپچا برای امنیت بیشتر
559
+ captchaInput.focus();
560
+ return;
561
+ }
562
+
563
+ // موفقیت آمیز بودن - شبیه‌سازی ارسال کد
564
+ displayPhone.innerText = phone;
565
+ showToast('کد تایید ارسال شد (کد تست: 12345)', 'success');
566
 
567
+ // شروع تایمر
568
  startTimer();
 
 
 
 
 
 
 
 
 
569
 
570
+ // انتقال به مرحله بعد
571
+ showStep(2);
572
+ otpInput.focus();
 
 
 
 
 
 
 
 
 
 
 
 
573
  }
574
 
575
+ // هندل کردن تایید کد (مرحله 2)
576
+ function handleVerifyCode(e) {
577
+ e.preventDefault();
578
  const code = otpInput.value.trim();
579
+
580
  if (code.length < 4) {
581
  showToast('کد تایید نامعتبر است', 'error');
582
  return;
583
  }
584
 
585
+ // شبیه‌سازی بررسی کد (در اینجا هر کد 5 رقمی یا کد خاصی قبول میشود)
586
+ // برای دمو، کد 12345 یا هر چیز 5 رقمی قبول میکنیم
587
+ if (code === '12345' || code.length === 5) {
588
+ showToast('در حال ورود...', 'info');
589
+
590
+ // تاخیر مصنوعی برای حس واقعی بودن
591
+ setTimeout(() => {
592
+ showStep(3);
593
+ }, 1000);
594
+ } else {
595
+ showToast('کد اشتباه است. دوباره تلاش کنید.', 'error');
596
+ }
597
+ }
598
+
599
+ // تایمر شمارش معکوس (2 دقیقه)
600
+ function startTimer() {
601
+ let timeLeft = RESEND_TIME;
602
 
603
+ // نمایش تایمر و مخفی کردن دکمه ارسال مجدد
604
+ timerArea.style.display = 'block';
605
+ resendBtn.style.display = 'none';
606
+ timerCount.innerText = timeLeft;
607
+
608
+ // پاک کردن تایمر قبلی اگر وجود دارد
609
+ if (countdownInterval) clearInterval(countdownInterval);
610
+
611
+ countdownInterval = setInterval(() => {
612
+ timeLeft--;
613
+ timerCount.innerText = timeLeft;
614
+
615
+ if (timeLeft <= 0) {
616
+ clearInterval(countdownInterval);
617
+ timerArea.style.display = 'none'; // مخفی کردن متن تایمر
618
+ resendBtn.style.display = 'inline-block'; // نمایش دکمه ارسال مجدد
619
+ showToast('اکنون می‌توانید کد جدید بگیرید', 'info');
620
+ }
621
  }, 1000);
622
  }
623
 
624
+ // ارسال مجدد کد
625
+ function resendCode() {
626
+ const phone = phoneInput.value.trim();
627
+ if (!isValidPhone(phone)) return;
 
 
628
 
629
+ showToast('کد تایید جدید ارسال شد', 'success');
630
+ otpInput.value = ''; // پاک کردن ورودی قبلی
631
+ otpInput.focus();
632
+ startTimer(); // شروع مجدد تایمر
633
+ }
634
 
635
+ // بازگشت به مرحله قبل
636
+ function goBack() {
637
+ showStep(1);
638
+ // پاک کردن تایمر زمانی که کاربر برمی‌گردد تا منابع مصرف نشوند
639
+ if (countdownInterval) clearInterval(countdownInterval);
640
  }
641
 
642
+ // فرمت خودکار ورودی شماره موبایل (فقط عدد)
643
+ phoneInput.addEventListener('input', function(e) {
644
+ this.value = this.value.replace(/[^0-9]/g, '');
645
+ });
646
 
647
+ // فرمت خودکار ورودی کپچا
648
+ captchaInput.addEventListener('input', function(e) {
649
+ this.value = this.value.replace(/[^0-9]/g, '');
650
+ });
651
 
652
+ // فرمت خودکار ورودی کد تایید
653
+ otpInput.addEventListener('input', function(e) {
654
+ this.value = this.value.replace(/[^0-9]/g, '');
655
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
 
657
  </script>
658
  </body>