Nischal Subedi commited on
Commit
afd5efe
·
1 Parent(s): ed73032
Files changed (1) hide show
  1. app.py +209 -495
app.py CHANGED
@@ -300,568 +300,274 @@ Answer:"""
300
  /* Import legible fonts from Google Fonts */
301
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap');
302
 
303
- /* Define light theme variables */
304
  :root {{
305
- --primary-color: #FF8C00;
306
- --primary-hover: #E07B00;
307
- --background-primary: hsl(30, 100%, 99.9%); /* Near white, slightly warm */
308
- --background-secondary: hsl(30, 100%, 96%); /* Slightly darker background */
309
- --text-primary: #4A3C32; /* Dark brown/off-black for main text */
310
- --text-secondary: #8C7B6F; /* Lighter brown/gray for subdued text */
311
- --border-color: hsl(30, 70%, 85%); /* Light brown/peach border */
312
- --border-focus: #FF8C00; /* Primary color for focus */
313
- --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
314
- --shadow-md: 0 4px 10px rgba(0,0,0,0.1);
315
- --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
316
- --error-bg: #FFF0E0; /* Light peach error background */
317
- --error-border: #FFD2B2; /* Peach error border */
318
- --error-text: #E05C00; /* Orange-red error text */
319
- }}
320
-
321
- /* IMPORTANT: Force Gradio's internal variables to use our light theme values for both light and dark modes */
322
- /* This is the key to override system theme preference without using theme_mode */
323
- /* Targeting :root, html.dark, body.dark, and .dark ensures maximum override */
324
  :root, html.dark, body.dark, .dark {{
325
  /* General backgrounds */
326
- --background-fill-primary: var(--background-primary) !important;
327
- --background-fill-secondary: var(--background-secondary) !important;
328
- --background-fill-tertiary: var(--background-secondary) !important; /* For less prominent backgrounds */
329
- --panel-background: var(--background-primary) !important;
330
- --block-background: var(--background-primary) !important;
331
- --color-background-primary: var(--background-primary) !important;
332
- --color-background-secondary: var(--background-secondary) !important;
333
 
334
  /* Text colors */
335
- --text-color-body: var(--text-primary) !important;
336
- --text-color-subdued: var(--text-secondary) !important;
337
- --text-color-highlight: var(--primary-color) !important;
338
- --text-color-placeholder: var(--text-secondary) !important;
339
- --text-color-link: var(--primary-color) !important; /* For links */
340
- --color-text-primary: var(--text-primary) !important;
341
- --color-text-secondary: var(--text-secondary) !important;
342
- --color-text-placeholder: var(--text-secondary) !important;
343
 
344
  /* Border colors */
345
- --border-color-primary: var(--border-color) !important;
346
- --border-color-accent: var(--border-focus) !important;
347
- --border-color-secondary: var(--border-color) !important;
348
- --border-color-tertiary: var(--border-color) !important;
349
- --color-border-primary: var(--border-color) !important;
350
- --color-border-secondary: var(--border-color) !important;
351
 
352
  /* Button colors */
353
- --button-primary-background: var(--primary-color) !important;
354
- --button-primary-background-hover: var(--primary-hover) !important;
355
  --button-primary-text-color: white !important; /* Ensure text is white on primary buttons */
356
  --button-secondary-background: transparent !important;
357
- --button-secondary-background-hover: var(--background-secondary) !important;
358
- --button-secondary-border-color: var(--border-color) !important;
359
- --button-secondary-border-color-hover: var(--primary-color) !important;
360
- --button-secondary-text-color: var(--text-primary) !important; /* Ensure text color for secondary */
361
- --color-button-primary-background: var(--primary-color) !important;
362
- --color-button-primary-background-hover: var(--primary-hover) !important;
363
- --color-button-secondary-background: transparent !important;
364
- --color-button-secondary-background-hover: var(--background-secondary) !important;
365
  --color-button-primary-text: white !important;
366
- --color-button-secondary-text: var(--text-primary) !important;
367
 
368
  /* Input specific */
369
- --input-background-fill: var(--background-primary) !important;
370
- --input-border-color: var(--border-color) !important;
371
- --input-border-color-focus: var(--border-focus) !important;
372
- --input-shadow: var(--shadow-sm) !important; /* For textboxes */
373
  --input-shadow-focus: 0 0 0 4px rgba(255, 140, 0, 0.2) !important;
374
- --input-text-color: var(--text-primary) !important;
375
 
376
  /* Shadows */
377
- --shadow-s: var(--shadow-sm) !important;
378
- --shadow-m: var(--shadow-md) !important;
379
- --shadow-l: var(--shadow-lg) !important;
380
 
381
  /* Misc */
382
- --color-accent-soft: rgba(255, 140, 0, 0.2) !important; /* Used for focus shadows */
383
- --color-error: var(--error-text) !important; /* For error messages */
384
- --color-error-background: var(--error-bg) !important;
385
- --color-error-border: var(--error-border) !important;
386
- }}
387
 
388
- /* Base styles for html and body */
389
- body, html {{
390
- background-color: var(--background-secondary) !important;
391
- color: var(--text-primary) !important;
392
- transition: none !important; /* Prevent any Gradio theme change transitions */
393
- }}
394
 
395
- /* General Gradio container and element overrides */
396
- .gradio-container {{
397
- max-width: 900px !important;
398
- margin: 0 auto !important;
399
- padding: 1.5rem !important;
400
- font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
401
- background-color: var(--background-secondary) !important; /* Ensure main container background */
402
- box-shadow: none !important;
403
- color: var(--text-primary) !important;
404
- }}
405
- .main-dashboard-container > * {{
406
- background-color: var(--background-primary) !important;
407
- border-color: var(--border-color) !important; /* Ensure card borders are consistent */
408
- color: var(--text-primary) !important;
409
- }}
410
- .app-header-wrapper {{
411
- background: linear-gradient(145deg, var(--background-primary) 0%, var(--background-secondary) 100%) !important;
412
- border: 2px solid var(--border-color) !important;
413
- border-radius: 16px !important;
414
- padding: 2.5rem 1.5rem !important;
415
- margin-bottom: 1.5rem !important;
416
- box-shadow: var(--shadow-md) !important;
417
- position: relative;
418
- overflow: hidden;
419
- text-align: center !important;
420
- color: var(--text-primary) !important;
421
- }}
422
- .app-header-wrapper::before {{
423
- content: '';
424
- position: absolute;
425
- top: 0;
426
- left: 0;
427
- width: 100%;
428
- height: 100%;
429
- background: radial-gradient(circle at top left, rgba(255,140,0,0.3) 0%, transparent 60%), radial-gradient(circle at bottom right, rgba(255,140,0,0.3) 0%, transparent 60%);
430
- z-index: 0;
431
- opacity: 0.8;
432
- pointer-events: none;
433
- }}
434
- .app-header-logo {{
435
- font-size: 8.5rem !important;
436
- margin-bottom: 0.75rem !important;
437
- display: block !important;
438
- color: var(--primary-color) !important;
439
- position: relative;
440
- z-index: 1;
441
- animation: float-icon 3s ease-in-out infinite alternate;
442
- }}
443
- @keyframes float-icon {{
444
- 0% {{ transform: translateY(0px); }}
445
- 50% {{ transform: translateY(-5px); }}
446
- 100% {{ transform: translateY(0px); }}
447
- }}
448
- .app-header-title {{
449
- font-family: 'Poppins', sans-serif !important;
450
- font-size: 3rem !important;
451
- font-weight: 800 !important;
452
- color: var(--text-primary) !important;
453
- margin: 0 0 0.75rem 0 !important;
454
- line-height: 1.1 !important;
455
- letter-spacing: -0.03em !important;
456
- position: relative;
457
- z-index: 1;
458
- display: inline-block;
459
- max-width: 100%;
460
- }}
461
- .app-header-tagline {{
462
- font-size: 1.25rem !important;
463
- color: var(--text-secondary) !important;
464
- font-weight: 400 !important;
465
- margin: 0 !important;
466
- max-width: 700px;
467
- display: inline-block;
468
- position: relative;
469
- z-index: 1;
470
- }}
471
- .main-dashboard-container {{
472
- display: flex !important;
473
- flex-direction: column !important;
474
- gap: 1.25rem !important;
475
- }}
476
- .dashboard-card-section {{
477
- background-color: var(--background-primary) !important;
478
- border: 2px solid var(--border-color) !important;
479
- border-radius: 12px !important;
480
- padding: 0 !important;
481
- box-shadow: var(--shadow-sm) !important;
482
- transition: all 0.3s ease-out !important;
483
- cursor: default;
484
- color: var(--text-primary) !important;
485
- }}
486
- .dashboard-card-section:hover {{
487
- box-shadow: var(--shadow-md) !important;
488
- transform: translateY(-3px) !important;
489
- }}
490
- .full-width-center {{
491
- display: flex !important;
492
- justify-content: center !important;
493
- align-items: center !important;
494
- width: 100% !important;
495
- flex-direction: column !important;
496
- background-color: transparent !important;
497
- }}
498
- .section-title-gradient-bar {{
499
- background-color: var(--background-secondary) !important;
500
- padding: 1.25rem 1.75rem !important;
501
- border-top-left-radius: 10px !important;
502
- border-top-right-radius: 10px !important;
503
- margin-bottom: 0 !important;
504
- text-align: center !important;
505
- box-sizing: border-box;
506
- width: 100%;
507
- color: var(--text-primary) !important;
508
- }}
509
- .section-title {{
510
- font-family: 'Poppins', sans-serif !important;
511
- font-size: 1.7rem !important;
512
- font-weight: 700 !important;
513
- color: var(--text-primary) !important;
514
- margin: 0 !important;
515
- padding-bottom: 0 !important;
516
- border-bottom: 2px solid var(--border-color) !important;
517
- line-height: 1.1 !important;
518
- display: inline-block !important;
519
- text-align: center !important;
520
- letter-spacing: -0.01em !important;
521
- }}
522
- .dashboard-card-content-area {{
523
- padding: 0 1.75rem 1.75rem 1.75rem !important;
524
- background-color: var(--background-primary) !important;
525
- box-sizing: border-box;
526
- width: 100%;
527
- color: var(--text-primary) !important;
528
- }}
529
- .dashboard-card-section p {{
530
- line-height: 1.7 !important;
531
- color: var(--text-primary) !important;
532
- font-size: 1rem !important;
533
- text-align: left !important;
534
- background-color: transparent !important;
535
- margin: 0 !important;
536
- padding: 0 !important;
537
- white-space: normal !important;
538
- }}
539
- .dashboard-card-section strong, .dashboard-card-section b {{
540
- font-weight: 700 !important;
541
- color: var(--primary-color) !important;
542
- }}
543
- /* More specific overrides for Gradio components */
544
- .gr-block, .gr-box, .gr-prose, .gr-form, .gr-panel,
545
- .gr-columns, .gr-column {{
546
- background-color: var(--background-primary) !important;
547
- color: var(--text-primary) !important;
548
- border-color: var(--border-color) !important; /* Ensure consistent borders */
549
- white-space: normal !important;
550
- overflow-wrap: break-word;
551
- word-break: break-word;
552
- }}
553
- .gradio-html, .gradio-markdown, .gradio-textbox, .gradio-radio, .gradio-button {{
554
- background-color: transparent !important; /* Let parent background control this */
555
- color: var(--text-primary) !important;
556
- white-space: normal !important;
557
- overflow-wrap: break-word;
558
- word-break: break-word;
559
- }}
560
- .gradio-textbox textarea,
561
- .gradio-textbox input,
562
- .gradio-radio label,
563
- .placeholder {{
564
- background-color: var(--background-primary) !important;
565
- color: var(--text-primary) !important;
566
- }}
567
- .gradio-textbox {{
568
- margin-bottom: 0.5rem !important;
569
  }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  .gradio-textbox textarea,
571
  .gradio-textbox input {{
572
- border: 2px solid var(--border-color) !important;
573
- border-radius: 8px !important;
574
- padding: 0.85rem 1rem !important;
575
- font-size: 0.98rem !important;
576
- font-family: 'Inter', sans-serif !important;
577
- color: var(--text-primary) !important; /* Ensure text color in inputs */
578
- transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
579
- box-shadow: var(--shadow-sm) !important;
580
- }}
581
- .gradio-textbox .scroll-hide {{
582
- background-color: var(--background-primary) !important;
583
  }}
584
  .gradio-textbox textarea:focus,
585
  .gradio-textbox input:focus {{
 
 
586
  outline: none !important;
587
- border-color: var(--border-focus) !important;
588
- box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.2) !important;
589
- }}
590
- .gradio-radio {{
591
- padding: 0 !important;
592
- margin-top: 1rem !important;
593
- }}
594
- .gradio-radio input[type="radio"] {{
595
- display: none !important;
596
  }}
 
 
597
  .gradio-radio label {{
598
- display: flex !important;
599
- justify-content: center !important;
600
- align-items: center !important;
601
- padding: 0.75rem 1rem !important;
602
- border: 2px solid var(--border-color) !important;
603
- border-radius: 8px !important;
604
- color: var(--text-primary) !important;
605
- font-weight: 500 !important;
606
- cursor: pointer !important;
607
- transition: all 0.2s ease-out !important;
608
- box-shadow: var(--shadow-sm) !important;
609
- margin: 0.2rem 0 !important;
610
- width: 100 !important;
611
- box-sizing: border-box !important;
612
  }}
613
  .gradio-radio label span.text-lg {{
614
- font-weight: 600 !important;
615
- color: var(--text-primary) !important;
616
- font-size: 0.98rem !important;
617
  }}
618
  .gradio-radio label:hover {{
619
- background-color: var(--background-secondary) !important;
620
- border-color: var(--primary-color) !important;
621
- box-shadow: var(--shadow-md) !important;
622
  transform: translateY(-2px) !important;
623
  }}
624
  .gradio-radio input[type="radio"]:checked + label {{
625
- background-color: var(--primary-color) !important;
626
- color: white !important; /* Ensure text is white when selected */
627
- border-color: var(--primary-hover) !important;
628
- box-shadow: var(--shadow-md) !important;
629
- transform: translateY(-1px) !important;
630
  }}
631
  .gradio-radio input[type="radio"]:checked + label span.text-lg {{
632
- color: white !important; /* Ensure text is white when selected */
633
- }}
634
- .gradio-radio .gr-form {{
635
- padding: 0 !important;
636
- }}
637
- .gradio-textbox label,
638
- .gradio-radio > label {{
639
- font-weight: 600 !important;
640
- color: var(--text-primary) !important;
641
- font-size: 1rem !important;
642
- margin-bottom: 0.6rem !important;
643
- display: block !important;
644
- text-align: left !important;
645
- }}
646
- .gr-prose {{
647
- font-size: 0.9rem !important;
648
- color: var(--text-secondary) !important;
649
- margin-top: 0.4rem !important;
650
- text-align: left !important;
651
- background-color: transparent !important;
652
- }}
653
- .input-column {{
654
- display: flex !important;
655
- flex-direction: column !important;
656
- gap: 1.25rem !important;
657
- margin-bottom: 0.5rem !important;
658
- }}
659
- .input-field {{
660
- flex: none !important;
661
- width: 100% !important;
662
- }}
663
- .button-row {{
664
- display: flex !important;
665
- gap: 1rem !important;
666
- justify-content: flex-end !important;
667
- margin-top: 1.5rem !important;
668
- }}
669
- .gradio-button {{
670
- padding: 0.85rem 1.8rem !important;
671
- border-radius: 9px !important;
672
- font-weight: 600 !important;
673
- font-size: 1rem !important;
674
- transition: all 0.2s ease-out !important;
675
- cursor: pointer !important;
676
- border: 2px solid transparent !important;
677
- text-align: center !important;
678
- color: var(--text-primary) !important;
679
  }}
 
 
680
  .gr-button-primary {{
681
- background-color: var(--primary-color) !important;
682
- color: white !important; /* Ensure text is white for primary buttons */
683
- box-shadow: var(--shadow-sm) !important;
684
  }}
685
  .gr-button-primary:hover {{
686
- background-color: var(--primary-hover) !important;
687
- box-shadow: var(--shadow-md) !important;
688
- transform: translateY(-2px) !important;
689
- }}
690
- .gr-button-primary:active {{
691
- transform: translateY(1px) !important;
692
- box-shadow: none !important;
693
  }}
694
  .gr-button-secondary {{
695
  background-color: transparent !important;
696
- color: var(--text-primary) !important;
697
- border-color: var(--border-color) !important;
698
  }}
699
  .gr-button-secondary:hover {{
700
- background-color: var(--background-secondary) !important;
701
- border-color: var(--primary-color) !important;
702
- transform: translateY(-2px) !important;
703
- }}
704
- .gr-button-secondary:active {{
705
- transform: translateY(1px) !important;
706
- box-shadow: none !important;
707
- }}
708
- .output-content-wrapper {{
709
- background-color: var(--background-primary) !important;
710
- border: 2px solid var(--border-color) !important;
711
- border-radius: 8px !important;
712
- padding: 1.5rem !important;
713
- min-height: 150px !important;
714
- color: var(--text-primary) !important;
715
- display: flex;
716
- flex-direction: column;
717
- justify-content: center;
718
- align-items: center;
719
- }}
720
- .animated-output-content {{
721
- opacity: 0;
722
- animation: fadeInAndSlideUp 0.7s ease-out forwards;
723
- width: 100%;
724
- white-space: pre-wrap;
725
- overflow-wrap: break-word;
726
- word-break: break-word;
727
- text-align: left !important;
728
- color: var(--text-primary) !important;
729
- }}
730
- @keyframes fadeInAndSlideUp {{
731
- from {{ opacity: 0; transform: translateY(15px); }}
732
- to {{ opacity: 1; transform: translateY(0); }}
733
- }}
734
- .response-header {{
735
- font-size: 1.3rem !important;
736
- font-weight: 700 !important;
737
- color: var(--primary-color) !important;
738
- margin-bottom: 0.75rem !important;
739
- display: flex !important;
740
- align-items: center !important;
741
- gap: 0.6rem !important;
742
- text-align: left !important;
743
- width: 100%;
744
- justify-content: flex-start;
745
- }}
746
- .response-icon {{
747
- font-size: 1.5rem !important;
748
- color: var(--primary-color) !important;
749
- }}
750
- .divider {{
751
- border: none !important;
752
- border-top: 1px dashed var(--border-color) !important;
753
- margin: 1rem 0 !important;
754
- }}
755
- .error-message {{
756
- background-color: var(--error-bg) !important;
757
- border: 2px solid var(--error-border) !important;
758
- color: var(--error-text) !important;
759
- padding: 1.25rem !important;
760
- border-radius: 8px !important;
761
- display: flex !important;
762
- align-items: flex-start !important;
763
- gap: 0.8rem !important;
764
- font-size: 0.95rem !important;
765
- font-weight: 500 !important;
766
- line-height: 1.6 !important;
767
- text-align: left !important;
768
- width: 100%;
769
- box-sizing: border-box;
770
- }}
771
- .error-message a {{
772
- color: var(--error-text) !important;
773
- text-decoration: underline !important;
774
- }}
775
- .error-icon {{
776
- font-size: 1.4rem !important;
777
- line-height: 1 !important;
778
- margin-top: 0.1rem !important;
779
- }}
780
- .error-details {{
781
- font-size: 0.85rem !important;
782
- color: var(--error-text) !important;
783
- margin-top: 0.5rem !important;
784
- opacity: 0.8;
785
  }}
 
 
786
  .placeholder {{
787
- background-color: var(--background-primary) !important;
788
- border: 2px dashed var(--border-color) !important;
789
- border-radius: 8px !important;
790
- padding: 2.5rem 1.5rem !important;
791
- text-align: center !important;
792
- color: var(--text-secondary) !important;
793
- font-style: italic !important;
794
- font-size: 1.1rem !important;
795
- width: 100%;
796
- box-sizing: border-box;
797
  }}
 
 
798
  .examples-section .gr-samples-table {{
799
- border: 2px solid var(--border-color) !important;
800
- border-radius: 8px !important;
801
- overflow: hidden !important;
802
- margin-top: 1rem !important;
803
- }}
804
- .examples-section .gr-samples-table th,
805
- .examples-section .gr-samples-table td {{
806
- padding: 0.9rem !important;
807
- border: none !important;
808
- font-size: 0.95rem !important;
809
- text-align: left !important;
810
- color: var(--text-primary) !important;
811
  }}
812
  .examples-section .gr-samples-table th {{
813
- background-color: var(--background-secondary) !important;
814
- font-weight: 700 !important;
815
- color: var(--text-primary) !important;
816
  }}
817
  .examples-section .gr-samples-table td {{
818
- background-color: var(--background-primary) !important;
819
- color: var(--text-primary) !important;
820
- border-top: 1px solid var(--border-color) !important;
821
- cursor: pointer !important;
822
- transition: background 0.2s ease, transform 0.1s ease !important;
823
  }}
824
  .examples-section .gr-samples-table tr:hover td {{
825
- background-color: var(--background-secondary) !important;
826
- transform: translateX(5px);
 
 
 
 
 
 
 
 
 
 
827
  }}
828
- .gr-examples .gr-label,
829
- .gr-examples .label-wrap,
830
- .gr-examples .gr-accordion-header {{
831
- display: none !important;
832
  }}
 
 
833
  .app-footer-wrapper {{
834
- background: linear-gradient(145deg, var(--background-primary) 0%, var(--background-secondary) 100%) !important;
835
- border: 2px solid var(--border-color) !important;
836
- border-radius: 12px !important;
837
- padding: 1.75rem !important;
838
- margin-top: 1.5rem !important;
839
- margin-bottom: 1.5rem !important;
840
- text-align: center !important;
841
- color: var(--text-primary) !important;
842
  }}
843
  .app-footer p {{
844
- margin: 0 !important;
845
- max-width: 90% !important;
846
- font-size: 0.95rem !important;
847
- color: var(--text-secondary) !important;
848
- line-height: 1.6 !important;
849
- background-color: transparent !important;
850
- text-align: center !important;
851
- white-space: normal !important;
852
  }}
853
  .app-footer strong, .app-footer b {{
854
- font-weight: 700 !important;
855
- color: var(--primary-color) !important;
856
  }}
857
  .app-footer a {{
858
- color: var(--primary-color) !important;
859
- text-decoration: underline !important;
860
- font-weight: 600 !important;
 
 
 
 
861
  }}
862
- .app-footer a:hover {{
863
- text-decoration: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
864
  }}
 
 
 
865
  @media (max-width: 768px) {{
866
  .gradio-container {{
867
  padding: 1rem !important;
@@ -902,7 +608,7 @@ Answer:"""
902
  }}
903
  """
904
 
905
- # Removed theme_mode="light" to avoid TypeError
906
  with gr.Blocks(css=custom_css, title="Landlord-Tenant Rights Assistant") as demo:
907
  with gr.Group(elem_classes="app-header-wrapper"):
908
  gr.Markdown(
@@ -994,11 +700,19 @@ Answer:"""
994
  gr.Markdown(
995
  f"""
996
  <style>
 
997
  .custom-link {{
998
  font-weight: bold !important;
999
- color: orange !important;
1000
  text-decoration: underline;
1001
  }}
 
 
 
 
 
 
 
1002
  </style>
1003
  <p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. For specific legal guidance, always consult with a licensed attorney in your jurisdiction.</p>
1004
  <p>Developed by <strong>Nischal Subedi</strong>. Connect on <a href="https://www.linkedin.com/in/nischal1/" target="_blank" class="custom-link">LinkedIn</a> or explore insights at <a href="https://datascientistinsights.substack.com/" target="_blank" class="custom-link">Substack</a>.</p>
 
300
  /* Import legible fonts from Google Fonts */
301
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap');
302
 
303
+ /* Define our custom light theme variables */
304
  :root {{
305
+ --custom-primary-color: #FF8C00;
306
+ --custom-primary-hover: #E07B00;
307
+ --custom-background-primary: hsl(30, 100%, 99.9%); /* Near white, slightly warm */
308
+ --custom-background-secondary: hsl(30, 100%, 96%); /* Slightly darker background */
309
+ --custom-text-primary: #4A3C32; /* Dark brown/off-black for main text */
310
+ --custom-text-secondary: #8C7B6F; /* Lighter brown/gray for subdued text */
311
+ --custom-border-color: hsl(30, 70%, 85%); /* Light brown/peach border */
312
+ --custom-border-focus: #FF8C00; /* Primary color for focus */
313
+ --custom-shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
314
+ --custom-shadow-md: 0 4px 10px rgba(0,0,0,0.1);
315
+ --custom-shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
316
+ --custom-error-bg: #FFF0E0; /* Light peach error background */
317
+ --custom-error-border: #FFD2B2; /* Peach error border */
318
+ --custom-error-text: #E05C00; /* Orange-red error text */
319
+ }}
320
+
321
+ /* CRITICAL: FORCE GRADIO'S INTERNAL VARIABLES TO OUR CUSTOM LIGHT THEME VALUES */
322
+ /* This targets :root, html.dark, body.dark, and generic .dark classes to ensure precedence */
 
323
  :root, html.dark, body.dark, .dark {{
324
  /* General backgrounds */
325
+ --background-fill-primary: var(--custom-background-primary) !important;
326
+ --background-fill-secondary: var(--custom-background-secondary) !important;
327
+ --background-fill-tertiary: var(--custom-background-secondary) !important;
328
+ --panel-background: var(--custom-background-primary) !important;
329
+ --block-background: var(--custom-background-primary) !important;
330
+ --color-background-primary: var(--custom-background-primary) !important;
331
+ --color-background-secondary: var(--custom-background-secondary) !important;
332
 
333
  /* Text colors */
334
+ --text-color-body: var(--custom-text-primary) !important;
335
+ --text-color-subdued: var(--custom-text-secondary) !important;
336
+ --text-color-highlight: var(--custom-primary-color) !important;
337
+ --text-color-placeholder: var(--custom-text-secondary) !important;
338
+ --text-color-link: var(--custom-primary-color) !important;
339
+ --color-text-primary: var(--custom-text-primary) !important;
340
+ --color-text-secondary: var(--custom-text-secondary) !important;
341
+ --color-text-placeholder: var(--custom-text-secondary) !important;
342
 
343
  /* Border colors */
344
+ --border-color-primary: var(--custom-border-color) !important;
345
+ --border-color-accent: var(--custom-border-focus) !important;
346
+ --border-color-secondary: var(--custom-border-color) !important;
347
+ --border-color-tertiary: var(--custom-border-color) !important;
348
+ --color-border-primary: var(--custom-border-color) !important;
349
+ --color-border-secondary: var(--custom-border-color) !important;
350
 
351
  /* Button colors */
352
+ --button-primary-background: var(--custom-primary-color) !important;
353
+ --button-primary-background-hover: var(--custom-primary-hover) !important;
354
  --button-primary-text-color: white !important; /* Ensure text is white on primary buttons */
355
  --button-secondary-background: transparent !important;
356
+ --button-secondary-background-hover: var(--custom-background-secondary) !important;
357
+ --button-secondary-border-color: var(--custom-border-color) !important;
358
+ --button-secondary-border-color-hover: var(--custom-primary-color) !important;
359
+ --button-secondary-text-color: var(--custom-text-primary) !important;
360
+ --color-button-primary-background: var(--custom-primary-color) !important;
361
+ --color-button-primary-background-hover: var(--custom-primary-hover) !important;
 
 
362
  --color-button-primary-text: white !important;
363
+ --color-button-secondary-text: var(--custom-text-primary) !important;
364
 
365
  /* Input specific */
366
+ --input-background-fill: var(--custom-background-primary) !important;
367
+ --input-border-color: var(--custom-border-color) !important;
368
+ --input-border-color-focus: var(--custom-border-focus) !important;
369
+ --input-shadow: var(--custom-shadow-sm) !important;
370
  --input-shadow-focus: 0 0 0 4px rgba(255, 140, 0, 0.2) !important;
371
+ --input-text-color: var(--custom-text-primary) !important;
372
 
373
  /* Shadows */
374
+ --shadow-s: var(--custom-shadow-sm) !important;
375
+ --shadow-m: var(--custom-shadow-md) !important;
376
+ --shadow-l: var(--custom-shadow-lg) !important;
377
 
378
  /* Misc */
379
+ --color-accent-soft: rgba(255, 140, 0, 0.2) !important;
380
+ --color-error: var(--custom-error-text) !important;
381
+ --color-error-background: var(--custom-error-bg) !important;
382
+ --color-error-border: var(--custom-error-border) !important;
 
383
 
384
+ /* Specific overrides for common Gradio components that might be problematic */
385
+ --block-border-color: var(--custom-border-color) !important;
386
+ --input-border-color: var(--custom-border-color) !important;
387
+ --input-label-color: var(--custom-text-primary) !important;
388
+ --link-text-color: var(--custom-primary-color) !important;
389
+ --link-text-color-hover: var(--custom-primary-hover) !important;
390
 
391
+ /* Ensure scrollbar in textboxes if it ever gets themed */
392
+ --scrollbar-thumb-color: var(--custom-border-color) !important;
393
+ --scrollbar-track-color: var(--custom-background-secondary) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  }}
395
+
396
+ /* Base styles for html and body - ensure no dark mode inheritance */
397
+ body, html {{
398
+ background-color: var(--custom-background-secondary) !important;
399
+ color: var(--custom-text-primary) !important;
400
+ transition: none !important; /* Extremely important to prevent theme transition flickering */
401
+ }}
402
+
403
+ /* Target the main Gradio application container directly if it's the root */
404
+ .gradio-app {{
405
+ background-color: var(--custom-background-secondary) !important;
406
+ color: var(--custom-text-primary) !important;
407
+ /* Add any other global overrides if needed for the app container */
408
+ }}
409
+
410
+ /* Ensure all core Gradio blocks and components use our defined colors */
411
+ .gr-block, .gr-box, .gr-panel, .gr-form, .gr-columns, .gr-column,
412
+ .gradio-html, .gradio-markdown, .gradio-prose {{
413
+ background-color: var(--custom-background-primary) !important;
414
+ color: var(--custom-text-primary) !important;
415
+ border-color: var(--custom-border-color) !important;
416
+ /* Ensure text content within markdown and HTML is consistent */
417
+ --text-color-body: var(--custom-text-primary) !important; /* Re-apply explicitly */
418
+ --text-color-subdued: var(--custom-text-secondary) !important; /* Re-apply explicitly */
419
+ }}
420
+
421
+ /* Specific overrides for input fields */
422
  .gradio-textbox textarea,
423
  .gradio-textbox input {{
424
+ background-color: var(--custom-background-primary) !important;
425
+ color: var(--custom-text-primary) !important;
426
+ border: 2px solid var(--custom-border-color) !important;
427
+ box-shadow: var(--custom-shadow-sm) !important;
 
 
 
 
 
 
 
428
  }}
429
  .gradio-textbox textarea:focus,
430
  .gradio-textbox input:focus {{
431
+ border-color: var(--custom-border-focus) !important;
432
+ box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.2) !important; /* Use rgba for consistent shadow */
433
  outline: none !important;
 
 
 
 
 
 
 
 
 
434
  }}
435
+
436
+ /* Specific overrides for radio buttons */
437
  .gradio-radio label {{
438
+ background-color: var(--custom-background-primary) !important;
439
+ color: var(--custom-text-primary) !important;
440
+ border: 2px solid var(--custom-border-color) !important;
441
+ box-shadow: var(--custom-shadow-sm) !important;
 
 
 
 
 
 
 
 
 
 
442
  }}
443
  .gradio-radio label span.text-lg {{
444
+ color: var(--custom-text-primary) !important; /* Ensure text color of radio labels */
 
 
445
  }}
446
  .gradio-radio label:hover {{
447
+ background-color: var(--custom-background-secondary) !important;
448
+ border-color: var(--custom-primary-color) !important;
449
+ box-shadow: var(--custom-shadow-md) !important;
450
  transform: translateY(-2px) !important;
451
  }}
452
  .gradio-radio input[type="radio"]:checked + label {{
453
+ background-color: var(--custom-primary-color) !important;
454
+ color: white !important; /* Text should be white on selected primary background */
455
+ border-color: var(--custom-primary-hover) !important;
456
+ box-shadow: var(--custom-shadow-md) !important;
 
457
  }}
458
  .gradio-radio input[type="radio"]:checked + label span.text-lg {{
459
+ color: white !important; /* Text should be white on selected primary background */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  }}
461
+
462
+ /* Overrides for buttons */
463
  .gr-button-primary {{
464
+ background-color: var(--custom-primary-color) !important;
465
+ color: white !important;
 
466
  }}
467
  .gr-button-primary:hover {{
468
+ background-color: var(--custom-primary-hover) !important;
 
 
 
 
 
 
469
  }}
470
  .gr-button-secondary {{
471
  background-color: transparent !important;
472
+ color: var(--custom-text-primary) !important;
473
+ border-color: var(--custom-border-color) !important;
474
  }}
475
  .gr-button-secondary:hover {{
476
+ background-color: var(--custom-background-secondary) !important;
477
+ border-color: var(--custom-primary-color) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  }}
479
+
480
+ /* Placeholders */
481
  .placeholder {{
482
+ background-color: var(--custom-background-primary) !important;
483
+ border: 2px dashed var(--custom-border-color) !important;
484
+ color: var(--custom-text-secondary) !important;
 
 
 
 
 
 
 
485
  }}
486
+
487
+ /* Example table */
488
  .examples-section .gr-samples-table {{
489
+ border: 2px solid var(--custom-border-color) !important;
490
+ background-color: var(--custom-background-primary) !important;
491
+ color: var(--custom-text-primary) !important;
 
 
 
 
 
 
 
 
 
492
  }}
493
  .examples-section .gr-samples-table th {{
494
+ background-color: var(--custom-background-secondary) !important;
495
+ color: var(--custom-text-primary) !important;
 
496
  }}
497
  .examples-section .gr-samples-table td {{
498
+ background-color: var(--custom-background-primary) !important;
499
+ color: var(--custom-text-primary) !important;
500
+ border-top: 1px solid var(--custom-border-color) !important;
 
 
501
  }}
502
  .examples-section .gr-samples-table tr:hover td {{
503
+ background-color: var(--custom-background-secondary) !important;
504
+ transform: translateX(5px); /* Keep the hover effect */
505
+ }}
506
+ .examples-section .gr-samples-table th, .examples-section .gr-samples-table td {{
507
+ border-color: var(--custom-border-color) !important; /* Explicitly set border color */
508
+ }}
509
+
510
+ /* Error messages */
511
+ .error-message {{
512
+ background-color: var(--custom-error-bg) !important;
513
+ border: 2px solid var(--custom-error-border) !important;
514
+ color: var(--custom-error-text) !important;
515
  }}
516
+ .error-message a {{
517
+ color: var(--custom-error-text) !important; /* Ensure link color in error messages */
 
 
518
  }}
519
+
520
+ /* Footer */
521
  .app-footer-wrapper {{
522
+ background: linear-gradient(145deg, var(--custom-background-primary) 0%, var(--custom-background-secondary) 100%) !important;
523
+ border: 2px solid var(--custom-border-color) !important;
524
+ color: var(--custom-text-primary) !important;
 
 
 
 
 
525
  }}
526
  .app-footer p {{
527
+ color: var(--custom-text-secondary) !important;
 
 
 
 
 
 
 
528
  }}
529
  .app-footer strong, .app-footer b {{
530
+ color: var(--custom-primary-color) !important;
 
531
  }}
532
  .app-footer a {{
533
+ color: var(--custom-primary-color) !important;
534
+ }}
535
+
536
+ /* General element classes that might inherit */
537
+ .gr-text, .gr-label, .gr-checkbox-group, .gr-radio-group,
538
+ .gr-slider, .gr-number, .gr-dropdown {{
539
+ color: var(--custom-text-primary) !important;
540
  }}
541
+
542
+ /* Ensure all text within any Gradio element defaults to primary text color */
543
+ .gradio-container * {{
544
+ color: var(--custom-text-primary) !important;
545
+ }}
546
+ /* And then re-override for specific cases that need secondary text color */
547
+ .gradio-container .gr-prose,
548
+ .gradio-container .app-header-tagline,
549
+ .gradio-container .placeholder,
550
+ .gradio-container .app-footer p {{
551
+ color: var(--custom-text-secondary) !important;
552
+ }}
553
+ /* And re-override for primary color elements */
554
+ .gradio-container .app-header-logo,
555
+ .gradio-container .response-header,
556
+ .gradio-container .response-icon,
557
+ .gradio-container .custom-link {{
558
+ color: var(--custom-primary-color) !important;
559
+ }}
560
+ .gradio-container .gr-button-primary {{
561
+ color: white !important;
562
+ }}
563
+ /* Ensure inputs specifically use primary text color, not inherited secondary */
564
+ .gradio-textbox textarea, .gradio-textbox input,
565
+ .gradio-radio label span.text-lg {{
566
+ color: var(--custom-text-primary) !important;
567
  }}
568
+
569
+
570
+ /* Existing Media Queries (keep as is) */
571
  @media (max-width: 768px) {{
572
  .gradio-container {{
573
  padding: 1rem !important;
 
608
  }}
609
  """
610
 
611
+ # Removed theme_mode="light" to prevent the TypeError
612
  with gr.Blocks(css=custom_css, title="Landlord-Tenant Rights Assistant") as demo:
613
  with gr.Group(elem_classes="app-header-wrapper"):
614
  gr.Markdown(
 
700
  gr.Markdown(
701
  f"""
702
  <style>
703
+ /* Use custom variables for consistency */
704
  .custom-link {{
705
  font-weight: bold !important;
706
+ color: var(--custom-primary-color) !important;
707
  text-decoration: underline;
708
  }}
709
+ /* Ensure general footer text color */
710
+ .app-footer p {{
711
+ color: var(--custom-text-secondary) !important;
712
+ }}
713
+ .app-footer strong, .app-footer b {{
714
+ color: var(--custom-primary-color) !important;
715
+ }}
716
  </style>
717
  <p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. For specific legal guidance, always consult with a licensed attorney in your jurisdiction.</p>
718
  <p>Developed by <strong>Nischal Subedi</strong>. Connect on <a href="https://www.linkedin.com/in/nischal1/" target="_blank" class="custom-link">LinkedIn</a> or explore insights at <a href="https://datascientistinsights.substack.com/" target="_blank" class="custom-link">Substack</a>.</p>