kdallash commited on
Commit
e9a43a5
Β·
verified Β·
1 Parent(s): 7c16a06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +100 -49
app.py CHANGED
@@ -175,69 +175,120 @@ def search_hadith(query, top_k):
175
  # Custom CSS (polished, professional)
176
  # ===============================
177
  custom_css = """
178
- /* Page */
179
- body { background-color: #f5f7fb; font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif; }
180
- /* Container (results) keeps RTL for hadith text blocks but LTR for metadata */
 
 
 
 
 
 
 
181
  .results { margin-top: 10px; }
182
- /* Card */
 
183
  .card {
184
- background: #ffffff;
185
- border-radius: 12px;
186
- padding: 18px;
187
- margin-bottom: 14px;
188
- box-shadow: 0 6px 20px rgba(18, 38, 63, 0.06);
189
- border: 1px solid rgba(20, 43, 74, 0.03);
 
190
  }
191
- /* Header layout */
 
192
  .card-header {
193
- display: flex;
194
- justify-content: space-between;
195
- align-items: flex-start;
196
- gap: 12px;
197
- margin-bottom: 10px;
198
  }
199
- .card-header .left { display:flex; flex-direction: column; gap:6px; }
 
 
200
  .index {
201
- display:inline-block;
202
- background: linear-gradient(90deg,#2563eb,#06b6d4);
203
- color: white;
204
- padding: 6px 10px;
205
- border-radius: 20px;
206
- font-weight: 600;
207
- font-size: 13px;
208
- width: fit-content;
209
  }
 
 
210
  .title {
211
- font-size: 18px;
212
- font-weight: 700;
213
- color: #0f172a;
214
  }
215
  .topic {
216
- font-size: 13px;
217
- color: #475569;
218
- margin-top: 4px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
- /* Right meta */
221
- .right-meta { text-align: right; min-width: 120px; }
222
- .meta { font-size: 12px; color: #6b7280; }
223
- .meta-val { color: #0f172a; font-weight: 600; margin-left: 6px; }
224
- /* Hadith text: keep RTL and readable */
225
- .text-rtl { direction: rtl; margin-top: 6px; margin-bottom: 10px; }
226
- .text-rtl .summary { cursor: pointer; font-size: 16px; color: #111827; line-height: 1.9; }
227
- .text-rtl .full-text { margin-top: 8px; font-size: 16px; color: #111827; line-height: 1.9; }
228
- /* Footer link */
229
- .footer { margin-top: 12px; }
 
 
230
  .footer a {
231
- text-decoration: none;
232
- color: #2563eb; font-weight: 600;
 
 
233
  }
234
- .footer a:hover { text-decoration: underline; }
235
- /* Empty state */
236
- .empty { font-size: 15px; color: #6b7280; text-align:center; padding: 12px; }
237
- /* Responsive */
 
 
238
  @media (max-width: 700px) {
239
- .card-header { flex-direction: column; align-items: flex-start; }
240
- .right-meta { text-align: left; }
241
  }
242
  """
243
 
 
175
  # Custom CSS (polished, professional)
176
  # ===============================
177
  custom_css = """
178
+ /* ── Force light background on the whole page ── */
179
+ body, .gradio-container, .gradio-container * {
180
+ font-family: Inter, 'Segoe UI', Tahoma, Arial, sans-serif !important;
181
+ }
182
+ .gradio-container {
183
+ background-color: #f5f7fb !important;
184
+ max-width: 1400px !important;
185
+ }
186
+
187
+ /* ── Results wrapper ── */
188
  .results { margin-top: 10px; }
189
+
190
+ /* ── Card ── */
191
  .card {
192
+ background: #ffffff !important;
193
+ border-radius: 12px !important;
194
+ padding: 18px !important;
195
+ margin-bottom: 14px !important;
196
+ box-shadow: 0 6px 20px rgba(18, 38, 63, 0.08) !important;
197
+ border: 1px solid #e2e8f0 !important;
198
+ color: #0f172a !important;
199
  }
200
+
201
+ /* ── Card header ── */
202
  .card-header {
203
+ display: flex !important;
204
+ justify-content: space-between !important;
205
+ align-items: flex-start !important;
206
+ gap: 12px !important;
207
+ margin-bottom: 10px !important;
208
  }
209
+ .card-header .left { display:flex !important; flex-direction: column !important; gap:6px !important; }
210
+
211
+ /* ── Rank badge ── */
212
  .index {
213
+ display: inline-block !important;
214
+ background: linear-gradient(90deg, #2563eb, #06b6d4) !important;
215
+ color: #ffffff !important;
216
+ padding: 4px 12px !important;
217
+ border-radius: 20px !important;
218
+ font-weight: 700 !important;
219
+ font-size: 13px !important;
220
+ width: fit-content !important;
221
  }
222
+
223
+ /* ── Title & topic ── */
224
  .title {
225
+ font-size: 17px !important;
226
+ font-weight: 700 !important;
227
+ color: #0f172a !important;
228
  }
229
  .topic {
230
+ font-size: 13px !important;
231
+ color: #475569 !important;
232
+ margin-top: 2px !important;
233
+ }
234
+
235
+ /* ── Right meta ── */
236
+ .right-meta { text-align: right !important; min-width: 100px !important; }
237
+ .meta { font-size: 12px !important; color: #64748b !important; }
238
+ .meta-val { color: #1e293b !important; font-weight: 600 !important; margin-left: 4px !important; }
239
+
240
+ /* ── Hadith text block (RTL Arabic) ── */
241
+ .text-rtl {
242
+ direction: rtl !important;
243
+ text-align: right !important;
244
+ margin-top: 8px !important;
245
+ margin-bottom: 10px !important;
246
+ background: #f8fafc !important;
247
+ border-radius: 8px !important;
248
+ padding: 10px 14px !important;
249
+ border-right: 4px solid #2563eb !important;
250
+ }
251
+ .text-rtl details > summary {
252
+ cursor: pointer !important;
253
+ font-size: 16px !important;
254
+ color: #1e293b !important;
255
+ line-height: 2.0 !important;
256
+ list-style: none !important;
257
+ }
258
+ .text-rtl details > summary::-webkit-details-marker { display: none !important; }
259
+ .text-rtl details > summary::before {
260
+ content: "β–Ά ";
261
+ font-size: 11px;
262
+ color: #2563eb;
263
+ margin-left: 6px;
264
  }
265
+ .text-rtl details[open] > summary::before { content: "β–Ό "; }
266
+ .text-rtl .full-text {
267
+ margin-top: 10px !important;
268
+ font-size: 16px !important;
269
+ color: #1e293b !important;
270
+ line-height: 2.0 !important;
271
+ border-top: 1px solid #e2e8f0 !important;
272
+ padding-top: 8px !important;
273
+ }
274
+
275
+ /* ── Footer link ── */
276
+ .footer { margin-top: 10px !important; }
277
  .footer a {
278
+ text-decoration: none !important;
279
+ color: #2563eb !important;
280
+ font-weight: 600 !important;
281
+ font-size: 13px !important;
282
  }
283
+ .footer a:hover { text-decoration: underline !important; }
284
+
285
+ /* ── Empty state ── */
286
+ .empty { font-size: 15px !important; color: #64748b !important; text-align: center !important; padding: 20px !important; }
287
+
288
+ /* ── Responsive ── */
289
  @media (max-width: 700px) {
290
+ .card-header { flex-direction: column !important; align-items: flex-start !important; }
291
+ .right-meta { text-align: left !important; }
292
  }
293
  """
294