samirerty commited on
Commit
bebbf67
·
verified ·
1 Parent(s): c89a70a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +570 -804
index.html CHANGED
@@ -1,856 +1,622 @@
1
  <!DOCTYPE html>
2
  <html lang="fa" dir="rtl">
3
-
4
  <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
7
- <title>ورود و ثبت نام | تم دارک حرفه‌ای</title>
8
- <!-- اتصال فونت وزیرمتن -->
9
- <link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet"
10
- type="text/css" />
11
-
12
- <style>
13
- /* تنظیمات کلی و متغیرهای رنگی */
14
- :root {
15
- --bg-body: #0f172a;
16
- --bg-card: #1e293b;
17
- --bg-input: #334155;
18
- --border-color: #475569;
19
- --primary-color: #f8fafc;
20
- --accent-color: #3b82f6;
21
- --accent-hover: #2563eb;
22
- --text-main: #f1f5f9;
23
- --text-muted: #94a3b8;
24
- --error-color: #ef4444;
25
- --success-color: #10b981;
26
- --radius: 16px;
27
- --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
28
- --glass-bg: rgba(30, 41, 59, 0.7);
29
- --glass-border: rgba(255, 255, 255, 0.1);
30
- }
31
-
32
- * {
33
- box-sizing: border-box;
34
- margin: 0;
35
- padding: 0;
36
- font-family: 'Vazirmatn', sans-serif;
37
- outline: none;
38
- -webkit-tap-highlight-color: transparent;
39
- }
40
-
41
- body {
42
- background-color: var(--bg-body);
43
- color: var(--text-main);
44
- min-height: 100vh;
45
- min-height: 100dvh;
46
- overflow-x: hidden;
47
- display: flex;
48
- justify-content: center;
49
- align-items: center;
50
- font-size: 16px;
51
- }
52
-
53
- /* لینک هدر */
54
- .header-link {
55
- position: fixed;
56
- top: 24px;
57
- left: 24px;
58
- color: var(--text-muted);
59
- text-decoration: none;
60
- font-size: 0.85rem;
61
- transition: var(--transition);
62
- z-index: 1000;
63
- padding: 8px 16px;
64
- border-radius: 50px;
65
- background: rgba(15, 23, 42, 0.6);
66
- backdrop-filter: blur(12px);
67
- border: 1px solid var(--glass-border);
68
- display: flex;
69
- align-items: center;
70
- gap: 8px;
71
- }
72
-
73
- .header-link:hover {
74
- color: var(--text-main);
75
- background: rgba(255, 255, 255, 0.1);
76
- transform: translateY(-2px);
77
- border-color: var(--accent-color);
78
- }
79
-
80
- /* --- Layout principale (Desktop Split) --- */
81
- .app-wrapper {
82
- width: 100%;
83
- height: 100%;
84
- min-height: 100dvh;
85
- display: flex;
86
- flex-direction: column;
87
- position: relative;
88
- overflow: hidden;
89
- }
90
-
91
- /* سمت چپ: بخش بصری (فقط دسکتاپ) */
92
- .visual-side {
93
- display: none;
94
- flex: 1;
95
- position: relative;
96
- background: radial-gradient(circle at 10% 20%, #1e1b4b 0%, #0f172a 90%);
97
- overflow: hidden;
98
- align-items: center;
99
- justify-content: center;
100
- padding: 60px;
101
- }
102
-
103
- /* اشکال متحرک پس زمینه */
104
- .orb {
105
- position: absolute;
106
- border-radius: 50%;
107
- filter: blur(80px);
108
- opacity: 0.6;
109
- animation: float 10s infinite ease-in-out;
110
- }
111
-
112
- .orb-1 {
113
- width: 400px;
114
- height: 400px;
115
- background: #4f46e5;
116
- top: -100px;
117
- left: -100px;
118
- animation-delay: 0s;
119
- }
120
-
121
- .orb-2 {
122
- width: 300px;
123
- height: 300px;
124
- background: #0ea5e9;
125
- bottom: -50px;
126
- right: -50px;
127
- animation-delay: -5s;
128
- }
129
-
130
- @keyframes float {
131
- 0%, 100% { transform: translate(0, 0); }
132
- 50% { transform: translate(30px, -30px); }
133
- }
134
-
135
- .visual-content {
136
- position: relative;
137
- z-index: 10;
138
- text-align: center;
139
- max-width: 500px;
140
- }
141
-
142
- .visual-content h1 {
143
- font-size: 3rem;
144
- font-weight: 800;
145
- margin-bottom: 20px;
146
- background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
147
- -webkit-background-clip: text;
148
- -webkit-text-fill-color: transparent;
149
- line-height: 1.2;
150
- }
151
-
152
- .visual-content p {
153
- font-size: 1.1rem;
154
- color: var(--text-muted);
155
- line-height: 1.8;
156
- }
157
-
158
- /* سمت راست: بخش فرم */
159
- .form-side {
160
- flex: 1;
161
- display: flex;
162
- justify-content: center;
163
- align-items: center;
164
- background-color: var(--bg-body);
165
- padding: 20px;
166
- position: relative;
167
- z-index: 20;
168
- }
169
-
170
- /* کانتینر کارت فرم */
171
- .form-card {
172
- background-color: var(--bg-card);
173
- border: 1px solid var(--glass-border);
174
- border-radius: 24px;
175
- position: relative;
176
- overflow: hidden;
177
- width: 100%;
178
- max-width: 460px;
179
- /* حذف ارتفاع ثابت برای اجازه اسکرول در محتواهای طولانی */
180
- min-height: 600px;
181
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
182
- display: flex;
183
- flex-direction: column;
184
- transition: var(--transition);
185
- }
186
-
187
- /* جعبه فرم‌ها */
188
- .forms-wrapper {
189
- position: relative;
190
- width: 100%;
191
- height: 100%;
192
- flex-grow: 1;
193
- padding: 48px;
194
- display: flex;
195
- flex-direction: column;
196
- }
197
-
198
- .form-content {
199
- width: 100%;
200
- display: flex;
201
- flex-direction: column;
202
- justify-content: center; /* عمودی وسط چین در دسکتاپ */
203
- opacity: 0;
204
- visibility: hidden;
205
- position: absolute;
206
- top: 0;
207
- left: 0;
208
- padding: 0 24px;
209
- transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
210
- transform: translateX(20px);
211
- height: 100%; /* پر کردن ارتفاع والد */
212
- }
213
-
214
- .form-content.active {
215
- opacity: 1;
216
- visibility: visible;
217
- transform: translateX(0);
218
- z-index: 10;
219
- }
220
-
221
- h2 {
222
- font-size: 2rem;
223
- margin-bottom: 12px;
224
- text-align: center;
225
- color: var(--text-main);
226
- font-weight: 800;
227
- }
228
-
229
- p.subtitle {
230
- text-align: center;
231
- color: var(--text-muted);
232
- margin-bottom: 40px;
233
- font-size: 1rem;
234
- line-height: 1.6;
235
- }
236
-
237
- /* استایل ورودی‌ها */
238
- .input-group {
239
- margin-bottom: 20px;
240
- }
241
-
242
- .input-group label {
243
- display: block;
244
- margin-bottom: 8px;
245
- color: var(--text-muted);
246
- font-size: 0.9rem;
247
- font-weight: 500;
248
- }
249
-
250
- input {
251
- width: 100%;
252
- padding: 16px;
253
- background-color: var(--bg-input);
254
- border: 1px solid var(--border-color);
255
- border-radius: 12px;
256
- color: var(--text-main);
257
- font-size: 1rem;
258
- transition: var(--transition);
259
- }
260
-
261
- input::placeholder {
262
- color: #64748b;
263
- }
264
-
265
- input:focus {
266
- border-color: var(--accent-color);
267
- background-color: #1e293b;
268
- box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
269
- }
270
-
271
- /* بخش کپچا */
272
- .captcha-container {
273
- display: flex;
274
- align-items: center;
275
- gap: 12px;
276
- background-color: var(--bg-input);
277
- padding: 6px;
278
- border-radius: 12px;
279
- border: 1px solid var(--border-color);
280
- }
281
-
282
- .captcha-wrapper {
283
- cursor: pointer;
284
- border-radius: 8px;
285
- overflow: hidden;
286
- flex-shrink: 0;
287
- background: #fff;
288
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
289
- transition: var(--transition);
290
- }
291
-
292
- .captcha-wrapper:hover {
293
- transform: scale(1.02);
294
- }
295
-
296
- canvas {
297
- display: block;
298
- }
299
-
300
- .refresh-btn {
301
- background: transparent;
302
- border: 1px solid var(--border-color);
303
- color: var(--text-muted);
304
- cursor: pointer;
305
- width: 46px;
306
- height: 46px;
307
- border-radius: 10px;
308
- font-size: 1.2rem;
309
- display: flex;
310
- align-items: center;
311
- justify-content: center;
312
- transition: var(--transition);
313
- flex-shrink: 0;
314
- }
315
-
316
- .refresh-btn:hover {
317
- color: var(--text-main);
318
- border-color: var(--text-main);
319
- transform: rotate(90deg);
320
- background: rgba(255, 255, 255, 0.05);
321
- }
322
-
323
- input#captchaInput,
324
- input#regCaptchaInput {
325
- flex-grow: 1;
326
- background: transparent;
327
- border: none;
328
- text-align: center;
329
- letter-spacing: 4px;
330
- font-weight: bold;
331
- }
332
-
333
- input#captchaInput:focus,
334
- input#regCaptchaInput:focus {
335
- background: transparent;
336
- border: none;
337
- box-shadow: none;
338
- }
339
-
340
- /* دکمه‌ها */
341
- .btn {
342
- width: 100%;
343
- padding: 18px; /* افزایش ارتفاع دکمه برای لمس راحت‌تر */
344
- background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
345
- color: #fff;
346
- border: none;
347
- border-radius: 12px;
348
- font-size: 1.05rem;
349
- font-weight: 700;
350
- cursor: pointer;
351
- transition: var(--transition);
352
- margin-top: 24px; /* فاصله بیشتر از بالا */
353
- box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
354
- position: relative;
355
- overflow: hidden;
356
- }
357
-
358
- .btn:hover {
359
- transform: translateY(-2px);
360
- box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
361
- }
362
-
363
- .btn:active {
364
- transform: scale(0.98);
365
- }
366
-
367
- /* لینک تغییر حالت */
368
- .toggle-text {
369
- text-align: center;
370
- margin-top: 30px;
371
- color: var(--text-muted);
372
- font-size: 0.95rem;
373
- padding-bottom: 10px;
374
- }
375
-
376
- .toggle-text a {
377
- color: var(--accent-color);
378
- text-decoration: none;
379
- font-weight: 700;
380
- transition: var(--transition);
381
- cursor: pointer;
382
- position: relative;
383
- }
384
-
385
- .toggle-text a::after {
386
- content: '';
387
- position: absolute;
388
- width: 0;
389
- height: 2px;
390
- bottom: -2px;
391
- right: 0;
392
- background-color: var(--accent-color);
393
- transition: width 0.3s;
394
- }
395
-
396
- .toggle-text a:hover::after {
397
- width: 100%;
398
- }
399
-
400
- /* سیستم اعلان (Toast) */
401
- .toast-container {
402
- position: fixed;
403
- top: 24px;
404
- left: 50%;
405
- transform: translateX(-50%);
406
- width: 90%;
407
- max-width: 400px;
408
- z-index: 2000;
409
- display: flex;
410
- flex-direction: column;
411
- gap: 10px;
412
- pointer-events: none;
413
- }
414
-
415
- .toast {
416
- background-color: rgba(30, 41, 59, 0.95);
417
- color: var(--text-main);
418
- padding: 16px 24px;
419
- border-radius: 12px;
420
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
421
- display: flex;
422
- align-items: center;
423
- gap: 12px;
424
- border-right: 4px solid transparent;
425
- backdrop-filter: blur(10px);
426
- animation: slideDown 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
427
- opacity: 0;
428
- transform: translateY(-20px);
429
- pointer-events: auto;
430
- }
431
-
432
- .toast.success { border-right-color: var(--success-color); }
433
- .toast.error { border-right-color: var(--error-color); }
434
-
435
- @keyframes slideDown {
436
- to { opacity: 1; transform: translateY(0); }
437
- }
438
-
439
- @keyframes fadeOutUp {
440
- to { opacity: 0; transform: translateY(-20px); }
441
- }
442
-
443
- /* --- ریسپانسیو (موبایل) --- */
444
- @media (max-width: 1023px) {
445
- body {
446
- align-items: flex-start;
447
- background-color: var(--bg-body);
448
- }
449
-
450
- .app-wrapper {
451
- flex-direction: column;
452
- }
453
-
454
- .visual-side {
455
- display: none;
456
- }
457
-
458
- .form-side {
459
- padding: 0;
460
- width: 100%;
461
- height: 100dvh;
462
- }
463
-
464
- .form-card {
465
- max-width: 100%;
466
- height: 100%;
467
- border-radius: 0;
468
- border: none;
469
- box-shadow: none;
470
- background: transparent;
471
- }
472
-
473
- .forms-wrapper {
474
- padding: 0;
475
- justify-content: flex-start;
476
- overflow-y: auto; /* اجازه اسکرول عمودی */
477
- padding-bottom: 40px;
478
- }
479
-
480
- /* تغییر استراتژی نمایش فرم در موبایل برای جلوگیری از مشکل دکمه‌ها */
481
- .form-content {
482
- position: relative; /* تغییر از absolute به relative */
483
- opacity: 1;
484
- visibility: visible;
485
- transform: none;
486
- display: none; /* مخفی کردن با display */
487
- padding: 40px 24px 80px 24px; /* پدینگ پایین زیاد برای دکمه */
488
- height: auto;
489
- min-height: 100vh;
490
- justify-content: flex-start;
491
- }
492
-
493
- .form-content.active {
494
- display: flex; /* نمایش با flex */
495
- z-index: 10;
496
- }
497
-
498
- h2 {
499
- font-size: 1.8rem;
500
- margin-top: 20px;
501
- }
502
-
503
- .header-link {
504
- top: 15px;
505
- left: 15px;
506
- font-size: 0.75rem;
507
- padding: 6px 12px;
508
- background: rgba(0, 0, 0, 0.3);
509
- border-color: rgba(255, 255, 255, 0.1);
510
- color: rgba(255, 255, 255, 0.6);
511
- }
512
- }
513
-
514
- /* --- دسکتاپ (Desktop Only) --- */
515
- @media (min-width: 1024px) {
516
- .app-wrapper {
517
- flex-direction: row-reverse;
518
- min-height: 100vh;
519
- background: var(--bg-body);
520
- }
521
-
522
- .visual-side {
523
- display: flex;
524
- }
525
-
526
- .form-card {
527
- background: rgba(30, 41, 59, 0.6);
528
- backdrop-filter: blur(20px);
529
- border: 1px solid rgba(255, 255, 255, 0.08);
530
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
531
- margin: 40px;
532
- }
533
- }
534
- </style>
535
- </head>
536
 
537
- <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
 
539
- <!-- لینک هدر درخواست شده -->
540
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="header-link">
541
- <span>✨</span> Built with anycoder
542
- </a>
543
 
544
- <!-- کانتینر اصلی -->
545
- <div class="app-wrapper" id="appWrapper">
 
 
 
546
 
547
- <!-- سمت راست: فرم‌ها (در دسکتاپ) -->
548
- <div class="form-side">
549
- <div class="form-card">
550
- <div class="forms-wrapper">
 
 
551
 
552
- <!-- فرم ورود -->
553
- <div class="form-content active" id="loginForm">
554
- <h2>خوش آمدید</h2>
555
- <p class="subtitle">برای دسترسی به پنل کاربری وارد شوید</p>
556
 
557
- <form onsubmit="handleLogin(event)">
558
- <div class="input-group">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  <label>شماره موبایل</label>
560
  <div class="input-wrapper">
561
- <input type="tel" id="loginPhone" placeholder="مثال: 09123456789" maxlength="11" inputmode="numeric">
 
562
  </div>
563
- </div>
564
 
565
- <div class="input-group">
566
  <label>رمز عبور</label>
567
  <div class="input-wrapper">
568
- <input type="password" id="loginPass" placeholder="رمز عبور خود را وارد کنید">
 
569
  </div>
570
- </div>
571
 
572
- <div class="input-group">
573
  <label>کد امنیتی</label>
574
  <div class="captcha-container">
575
- <div class="captcha-wrapper" onclick="generateCaptcha('loginCanvas')" title="برای تعویض کد کلیک کنید">
576
- <canvas id="loginCanvas" width="100" height="45"></canvas>
577
- </div>
578
- <button type="button" class="refresh-btn" onclick="generateCaptcha('loginCanvas')">↻</button>
579
- <input type="text" id="loginCaptchaInput" placeholder="کد" maxlength="5" inputmode="numeric">
580
  </div>
581
- </div>
582
-
583
- <button type="submit" class="btn">ورود به حساب</button>
584
- </form>
585
 
586
- <div class="toggle-text">
587
- حساب کاربری ندارید؟ <a onclick="toggleForm('register')">ثبت نام کنید</a>
588
  </div>
589
- </div>
590
 
591
- <!-- فرم ثبت نام -->
592
- <div class="form-content" id="registerForm">
593
- <h2>ثبت نام</h2>
594
- <p class="subtitle">همین حالا عضو شوید و دنیای جدیدی را تجربه کنید</p>
 
595
 
596
- <form onsubmit="handleRegister(event)">
597
- <div class="input-group">
 
598
  <label>شماره موبایل</label>
599
  <div class="input-wrapper">
600
- <input type="tel" id="regPhone" placeholder="مثال: 09123456789" maxlength="11" inputmode="numeric">
 
601
  </div>
602
- </div>
603
 
604
- <div class="input-group">
605
  <label>رمز عبور</label>
606
  <div class="input-wrapper">
607
- <input type="password" id="regPass" placeholder="حداقل ۶ کاراکتر">
 
608
  </div>
609
- </div>
610
 
611
- <div class="input-group">
612
  <label>تکرار رمز عبور</label>
613
  <div class="input-wrapper">
614
- <input type="password" id="regPassConfirm" placeholder="تکرار رمز عبور">
 
615
  </div>
616
- </div>
617
 
618
- <div class="input-group">
619
  <label>کد امنیتی</label>
620
  <div class="captcha-container">
621
- <div class="captcha-wrapper" onclick="generateCaptcha('regCanvas')" title="برای تعویض کد کلیک کنید">
622
- <canvas id="regCanvas" width="100" height="45"></canvas>
623
- </div>
624
- <button type="button" class="refresh-btn" onclick="generateCaptcha('regCanvas')">↻</button>
625
- <input type="text" id="regCaptchaInput" placeholder="کد" maxlength="5" inputmode="numeric">
626
  </div>
627
- </div>
628
-
629
- <button type="submit" class="btn">ساخت حساب کاربری</button>
630
- </form>
631
-
632
- <div class="toggle-text">
633
- قبلاً ثبت نام کرده‌اید؟ <a onclick="toggleForm('login')">وارد شوید</a>
634
  </div>
635
- </div>
636
 
 
 
 
 
637
  </div>
638
- </div>
639
- </div>
640
-
641
- <!-- سمت چپ: بخش بصری (فقط دسکتاپ) -->
642
- <div class="visual-side">
643
- <div class="orb orb-1"></div>
644
- <div class="orb orb-2"></div>
645
- <div class="visual-content">
646
- <h1>آینده‌ای روشن<br>در انتظار شماست</h1>
647
- <p>ما با ��ستفاده از جدیدترین تکنولوژی‌ها، تجربه‌ای بی‌نظیر و امن را برای کاربران خود رقم می‌زنیم. همین حالا شروع
648
- کنید.</p>
649
- </div>
650
- </div>
651
-
652
- </div>
653
-
654
- <!-- کانتینر برای نمایش پیام‌ها -->
655
- <div class="toast-container" id="toastContainer"></div>
656
-
657
- <script>
658
- // متغیرهای سراسری برای ذخیره کد کپچا
659
- let captchaCodes = {
660
- login: '',
661
- register: ''
662
- };
663
-
664
- // اجرای اولیه هنگام لود شدن صفحه
665
- window.onload = function() {
666
- generateCaptcha('loginCanvas');
667
- generateCaptcha('regCanvas');
668
- initParallax();
669
- };
670
-
671
- // تابع تولید کد کپچا و رسم روی Canvas
672
- function generateCaptcha(canvasId) {
673
- const canvas = document.getElementById(canvasId);
674
- const ctx = canvas.getContext('2d');
675
- const width = canvas.width;
676
- const height = canvas.height;
677
-
678
- // پاک کردن بوم
679
- ctx.clearRect(0, 0, width, height);
680
-
681
- // پس‌زمینه با گرادینت ملایم
682
- const gradient = ctx.createLinearGradient(0, 0, width, height);
683
- gradient.addColorStop(0, '#f1f5f9');
684
- gradient.addColorStop(1, '#e2e8f0');
685
- ctx.fillStyle = gradient;
686
- ctx.fillRect(0, 0, width, height);
687
-
688
- // خطوط مزاحم
689
- for (let i = 0; i < 7; i++) {
690
- ctx.strokeStyle = `rgba(59, 130, 246, ${Math.random() * 0.15})`;
691
- ctx.lineWidth = 1.5;
692
- ctx.beginPath();
693
- ctx.moveTo(Math.random() * width, Math.random() * height);
694
- ctx.lineTo(Math.random() * width, Math.random() * height);
695
- ctx.stroke();
696
- }
697
-
698
- // تولید کد رندوم ۵ رقمی
699
- let code = '';
700
- const chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'; // حذف کاراکترهای مبهم
701
- for (let i = 0; i < 5; i++) {
702
- code += chars[Math.floor(Math.random() * chars.length)];
703
- }
704
-
705
- // ذخیره کد
706
- if(canvasId === 'loginCanvas') captchaCodes.login = code;
707
- else captchaCodes.register = code;
708
-
709
- // رسم متن
710
- ctx.font = 'bold 26px Courier New';
711
- ctx.textBaseline = 'middle';
712
-
713
- for (let i = 0; i < code.length; i++) {
714
- ctx.save();
715
- const x = 12 + i * 17;
716
- const y = height / 2 + (Math.random() * 6 - 3);
717
- const angle = (Math.random() * 0.5) - 0.25;
718
 
719
- ctx.translate(x, y);
720
- ctx.rotate(angle);
721
- ctx.fillStyle = '#1e293b'; // رنگ متن تیره
722
- ctx.fillText(code[i], 0, 0);
723
- ctx.restore();
724
- }
725
-
726
- // افزودن نویز (نقطه ریز)
727
- for(let i=0; i<30; i++) {
728
- ctx.fillStyle = `rgba(0,0,0,0.1)`;
729
- ctx.beginPath();
730
- ctx.arc(Math.random()*width, Math.random()*height, 1, 0, 2*Math.PI);
731
- ctx.fill();
732
- }
733
- }
734
-
735
- // تابع سوئیچ بین فرم ورود و ثبت نام
736
- function toggleForm(target) {
737
- const loginForm = document.getElementById('loginForm');
738
- const regForm = document.getElementById('registerForm');
739
-
740
- // اسکرول به بالای صفحه در موبایل برای تجربه بهتر
741
- if(window.innerWidth < 1024) {
742
- window.scrollTo({ top: 0, behavior: 'smooth' });
743
- }
744
-
745
- if (target === 'register') {
746
- loginForm.classList.remove('active');
747
- setTimeout(() => {
748
- regForm.classList.add('active');
749
- generateCaptcha('regCanvas');
750
- }, 50);
751
- } else {
752
- regForm.classList.remove('active');
753
  setTimeout(() => {
754
- loginForm.classList.add('active');
755
- generateCaptcha('loginCanvas');
756
- }, 50);
757
- }
758
- }
759
-
760
- // هندل کردن فرم ورود
761
- function handleLogin(e) {
762
- e.preventDefault();
763
- const phone = document.getElementById('loginPhone').value;
764
- const pass = document.getElementById('loginPass').value;
765
- const userCaptcha = document.getElementById('loginCaptchaInput').value;
766
-
767
- // اعتبارسنجی
768
- if (!validatePhone(phone)) return showToast('شماره موبایل نامعتبر است', 'error');
769
- if (pass.length < 4) return showToast('رمز عبور کوتاه است', 'error');
770
- if (userCaptcha.toUpperCase() !== captchaCodes.login) {
771
- generateCaptcha('loginCanvas');
772
- document.getElementById('loginCaptchaInput').value = '';
773
- return showToast('کد امنیتی اشتباه است', 'error');
774
- }
775
-
776
- // شبیه‌سازی ورود موفق
777
- showToast('در حال ورود...', 'success');
778
- setTimeout(() => {
779
- showToast('خوش آمدید! ورود موفقیت آمیز بود.', 'success');
780
- }, 1500);
781
- }
782
-
783
- // هندل کردن فرم ثبت نام
784
- function handleRegister(e) {
785
- e.preventDefault();
786
- const phone = document.getElementById('regPhone').value;
787
- const pass = document.getElementById('regPass').value;
788
- const confirmPass = document.getElementById('regPassConfirm').value;
789
- const userCaptcha = document.getElementById('regCaptchaInput').value;
790
-
791
- // اعتبارسنجی
792
- if (!validatePhone(phone)) return showToast('شماره موبایل نامعتبر است', 'error');
793
- if (pass.length < 6) return showToast('رمز عبور باید حداقل ۶ کاراکتر باشد', 'error');
794
- if (pass !== confirmPass) return showToast('تکرار رمز عبور مطابقت ندارد', 'error');
795
- if (userCaptcha.toUpperCase() !== captchaCodes.register) {
796
- generateCaptcha('regCanvas');
797
- document.getElementById('regCaptchaInput').value = '';
798
- return showToast('کد امنیتی اشتباه است', 'error');
799
- }
800
-
801
- // شبیه‌سازی ثبت نام موفق
802
- showToast('در حال ثبت نام...', 'success');
803
- setTimeout(() => {
804
- showToast('حساب کاربری با موفقیت ساخته شد!', 'success');
805
- toggleForm('login');
806
- }, 1500);
807
- }
808
-
809
- // تابع کمکی اعتبارسنجی شماره موبایل ایران
810
- function validatePhone(phone) {
811
- const regex = /^09\d{9}$/;
812
- return regex.test(phone);
813
- }
814
-
815
- // تابع نمایش پیام (Toast)
816
- function showToast(message, type = 'success') {
817
- const container = document.getElementById('toastContainer');
818
- const toast = document.createElement('div');
819
- toast.className = `toast ${type}`;
820
-
821
- const icon = type === 'success' ? '✔' : '✖';
822
-
823
- toast.innerHTML = `<span>${icon}</span> <span>${message}</span>`;
824
-
825
- container.appendChild(toast);
826
-
827
- // حذف خودکار بعد از ۳ ثانیه
828
- setTimeout(() => {
829
- toast.style.animation = 'fadeOutUp 0.4s forwards';
830
- toast.addEventListener('animationend', () => {
831
- toast.remove();
832
- });
833
- }, 3000);
834
- }
835
 
836
- // افکت پارالاکس برای دسکتاپ
837
- function initParallax() {
838
- const wrapper = document.getElementById('appWrapper');
839
- const orbs = document.querySelectorAll('.orb');
 
840
 
841
- if (window.innerWidth < 1024) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842
 
843
- wrapper.addEventListener('mousemove', (e) => {
844
- const x = (window.innerWidth - e.pageX) / 50;
845
- const y = (window.innerHeight - e.pageY) / 50;
 
 
 
 
 
846
 
847
- orbs.forEach((orb, index) => {
848
- const speed = (index + 1) * 2;
849
- orb.style.transform = `translate(${x * speed}px, ${y * speed}px)`;
 
 
 
 
 
 
 
 
 
 
 
 
850
  });
851
  });
852
- }
853
- </script>
854
- </body>
855
 
 
 
856
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="fa" dir="rtl">
 
3
  <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ورود و ثبت نام | سیستم امن</title>
7
+ <!-- ایمپورت فونت وزیرمتن برای ظاهر زیبای فارسی -->
8
+ <link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet" type="text/css" />
9
+ <!-- ایمپورت آیکون‌ها -->
10
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
11
+
12
+ <style>
13
+ :root {
14
+ --bg-color: #0f172a;
15
+ --card-bg: rgba(30, 41, 59, 0.7);
16
+ --primary: #6366f1;
17
+ --primary-hover: #4f46e5;
18
+ --text-main: #f8fafc;
19
+ --text-muted: #94a3b8;
20
+ --input-bg: rgba(15, 23, 42, 0.6);
21
+ --border-color: rgba(148, 163, 184, 0.2);
22
+ --error: #ef4444;
23
+ --success: #10b981;
24
+ --glass-border: 1px solid rgba(255, 255, 255, 0.1);
25
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ * {
28
+ box-sizing: border-box;
29
+ margin: 0;
30
+ padding: 0;
31
+ font-family: 'Vazirmatn', sans-serif;
32
+ }
33
+
34
+ body {
35
+ background-color: var(--bg-color);
36
+ background-image:
37
+ radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
38
+ radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%),
39
+ radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
40
+ color: var(--text-main);
41
+ min-height: 100vh;
42
+ display: flex;
43
+ flex-direction: column;
44
+ align-items: center;
45
+ justify-content: center;
46
+ overflow-x: hidden;
47
+ }
48
+
49
+ /* هدر */
50
+ header {
51
+ position: absolute;
52
+ top: 20px;
53
+ width: 100%;
54
+ text-align: center;
55
+ z-index: 10;
56
+ }
57
+
58
+ .brand-link {
59
+ color: var(--text-muted);
60
+ text-decoration: none;
61
+ font-size: 0.9rem;
62
+ transition: color 0.3s;
63
+ display: inline-flex;
64
+ align-items: center;
65
+ gap: 8px;
66
+ padding: 8px 16px;
67
+ background: rgba(255,255,255,0.05);
68
+ border-radius: 20px;
69
+ backdrop-filter: blur(5px);
70
+ }
71
+
72
+ .brand-link:hover {
73
+ color: var(--primary);
74
+ background: rgba(255,255,255,0.1);
75
+ }
76
+
77
+ /* کارت اصلی */
78
+ .auth-container {
79
+ width: 90%;
80
+ max-width: 420px;
81
+ background: var(--card-bg);
82
+ backdrop-filter: blur(16px);
83
+ -webkit-backdrop-filter: blur(16px);
84
+ border: var(--glass-border);
85
+ border-radius: 24px;
86
+ padding: 40px 30px;
87
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
88
+ position: relative;
89
+ overflow: hidden;
90
+ transition: all 0.4s ease;
91
+ }
92
+
93
+ /* تب‌های تغییر وضعیت */
94
+ .tabs {
95
+ display: flex;
96
+ justify-content: center;
97
+ margin-bottom: 30px;
98
+ background: var(--input-bg);
99
+ padding: 5px;
100
+ border-radius: 12px;
101
+ position: relative;
102
+ }
103
+
104
+ .tab-btn {
105
+ flex: 1;
106
+ padding: 12px;
107
+ border: none;
108
+ background: transparent;
109
+ color: var(--text-muted);
110
+ cursor: pointer;
111
+ border-radius: 8px;
112
+ font-size: 1rem;
113
+ font-weight: 500;
114
+ transition: all 0.3s ease;
115
+ z-index: 2;
116
+ }
117
+
118
+ .tab-btn.active {
119
+ color: #fff;
120
+ background: var(--primary);
121
+ box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
122
+ }
123
+
124
+ /* فرم‌ها */
125
+ .form-wrapper {
126
+ position: relative;
127
+ }
128
+
129
+ .auth-form {
130
+ display: flex;
131
+ flex-direction: column;
132
+ gap: 20px;
133
+ transition: opacity 0.3s ease, transform 0.3s ease;
134
+ }
135
+
136
+ .hidden {
137
+ display: none;
138
+ opacity: 0;
139
+ transform: translateX(20px);
140
+ }
141
+
142
+ .visible {
143
+ display: flex;
144
+ opacity: 1;
145
+ transform: translateX(0);
146
+ animation: fadeIn 0.4s ease-out;
147
+ }
148
+
149
+ @keyframes fadeIn {
150
+ from { opacity: 0; transform: translateY(10px); }
151
+ to { opacity: 1; transform: translateY(0); }
152
+ }
153
+
154
+ /* گروه ورودی */
155
+ .input-group {
156
+ position: relative;
157
+ }
158
+
159
+ .input-group label {
160
+ display: block;
161
+ margin-bottom: 8px;
162
+ color: var(--text-muted);
163
+ font-size: 0.9rem;
164
+ }
165
+
166
+ .input-wrapper {
167
+ position: relative;
168
+ display: flex;
169
+ align-items: center;
170
+ }
171
+
172
+ .input-wrapper i {
173
+ position: absolute;
174
+ right: 15px;
175
+ color: var(--text-muted);
176
+ transition: color 0.3s;
177
+ }
178
+
179
+ .form-input {
180
+ width: 100%;
181
+ padding: 14px 45px 14px 15px;
182
+ background: var(--input-bg);
183
+ border: 1px solid var(--border-color);
184
+ border-radius: 12px;
185
+ color: #fff;
186
+ font-size: 1rem;
187
+ outline: none;
188
+ transition: all 0.3s;
189
+ }
190
+
191
+ .form-input:focus {
192
+ border-color: var(--primary);
193
+ box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
194
+ }
195
+
196
+ .form-input:focus + i {
197
+ color: var(--primary);
198
+ }
199
+
200
+ /* کپچا */
201
+ .captcha-container {
202
+ display: flex;
203
+ gap: 10px;
204
+ align-items: center;
205
+ }
206
+
207
+ .captcha-canvas {
208
+ background: #fff;
209
+ border-radius: 8px;
210
+ cursor: pointer;
211
+ flex-shrink: 0;
212
+ }
213
+
214
+ .captcha-input {
215
+ flex-grow: 1;
216
+ }
217
+
218
+ /* دکمه اصلی */
219
+ .submit-btn {
220
+ background: linear-gradient(135deg, var(--primary), #818cf8);
221
+ color: white;
222
+ border: none;
223
+ padding: 14px;
224
+ border-radius: 12px;
225
+ font-size: 1rem;
226
+ font-weight: bold;
227
+ cursor: pointer;
228
+ transition: transform 0.2s, box-shadow 0.2s;
229
+ margin-top: 10px;
230
+ display: flex;
231
+ justify-content: center;
232
+ align-items: center;
233
+ gap: 10px;
234
+ }
235
+
236
+ .submit-btn:hover {
237
+ transform: translateY(-2px);
238
+ box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.6);
239
+ }
240
+
241
+ .submit-btn:active {
242
+ transform: translateY(0);
243
+ }
244
+
245
+ .submit-btn.loading {
246
+ opacity: 0.8;
247
+ pointer-events: none;
248
+ }
249
+
250
+ .submit-btn.loading i {
251
+ animation: spin 1s linear infinite;
252
+ }
253
 
254
+ @keyframes spin {
255
+ 100% { transform: rotate(360deg); }
256
+ }
 
257
 
258
+ /* لینک فراموشی رمز */
259
+ .forgot-pass {
260
+ text-align: left;
261
+ margin-top: -10px;
262
+ }
263
 
264
+ .forgot-pass a {
265
+ color: var(--text-muted);
266
+ font-size: 0.85rem;
267
+ text-decoration: none;
268
+ transition: color 0.3s;
269
+ }
270
 
271
+ .forgot-pass a:hover {
272
+ color: var(--primary);
273
+ }
 
274
 
275
+ /* سیستم نوتیفیکیشن (Toast) */
276
+ .toast-container {
277
+ position: fixed;
278
+ bottom: 20px;
279
+ left: 50%;
280
+ transform: translateX(-50%);
281
+ display: flex;
282
+ flex-direction: column;
283
+ gap: 10px;
284
+ z-index: 100;
285
+ }
286
+
287
+ .toast {
288
+ background: rgba(30, 41, 59, 0.95);
289
+ color: #fff;
290
+ padding: 12px 24px;
291
+ border-radius: 50px;
292
+ box-shadow: 0 10px 30px rgba(0,0,0,0.5);
293
+ display: flex;
294
+ align-items: center;
295
+ gap: 10px;
296
+ font-size: 0.9rem;
297
+ animation: slideUp 0.3s ease-out;
298
+ border: 1px solid var(--border-color);
299
+ min-width: 280px;
300
+ justify-content: center;
301
+ }
302
+
303
+ .toast.success { border-color: var(--success); color: var(--success); }
304
+ .toast.error { border-color: var(--error); color: var(--error); }
305
+
306
+ @keyframes slideUp {
307
+ from { transform: translateY(20px); opacity: 0; }
308
+ to { transform: translateY(0); opacity: 1; }
309
+ }
310
+
311
+ /* رسپانسیو */
312
+ @media (max-width: 480px) {
313
+ .auth-container {
314
+ width: 95%;
315
+ padding: 30px 20px;
316
+ }
317
+
318
+ .submit-btn {
319
+ padding: 12px;
320
+ }
321
+ }
322
+ </style>
323
+ </head>
324
+ <body>
325
+
326
+ <!-- هدر و لینک اجباری -->
327
+ <header>
328
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="brand-link">
329
+ <i class="fas fa-code"></i>
330
+ Built with anycoder
331
+ </a>
332
+ </header>
333
+
334
+ <main class="auth-container">
335
+ <!-- تب‌های بالا -->
336
+ <div class="tabs">
337
+ <button class="tab-btn active" onclick="switchTab('login')">ورود</button>
338
+ <button class="tab-btn" onclick="switchTab('register')">ثبت‌نام</button>
339
+ </div>
340
+
341
+ <!-- فرم ورود -->
342
+ <div id="login-form" class="auth-form visible">
343
+ <div class="input-group">
344
  <label>شماره موبایل</label>
345
  <div class="input-wrapper">
346
+ <input type="tel" id="login-phone" class="form-input" placeholder="مثلا: 09123456789" maxlength="11">
347
+ <i class="fas fa-mobile-alt"></i>
348
  </div>
349
+ </div>
350
 
351
+ <div class="input-group">
352
  <label>رمز عبور</label>
353
  <div class="input-wrapper">
354
+ <input type="password" id="login-pass" class="form-input" placeholder="رمز عبور خود را وارد کنید">
355
+ <i class="fas fa-lock"></i>
356
  </div>
357
+ </div>
358
 
359
+ <div class="input-group">
360
  <label>کد امنیتی</label>
361
  <div class="captcha-container">
362
+ <canvas id="login-canvas" width="100" height="44" class="captcha-canvas" title="برای تغییر کلیک کنید"></canvas>
363
+ <input type="text" id="login-captcha-input" class="form-input captcha-input" placeholder="کد تصویر" maxlength="4">
 
 
 
364
  </div>
365
+ </div>
 
 
 
366
 
367
+ <div class="forgot-pass">
368
+ <a href="#">رمز عبور را فراموش کرده‌اید؟</a>
369
  </div>
 
370
 
371
+ <button class="submit-btn" onclick="handleLogin()">
372
+ <span>ورود به حساب</span>
373
+ <i class="fas fa-arrow-left"></i>
374
+ </button>
375
+ </div>
376
 
377
+ <!-- فرم ثبت نام -->
378
+ <div id="register-form" class="auth-form hidden">
379
+ <div class="input-group">
380
  <label>شماره موبایل</label>
381
  <div class="input-wrapper">
382
+ <input type="tel" id="reg-phone" class="form-input" placeholder="مثلا: 09123456789" maxlength="11">
383
+ <i class="fas fa-mobile-alt"></i>
384
  </div>
385
+ </div>
386
 
387
+ <div class="input-group">
388
  <label>رمز عبور</label>
389
  <div class="input-wrapper">
390
+ <input type="password" id="reg-pass" class="form-input" placeholder="حداقل ۸ کاراکتر">
391
+ <i class="fas fa-lock"></i>
392
  </div>
393
+ </div>
394
 
395
+ <div class="input-group">
396
  <label>تکرار رمز عبور</label>
397
  <div class="input-wrapper">
398
+ <input type="password" id="reg-pass-conf" class="form-input" placeholder="تکرار رمز عبور">
399
+ <i class="fas fa-check-double"></i>
400
  </div>
401
+ </div>
402
 
403
+ <div class="input-group">
404
  <label>کد امنیتی</label>
405
  <div class="captcha-container">
406
+ <canvas id="reg-canvas" width="100" height="44" class="captcha-captcha" title="برای تغییر کلیک کنید"></canvas>
407
+ <input type="text" id="reg-captcha-input" class="form-input captcha-input" placeholder="کد تصویر" maxlength="4">
 
 
 
408
  </div>
 
 
 
 
 
 
 
409
  </div>
 
410
 
411
+ <button class="submit-btn" onclick="handleRegister()">
412
+ <span>ثبت‌نام کنید</span>
413
+ <i class="fas fa-user-plus"></i>
414
+ </button>
415
  </div>
416
+ </main>
417
+
418
+ <!-- کانتینر پیام‌ها -->
419
+ <div class="toast-container" id="toast-container"></div>
420
+
421
+ <script>
422
+ // متغیرهای سراسری برای کد کپچا
423
+ let loginCaptchaCode = '';
424
+ let regCaptchaCode = '';
425
+
426
+ // --- توابع کمکی ---
427
+
428
+ // تابع نمایش پیام (Toast)
429
+ function showToast(message, type = 'success') {
430
+ const container = document.getElementById('toast-container');
431
+ const toast = document.createElement('div');
432
+ toast.className = `toast ${type}`;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
 
434
+ const icon = type === 'success' ? '<i class="fas fa-check-circle"></i>' : '<i class="fas fa-exclamation-circle"></i>';
435
+ toast.innerHTML = `${icon} <span>${message}</span>`;
436
+
437
+ container.appendChild(toast);
438
+
439
+ // حذف پیام بعد از ۳ ثانیه
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  setTimeout(() => {
441
+ toast.style.opacity = '0';
442
+ toast.style.transform = 'translateY(20px)';
443
+ setTimeout(() => toast.remove(), 300);
444
+ }, 3000);
445
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
 
447
+ // تابع اعتبارسنجی شماره موبایل ایران
448
+ function isValidPhone(phone) {
449
+ const regex = /^09[0-9]{9}$/;
450
+ return regex.test(phone);
451
+ }
452
 
453
+ // تولید کپچا تصادفی
454
+ function generateCaptcha(canvasId, codeVariable) {
455
+ const canvas = document.getElementById(canvasId);
456
+ const ctx = canvas.getContext('2d');
457
+ const chars = '0123456789';
458
+ let code = '';
459
+
460
+ // پاک کردن بوم
461
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
462
+
463
+ // پس‌زمینه نویز
464
+ ctx.fillStyle = '#f0f0f0';
465
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
466
+
467
+ // رسم خطوط تصادفی
468
+ for (let i = 0; i < 7; i++) {
469
+ ctx.strokeStyle = `rgba(${Math.random()*255},${Math.random()*255},${Math.random()*255},0.5)`;
470
+ ctx.beginPath();
471
+ ctx.moveTo(Math.random() * canvas.width, Math.random() * canvas.height);
472
+ ctx.lineTo(Math.random() * canvas.width, Math.random() * canvas.height);
473
+ ctx.stroke();
474
+ }
475
+
476
+ // رسم متن
477
+ ctx.font = 'bold 24px Vazirmatn, Arial';
478
+ ctx.textBaseline = 'middle';
479
+
480
+ for (let i = 0; i < 4; i++) {
481
+ const char = chars[Math.floor(Math.random() * chars.length)];
482
+ code += char;
483
+ ctx.save();
484
+ // جابجایی و چرخش تصادفی
485
+ const x = 20 * i + 15;
486
+ const y = canvas.height / 2;
487
+ ctx.translate(x, y);
488
+ ctx.rotate((Math.random() - 0.5) * 0.4);
489
+ ctx.fillStyle = `rgb(${Math.random()*100},${Math.random()*100},${Math.random()*100})`;
490
+ ctx.fillText(char, 0, 0);
491
+ ctx.restore();
492
+ }
493
+
494
+ // ذخیره کد در متغیر مناسب
495
+ if (canvasId === 'login-canvas') loginCaptchaCode = code;
496
+ if (canvasId === 'reg-canvas') regCaptchaCode = code;
497
+ }
498
+
499
+ // --- مدیریت تب‌ها ---
500
+ function switchTab(tab) {
501
+ const loginForm = document.getElementById('login-form');
502
+ const registerForm = document.getElementById('register-form');
503
+ const btns = document.querySelectorAll('.tab-btn');
504
+
505
+ if (tab === 'login') {
506
+ loginForm.classList.remove('hidden');
507
+ loginForm.classList.add('visible');
508
+ registerForm.classList.remove('visible');
509
+ registerForm.classList.add('hidden');
510
+
511
+ btns[0].classList.add('active');
512
+ btns[1].classList.remove('active');
513
+ generateCaptcha('login-canvas'); // رفرش کپچا هنگام باز شدن
514
+ } else {
515
+ registerForm.classList.remove('hidden');
516
+ registerForm.classList.add('visible');
517
+ loginForm.classList.remove('visible');
518
+ loginForm.classList.add('hidden');
519
+
520
+ btns[0].classList.remove('active');
521
+ btns[1].classList.add('active');
522
+ generateCaptcha('reg-canvas'); // رفرش کپچا هنگام باز شدن
523
+ }
524
+ }
525
+
526
+ // --- مدیریت لاگین ---
527
+ function handleLogin() {
528
+ const phone = document.getElementById('login-phone').value;
529
+ const pass = document.getElementById('login-pass').value;
530
+ const captcha = document.getElementById('login-captcha-input').value;
531
+ const btn = document.querySelector('#login-form .submit-btn');
532
+
533
+ // اعتبارسنجی
534
+ if (!isValidPhone(phone)) {
535
+ showToast('لطفاً شماره موبایل معتبر وارد کنید', 'error');
536
+ return;
537
+ }
538
+ if (pass.length < 4) {
539
+ showToast('رمز عبور اشتباه است', 'error');
540
+ return;
541
+ }
542
+ if (captcha.toLowerCase() !== loginCaptchaCode) {
543
+ showToast('کد امنیتی اشتباه است', 'error');
544
+ generateCaptcha('login-canvas');
545
+ document.getElementById('login-captcha-input').value = '';
546
+ return;
547
+ }
548
+
549
+ // شبیه‌سازی ارسال به سرور
550
+ btn.classList.add('loading');
551
+ btn.innerHTML = '<i class="fas fa-spinner"></i> در حال پردازش...';
552
+
553
+ setTimeout(() => {
554
+ btn.classList.remove('loading');
555
+ btn.innerHTML = '<span>ورود به حساب</span><i class="fas fa-arrow-left"></i>';
556
+ showToast('خوش آمدید! ورود موفقیت آمیز بود.', 'success');
557
+ // اینجا می‌توانید کاربر را ریدایرکت کنید
558
+ }, 2000);
559
+ }
560
+
561
+ // --- مدیریت ثبت نام ---
562
+ function handleRegister() {
563
+ const phone = document.getElementById('reg-phone').value;
564
+ const pass = document.getElementById('reg-pass').value;
565
+ const passConf = document.getElementById('reg-pass-conf').value;
566
+ const captcha = document.getElementById('reg-captcha-input').value;
567
+ const btn = document.querySelector('#register-form .submit-btn');
568
+
569
+ // اعتبارسنجی
570
+ if (!isValidPhone(phone)) {
571
+ showToast('شماره موبایل نامعتبر است', 'error');
572
+ return;
573
+ }
574
+ if (pass.length < 8) {
575
+ showToast('رمز عبور باید حداقل ۸ کاراکتر باشد', 'error');
576
+ return;
577
+ }
578
+ if (pass !== passConf) {
579
+ showToast('تکرار رمز عبور مطابقت ندارد', 'error');
580
+ return;
581
+ }
582
+ if (captcha.toLowerCase() !== regCaptchaCode) {
583
+ showToast('کد امنیتی اشتباه است', 'error');
584
+ generateCaptcha('reg-canvas');
585
+ document.getElementById('reg-captcha-input').value = '';
586
+ return;
587
+ }
588
+
589
+ // ش��یه‌سازی ارسال به سرور
590
+ btn.classList.add('loading');
591
+ btn.innerHTML = '<i class="fas fa-spinner"></i> در حال ثبت...';
592
 
593
+ setTimeout(() => {
594
+ btn.classList.remove('loading');
595
+ btn.innerHTML = '<span>ثبت‌نام کنید</span><i class="fas fa-user-plus"></i>';
596
+ showToast('حساب کاربری با موفقیت ساخته شد.', 'success');
597
+ // سوئیچ به تب لاگین بعد از ثبت نام موفق
598
+ setTimeout(() => switchTab('login'), 1500);
599
+ }, 2000);
600
+ }
601
 
602
+ // --- رویدادها ---
603
+ document.addEventListener('DOMContentLoaded', () => {
604
+ // تولید کپچای اولیه
605
+ generateCaptcha('login-canvas');
606
+
607
+ // قابلیت کلیک روی کپچا برای تغییر
608
+ document.getElementById('login-canvas').addEventListener('click', () => generateCaptcha('login-canvas'));
609
+ document.getElementById('reg-canvas').addEventListener('click', () => generateCaptcha('reg-canvas'));
610
+
611
+ // جلوگیری از ورود اعداد انگلیسی/فارسی نامنظم در شماره موبایل (اختیاری)
612
+ const phoneInputs = document.querySelectorAll('input[type="tel"]');
613
+ phoneInputs.forEach(input => {
614
+ input.addEventListener('input', function(e) {
615
+ this.value = this.value.replace(/[^0-9]/g, '');
616
+ });
617
  });
618
  });
 
 
 
619
 
620
+ </script>
621
+ </body>
622
  </html>