@@ -475,7 +475,92 @@ def generate_excel_report(
475475
476476def main ():
477477 st .set_page_config (page_title = "File Validator" , layout = "wide" )
478- st .title ("Claims Validation Report Generator" )
478+
479+ # Initialize session state for theme
480+ if "dark_mode" not in st .session_state :
481+ st .session_state .dark_mode = True
482+
483+ # Header with title and theme toggle
484+ col1 , col2 = st .columns ([0.85 , 0.15 ])
485+
486+ with col1 :
487+ st .title ("Claims Validation Report Generator" )
488+
489+ with col2 :
490+ # Icon button toggle for theme (avoids checkbox DOM hacks)
491+ button_label = "🌙" if st .session_state .dark_mode else "☀️"
492+ if st .button (button_label , key = "theme_button" , help = "Toggle dark mode" ):
493+ st .session_state .dark_mode = not st .session_state .dark_mode
494+
495+ # Keep header compact but avoid global .stButton overrides
496+ # (No global compact CSS here to prevent shrinking other buttons)
497+
498+ # Apply theme-specific styling — target Streamlit app container and use !important
499+ if st .session_state .dark_mode :
500+ st .markdown ("""
501+ <style>
502+ /* Main app background and text */
503+ .stApp, .stApp .main, .block-container {
504+ background-color: #0e1117 !important;
505+ color: #c9d1d9 !important;
506+ }
507+ /* Metric cards */
508+ .stMetric, .stMetricValue {
509+ background-color: #161b22 !important;
510+ color: #c9d1d9 !important;
511+ padding: 10px !important;
512+ border-radius: 6px !important;
513+ }
514+ /* Buttons and download */
515+ button, .stButton>button, .stDownloadButton>button {
516+ background-color: #1f6feb !important;
517+ color: #ffffff !important;
518+ border: none !important;
519+ padding: 8px 14px !important;
520+ font-weight: 600 !important;
521+ box-shadow: 0 4px 10px rgba(31,111,235,0.18) !important;
522+ border-radius: 8px !important;
523+ transition: transform .08s ease-in-out, box-shadow .12s ease-in-out !important;
524+ }
525+ .stButton>button:hover { transform: translateY(-1px) !important; }
526+ .stDownloadButton>button { background-color: transparent !important; color: inherit !important; box-shadow: none !important; }
527+ /* Make tables and cells readable */
528+ table, th, td {
529+ color: #c9d1d9 !important;
530+ }
531+ </style>
532+ """ , unsafe_allow_html = True )
533+ else :
534+ st .markdown ("""
535+ <style>
536+ .stApp, .stApp .main, .block-container {
537+ background-color: #ffffff !important;
538+ color: #000000 !important;
539+ }
540+ .stMetric, .stMetricValue {
541+ background-color: #f5f5f5 !important;
542+ color: #000000 !important;
543+ padding: 10px !important;
544+ border-radius: 6px !important;
545+ }
546+ button, .stButton>button, .stDownloadButton>button {
547+ background-color: #e6eef8 !important;
548+ color: #000000 !important;
549+ border: none !important;
550+ padding: 8px 14px !important;
551+ font-weight: 600 !important;
552+ box-shadow: 0 4px 10px rgba(0,0,0,0.04) !important;
553+ border-radius: 8px !important;
554+ transition: transform .08s ease-in-out, box-shadow .12s ease-in-out !important;
555+ }
556+ .stButton>button:hover { transform: translateY(-1px) !important; }
557+ .stDownloadButton>button { background-color: transparent !important; color: inherit !important; box-shadow: none !important; }
558+ table, th, td {
559+ color: #000000 !important;
560+ }
561+ </style>
562+ """ , unsafe_allow_html = True )
563+
479564 st .markdown ("---" )
480565
481566 st .markdown ("""
@@ -500,13 +585,17 @@ def main():
500585 base_file = st .file_uploader ("Upload Base File" , type = ["txt" ], key = "base" )
501586
502587 with col3 :
503- st .subheader ("📄 ADHOC (Adhoc) " )
588+ st .subheader ("📄 ADHOC" )
504589 adhoc_file = st .file_uploader ("Upload ADHOC File" , type = ["txt" ], key = "adhoc" )
505590
506591 st .markdown ("---" )
507592
508- # Generate report button
509- if st .button ("🚀 Generate Report" , type = "primary" , use_container_width = True ):
593+ # Generate report button (centered)
594+ col_l , col_c , col_r = st .columns ([1 , 2 , 1 ])
595+ with col_c :
596+ generate_pressed = st .button ("🚀 Generate Report" , type = "primary" , use_container_width = True , key = "generate_report" )
597+
598+ if generate_pressed :
510599 if not all ([mapping_file , base_file , adhoc_file ]):
511600 st .error ("❌ Please upload all three files before generating the report." )
512601 return
0 commit comments