GSMEthesis commited on
Commit
7f6e3da
·
verified ·
1 Parent(s): 960f1d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +604 -315
app.py CHANGED
@@ -18,370 +18,657 @@ SHEET_NAME = "Condition1"
18
 
19
  # ========== استایل‌های سفارشی یکپارچه ==========
20
  st.markdown("""
21
- <style>
22
- @font-face {
23
- font-family: 'B Nazanin';
24
- src: url('https://cdn.jsdelivr.net/gh/rastikerdar/fonts@master/fonts/B%20Nazanin/B%20Nazanin.woff') format('woff');
25
- }
 
26
 
27
- :root {
28
- --primary: #6a0dad;
29
- --text: #333333;
30
- --background: #ffffff;
31
- --border: #dddddd;
32
- --input-bg: #ffffff;
33
- --secondary-bg: #f8f9fa;
34
- --green: #f0ff0;
35
- --dgreen: #006400
36
- }
37
 
38
- * {
39
- font-family: 'B Nazanin', 'B Nazanin Bold', sans-serif !important;
40
- text-align: right !important;
41
- direction: rtl !important;
42
- }
43
 
44
- /* تنظیمات اصلی */
45
- body, .stApp, [data-testid="stAppViewContainer"] {
46
- background-color: var(--background) !important;
47
- color: var(--text) !important;
48
- }
 
 
 
 
 
 
 
 
 
 
 
49
 
50
- /* هدر راهیار */
51
- .rahyar-title {
52
- color: var(--primary) !important;
53
- margin: 0 !important;
 
 
 
 
 
54
  }
55
 
56
- .rahyar-subtitle {
57
- color: var(--primary) !important;
58
- margin: 0 !important;
59
- font-size: 14px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
- /* توضیحات */
63
- .explanation-title {
64
- color: var(--primary) !important;
65
- font-weight: bold !important;
66
- margin: 20px 0 10px 0 !important;
67
- font-size: 18px !important;
68
  }
69
 
70
- .explanation-item {
71
- background-color: var(--secondary-bg) !important;
72
- border-radius: 8px !important;
73
- padding: 12px 15px !important;
74
- margin: 8px 0 !important;
75
- border-right: 3px solid var(--primary) !important;
76
  }
77
 
78
- /* ========== استایل‌های ورودی یکپارچه ========== */
79
- /* استایل پایه برای تمام عناصر ورودی */
80
- .stTextInput input,
81
- .stNumberInput input,
82
- .stSelectbox select,
83
- .stTextArea textarea,
84
- .stDateInput input,
85
- .stTimeInput input,
86
- .stMultiSelect div[role="combobox"],
87
- div[data-testid="stVerticalBlock"] > div[data-testid="stHorizontalBlock"] > div > div > div > div > input,
88
- div[data-baseweb="select"] > div:first-child {
89
- color: var(--text) !important;
90
- background-color: var(--input-bg) !important;
91
- border: 1px solid var(--primary) !important;
92
- border-radius: 6px !important;
93
- min-height: 40px !important;
94
- transition: all 0.2s ease !important;
95
- }
96
-
97
- /* استایل برای حالت hover و focus */
98
- .stTextInput input:hover,
99
- .stNumberInput input:hover,
100
- .stSelectbox select:hover,
101
- .stTextArea textarea:hover,
102
- .stDateInput input:hover,
103
- .stTimeInput input:hover,
104
- .stMultiSelect div[role="combobox"]:hover,
105
- .stTextInput input:focus,
106
- .stNumberInput input:focus,
107
- .stSelectbox select:focus,
108
- .stTextArea textarea:focus,
109
- .stDateInput input:focus,
110
- .stTimeInput input:focus {
111
- border-color: var(--primary) !important;
112
- box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.15) !important;
113
- outline: none !important;
114
- }
115
-
116
- /* استایل لیبل‌ها */
117
- .stTextInput > label,
118
- .stNumberInput > label,
119
- .stSelectbox > label,
120
- .stRadio > label,
121
- .stSlider > label {
122
- color: var(--text) !important;
123
- font-weight: bold !important;
124
- margin-bottom: 8px !important;
125
- font-size: 14px !important;
126
  }
127
 
128
- /* استایل placeholder */
129
- ::placeholder {
130
- color: var(--text) !important;
131
- opacity: 0.5 !important;
132
  }
133
 
134
- /* ========== استایل‌های خاص Selectbox ========== */
135
- div[data-baseweb="select"] > div:first-child {
136
- -webkit-appearance: none !important;
137
- -moz-appearance: none !important;
138
- appearance: none !important;
139
- background-image: none !important;
140
  }
141
 
142
- /* برای اینترنت اکسپلورر */
143
- div[data-baseweb="select"] > div:first-child::-ms-expand {
144
- display: none !important;
 
145
  }
146
 
147
- div[data-baseweb="select"] {
148
- position: relative !important;
149
- }
150
-
151
- div[data-baseweb="select"]::after {
152
- content: "▼";
153
  position: absolute;
154
- left: 8px;
155
- top: 50%;
156
- transform: translateY(-50%);
157
- color: var(--primary);
158
- background-color: white !important; /* پسزمینه سفید برای پوشاندن فلش پیشفرض */
159
- font-size: 14px;
160
- pointer-events: none;
161
  }
162
-
163
-
164
- /* ===== راه حل تضمینی برای استایل dropdown ===== */
165
-
166
- /* آیتم‌های لیست */
167
- div[data-baseweb="popover"] [role="option"] {
168
- color: var(--text) !important;
169
- background-color: white !important;
170
- border: 1px var(--primary) !important;
171
  }
172
 
173
- /* آیتم انتخاب شده */
174
- div[data-baseweb="popover"] [role="option"][aria-selected="true"] {
175
- background-color: #f0e6ff !important;
176
- color: black !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
178
 
179
- /* ========== استایل‌های Number Input ========== */
180
- .stNumberInput button {
181
- color: var(--primary) !important;
182
- background-color: transparent !important;
183
- border: none !important;
184
- width: 30px !important;
185
- font-weight: bold !important;
186
  }
187
 
188
- .stNumberInput button:hover {
189
- background-color: #f0e6ff !important;
 
 
 
 
 
 
 
190
  }
191
-
192
 
193
- /* کامپوننت‌های سفارشی */
194
- .rahyar-header {
195
- background-color: var(--primary) !important;
196
- color: white !important;
197
- padding: 15px !important;
198
- border-radius: 10px !important;
199
- margin-bottom: 20px !important;
200
- text-align: center !important;
201
- }
202
 
203
- .price-container {
204
- background-color: var(--secondary-bg) !important;
205
- border-radius: 10px !important;
206
- padding: 15px !important;
207
- margin: 15px 0 !important;
208
- border-right: 5px solid var(--primary) !important;
209
- }
210
 
211
- /* دکمه اصلی (بنفش با متن سفید) */
212
- .stButton>button,
213
- [data-testid="baseButton-primary"],
214
- .accept-btn,
215
- div[data-testid="stVerticalBlock"] > div[data-testid="stHorizontalBlock"] > div > div > button {
216
- background-color: var(--primary) !important;
217
- color: white !important;
218
- border: none !important;
219
- border-radius: 8px !important;
220
- padding: 10px 20px !important;
221
- font-weight: bold !important;
222
- transition: all 0.3s ease !important; /* افزودن transition برای انیمیشن نرم */
223
- }
224
-
225
- /* افکت hover برای دکمه اصلی */
226
- .stButton>button:hover,
227
- [data-testid="baseButton-primary"]:hover,
228
- .accept-btn:hover,
229
- div[data-testid="stVerticalBlock"] > div[data-testid="stHorizontalBlock"] > div > div > button:hover {
230
- background-color: #5a0a96 !important; /* بنفش تیره‌تر */
231
- transform: translateY(-1px) !important; /* حرکت جزئی به بالا */
232
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* سایه بیشتر */
233
- }
234
-
235
- /* دکمه ثانویه (سفید با حاشیه بنفش) */
236
- .stFormSubmitButton>button,
237
- [data-testid="baseButton-secondary"],
238
- .reject-btn {
239
- background-color: var(--primary) !important;
240
- color: white !important;
241
- border: none !important;
242
- border-radius: 8px !important;
243
- padding: 10px 20px !important;
244
- font-weight: bold !important;
245
- transition: all 0.3s ease !important; /* افزودن transition برای انیمیشن نرم */
246
- }
247
-
248
- /* افکت hover برای دکمه ثانویه */
249
- .stFormSubmitButton>button:hover,
250
- [data-testid="baseButton-secondary"]:hover,
251
- .reject-btn:hover {
252
- background-color: #5a0a96 !important; /* بنفش تیره‌تر */
253
- transform: translateY(-1px) !important; /* حرکت جزئی به بالا */
254
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* سایه بیشتر */
255
- }
256
 
257
- /* استایل تضمینی برای رادیو باتن‌ها - نسخه نهایی */
258
- .stRadio > div > div > div > div > div > label,
259
- .stRadio > div > div > div > div > label,
260
- .stRadio > div > div > div > label,
261
- .stRadio > div > div > label,
262
- .stRadio > div > label,
263
- .stRadio > label {
264
- color: #000000 !important;
265
- -webkit-text-fill-color: #000000 !important; /* برای مرورگرهای وبکیت */
266
- }
267
-
268
- .stRadio span {
269
- color: #000000 !important;
270
- -webkit-text-fill-color: #000000 !important;
271
- }
272
-
273
- /* اگر باز هم مشکل داشت این را اضافه کنید */
274
- .stRadio > div > div > div > div > div > label > div:first-child,
275
- .stRadio > div > div > div > div > label > div:first-child,
276
- .stRadio > div > div > div > label > div:first-child,
277
- .stRadio > div > div > label > div:first-child,
278
- .stRadio > div > label > div:first-child,
279
- .stRadio > label > div:first-child {
280
- color: #000000 !important;
281
- -webkit-text-fill-color: #000000 !important;
282
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
 
284
- /* استایل پایه برای هشدارها */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  .stAlert .st-ae {
286
- border-right: 4px solid #ffc107 !important;
287
- background-color: #fff3cd !important;
288
- border-radius: 8px !important;
289
- padding: 16px !important;
290
- color: #856404 !important;
291
  }
292
-
293
- /* آیکون هشدار */
294
- .stAlert .st-af {
295
- color: #ffc107 !important;
296
- font-size: 20px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  }
298
 
299
- /* متن هشدار */
300
- .stAlert .st-ag {
301
- color: #856404 !important;
302
- font-family: 'B Nazanin' !important;
303
  font-size: 14px !important;
304
- margin-right: 8px !important;
305
- }
306
-
307
- /* حالت hover برای هشدار */
308
- .stAlert .st-ae:hover {
309
- box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2) !important;
310
- transform: translateX(2px);
311
- transition: all 0.3s ease;
312
  }
313
 
314
- /* استایل برای دکمه بستن هشدار */
315
- .stAlert .st-ah {
316
- color: #856404 !important;
 
 
 
317
  }
318
 
319
- /* استایل مخصوص موبایل */
320
- @media (max-width: 768px) {
321
- .stAlert .st-ae {
322
- padding: 12px !important;
323
- font-size: 13px !important;
324
- }
325
  }
326
 
327
-
328
- /* متن گزینه‌ها */
329
- .stRadio span {
330
- color: #000000 !important; /* مشکی خالص */
331
- font-size: 14px !important;
332
- padding-right: 5px !important;
333
  }
334
 
335
- /* حالت hover */
336
- .stRadio label:hover span {
337
- color: #333333 !important; /* مشکی کمی روشن‌تر */
338
  }
339
 
340
- /* کانتینر اصلی */
341
- .stRadio > div {
342
- margin-bottom: 10px !important;
343
  }
 
344
 
 
 
 
 
 
 
 
 
 
 
345
 
346
- /* تنظیمات مخصوص موبایل */
347
- @media (max-width: 768px) {
348
- .folium-map {
349
- height: 300px !important;
350
- }
351
-
352
- /* فرم‌ها در موبایل */
353
- .stTextInput>label,
354
- .stNumberInput>label,
355
- .stSelectbox>label {
356
- font-size: 14px !important;
357
- padding: 4px 0 !important;
358
- }
359
-
360
- .stTextInput input,
361
- .stNumberInput input,
362
- .stSelectbox select {
363
- font-size: 16px !important;
364
- padding: 12px !important;
365
- height: auto !important;
366
- }
367
-
368
- .stButton>button {
369
- font-size: 14px !important;
370
- padding: 8px 16px !important;
371
- }
372
-
373
- .stMarkdown h3 {
374
- font-size: 16px !important;
375
- }
376
-
377
- .stMarkdown p {
378
- font-size: 13px !important;
379
- }
380
-
381
- .stSelectbox [role="listbox"] {
382
- font-size: 16px !important;
383
- }
384
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  </style>
386
  """, unsafe_allow_html=True)
387
 
@@ -1035,16 +1322,18 @@ def thank_you_page():
1035
  ✉ ایمیل: maryam.ilka2000@gmail.com
1036
  """)
1037
  st.balloons()
1038
-
1039
- if st.button("بازگشت به ابتدا"):
1040
- st.session_state.clear()
1041
- st.rerun()
1042
 
1043
  # ========== مدیریت وضعیت و صفحه‌بندی ==========
1044
  def main():
1045
  # تشخیص دستگاه
1046
  user_agent = st.query_params.get("user_agent", [""])[0]
1047
  st.session_state.is_desktop = "mobile" not in user_agent.lower()
 
 
 
 
 
 
1048
 
1049
  if 'current_page' not in st.session_state:
1050
  st.session_state.current_page = "welcome"
 
18
 
19
  # ========== استایل‌های سفارشی یکپارچه ==========
20
  st.markdown("""
21
+ <style>
22
+ /* تنظیمات کلی استایل‌ها */
23
+ @font-face {
24
+ font-family: 'B Nazanin';
25
+ src: url('https://cdn.jsdelivr.net/gh/rastikerdar/fonts@master/fonts/B%20Nazanin/B%20Nazanin.woff') format('woff');
26
+ }
27
 
28
+ :root {
29
+ --primary: #6a0dad;
30
+ --text: #333333;
31
+ --background: #ffffff;
32
+ --border: #dddddd;
33
+ --input-bg: #ffffff;
34
+ --secondary-bg: #f8f9fa;
35
+ --green: #f0ff0;
36
+ --dgreen: #006400;
37
+ }
38
 
39
+ * {
40
+ font-family: 'B Nazanin', 'B Nazanin Bold', sans-serif !important;
41
+ text-align: right !important;
42
+ direction: rtl !important;
43
+ }
44
 
45
+ /* ======== تنظیمات پایه ======== */
46
+ * {
47
+ font-family: 'B Nazanin', 'B Nazanin Bold', sans-serif !important;
48
+ text-align: right !important;
49
+ direction: rtl !important;
50
+ box-sizing: border-box !important;
51
+ }
52
+
53
+ /* تنظیمات برای موبایل و نمایش موبایل در تمام دستگاه‌ها */
54
+ html, body, .stApp {
55
+ max-width: 768px !important; /* حداکثر عرض صفحه */
56
+ margin: 0 auto; /* وسط‌چین کردن محتوا */
57
+ width: 100% !important
58
+ background-color: var(--background) !important;
59
+ color: var(--text) !important;
60
+ }
61
 
62
+ @media (min-width: 768px) {
63
+ /* Container for the mobile frame */
64
+ body {
65
+ background: #f0f0f0 !important;
66
+ display: flex !important;
67
+ justify-content: center !important;
68
+ align-items: center !important;
69
+ height: 100vh !important;
70
+ overflow: hidden !important;
71
  }
72
 
73
+ /* Mobile frame styling */
74
+ [data-testid="stAppViewContainer"] {
75
+ width: 475px !important;
76
+ height: 667px !important;
77
+ margin: 0 auto !important;
78
+ border: 12px solid #000 !important;
79
+ border-radius: 40px !important;
80
+ box-shadow:
81
+ 0 0 0 6px #666,
82
+ 0 0 30px rgba(0,0,0,0.5) !important;
83
+ background-color: var(--background) !important;
84
+ color: var(--text) !important;
85
+ overflow-y: auto !important;
86
+ overflow-x: hidden !important;
87
+ scrollbar-width: thin !important;
88
+ scrollbar-color: #6a0dad #f0f0f0 !important;
89
+ direction: rtl !important;
90
  }
91
 
92
+ /* Remove any potential dark background from parent elements */
93
+ #root, .stApp {
94
+ background: transparent !important;
95
+ margin: 0 auto;
 
 
96
  }
97
 
98
+ /* Ensure Streamlit's main container doesn't add extra space */
99
+ [data-testid="stAppViewContainer"] > div {
100
+ max-width: 100% !important;
101
+ margin: 0 auto;
 
 
102
  }
103
 
104
+ /* Webkit scrollbar styles */
105
+ [data-testid="stAppViewContainer"]::-webkit-scrollbar {
106
+ width: 6px !important;
107
+ right: 0 !important;
108
+ left: auto !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
+ [data-testid="stAppViewContainer"]::-webkit-scrollbar-track {
112
+ background: #f0f0f0 !important;
113
+ border-radius: 3px !important;
114
+ margin: 10px 0 !important;
115
  }
116
 
117
+ [data-testid="stAppViewContainer"]::-webkit-scrollbar-thumb {
118
+ background-color: #6a0dad !important;
119
+ border-radius: 3px !important;
120
+ margin-left: 10px !important;
 
 
121
  }
122
 
123
+ /* Reset direction for content */
124
+ [data-testid="stAppViewContainer"] > * {
125
+ direction: ltr !important;
126
+ text-align: right !important;
127
  }
128
 
129
+ /* Virtual home button */
130
+ [data-testid="stAppViewContainer"]::after {
131
+ content: "";
 
 
 
132
  position: absolute;
133
+ bottom: 15px;
134
+ left: 50%;
135
+ transform: translateX(-50%);
136
+ width: 100px;
137
+ height: 4px;
138
+ background: #333;
139
+ border-radius: 2px;
140
  }
141
+ /* تنظیم پدینگ عمومی با * */
142
+ [data-testid="stAppViewContainer"] * {
143
+ padding-right: 5px !important;
144
+ padding-left: 8px !important;
145
+ box-sizing: border-box !important;
 
 
 
 
146
  }
147
 
148
+ /* استثناهای اصلی */
149
+ [data-testid="stAppViewContainer"]::after,
150
+ [data-testid="stAppViewContainer"]::-webkit-scrollbar,
151
+ [data-testid="stAppViewContainer"] .stButton>button,
152
+ [data-testid="stAppViewContainer"] .stTextInput>div>div>input,
153
+ [data-testid="stAppViewContainer"] .stNumberInput>div>div>input,
154
+ [data-testid="stAppViewContainer"] .stSelectbox>div>div>select,
155
+ [data-testid="stAppViewContainer"] .stTextArea>div>textarea,
156
+ [data-testid="stAppViewContainer"] .stDateInput>div>div>input,
157
+ [data-testid="stAppViewContainer"] .stTimeInput>div>div>input,
158
+ [data-testid="stAppViewContainer"] .price-container,
159
+ [data-testid="stAppViewContainer"] .explanation-item,
160
+ [data-testid="stAppViewContainer"] .stAlert,
161
+ [data-testid="stAppViewContainer"] .stMarkdown,
162
+ [data-testid="stAppViewContainer"] .folium-map,
163
+ [data-testid="stAppViewContainer"] .stRadio>div>div>div>label,
164
+ [data-testid="stAppViewContainer"] .stCheckbox>div>div>label,
165
+ [data-testid="stAppViewContainer"] .stSlider>div>div>div>div,
166
+ [data-testid="stAppViewContainer"] .stMultiSelect>div>div>div {
167
+ padding-right: 0 !important;
168
+ padding-left: 0 !important;
169
  }
170
 
171
+ /* تنظیمات خاص برای کانتینرهای Streamlit */
172
+ [data-testid="stAppViewContainer"] [data-testid="stVerticalBlock"]>div,
173
+ [data-testid="stAppViewContainer"] [data-testid="stHorizontalBlock"]>div {
174
+ padding-right: 5px !important;
175
+ padding-left: 8px !important;
 
 
176
  }
177
 
178
+ /* بازنشانی پدینگ برای المان‌های داخلی خاص */
179
+ [data-testid="stAppViewContainer"] .stTextInput>div,
180
+ [data-testid="stAppViewContainer"] .stNumberInput>div,
181
+ [data-testid="stAppViewContainer"] .stSelectbox>div,
182
+ [data-testid="stAppViewContainer"] .stTextArea>div,
183
+ [data-testid="stAppViewContainer"] .stDateInput>div,
184
+ [data-testid="stAppViewContainer"] .stTimeInput>div {
185
+ padding-right: 0 !important;
186
+ padding-left: 0 !important;
187
  }
188
+ }
189
 
190
+ /* هدر راهیار */
191
+ .rahyar-title {
192
+ color: var(--primary) !important;
193
+ margin: 0 !important;
194
+ }
 
 
 
 
195
 
196
+ .rahyar-subtitle {
197
+ color: var(--primary) !important;
198
+ margin: 0 !important;
199
+ font-size: 14px !important;
200
+ }
 
 
201
 
202
+ /* توضیحات */
203
+ .explanation-title {
204
+ color: var(--primary) !important;
205
+ font-weight: bold !important;
206
+ margin: 20px 0 10px 0 !important;
207
+ font-size: 18px !important;
208
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
+ .explanation-item {
211
+ background-color: var(--secondary-bg) !important;
212
+ border-radius: 8px !important;
213
+ padding: 12px 15px !important;
214
+ margin: 8px 0 !important;
215
+ border-right: 3px solid var(--primary) !important;
216
+ }
217
+
218
+
219
+ /* ========== استایل‌های ورودی یکپارچه ========== */
220
+ /* استایل پایه برای تمام کانتینرهای ورودی */
221
+ div[data-baseweb="select"] > div:first-child,
222
+ div[data-baseweb="input"] > div:first-child,
223
+ div[data-baseweb="textarea"] > div:first-child {
224
+ color: var(--text) !important;
225
+ border-radius: 6px !important;
226
+ border: 1px solid var(--primary) !important;
227
+ background-color: white !important;
228
+ }
229
+
230
+ /* استایل داخلی برای المان‌های ورودی */
231
+ div[data-baseweb="select"] input,
232
+ div[data-baseweb="input"] input,
233
+ div[data-baseweb="textarea"] textarea {
234
+ color: var(--text) !important;
235
+ background-color: white !important;
236
+ border: none !important;
237
+ min-height: 40px !important;
238
+ font-family: 'B Nazanin' !important;
239
+ direction: rtl !important;
240
+ }
241
+
242
+ /* استایل خاص برای سلکت باکس */
243
+ div[data-baseweb="select"] > div:first-child {
244
+ -webkit-appearance: none !important;
245
+ -moz-appearance: none !important;
246
+ appearance: none !important;
247
+ background-image: none !important;
248
+ padding-right: 30px !important; /* فضای برای فلش */
249
+ }
250
+
251
+ /* فلش سفارشی برای سلکت باکس */
252
+ div[data-baseweb="select"]::after {
253
+ content: "▼";
254
+ position: absolute;
255
+ left: 7px !important;
256
+ top: 50%;
257
+ transform: translateY(-50%);
258
+ color: var(--primary) !important;
259
+ background-color: white !important; /* پسزمینه سفید برای پوشاندن فلش پیشفرض */
260
+ font-size: 14px !important;
261
+ pointer-events: none;
262
+ }
263
+
264
+ /* استایل dropdown */
265
+ div[data-baseweb="popover"] {
266
+ border: 1px solid var(--primary) !important;
267
+ border-radius: 6px !important;
268
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
269
+ }
270
+
271
+ /* آیتم‌های dropdown */
272
+ div[data-baseweb="popover"] [role="option"] {
273
+ color: var(--text) !important;
274
+ background-color: white !important;
275
+ padding: 10px 12px !important;
276
+ font-family: 'B Nazanin' !important;
277
+ direction: rtl !important;
278
+ }
279
+
280
+ /* آیتم انتخاب شده در dropdown */
281
+ div[data-baseweb="popover"] [role="option"][aria-selected="true"] {
282
+ background-color: #f0e6ff !important;
283
+ }
284
+
285
+ /* استایل hover برای تمام المان‌های ورودی */
286
+ div[data-baseweb="select"] > div:first-child:hover,
287
+ div[data-baseweb="input"] > div:first-child:hover,
288
+ div[data-baseweb="textarea"] > div:first-child:hover {
289
+ border-color: var(--primary) !important;
290
+ box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.15) !important;
291
+ }
292
+
293
+ /* استایل focus */
294
+ div[data-baseweb="select"] > div:first-child:focus-within,
295
+ div[data-baseweb="input"] > div:first-child:focus-within,
296
+ div[data-baseweb="textarea"] > div:first-child:focus-within {
297
+ border-color: var(--primary) !important;
298
+ box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.15) !important;
299
+ outline: none !important;
300
+ }
301
+
302
+ /* استایل لیبل‌ها */
303
+ .stTextInput > label,
304
+ .stNumberInput > label,
305
+ .stSelectbox > label,
306
+ .stRadio > label,
307
+ .stSlider > label {
308
+ color: var(--text) !important;
309
+ font-weight: bold !important;
310
+ margin-bottom: 8px !important;
311
+ font-size: 14px !important;
312
+ display: block !important;
313
+ }
314
+
315
+ /* استایل placeholder */
316
+ ::placeholder {
317
+ color: var(--text) !important;
318
+ opacity: 0.5 !important;
319
+ font-family: 'B Nazanin' !important;
320
+ }
321
+
322
+ /* پاکسازی عناصر سیاه رنگ ناخواسته */
323
+ div[data-testid="stNumberInput"] > div > div:first-child,
324
+ div[data-testid="stNumberInput"] > div > div:last-child {
325
+ background-color: transparent !important;
326
+ border: none !important;
327
+ }
328
+
329
+ /* حذف عناصر سیاه پس‌زمینه */
330
+ div[data-testid="stNumberInput"] button > div {
331
+ display: none !important;
332
+ }
333
+
334
+ /* حذف کامل عناصر داخلی ناخواسته */
335
+ div[data-testid="stNumberInput"] button > div,
336
+ div[data-testid="stNumberInput"] button > svg {
337
+ display: none !important;
338
+ visibility: hidden !important;
339
+ }
340
+
341
+ /* ایجاد آیکون‌های سفارشی با رنگ بنفش */
342
+ div[data-testid="stNumberInput"] button {
343
+ position: relative !important;
344
+ color: transparent !important; /* مخفی کردن متن پیش‌فرض */
345
+ }
346
+
347
+ /* دکمه سمت راست (کاهش) */
348
+ div[data-testid="stNumberInput"] button:first-child::after {
349
+ content: "-" !important;
350
+ position: absolute !important;
351
+ top: 50% !important;
352
+ left: 50% !important;
353
+ transform: translate(-50%, -50%) !important;
354
+ color: var(--primary) !important;
355
+ font-size: 1.2rem !important;
356
+ font-weight: bold !important;
357
+ }
358
+
359
+ /* دکمه سمت چپ (افزایش) */
360
+ div[data-testid="stNumberInput"] button:last-child::after {
361
+ content: "+" !important;
362
+ position: absolute !important;
363
+ top: 50% !important;
364
+ left: 50% !important;
365
+ transform: translate(-50%, -50%) !important;
366
+ color: var(--primary) !important;
367
+ font-size: 1.2rem !important;
368
+ font-weight: bold !important;
369
+ }
370
+
371
+ /* بازنشانی کامل استایل‌های Streamlit */
372
+ div[data-testid="stNumberInput"] button {
373
+ all: unset !important;
374
+ width: 36px !important;
375
+ height: 100% !important;
376
+ position: relative !important;
377
+ cursor: pointer !important;
378
+ z-index: 10 !important;
379
+ }
380
 
381
+ /* تضمین رنگ در حالت‌های مختلف */
382
+ div[data-testid="stNumberInput"] button:hover::after,
383
+ div[data-testid="stNumberInput"] button:focus::after {
384
+ color: var(--primary) !important;
385
+ }
386
+
387
+ /* استایل hover برای دکمه‌ها */
388
+ div[data-testid="stNumberInput"] button:hover {
389
+ background-color: #f0e6ff !important;
390
+ }
391
+
392
+ /* استایل focus */
393
+ div[data-testid="stNumberInput"] > div:focus-within {
394
+ border-color: var(--primary) !important;
395
+ box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.15) !important;
396
+ outline: none !important;
397
+ }
398
+
399
+
400
+ /* کامپوننت‌های سفارشی */
401
+ .rahyar-header {
402
+ background-color: var(--primary) !important;
403
+ color: white !important;
404
+ padding: 15px !important;
405
+ border-radius: 10px !important;
406
+ margin-bottom: 20px !important;
407
+ text-align: center !important;
408
+ }
409
+
410
+ .price-container {
411
+ background-color: var(--secondary-bg) !important;
412
+ border-radius: 10px !important;
413
+ padding: 15px !important;
414
+ margin: 15px 0 !important;
415
+ border-right: 5px solid var(--primary) !important;
416
+ }
417
+
418
+ /* دکمه اصلی (بنفش با متن سفید) */
419
+ .stButton>button,
420
+ [data-testid="baseButton-primary"],
421
+ .accept-btn,
422
+ div[data-testid="stVerticalBlock"] > div[data-testid="stHorizontalBlock"] > div > div > button {
423
+ background-color: var(--primary) !important;
424
+ color: white !important;
425
+ border: none !important;
426
+ border-radius: 8px !important;
427
+ padding: 10px 20px !important;
428
+ font-weight: bold !important;
429
+ transition: all 0.3s ease !important; /* افزودن transition برای انیمیشن نرم */
430
+ }
431
+
432
+ /* افکت hover برای دکمه اصلی */
433
+ .stButton>button:hover,
434
+ [data-testid="baseButton-primary"]:hover,
435
+ .accept-btn:hover,
436
+ div[data-testid="stVerticalBlock"] > div[data-testid="stHorizontalBlock"] > div > div > button:hover {
437
+ background-color: #5a0a96 !important; /* بنفش تیره‌تر */
438
+ transform: translateY(-1px) !important; /* حرکت جزئی به بالا */
439
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* سایه بیشتر */
440
+ }
441
+
442
+ /* دکمه ثانویه (سفید با حاشیه بنفش) */
443
+ .stFormSubmitButton>button,
444
+ [data-testid="baseButton-secondary"],
445
+ .reject-btn {
446
+ background-color: var(--primary) !important;
447
+ color: white !important;
448
+ border: none !important;
449
+ border-radius: 8px !important;
450
+ padding: 10px 20px !important;
451
+ font-weight: bold !important;
452
+ transition: all 0.3s ease !important; /* افزودن transition برای انیمیشن نرم */
453
+ }
454
+
455
+ /* افکت hover برای دکمه ثانویه */
456
+ .stFormSubmitButton>button:hover,
457
+ [data-testid="baseButton-secondary"]:hover,
458
+ .reject-btn:hover {
459
+ background-color: #5a0a96 !important; /* بنفش تیره‌تر */
460
+ transform: translateY(-1px) !important; /* حرکت جزئی به بالا */
461
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* سایه بیشتر */
462
+ }
463
+
464
+ /* استایل تضمینی برای رادیو باتن‌ها - نسخه نهایی */
465
+ .stRadio > div > div > div > div > div > label,
466
+ .stRadio > div > div > div > div > label,
467
+ .stRadio > div > div > div > label,
468
+ .stRadio > div > div > label,
469
+ .stRadio > div > label,
470
+ .stRadio > label {
471
+ color: #000000 !important;
472
+ -webkit-text-fill-color: #000000 !important; /* برای مرورگرهای وبکیت */
473
+ }
474
+
475
+ .stRadio span {
476
+ color: #000000 !important;
477
+ -webkit-text-fill-color: #000000 !important;
478
+ }
479
+
480
+ /* اگر باز هم مشکل داشت این را اضافه کنید */
481
+ .stRadio > div > div > div > div > div > label > div:first-child,
482
+ .stRadio > div > div > div > div > label > div:first-child,
483
+ .stRadio > div > div > div > label > div:first-child,
484
+ .stRadio > div > div > label > div:first-child,
485
+ .stRadio > div > label > div:first-child,
486
+ .stRadio > label > div:first-child {
487
+ color: #000000 !important;
488
+ -webkit-text-fill-color: #000000 !important;
489
+ }
490
+
491
+ /* استایل پایه برای هشدارها */
492
+ .stAlert .st-ae {
493
+ border-right: 4px solid #ffc107 !important;
494
+ background-color: #fff3cd !important;
495
+ border-radius: 8px !important;
496
+ padding: 16px !important;
497
+ color: #856404 !important;
498
+ }
499
+
500
+ /* آیکون هشدار */
501
+ .stAlert .st-af {
502
+ color: #ffc107 !important;
503
+ font-size: 20px !important;
504
+ }
505
+
506
+ /* متن هشدار */
507
+ .stAlert .st-ag {
508
+ color: #856404 !important;
509
+ font-family: 'B Nazanin' !important;
510
+ font-size: 14px !important;
511
+ margin-right: 8px !important;
512
+ }
513
+
514
+ /* حالت hover برای هشدار */
515
+ .stAlert .st-ae:hover {
516
+ box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2) !important;
517
+ transform: translateX(2px);
518
+ transition: all 0.3s ease;
519
+ }
520
+
521
+ /* استایل برای دکمه بستن هشدار */
522
+ .stAlert .st-ah {
523
+ color: #856404 !important;
524
+ }
525
+
526
+ /* استایل مخصوص موبایل */
527
+ @media (max-width: 768px) {
528
  .stAlert .st-ae {
529
+ padding: 12px !important;
530
+ font-size: 13px !important;
 
 
 
531
  }
532
+ }
533
+
534
+
535
+ /* متن گزینه‌ها */
536
+ .stRadio span {
537
+ color: #000000 !important; /* مشکی خالص */
538
+ font-size: 14px !important;
539
+ padding-right: 5px !important;
540
+ }
541
+
542
+ /* حالت hover */
543
+ .stRadio label:hover span {
544
+ color: #333333 !important; /* مشکی کمی روشن‌تر */
545
+ }
546
+
547
+ /* کانتینر اصلی */
548
+ .stRadio > div {
549
+ margin-bottom: 10px !important;
550
+ }
551
+
552
+
553
+ /* تنظیمات مخصوص موبایل */
554
+ @media (max-width: 768px) {
555
+ .folium-map {
556
+ height: 300px !important;
557
  }
558
 
559
+ /* فرمها در موبایل */
560
+ .stTextInput>label,
561
+ .stNumberInput>label,
562
+ .stSelectbox>label {
563
  font-size: 14px !important;
564
+ padding: 4px 0 !important;
 
 
 
 
 
 
 
565
  }
566
 
567
+ .stTextInput input,
568
+ .stNumberInput input,
569
+ .stSelectbox select {
570
+ font-size: 16px !important;
571
+ padding: 12px !important;
572
+ height: auto !important;
573
  }
574
 
575
+ .stButton>button {
576
+ font-size: 14px !important;
577
+ padding: 8px 16px !important;
 
 
 
578
  }
579
 
580
+ .stMarkdown h3 {
581
+ font-size: 16px !important;
 
 
 
 
582
  }
583
 
584
+ .stMarkdown p {
585
+ font-size: 13px !important;
 
586
  }
587
 
588
+ .stSelectbox [role="listbox"] {
589
+ font-size: 16px !important;
 
590
  }
591
+ }
592
 
593
+ /* ======== تنظیمات پایه واکنش‌گرا ======== */
594
+ :root {
595
+ /* اندازه‌های پایه بر اساس عرض 375px (آیفون X) */
596
+ --base-font-size: 14px;
597
+ --base-heading1-size: 24px;
598
+ --base-heading2-size: 20px;
599
+ --base-heading3-size: 18px;
600
+ --base-input-font: 16px;
601
+ --base-button-font: 16px;
602
+ }
603
 
604
+ /* ======== تنظیمات پویا بر اساس عرض دستگاه ======== */
605
+ @media (max-width: 400px) {
606
+ :root {
607
+ --base-font-size: 13px;
608
+ --base-heading1-size: 22px;
609
+ --base-heading2-size: 18px;
610
+ --base-heading3-size: 16px;
611
+ --base-input-font: 14px;
612
+ --base-button-font: 14px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
  }
614
+ }
615
+
616
+ @media (min-width: 401px) and (max-width: 768px) {
617
+ :root {
618
+ --base-font-size: 14px;
619
+ --base-heading1-size: 24px;
620
+ --base-heading2-size: 20px;
621
+ --base-heading3-size: 18px;
622
+ --base-input-font: 16px;
623
+ --base-button-font: 16px;
624
+ }
625
+ }
626
+
627
+ /* ======== اعمال اندازه‌های پویا ======== */
628
+ * {
629
+ font-size: var(--base-font-size) !important;
630
+ }
631
+
632
+ h1 {
633
+ font-size: var(--base-heading1-size) !important;
634
+ }
635
+
636
+ h2 {
637
+ font-size: var(--base-heading2-size) !important;
638
+ }
639
+
640
+ h3 {
641
+ font-size: var(--base-heading3-size) !important;
642
+ }
643
+
644
+ .stTextInput input,
645
+ .stNumberInput input,
646
+ .stSelectbox select,
647
+ .stTextArea textarea {
648
+ font-size: var(--base-input-font) !important;
649
+ }
650
+
651
+ .stButton>button {
652
+ font-size: var(--base-button-font) !important;
653
+ }
654
+
655
+ /* ======== تنظیمات نقشه واکنش‌گرا ======== */
656
+ .folium-map {
657
+ height: calc(100vw * 0.8) !important; /* ارتفاع متناسب با عرض */
658
+ max-height: 400px !important;
659
+ }
660
+
661
+ /* ======== تنظیمات کانتینرها ======== */
662
+ .price-container,
663
+ .explanation-item {
664
+ padding: calc(var(--base-font-size) * 0.8) !important;
665
+ margin: calc(var(--base-font-size) * 0.5) 0 !important;
666
+ }
667
+
668
+ /* ======== تنظیمات دکمه‌ها ======== */
669
+ .stButton>button {
670
+ padding: calc(var(--base-font-size) * 0.7) calc(var(--base-font-size) * 1.2) !important;
671
+ }
672
  </style>
673
  """, unsafe_allow_html=True)
674
 
 
1322
  ✉ ایمیل: maryam.ilka2000@gmail.com
1323
  """)
1324
  st.balloons()
 
 
 
 
1325
 
1326
  # ========== مدیریت وضعیت و صفحه‌بندی ==========
1327
  def main():
1328
  # تشخیص دستگاه
1329
  user_agent = st.query_params.get("user_agent", [""])[0]
1330
  st.session_state.is_desktop = "mobile" not in user_agent.lower()
1331
+
1332
+
1333
+ # اینجا می‌توانید از is_desktop برای تعیین اینکه نمایشگر موبایل اعمال شود، استفاده کنید
1334
+ if st.session_state.is_desktop:
1335
+ # اطمینان از نمایش همان حالت موبایل برای همه دستگاه‌ها
1336
+ st.session_state.is_desktop = False
1337
 
1338
  if 'current_page' not in st.session_state:
1339
  st.session_state.current_page = "welcome"