Maximofn commited on
Commit
98ba635
·
1 Parent(s): 5b67ed9

Añade estilos modernos y limpios para el chatbot, incluyendo soporte para temas claro y oscuro. Se mejoran los estilos de mensajes, botones y áreas de entrada, optimizando la experiencia del usuario.

Browse files
Files changed (1) hide show
  1. app.py +201 -17
app.py CHANGED
@@ -238,37 +238,221 @@ style = """
238
  color: var(--primary-purple-light) !important;
239
  }
240
 
241
- /* Dark theme styles - only apply when .dark class is present */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  .dark :root, .dark .gradio-container { color-scheme: dark; }
243
  .dark body, .dark .gradio-container { background: var(--bg-dark-primary); }
244
  .dark .prose, .dark .gr-text, .dark .gr-form { color: var(--text-dark-secondary); }
245
 
246
- /* Chat bubbles */
247
- .dark .message.user {
248
- background: var(--bg-dark-card);
249
- border-radius: var(--card-radius);
 
 
 
 
 
 
 
 
 
 
250
  }
251
- .dark .message.assistant {
252
- background: var(--bg-dark-secondary);
253
- border-radius: var(--card-radius);
 
 
 
 
 
 
254
  }
255
 
256
- /* Input */
257
- .dark textarea, .dark .gr-textbox textarea {
 
 
258
  background: var(--bg-dark-secondary) !important;
259
  color: var(--text-dark-primary) !important;
260
  border-color: var(--border-dark) !important;
261
  }
262
 
263
- /* Buttons */
264
- .dark button {
265
- background: var(--bg-dark-tertiary) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  color: var(--text-dark-primary) !important;
267
- border: 1px solid var(--border-dark) !important;
268
  }
269
- .dark button:hover {
270
- background: var(--primary-purple) !important;
271
- border-color: var(--primary-purple-dark) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  }
273
  """
274
 
 
238
  color: var(--primary-purple-light) !important;
239
  }
240
 
241
+ /* ============================================
242
+ CHATBOT STYLING - Modern and Clean
243
+ ============================================ */
244
+
245
+ /* Chat container */
246
+ .chatbot, [data-testid="chatbot"] {
247
+ border-radius: var(--card-radius) !important;
248
+ box-shadow: var(--card-shadow-light) !important;
249
+ }
250
+
251
+ /* User messages - Purple accent */
252
+ .message.user,
253
+ .user-message,
254
+ [data-testid="user-message"] {
255
+ background: linear-gradient(135deg, var(--primary-purple-light) 0%, var(--primary-purple) 100%) !important;
256
+ color: white !important;
257
+ border-radius: 18px 18px 4px 18px !important;
258
+ padding: 0.875rem 1.125rem !important;
259
+ margin: 0.5rem 0 !important;
260
+ box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25) !important;
261
+ margin-left: auto !important;
262
+ }
263
+
264
+ /* Assistant messages - Light background */
265
+ .message.bot,
266
+ .bot-message,
267
+ [data-testid="bot-message"] {
268
+ background: var(--bg-light-card) !important;
269
+ color: var(--text-light-primary) !important;
270
+ border-radius: 18px 18px 18px 4px !important;
271
+ padding: 0.875rem 1.125rem !important;
272
+ margin: 0.5rem 0 !important;
273
+ border: 1px solid var(--border-light) !important;
274
+ box-shadow: var(--card-shadow-light) !important;
275
+ max-width: 80% !important;
276
+ margin-right: auto !important;
277
+ }
278
+
279
+ /* Input textarea */
280
+ textarea,
281
+ .gr-textbox textarea,
282
+ [data-testid="textbox"] {
283
+ background: var(--bg-light-card) !important;
284
+ color: var(--text-light-primary) !important;
285
+ border: 2px solid var(--border-light) !important;
286
+ border-radius: 12px !important;
287
+ padding: 0.75rem 1rem !important;
288
+ font-size: 1rem !important;
289
+ transition: all 0.2s ease !important;
290
+ }
291
+
292
+ textarea:focus,
293
+ .gr-textbox textarea:focus {
294
+ border-color: var(--primary-purple) !important;
295
+ box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
296
+ outline: none !important;
297
+ }
298
+
299
+ /* Submit button and action buttons */
300
+ button[type="submit"],
301
+ .submit-button,
302
+ button.primary {
303
+ background: var(--gradient-purple) !important;
304
+ color: white !important;
305
+ border: none !important;
306
+ border-radius: 12px !important;
307
+ padding: 0.625rem 1.5rem !important;
308
+ font-weight: 600 !important;
309
+ transition: all 0.2s ease !important;
310
+ box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25) !important;
311
+ }
312
+
313
+ button[type="submit"]:hover,
314
+ .submit-button:hover,
315
+ button.primary:hover {
316
+ background: var(--primary-purple-dark) !important;
317
+ box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35) !important;
318
+ transform: translateY(-1px) !important;
319
+ }
320
+
321
+ /* Example buttons */
322
+ .example,
323
+ button.example {
324
+ background: var(--bg-light-secondary) !important;
325
+ color: var(--text-light-primary) !important;
326
+ border: 1px solid var(--border-light) !important;
327
+ border-radius: 12px !important;
328
+ padding: 0.75rem 1rem !important;
329
+ transition: all 0.2s ease !important;
330
+ }
331
+
332
+ .example:hover,
333
+ button.example:hover {
334
+ background: var(--bg-light-tertiary) !important;
335
+ border-color: var(--primary-purple-light) !important;
336
+ transform: translateY(-2px) !important;
337
+ box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15) !important;
338
+ }
339
+
340
+ /* Scrollbar styling */
341
+ .chatbot::-webkit-scrollbar,
342
+ [data-testid="chatbot"]::-webkit-scrollbar {
343
+ width: 8px;
344
+ }
345
+
346
+ .chatbot::-webkit-scrollbar-track,
347
+ [data-testid="chatbot"]::-webkit-scrollbar-track {
348
+ background: var(--bg-light-secondary);
349
+ border-radius: 10px;
350
+ }
351
+
352
+ .chatbot::-webkit-scrollbar-thumb,
353
+ [data-testid="chatbot"]::-webkit-scrollbar-thumb {
354
+ background: var(--primary-purple-light);
355
+ border-radius: 10px;
356
+ }
357
+
358
+ .chatbot::-webkit-scrollbar-thumb:hover,
359
+ [data-testid="chatbot"]::-webkit-scrollbar-thumb:hover {
360
+ background: var(--primary-purple);
361
+ }
362
+
363
+ /* ============================================
364
+ DARK THEME STYLES
365
+ ============================================ */
366
+
367
  .dark :root, .dark .gradio-container { color-scheme: dark; }
368
  .dark body, .dark .gradio-container { background: var(--bg-dark-primary); }
369
  .dark .prose, .dark .gr-text, .dark .gr-form { color: var(--text-dark-secondary); }
370
 
371
+ /* Dark theme - Chat container */
372
+ .dark .chatbot,
373
+ .dark [data-testid="chatbot"] {
374
+ border-color: var(--border-dark) !important;
375
+ box-shadow: var(--card-shadow-dark) !important;
376
+ }
377
+
378
+ /* Dark theme - User messages */
379
+ .dark .message.user,
380
+ .dark .user-message,
381
+ .dark [data-testid="user-message"] {
382
+ background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-dark) 100%) !important;
383
+ color: white !important;
384
+ box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4) !important;
385
  }
386
+
387
+ /* Dark theme - Assistant messages */
388
+ .dark .message.bot,
389
+ .dark .bot-message,
390
+ .dark [data-testid="bot-message"] {
391
+ background: var(--bg-dark-card) !important;
392
+ color: var(--text-dark-primary) !important;
393
+ border-color: var(--border-dark) !important;
394
+ box-shadow: var(--card-shadow-dark) !important;
395
  }
396
 
397
+ /* Dark theme - Input */
398
+ .dark textarea,
399
+ .dark .gr-textbox textarea,
400
+ .dark [data-testid="textbox"] {
401
  background: var(--bg-dark-secondary) !important;
402
  color: var(--text-dark-primary) !important;
403
  border-color: var(--border-dark) !important;
404
  }
405
 
406
+ .dark textarea:focus,
407
+ .dark .gr-textbox textarea:focus {
408
+ border-color: var(--primary-purple-light) !important;
409
+ box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2) !important;
410
+ }
411
+
412
+ /* Dark theme - Buttons */
413
+ .dark button[type="submit"],
414
+ .dark .submit-button,
415
+ .dark button.primary {
416
+ background: var(--gradient-purple) !important;
417
+ box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4) !important;
418
+ }
419
+
420
+ .dark button[type="submit"]:hover,
421
+ .dark .submit-button:hover,
422
+ .dark button.primary:hover {
423
+ background: var(--primary-purple-light) !important;
424
+ box-shadow: 0 4px 12px rgba(167, 139, 250, 0.5) !important;
425
+ }
426
+
427
+ /* Dark theme - Example buttons */
428
+ .dark .example,
429
+ .dark button.example {
430
+ background: var(--bg-dark-card) !important;
431
  color: var(--text-dark-primary) !important;
432
+ border-color: var(--border-dark) !important;
433
  }
434
+
435
+ .dark .example:hover,
436
+ .dark button.example:hover {
437
+ background: var(--bg-dark-secondary) !important;
438
+ border-color: var(--primary-purple-light) !important;
439
+ box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25) !important;
440
+ }
441
+
442
+ /* Dark theme - Scrollbar */
443
+ .dark .chatbot::-webkit-scrollbar-track,
444
+ .dark [data-testid="chatbot"]::-webkit-scrollbar-track {
445
+ background: var(--bg-dark-secondary);
446
+ }
447
+
448
+ .dark .chatbot::-webkit-scrollbar-thumb,
449
+ .dark [data-testid="chatbot"]::-webkit-scrollbar-thumb {
450
+ background: var(--primary-purple);
451
+ }
452
+
453
+ .dark .chatbot::-webkit-scrollbar-thumb:hover,
454
+ .dark [data-testid="chatbot"]::-webkit-scrollbar-thumb:hover {
455
+ background: var(--primary-purple-light);
456
  }
457
  """
458