mahdirahdar commited on
Commit
8fe58c9
·
verified ·
1 Parent(s): a3f2618

میخوام بعد از اینکه طرح رو از کاربر گرفت ، دقیقا ایده با خلاقیت هوش مصنوعی روی خود لباس پیاده بشه - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +595 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: First
3
- emoji:
4
- colorFrom: yellow
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: first
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,595 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>استودیو مد هوش مصنوعی - لباس زنانه سفارشی</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .gradient-bg {
11
+ background: linear-gradient(135deg, #fff0f6 0%, #ffdeeb 100%);
12
+ }
13
+ .fabric-pattern {
14
+ background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjYiPgo8cmVjdCB3aWR0aD0iNiIgaGVpZ2h0PSI2IiBmaWxsPSIjZmZmIj48L3JlY3Q+CjxwYXRoIGQ9Ik0wIDBMNiA2IiBzdHJva2U9IiNjY2MiIHN0cm9rZS13aWR0aD0iMC41Ij48L3BhdGg+CjxwYXRoIGQ9Ik02IDBMMCA2IiBzdHJva2U9IiNjY2MiIHN0cm9rZS13aWR0aD0iMC41Ij48L3BhdGg+Cjwvc3ZnPg==');
15
+ }
16
+ .dress-display {
17
+ box-shadow: 0 15px 30px rgba(0,0,0,0.1);
18
+ transition: all 0.3s ease;
19
+ }
20
+ .dress-display:hover {
21
+ transform: translateY(-5px);
22
+ box-shadow: 0 20px 40px rgba(0,0,0,0.15);
23
+ }
24
+ .color-option {
25
+ width: 30px;
26
+ height: 30px;
27
+ border-radius: 50%;
28
+ cursor: pointer;
29
+ transition: transform 0.2s;
30
+ }
31
+ .color-option:hover {
32
+ transform: scale(1.2);
33
+ }
34
+ .color-option.selected {
35
+ transform: scale(1.3);
36
+ box-shadow: 0 0 0 2px white, 0 0 0 4px #4f46e5;
37
+ }
38
+ .pattern-option {
39
+ width: 50px;
40
+ height: 50px;
41
+ cursor: pointer;
42
+ transition: all 0.2s;
43
+ background-size: cover;
44
+ }
45
+ .pattern-option:hover {
46
+ transform: scale(1.1);
47
+ }
48
+ .pattern-option.selected {
49
+ transform: scale(1.15);
50
+ box-shadow: 0 0 0 2px white, 0 0 0 4px #4f46e5;
51
+ }
52
+ .loading-spinner {
53
+ animation: spin 1s linear infinite;
54
+ }
55
+ @keyframes spin {
56
+ 0% { transform: rotate(0deg); }
57
+ 100% { transform: rotate(360deg); }
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="gradient-bg min-h-screen font-sans">
62
+ <div class="container mx-auto px-4 py-8">
63
+ <!-- Header -->
64
+ <header class="flex flex-col md:flex-row justify-between items-center mb-12">
65
+ <div class="flex items-center mb-4 md:mb-0">
66
+ <i class="fas fa-tshirt text-4xl text-pink-500 mr-3"></i>
67
+ <h1 class="text-3xl font-bold text-gray-800">استودیو مد هوش مصنوعی</h1>
68
+ </div>
69
+ <div class="flex items-center space-x-4">
70
+ <button class="bg-pink-500 hover:bg-pink-600 text-white px-4 py-2 rounded-lg flex items-center">
71
+ <i class="fas fa-user-circle mr-2"></i> طرح‌های من
72
+ </button>
73
+ <button class="bg-white hover:bg-gray-100 text-pink-500 px-4 py-2 rounded-lg border border-pink-500 flex items-center">
74
+ <i class="fas fa-shopping-cart mr-2"></i> سبد خرید
75
+ </button>
76
+ </div>
77
+ </header>
78
+
79
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
80
+ <!-- Left Panel - Design Controls -->
81
+ <div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-1">
82
+ <h2 class="text-2xl font-semibold text-gray-800 mb-6">لباس خود را طراحی کنید</h2>
83
+
84
+ <!-- Style Selection -->
85
+ <div class="mb-8">
86
+ <h3 class="text-lg font-medium text-gray-700 mb-3">انتخاب سبک</h3>
87
+ <div class="grid grid-cols-2 gap-3">
88
+ <button class="style-btn bg-gray-100 hover:bg-pink-50 text-gray-800 py-2 px-3 rounded-lg border border-gray-200 flex items-center justify-center" data-style="casual">
89
+ <i class="fas fa-tshirt mr-2"></i> معمولی
90
+ </button>
91
+ <button class="style-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 px-3 rounded-lg border border-gray-200 flex items-center justify-center" data-style="formal">
92
+ <i class="fas fa-user-tie mr-2"></i> رسمی
93
+ </button>
94
+ <button class="style-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 px-3 rounded-lg border border-gray-200 flex items-center justify-center" data-style="party">
95
+ <i class="fas fa-glass-cheers mr-2"></i> مهمانی
96
+ </button>
97
+ <button class="style-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 px-3 rounded-lg border border-gray-200 flex items-center justify-center" data-style="sport">
98
+ <i class="fas fa-running mr-2"></i> ورزشی
99
+ </button>
100
+ </div>
101
+ </div>
102
+
103
+ <!-- Color Selection -->
104
+ <div class="mb-8">
105
+ <h3 class="text-lg font-medium text-gray-700 mb-3">انتخاب رنگ</h3>
106
+ <div class="flex flex-wrap gap-3">
107
+ <div class="color-option bg-red-500 selected" data-color="#ef4444"></div>
108
+ <div class="color-option bg-pink-500" data-color="#ec4899"></div>
109
+ <div class="color-option bg-purple-500" data-color="#a855f7"></div>
110
+ <div class="color-option bg-indigo-500" data-color="#6366f1"></div>
111
+ <div class="color-option bg-blue-500" data-color="#3b82f6"></div>
112
+ <div class="color-option bg-green-500" data-color="#10b981"></div>
113
+ <div class="color-option bg-yellow-500" data-color="#f59e0b"></div>
114
+ <div class="color-option bg-gray-500" data-color="#6b7280"></div>
115
+ <div class="color-option bg-black" data-color="#000000"></div>
116
+ <div class="color-option bg-white border border-gray-300" data-color="#ffffff"></div>
117
+ </div>
118
+ <div class="mt-3">
119
+ <label for="custom-color" class="block text-sm font-medium text-gray-700 mb-1">یا رنگ دلخواه انتخاب کنید:</label>
120
+ <input type="color" id="custom-color" value="#ef4444" class="w-full h-10 cursor-pointer">
121
+ </div>
122
+ </div>
123
+
124
+ <!-- Pattern Selection -->
125
+ <div class="mb-8">
126
+ <h3 class="text-lg font-medium text-gray-700 mb-3">انتخاب طرح</h3>
127
+ <div class="flex flex-wrap gap-3">
128
+ <div class="pattern-option selected" data-pattern="solid" style="background-color: #ef4444;"></div>
129
+ <div class="pattern-option" data-pattern="stripes" style="background: linear-gradient(45deg, #ef4444 25%, #ffffff 25%, #ffffff 50%, #ef4444 50%, #ef4444 75%, #ffffff 75%, #ffffff 100%); background-size: 14.14px 14.14px;"></div>
130
+ <div class="pattern-option" data-pattern="polka" style="background: radial-gradient(circle, #ef4444 20%, transparent 20%), #ffffff; background-size: 10px 10px;"></div>
131
+ <div class="pattern-option" data-pattern="floral" style="background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZD0iTTQwIDBDMjAgMTAgMTAgMzAgMTAgNTBjMCAyMCAxMCA0MCAzMCA1MCAyMC0xMCAzMC0zMCAzMC01MEM3MCAzMCA2MCAxMCA0MCAweiIgZmlsbD0iI2VmNDQ0NCIvPjwvc3ZnPg==');"></div>
132
+ <div class="pattern-option" data-pattern="geometric" style="background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZD0iTTAgMEg1MFY1MEgweiIgZmlsbD0iI2VmNDQ0NCIvPjxwYXRoIGQ9Ik01MCA1MEgxMDBWMTAwSDUweiIgZmlsbD0iI2VmNDQ0NCIvPjwvc3ZnPg==');"></div>
133
+ </div>
134
+ </div>
135
+
136
+ <!-- AI Suggestions -->
137
+ <div class="mb-8">
138
+ <h3 class="text-lg font-medium text-gray-700 mb-3">پیشنهادهای هوش مصنوعی</h3>
139
+ <div class="bg-pink-50 rounded-lg p-4">
140
+ <p class="text-pink-800 mb-3">"بر اساس ترندهای فعلی، پیشنهاد می‌کنیم طرح گل‌دار با رنگ‌های پاستلی برای ظاهری بهاری امتحان کنید."</p>
141
+ <button class="ai-suggestion-btn bg-pink-100 hover:bg-pink-200 text-pink-800 py-1 px-3 rounded-full text-sm flex items-center">
142
+ <i class="fas fa-magic mr-1"></i> اعمال پیشنهاد
143
+ </button>
144
+ </div>
145
+ </div>
146
+
147
+ <!-- Size Selection -->
148
+ <div class="mb-8">
149
+ <h3 class="text-lg font-medium text-gray-700 mb-3">انتخاب سایز</h3>
150
+ <div class="grid grid-cols-5 gap-2">
151
+ <button class="size-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 rounded-lg border border-gray-200" data-size="XS">XS</button>
152
+ <button class="size-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 rounded-lg border border-gray-200" data-size="S">S</button>
153
+ <button class="size-btn bg-pink-100 border-pink-500 text-pink-700 py-2 rounded-lg border-2" data-size="M">M</button>
154
+ <button class="size-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 rounded-lg border border-gray-200" data-size="L">L</button>
155
+ <button class="size-btn bg-gray-100 hover:bg-indigo-50 text-gray-800 py-2 rounded-lg border border-gray-200" data-size="XL">XL</button>
156
+ </div>
157
+ </div>
158
+
159
+ <!-- Custom Text -->
160
+ <div class="mb-8">
161
+ <h3 class="text-lg font-medium text-gray-700 mb-3">افزودن متن سفارشی</h3>
162
+ <input type="text" placeholder="متن خود را اینجا وارد کنید" class="custom-text w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
163
+ <div class="mt-2 flex items-center">
164
+ <label for="text-color" class="mr-2 text-sm text-gray-700">رنگ:</label>
165
+ <input type="color" id="text-color" value="#000000" class="h-6 w-6 cursor-pointer">
166
+ <button class="ml-auto text-sm bg-gray-100 hover:bg-gray-200 px-2 py-1 rounded">افزودن متن</button>
167
+ </div>
168
+ </div>
169
+
170
+ <!-- Action Buttons -->
171
+ <div class="flex flex-col space-y-3">
172
+ <button id="generate-btn" class="bg-pink-500 hover:bg-pink-600 text-white py-3 rounded-lg font-medium flex items-center justify-center">
173
+ <i class="fas fa-robot mr-2"></i> تولید با هوش مصنوعی
174
+ </button>
175
+ <button class="bg-white hover:bg-gray-100 text-pink-500 py-3 rounded-lg border-2 border-pink-500 font-medium flex items-center justify-center">
176
+ <i class="fas fa-save mr-2"></i> ذخیره طرح
177
+ </button>
178
+ <button class="bg-white hover:bg-gray-100 text-gray-800 py-3 rounded-lg border border-gray-300 font-medium flex items-center justify-center">
179
+ <i class="fas fa-shopping-bag mr-2"></i> افزودن به سبد
180
+ </button>
181
+ </div>
182
+ </div>
183
+
184
+ <!-- Center Panel - Dress Display -->
185
+ <div class="lg:col-span-2">
186
+ <div class="bg-white rounded-xl shadow-lg p-6 mb-6">
187
+ <div class="flex justify-between items-center mb-4">
188
+ <h2 class="text-2xl font-semibold text-gray-800">طراحی سفارشی شما</h2>
189
+ <div class="flex space-x-2">
190
+ <button class="view-btn bg-gray-100 hover:bg-gray-200 text-gray-800 p-2 rounded-full" data-view="front">
191
+ <i class="fas fa-user"></i>
192
+ </button>
193
+ <button class="view-btn bg-pink-100 text-pink-700 p-2 rounded-full" data-view="back">
194
+ <i class="fas fa-user-alt"></i>
195
+ </button>
196
+ <button class="view-btn bg-gray-100 hover:bg-gray-200 text-gray-800 p-2 rounded-full" data-view="side">
197
+ <i class="fas fa-user-friends"></i>
198
+ </button>
199
+ </div>
200
+ </div>
201
+
202
+ <div class="dress-display fabric-pattern rounded-xl overflow-hidden relative" style="height: 500px; background-color: #ef4444;">
203
+ <!-- Dress will be displayed here -->
204
+ <div id="dress-container" class="h-full flex items-center justify-center">
205
+ <div class="text-center">
206
+ <i class="fas fa-tshirt text-6xl text-white opacity-50 mb-3"></i>
207
+ <p class="text-white opacity-70">با استفاده از کنترل‌ها لباس خود را سفارشی کنید</p>
208
+ </div>
209
+ </div>
210
+
211
+ <!-- Loading overlay -->
212
+ <div id="loading-overlay" class="hidden absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center">
213
+ <div class="text-white text-center">
214
+ <i class="fas fa-spinner loading-spinner text-4xl mb-2"></i>
215
+ <p>هوش مصنوعی در حال تولید طرح شماست...</p>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <div class="mt-4 flex justify-between items-center">
221
+ <div>
222
+ <p class="text-gray-600">سبک فعلی: <span class="font-medium" id="current-style">معمولی</span></p>
223
+ <p class="text-gray-600">رنگ: <span class="font-medium" id="current-color">قرمز</span></p>
224
+ </div>
225
+ <div class="flex space-x-2">
226
+ <button class="zoom-btn bg-gray-100 hover:bg-gray-200 text-gray-800 p-2 rounded-full">
227
+ <i class="fas fa-search-plus"></i>
228
+ </button>
229
+ <button class="zoom-btn bg-gray-100 hover:bg-gray-200 text-gray-800 p-2 rounded-full">
230
+ <i class="fas fa-search-minus"></i>
231
+ </button>
232
+ <button class="rotate-btn bg-gray-100 hover:bg-gray-200 text-gray-800 p-2 rounded-full">
233
+ <i class="fas fa-sync-alt"></i>
234
+ </button>
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <!-- AI Recommendations -->
240
+ <div class="bg-white rounded-xl shadow-lg p-6">
241
+ <h2 class="text-2xl font-semibold text-gray-800 mb-4">پیشنهادهای هوش مصنوعی</h2>
242
+ <p class="text-gray-600 mb-4">هوش مصنوعی ما با تحلیل ترندهای مد و ترجیحات شما این موارد تکمیلی را پیشنهاد می‌کند:</p>
243
+
244
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
245
+ <div class="bg-gray-50 rounded-lg p-3 text-center">
246
+ <div class="bg-gray-200 h-24 mb-2 rounded-lg flex items-center justify-center">
247
+ <i class="fas fa-shoe-prints text-3xl text-gray-400"></i>
248
+ </div>
249
+ <p class="font-medium">کفش هماهنگ</p>
250
+ <p class="text-sm text-gray-500">$79.99</p>
251
+ <button class="mt-2 text-xs bg-indigo-600 hover:bg-indigo-700 text-white px-2 py-1 rounded">افزودن</button>
252
+ </div>
253
+ <div class="bg-gray-50 rounded-lg p-3 text-center">
254
+ <div class="bg-gray-200 h-24 mb-2 rounded-lg flex items-center justify-center">
255
+ <i class="fas fa-ring text-3xl text-gray-400"></i>
256
+ </div>
257
+ <p class="font-medium">گردنبند طلا</p>
258
+ <p class="text-sm text-gray-500">$129.99</p>
259
+ <button class="mt-2 text-xs bg-indigo-600 hover:bg-indigo-700 text-white px-2 py-1 rounded">Add</button>
260
+ </div>
261
+ <div class="bg-gray-50 rounded-lg p-3 text-center">
262
+ <div class="bg-gray-200 h-24 mb-2 rounded-lg flex items-center justify-center">
263
+ <i class="fas fa-hat-cowboy text-3xl text-gray-400"></i>
264
+ </div>
265
+ <p class="font-medium">کلاه تابستانی</p>
266
+ <p class="text-sm text-gray-500">$39.99</p>
267
+ <button class="mt-2 text-xs bg-indigo-600 hover:bg-indigo-700 text-white px-2 py-1 rounded">Add</button>
268
+ </div>
269
+ <div class="bg-gray-50 rounded-lg p-3 text-center">
270
+ <div class="bg-gray-200 h-24 mb-2 rounded-lg flex items-center justify-center">
271
+ <i class="fas fa-bag-shopping text-3xl text-gray-400"></i>
272
+ </div>
273
+ <p class="font-medium">کیف چرمی</p>
274
+ <p class="text-sm text-gray-500">$89.99</p>
275
+ <button class="mt-2 text-xs bg-indigo-600 hover:bg-indigo-700 text-white px-2 py-1 rounded">Add</button>
276
+ </div>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </div>
282
+
283
+ <script>
284
+ document.addEventListener('DOMContentLoaded', function() {
285
+ // Current design state
286
+ const designState = {
287
+ style: 'casual',
288
+ color: '#ef4444',
289
+ pattern: 'solid',
290
+ size: 'M',
291
+ view: 'front',
292
+ customText: '',
293
+ textColor: '#000000'
294
+ };
295
+
296
+ // Color name mapping
297
+ const colorNames = {
298
+ '#ef4444': 'قرمز',
299
+ '#ec4899': 'صورتی',
300
+ '#a855f7': 'بنفش',
301
+ '#6366f1': 'نیلی',
302
+ '#3b82f6': 'آبی',
303
+ '#10b981': 'سبز',
304
+ '#f59e0b': 'زرد',
305
+ '#6b7280': 'خاکستری',
306
+ '#000000': 'مشکی',
307
+ '#ffffff': 'سفید'
308
+ };
309
+
310
+ // Style name mapping
311
+ const styleNames = {
312
+ 'casual': 'معمولی',
313
+ 'formal': 'رسمی',
314
+ 'party': 'مهمانی',
315
+ 'sport': 'ورزشی'
316
+ };
317
+
318
+ // DOM elements
319
+ const colorOptions = document.querySelectorAll('.color-option');
320
+ const patternOptions = document.querySelectorAll('.pattern-option');
321
+ const styleButtons = document.querySelectorAll('.style-btn');
322
+ const sizeButtons = document.querySelectorAll('.size-btn');
323
+ const viewButtons = document.querySelectorAll('.view-btn');
324
+ const customColorInput = document.getElementById('custom-color');
325
+ const customTextInput = document.querySelector('.custom-text');
326
+ const textColorInput = document.getElementById('text-color');
327
+ const generateBtn = document.getElementById('generate-btn');
328
+ const loadingOverlay = document.getElementById('loading-overlay');
329
+ const currentStyleElement = document.getElementById('current-style');
330
+ const currentColorElement = document.getElementById('current-color');
331
+ const dressContainer = document.getElementById('dress-container');
332
+ const aiSuggestionBtn = document.querySelector('.ai-suggestion-btn');
333
+
334
+ // Initialize
335
+ updateDisplay();
336
+
337
+ // Event listeners
338
+ colorOptions.forEach(option => {
339
+ option.addEventListener('click', function() {
340
+ // Remove selected class from all options
341
+ colorOptions.forEach(opt => opt.classList.remove('selected'));
342
+ // Add selected class to clicked option
343
+ this.classList.add('selected');
344
+ // Update design state
345
+ designState.color = this.getAttribute('data-color');
346
+ // Update custom color picker
347
+ customColorInput.value = designState.color;
348
+ // Update display
349
+ updateDisplay();
350
+ });
351
+ });
352
+
353
+ patternOptions.forEach(option => {
354
+ option.addEventListener('click', function() {
355
+ // Remove selected class from all options
356
+ patternOptions.forEach(opt => opt.classList.remove('selected'));
357
+ // Add selected class to clicked option
358
+ this.classList.add('selected');
359
+ // Update design state
360
+ designState.pattern = this.getAttribute('data-pattern');
361
+ // Update display
362
+ updateDisplay();
363
+ });
364
+ });
365
+
366
+ styleButtons.forEach(button => {
367
+ button.addEventListener('click', function() {
368
+ // Update design state
369
+ designState.style = this.getAttribute('data-style');
370
+ // Update display
371
+ updateDisplay();
372
+ });
373
+ });
374
+
375
+ sizeButtons.forEach(button => {
376
+ button.addEventListener('click', function() {
377
+ // Remove selected styling from all buttons
378
+ sizeButtons.forEach(btn => {
379
+ btn.classList.remove('bg-indigo-100', 'border-indigo-500', 'text-indigo-700', 'border-2');
380
+ btn.classList.add('bg-gray-100', 'border-gray-200', 'text-gray-800');
381
+ });
382
+ // Add selected styling to clicked button
383
+ this.classList.remove('bg-gray-100', 'border-gray-200', 'text-gray-800');
384
+ this.classList.add('bg-indigo-100', 'border-indigo-500', 'text-indigo-700', 'border-2');
385
+ // Update design state
386
+ designState.size = this.getAttribute('data-size');
387
+ });
388
+ });
389
+
390
+ viewButtons.forEach(button => {
391
+ button.addEventListener('click', function() {
392
+ // Remove selected styling from all buttons
393
+ viewButtons.forEach(btn => {
394
+ btn.classList.remove('bg-indigo-100', 'text-indigo-700');
395
+ btn.classList.add('bg-gray-100', 'text-gray-800');
396
+ });
397
+ // Add selected styling to clicked button
398
+ this.classList.remove('bg-gray-100', 'text-gray-800');
399
+ this.classList.add('bg-indigo-100', 'text-indigo-700');
400
+ // Update design state
401
+ designState.view = this.getAttribute('data-view');
402
+ // Update display
403
+ updateDisplay();
404
+ });
405
+ });
406
+
407
+ customColorInput.addEventListener('input', function() {
408
+ // Update design state
409
+ designState.color = this.value;
410
+ // Find matching color option if exists
411
+ let matchingOption = null;
412
+ colorOptions.forEach(option => {
413
+ if (option.getAttribute('data-color').toLowerCase() === this.value.toLowerCase()) {
414
+ matchingOption = option;
415
+ }
416
+ });
417
+
418
+ // Update selected color option
419
+ colorOptions.forEach(opt => opt.classList.remove('selected'));
420
+ if (matchingOption) {
421
+ matchingOption.classList.add('selected');
422
+ } else {
423
+ // If custom color doesn't match any option, select the custom color
424
+ // (in a real app, you might add a new option dynamically)
425
+ }
426
+
427
+ // Update display
428
+ updateDisplay();
429
+ });
430
+
431
+ customTextInput.addEventListener('input', function() {
432
+ designState.customText = this.value;
433
+ });
434
+
435
+ textColorInput.addEventListener('input', function() {
436
+ designState.textColor = this.value;
437
+ });
438
+
439
+ generateBtn.addEventListener('click', function() {
440
+ // Show loading overlay
441
+ loadingOverlay.classList.remove('hidden');
442
+
443
+ // Simulate AI generation (in a real app, this would call an API)
444
+ setTimeout(() => {
445
+ // Hide loading overlay
446
+ loadingOverlay.classList.add('hidden');
447
+
448
+ // Update display with "AI-generated" design
449
+ updateDisplay(true);
450
+
451
+ // Show success message
452
+ alert('هوش مصنوعی یک طرح جدید بر اساس ترجیحات شما تولید کرد!');
453
+ }, 2000);
454
+ });
455
+
456
+ aiSuggestionBtn.addEventListener('click', function() {
457
+ // Apply AI suggestion
458
+ designState.color = '#a855f7'; // Purple
459
+ designState.pattern = 'floral';
460
+
461
+ // Update UI to match new state
462
+ colorOptions.forEach(opt => opt.classList.remove('selected'));
463
+ document.querySelector('.color-option[data-color="#a855f7"]').classList.add('selected');
464
+
465
+ patternOptions.forEach(opt => opt.classList.remove('selected'));
466
+ document.querySelector('.pattern-option[data-pattern="floral"]').classList.add('selected');
467
+
468
+ customColorInput.value = designState.color;
469
+
470
+ // Update display
471
+ updateDisplay();
472
+
473
+ // Show message
474
+ alert('پیشنهاد هوش مصنوعی اعمال شد!');
475
+ });
476
+
477
+ // Update the dress display
478
+ function updateDisplay(isAIGenerated = false) {
479
+ // Update info text
480
+ currentStyleElement.textContent = styleNames[designState.style];
481
+ currentColorElement.textContent = colorNames[designState.color] || 'سفارشی';
482
+
483
+ const dressDisplay = document.querySelector('.dress-display');
484
+ const initialPrompt = document.getElementById('initial-prompt');
485
+ const aiDesign = document.getElementById('ai-design');
486
+
487
+ if (isAIGenerated) {
488
+ initialPrompt.classList.add('hidden');
489
+ aiDesign.classList.remove('hidden');
490
+
491
+ // Generate AI-enhanced design
492
+ const designElements = {
493
+ casual: ['fas fa-tshirt', 'طرح روزمره'],
494
+ formal: ['fas fa-user-tie', 'طراحی رسمی'],
495
+ party: ['fas fa-glass-cheers', 'طرح مهمانی'],
496
+ sport: ['fas fa-running', 'طراحی ورزشی']
497
+ };
498
+
499
+ const [icon, title] = designElements[designState.style];
500
+ const colorName = colorNames[designState.color] || 'سفارشی';
501
+
502
+ aiDesign.innerHTML = `
503
+ <div class="text-center p-4 bg-white bg-opacity-20 rounded-xl">
504
+ <i class="${icon} text-6xl text-white mb-3"></i>
505
+ <h3 class="text-xl font-bold text-white">${title}</h3>
506
+ <p class="text-white">رنگ: ${colorName}</p>
507
+ <p class="text-white">طرح: ${designState.pattern}</p>
508
+ <div class="mt-4 w-full h-1 bg-white bg-opacity-50"></div>
509
+ <p class="text-white mt-2 text-sm">طراحی شده با هوش مصنوعی</p>
510
+ </div>
511
+ `;
512
+
513
+ // Apply creative pattern based on user selection
514
+ dressDisplay.style.background = getAIPattern(designState.pattern, designState.color);
515
+ } else {
516
+ initialPrompt.classList.remove('hidden');
517
+ aiDesign.classList.add('hidden');
518
+ dressDisplay.style.background = getBasicPattern(designState.pattern, designState.color);
519
+ }
520
+ }
521
+
522
+ function getBasicPattern(pattern, color) {
523
+ switch(pattern) {
524
+ case 'solid': return color;
525
+ case 'stripes':
526
+ return `linear-gradient(45deg, ${color} 25%, #ffffff 25%, #ffffff 50%, ${color} 50%, ${color} 75%, #ffffff 75%, #ffffff 100%)`;
527
+ case 'polka':
528
+ return `radial-gradient(circle, ${color} 20%, transparent 20%), #ffffff`;
529
+ case 'floral':
530
+ return `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZD0iTTQwIDBDMjAgMTAgMTAgMzAgMTAgNTBjMCAyMCAxMCA0MCAzMCA1MCAyMC0xMCAzMC0zMCAzMC01MEM3MCAzMCA2MCAxMCA0MCB6IiBmaWxsPSJ${color.substring(1)}Ii8+PC9zdmc+')`;
531
+ case 'geometric':
532
+ return `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZD0iTTAgMEg1MFY1MEgweiIgZmlsbD0i${color.substring(1)}Ii8+PHBhdGggZD0iTTUwIDBIMTAwVjUwSDUweiIgZmlsbD0i${color.substring(1)}Ii8+PC9zdmc+')`;
533
+ default: return color;
534
+ }
535
+ }
536
+
537
+ function getAIPattern(pattern, color) {
538
+ // More creative patterns for AI version
539
+ switch(pattern) {
540
+ case 'solid':
541
+ return `linear-gradient(135deg, ${color} 0%, ${shadeColor(color, -20)} 100%)`;
542
+ case 'stripes':
543
+ return `repeating-linear-gradient(45deg, ${color}, ${color} 10px, ${shadeColor(color, -30)} 10px, ${shadeColor(color, -30)} 20px)`;
544
+ case 'polka':
545
+ return `radial-gradient(circle at 10px 10px, ${color} 2px, transparent 2px),
546
+ radial-gradient(circle at 10px 10px, ${color} 2px, transparent 2px) ${shadeColor(color, 20)};
547
+ background-size: 20px 20px`;
548
+ case 'floral':
549
+ return `url('data:image/svg+xml;base64,${btoa(`
550
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
551
+ <path d="M50 0C30 15 15 30 0 50c15 20 30 35 50 50 20-15 35-30 50-50C85 30 70 15 50 0z"
552
+ fill="${color}"/>
553
+ <path d="M30 20C15 30 5 45 0 60c10 15 25 25 40 30-5-15-5-30 0-45-5 5-10 10-10 15z"
554
+ fill="${shadeColor(color, 20)}"/>
555
+ </svg>`)}')`;
556
+ case 'geometric':
557
+ return `url('data:image/svg+xml;base64,${btoa(`
558
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
559
+ <polygon points="0,0 50,0 0,50" fill="${color}"/>
560
+ <polygon points="50,0 100,0 100,50" fill="${shadeColor(color, -20)}"/>
561
+ <polygon points="0,50 0,100 50,100" fill="${shadeColor(color, 20)}"/>
562
+ <polygon points="50,100 100,100 100,50" fill="${shadeColor(color, -30)}"/>
563
+ </svg>`)}')`;
564
+ default:
565
+ return `linear-gradient(135deg, ${color} 0%, ${shadeColor(color, -20)} 100%)`;
566
+ }
567
+ }
568
+
569
+ function shadeColor(color, percent) {
570
+ let R = parseInt(color.substring(1,3), 16);
571
+ let G = parseInt(color.substring(3,5), 16);
572
+ let B = parseInt(color.substring(5,7), 16);
573
+
574
+ R = parseInt(R * (100 + percent) / 100);
575
+ G = parseInt(G * (100 + percent) / 100);
576
+ B = parseInt(B * (100 + percent) / 100);
577
+
578
+ R = (R<255)?R:255;
579
+ G = (G<255)?G:255;
580
+ B = (B<255)?B:255;
581
+
582
+ R = Math.round(R);
583
+ G = Math.round(G);
584
+ B = Math.round(B);
585
+
586
+ const RR = ((R.toString(16).length==1)?"0"+R.toString(16):R.toString(16));
587
+ const GG = ((G.toString(16).length==1)?"0"+G.toString(16):G.toString(16));
588
+ const BB = ((B.toString(16).length==1)?"0"+B.toString(16):B.toString(16));
589
+
590
+ return "#"+RR+GG+BB;
591
+ }
592
+ });
593
+ </script>
594
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=mahdirahdar/first" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
595
+ </html>