diff --git a/app.py b/app.py index 5e70a8b..c900f83 100644 --- a/app.py +++ b/app.py @@ -99,7 +99,7 @@ def get_all_predictions(self, predictions): from models.navigation import top_navigation_bar except ImportError: def top_navigation_bar(): - st.error("Navigation component not found") + pass # Silent fallback # --- Session State Initialization --- # Initialize all session state variables @@ -148,6 +148,52 @@ def navigate_to(page_name): --hover-glow: rgba(0, 212, 170, 0.3); } + /* Improved font styling */ + body, .stApp, .main { + font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important; + font-weight: 400 !important; + line-height: 1.6 !important; + letter-spacing: 0.01em !important; + } + + h1, h2, h3, h4, h5, h6 { + font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important; + font-weight: 600 !important; + line-height: 1.3 !important; + letter-spacing: -0.02em !important; + } + + .stMarkdown h1 { + font-size: 2.5rem !important; + font-weight: 700 !important; + margin-bottom: 1rem !important; + } + + .stMarkdown h2 { + font-size: 2rem !important; + font-weight: 600 !important; + margin-bottom: 0.8rem !important; + } + + .stMarkdown h3 { + font-size: 1.5rem !important; + font-weight: 600 !important; + margin-bottom: 0.6rem !important; + } + + .stMarkdown p { + font-size: 1rem !important; + line-height: 1.7 !important; + margin-bottom: 1rem !important; + } + + .stButton > button { + font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important; + font-weight: 500 !important; + font-size: 0.95rem !important; + letter-spacing: 0.02em !important; + } + /* Dark theme overrides */ @media (prefers-color-scheme: dark) { :root { @@ -524,11 +570,26 @@ def navigate_to(page_name): transform: translateY(-1px) !important; } - /* Sidebar hover effects */ + /* Sidebar hover effects and scrolling fix */ .stSidebar > div:hover { box-shadow: 0 4px 12px var(--hover-shadow) !important; } + /* Ensure sidebar can scroll properly */ + .stSidebar { + overflow-y: auto !important; + overflow-x: hidden !important; + position: relative !important; + z-index: 999 !important; + } + + .stSidebar > div { + overflow-y: auto !important; + overflow-x: hidden !important; + height: 100vh !important; + max-height: 100vh !important; + } + /* Progress bar hover effects */ .stProgress > div:hover { box-shadow: 0 0 10px var(--hover-glow) !important; @@ -565,9 +626,117 @@ def navigate_to(page_name): transform: translateY(-1px) !important; box-shadow: 0 4px 12px var(--hover-shadow) !important; } + + /* Minimal fix for overlapping issues - only for dashboard elements */ + .stTooltip { + z-index: 9999 !important; + position: fixed !important; + } + + /* Fix only dashboard-specific elements */ + .metric-container { + position: relative !important; + z-index: 1 !important; + margin: 10px 0 !important; + } + + /* Fix column layout for dashboard cards */ + .stColumns { + display: flex !important; + flex-wrap: wrap !important; + gap: 10px !important; + margin: 0 !important; + padding: 0 !important; + } + + .stColumns > div { + flex: 1 !important; + min-width: 0 !important; + margin: 0 !important; + padding: 0 !important; + } + + /* Dashboard container fixes */ + .dashboard-content { + position: relative !important; + z-index: 1 !important; + margin: 20px 0 !important; + } + + .dashboard-tabs-container { + position: relative !important; + z-index: 1 !important; + margin: 20px 0 !important; + } + + .dashboard-tab-content { + position: relative !important; + z-index: 1 !important; + margin: 20px 0 !important; + padding: 10px 0 !important; + } + + /* Smooth scrolling for navigation */ + html { + scroll-behavior: smooth !important; + } + + /* Content sections for navigation */ + .content-section { + scroll-margin-top: 100px !important; + padding: 20px 0 !important; + } + + /* Navigation button scroll effects */ + .nav-scroll-button { + transition: all 0.3s ease !important; + cursor: pointer !important; + } + + .nav-scroll-button:hover { + transform: translateY(-2px) !important; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important; + } + + /* Active button styling */ + .stButton > button:active, + .stButton > button:focus { + background-color: #4ecdc4 !important; + color: #ffffff !important; + border: 2px solid #4ecdc4 !important; + box-shadow: 0 0 10px rgba(78, 205, 196, 0.5) !important; + } + + /* Clicked button styling */ + .nav-button-clicked { + background-color: #4ecdc4 !important; + color: #ffffff !important; + border: 2px solid #4ecdc4 !important; + box-shadow: 0 0 10px rgba(78, 205, 196, 0.5) !important; + } """, unsafe_allow_html=True) +# Add JavaScript for button click styling +st.markdown(""" + +""", unsafe_allow_html=True) + + + # --- Page Functions --- def show_home_page(): """Beautiful and comprehensive home page""" @@ -612,29 +781,29 @@ def show_home_page(): """, unsafe_allow_html=True) # Quick Action Buttons - st.markdown("### đ Quick Actions") + st.markdown("### Quick Actions") col_btn1, col_btn2, col_btn3, col_btn4 = st.columns(4) with col_btn1: - if st.button("đ Start Analysis", type="primary", use_container_width=True, help="Analyze SMS messages for threats"): + if st.button("Start Analysis", type="primary", use_container_width=True, help="Analyze SMS messages for threats"): navigate_to('analyzer') with col_btn2: - if st.button("đ Analytics", use_container_width=True, help="View performance metrics"): + if st.button("Analytics", use_container_width=True, help="View performance metrics"): navigate_to('analytics') with col_btn3: - if st.button("⥠Features", use_container_width=True, help="Explore all features"): + if st.button("Features", use_container_width=True, help="Explore all features"): navigate_to('features') with col_btn4: - if st.button("âšī¸ About", use_container_width=True, help="Learn more about Spamlyser"): + if st.button("About", use_container_width=True, help="Learn more about Spamlyser"): navigate_to('about') st.markdown("---") # Feature Showcase - st.markdown("### đ Why Choose Spamlyser Pro?") + st.markdown("### Why Choose Spamlyser Pro?") col1, col2 = st.columns(2) @@ -647,7 +816,7 @@ def show_home_page(): margin-bottom: 20px; box-shadow: 0 5px 15px rgba(255, 154, 158, 0.3); "> -
Uses state-of-the-art transformer models including BERT, RoBERTa, DistilBERT, and ALBERT for maximum accuracy in threat detection. @@ -663,7 +832,7 @@ def show_home_page(): margin-bottom: 20px; box-shadow: 0 5px 15px rgba(168, 237, 234, 0.3); "> -
Get instant results with lightning-fast processing. Analyze SMS messages in milliseconds with our optimized AI pipeline. @@ -696,7 +865,7 @@ def show_home_page(): margin-bottom: 20px; box-shadow: 0 5px 15px rgba(210, 153, 194, 0.3); "> -
Track performance metrics, view detailed reports, and export results in multiple formats for comprehensive analysis. @@ -707,26 +876,26 @@ def show_home_page(): st.markdown("---") # Statistics Section - st.markdown("### đ Platform Statistics") + st.markdown("### Platform Statistics") metric_col1, metric_col2, metric_col3, metric_col4 = st.columns(4) with metric_col1: - st.metric("đ¯ Accuracy", "97.8%", "+2.1%") + st.metric("Accuracy", "97.8%", "+2.1%") with metric_col2: - st.metric("⥠Speed", "< 100ms", "-15ms") + st.metric("Speed", "< 100ms", "-15ms") with metric_col3: - st.metric("đĄī¸ Threats Blocked", "10M+", "+2.3M") + st.metric("Threats Blocked", "10M+", "+2.3M") with metric_col4: - st.metric("đ¤ AI Models", "4", "+1") + st.metric("AI Models", "4", "+1") st.markdown("---") # How It Works Section - st.markdown("### đ¯ How Spamlyser Pro Works") + st.markdown("### How Spamlyser Pro Works") step_col1, step_col2, step_col3, step_col4 = st.columns(4) @@ -744,7 +913,7 @@ def show_home_page(): margin: 0 auto 15px auto; box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4); "> - đą + 1
Input SMS Message
@@ -765,7 +934,7 @@ def show_home_page(): margin: 0 auto 15px auto; box-shadow: 0 5px 15px rgba(255, 154, 158, 0.4); "> - đ¤ + 2AI Analysis
@@ -786,7 +955,7 @@ def show_home_page(): margin: 0 auto 15px auto; box-shadow: 0 5px 15px rgba(168, 237, 234, 0.4); "> - đ + 3Threat Detection
@@ -807,7 +976,7 @@ def show_home_page(): margin: 0 auto 15px auto; box-shadow: 0 5px 15px rgba(255, 236, 210, 0.4); "> - đ + 4Results & Report
@@ -817,9 +986,9 @@ def show_home_page(): # Feedback Section st.markdown("---") st.markdown(""" -Help us improve Spamlyser by sharing your thoughts and suggestions @@ -6652,6 +6821,38 @@ def update_progress(progress, message=""): .main, .stApp { background: #181f2f; } + + /* Sidebar dark mode styling */ + .stSidebar { + background: #232a3d !important; + color: #f8fafc !important; + } + + .stSidebar .stMarkdown { + color: #f8fafc !important; + } + + .stSidebar label { + color: #f8fafc !important; + } + + .stSidebar .stExpander { + background: #232a3d !important; + border: 1px solid #324a7c !important; + } + + .stSidebar .stCheckbox label { + color: #f8fafc !important; + } + + .stSidebar .stRadio label { + color: #f8fafc !important; + } + + .stSidebar .stSelectbox label { + color: #f8fafc !important; + } + .metric-container, .prediction-card, .ensemble-card, .feature-card, .model-info, .ensemble-method, .method-comparison { background: #232a3d; border-radius: 16px; @@ -6716,6 +6917,204 @@ def update_progress(progress, message=""): .main, .stApp { background: #f4f8ff; } + + /* Sidebar light mode styling */ + .stSidebar { + background: #ffffff !important; + color: #232a3d !important; + } + + .stSidebar .stMarkdown { + color: #232a3d !important; + } + + .stSidebar label { + color: #232a3d !important; + } + + .stSidebar .stExpander { + background: #ffffff !important; + border: 1px solid #b3c7f7 !important; + } + + .stSidebar .stCheckbox label { + color: #232a3d !important; + } + + .stSidebar .stRadio label { + color: #232a3d !important; + } + + .stSidebar .stSelectbox label { + color: #232a3d !important; + } + + /* Additional sidebar elements for light mode */ + .stSidebar .stText { + color: #232a3d !important; + } + + .stSidebar .stMetric { + color: #232a3d !important; + } + + .stSidebar .stSelectbox > div > div { + background: #ffffff !important; + color: #232a3d !important; + border: 1px solid #b3c7f7 !important; + } + + .stSidebar .stSelectbox > div > div > div { + background: #ffffff !important; + color: #232a3d !important; + } + + .stSidebar .stCheckbox > div > label { + color: #232a3d !important; + } + + .stSidebar .stRadio > div > label { + color: #232a3d !important; + } + + .stSidebar .stNumberInput label { + color: #232a3d !important; + } + + .stSidebar .stSlider label { + color: #232a3d !important; + } + + .stSidebar .stProgress label { + color: #232a3d !important; + } + + .stSidebar .stInfo { + color: #232a3d !important; + } + + .stSidebar .stSuccess { + color: #232a3d !important; + } + + .stSidebar .stWarning { + color: #232a3d !important; + } + + .stSidebar .stError { + color: #232a3d !important; + } + + /* Force sidebar text visibility in light mode */ + .stSidebar * { + color: #232a3d !important; + } + + .stSidebar div { + color: #232a3d !important; + } + + .stSidebar span { + color: #232a3d !important; + } + + .stSidebar p { + color: #232a3d !important; + } + + .stSidebar h1, .stSidebar h2, .stSidebar h3, .stSidebar h4, .stSidebar h5, .stSidebar h6 { + color: #232a3d !important; + } + + /* Specific targeting for Streamlit components */ + .stSidebar [data-testid="stCheckbox"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stRadio"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stSelectbox"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stExpander"] label { + color: #232a3d !important; + } + + .stSidebar [data-testid="stText"] { + color: #232a3d !important; + } + + .stSidebar [data-testid="stMetric"] { + color: #232a3d !important; + } + + /* Override any inherited light colors */ + .stSidebar .stMarkdown p { + color: #232a3d !important; + } + + .stSidebar .stMarkdown div { + color: #232a3d !important; + } + + .stSidebar .stMarkdown span { + color: #232a3d !important; + } + + /* Ensure form elements are visible */ + .stSidebar .stForm label { + color: #232a3d !important; + } + + .stSidebar .stForm div { + color: #232a3d !important; + } + + .stSidebar .stForm span { + color: #232a3d !important; + } + + /* Specific fix for Overall Statistics section */ + .stSidebar .stMetric { + background: #ffffff !important; + border: 1px solid #b3c7f7 !important; + color: #232a3d !important; + } + + .stSidebar .stMetric > div { + color: #232a3d !important; + } + + .stSidebar .stMetric label { + color: #232a3d !important; + } + + .stSidebar .stMetric div { + color: #232a3d !important; + } + + .stSidebar .stMetric span { + color: #232a3d !important; + } + + .stSidebar .stMetric p { + color: #232a3d !important; + } + + /* Force visibility for metric containers */ + .stSidebar [data-testid="metric-container"] { + background: #ffffff !important; + border: 1px solid #b3c7f7 !important; + color: #232a3d !important; + } + + .stSidebar [data-testid="metric-container"] * { + color: #232a3d !important; + } + .metric-container, .prediction-card, .ensemble-card, .feature-card, .model-info, .ensemble-method, .method-comparison { background: #e3eafc; border-radius: 16px; @@ -6787,7 +7186,7 @@ def render_spamlyser_dashboard(): st.markdown("---") st.markdown(""" -