| def get_custom_css(): | |
| """Modern blue theme with dark/light mode support""" | |
| return """ | |
| /* Modern Blue Theme with Dark/Light Mode Support */ | |
| :root { | |
| /* Light mode colors */ | |
| --primary-blue: #2563eb; | |
| --primary-blue-light: #3b82f6; | |
| --primary-blue-dark: #1d4ed8; | |
| --secondary-blue: #60a5fa; | |
| --accent-blue: #93c5fd; | |
| --light-blue: #dbeafe; | |
| --bg-primary: linear-gradient(135deg, #2563eb 0%, #1e40af 50%, #1d4ed8 100%); | |
| --bg-secondary: #ffffff; | |
| --bg-card: #f8fafc; | |
| --bg-hover: #f1f5f9; | |
| --text-primary: #1e293b; | |
| --text-secondary: #475569; | |
| --text-muted: #64748b; | |
| --text-inverse: #ffffff; | |
| --border-color: #e2e8f0; | |
| --border-hover: #cbd5e1; | |
| --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); | |
| --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); | |
| --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); | |
| --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); | |
| --success-color: #22c55e; | |
| --warning-color: #f59e0b; | |
| --error-color: #ef4444; | |
| --info-color: #3b82f6; | |
| /* Radio button specific colors */ | |
| --radio-bg: #ffffff; | |
| --radio-border: #d1d5db; | |
| --radio-hover: #f3f4f6; | |
| --radio-selected: #2563eb; | |
| --radio-selected-bg: #eff6ff; | |
| --radio-text: #374151; | |
| } | |
| /* Dark mode */ | |
| @media (prefers-color-scheme: dark) { | |
| :root { | |
| --bg-primary: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #1d4ed8 100%); | |
| --bg-secondary: #0f172a; | |
| --bg-card: #1e293b; | |
| --bg-hover: #334155; | |
| --text-primary: #f1f5f9; | |
| --text-secondary: #cbd5e1; | |
| --text-muted: #94a3b8; | |
| --text-inverse: #0f172a; | |
| --border-color: #334155; | |
| --border-hover: #475569; | |
| --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.25); | |
| --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3); | |
| --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3); | |
| --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3); | |
| /* Dark mode radio colors */ | |
| --radio-bg: #374151; | |
| --radio-border: #4b5563; | |
| --radio-hover: #4b5563; | |
| --radio-selected: #60a5fa; | |
| --radio-selected-bg: #1e3a8a; | |
| --radio-text: #f9fafb; | |
| } | |
| } | |
| /* Manual dark mode toggle */ | |
| .dark-mode { | |
| --bg-primary: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #1d4ed8 100%); | |
| --bg-secondary: #0f172a; | |
| --bg-card: #1e293b; | |
| --bg-hover: #334155; | |
| --text-primary: #f1f5f9; | |
| --text-secondary: #cbd5e1; | |
| --text-muted: #94a3b8; | |
| --text-inverse: #0f172a; | |
| --border-color: #334155; | |
| --border-hover: #475569; | |
| /* Dark mode radio colors */ | |
| --radio-bg: #374151; | |
| --radio-border: #4b5563; | |
| --radio-hover: #4b5563; | |
| --radio-selected: #60a5fa; | |
| --radio-selected-bg: #1e3a8a; | |
| --radio-text: #f9fafb; | |
| } | |
| /* Global styles */ | |
| .gradio-container { | |
| background: var(--bg-primary); | |
| font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; | |
| color: var(--text-primary); | |
| min-height: 100vh; | |
| } | |
| /* Header */ | |
| .header { | |
| text-align: center; | |
| background: rgba(255, 255, 255, 0.3); | |
| backdrop-filter: blur(20px); | |
| border-radius: 24px; | |
| padding: 3rem 2rem; | |
| margin: 2rem; | |
| border: 1px solid rgba(255, 255, 255, 0.2); | |
| box-shadow: var(--shadow-xl); | |
| } | |
| .header h1 { | |
| color: rgba(255, 255, 255, 0.9) !important; | |
| font-size: 3rem; | |
| font-weight: 800; | |
| margin: 0; | |
| text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); | |
| letter-spacing: -0.025em; | |
| } | |
| .header p { | |
| color: rgba(255, 255, 255, 0.9); | |
| font-size: 1.25rem; | |
| margin: 1rem 0 0; | |
| font-weight: 400; | |
| } | |
| /* Input container */ | |
| .input-container { | |
| background: var(--bg-card); | |
| border-radius: 20px; | |
| padding: 2rem; | |
| margin: 1rem; | |
| box-shadow: var(--shadow-lg); | |
| border: 1px solid var(--border-color); | |
| transition: all 0.3s ease; | |
| } | |
| .input-container:hover { | |
| box-shadow: var(--shadow-xl); | |
| border-color: var(--border-hover); | |
| } | |
| /* Labels */ | |
| .gr-form label { | |
| color: var(--text-primary) !important; | |
| font-weight: 600 !important; | |
| margin-bottom: 0.5rem !important; | |
| } | |
| /* Additional selectors to ensure white background */ | |
| .gr-textbox { | |
| background: white !important; | |
| } | |
| .gr-textbox textarea { | |
| background: white !important; | |
| color: #1e293b !important; | |
| } | |
| /* Target the specific textbox container */ | |
| div[data-testid="textbox"] { | |
| background: white !important; | |
| } | |
| div[data-testid="textbox"] textarea { | |
| background: white !important; | |
| color: #1e293b !important; | |
| } | |
| /* Textarea placeholder */ | |
| /* Radio button container */ | |
| .gr-radio { | |
| background: transparent !important; | |
| } | |
| .gr-radio .gr-box { | |
| background: var(--bg-card) !important; | |
| border: 1px solid var(--border-color) !important; | |
| border-radius: 12px !important; | |
| padding: 1rem !important; | |
| box-shadow: none !important; | |
| } | |
| /* Radio button fieldset */ | |
| .gr-radio fieldset { | |
| border: none !important; | |
| padding: 0 !important; | |
| margin: 0 !important; | |
| } | |
| /* Individual radio buttons */ | |
| .gr-radio label { | |
| background: var(--radio-bg) !important; | |
| border: 2px solid var(--radio-border) !important; | |
| color: var(--radio-text) !important; | |
| border-radius: 8px !important; | |
| padding: 0.75rem 1.5rem !important; | |
| margin: 0.25rem !important; | |
| cursor: pointer !important; | |
| transition: all 0.3s ease !important; | |
| font-weight: 500 !important; | |
| display: flex !important; | |
| align-items: center !important; | |
| justify-content: center !important; | |
| } | |
| /* Radio button hover effect */ | |
| .gr-radio label:hover { | |
| background: var(--radio-hover) !important; | |
| border-color: var(--radio-selected) !important; | |
| transform: translateY(-1px) !important; | |
| box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; | |
| } | |
| /* Selected radio button */ | |
| .gr-radio input[type="radio"]:checked + label { | |
| background: var(--radio-selected-bg) !important; | |
| border-color: var(--radio-selected) !important; | |
| color: var(--radio-selected) !important; | |
| font-weight: 600 !important; | |
| box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important; | |
| } | |
| /* Hide the actual radio input */ | |
| .gr-radio input[type="radio"] { | |
| display: none !important; | |
| } | |
| /* Radio group info text */ | |
| .gr-radio .gr-info { | |
| color: var(--text-secondary) !important; | |
| font-size: 0.875rem !important; | |
| margin-top: 0.5rem !important; | |
| } | |
| /* Sentiment results */ | |
| .sentiment-result { | |
| text-align: center; | |
| padding: 2rem; | |
| border-radius: 20px; | |
| margin: 1rem 0; | |
| background: var(--bg-card); | |
| border: 2px solid var(--border-color); | |
| box-shadow: var(--shadow-lg); | |
| transition: all 0.3s ease; | |
| } | |
| .sentiment-result[data-sentiment="positive"] { | |
| border-color: var(--success-color); | |
| background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05)); | |
| } | |
| .sentiment-result[data-sentiment="negative"] { | |
| border-color: var(--error-color); | |
| background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05)); | |
| } | |
| .sentiment-result[data-sentiment="neutral"] { | |
| border-color: var(--info-color); | |
| background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05)); | |
| } | |
| .sentiment-result.error { | |
| border-color: var(--error-color); | |
| background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05)); | |
| color: var(--error-color); | |
| } | |
| .sentiment-result.warning { | |
| border-color: var(--warning-color); | |
| background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05)); | |
| color: var(--warning-color); | |
| } | |
| .result-title { | |
| margin: 0 0 1rem; | |
| color: #ffffff; | |
| font-size: 1.75rem; | |
| font-weight: 700; | |
| } | |
| .sentiment-label { | |
| font-size: 2rem; | |
| font-weight: 800; | |
| margin: 1rem 0; | |
| color: #ffffff; | |
| letter-spacing: 0.05em; | |
| } | |
| .model-info, .confidence-info { | |
| color: #ffffff; | |
| font-size: 1rem; | |
| margin: 0.5rem 0; | |
| font-weight: 500; | |
| } | |
| .confidence-info { | |
| font-size: 0.875rem; | |
| } | |
| /* Statistics */ | |
| .stats-container { | |
| background: var(--bg-card); | |
| padding: 2rem; | |
| border-radius: 20px; | |
| color: var(--text-primary); | |
| text-align: center; | |
| box-shadow: var(--shadow-lg); | |
| border: 1px solid var(--border-color); | |
| } | |
| .stats-title { | |
| color: var(--text-primary); | |
| margin-bottom: 1.5rem; | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| } | |
| .stats-total { | |
| font-weight: 600; | |
| margin: 1rem 0; | |
| color: var(--text-primary); | |
| font-size: 1.125rem; | |
| } | |
| .stats-section { | |
| margin: 1.5rem 0; | |
| text-align: left; | |
| } | |
| .stats-section p { | |
| font-weight: 600; | |
| color: var(--text-secondary); | |
| margin-bottom: 0.75rem; | |
| } | |
| strong { | |
| font-weight: bold; | |
| color: var(--text-primary); | |
| } | |
| .stats-list { | |
| list-style: none; | |
| padding: 0; | |
| margin: 0; | |
| } | |
| .stats-item { | |
| padding: 0.5rem 0; | |
| color: var(--text-secondary); | |
| font-weight: 500; | |
| border-bottom: 1px solid var(--border-color); | |
| } | |
| .stats-item:last-child { | |
| border-bottom: none; | |
| } | |
| .stats-item.stats-positive { | |
| color: var(--success-color); | |
| } | |
| .stats-item.stats-negative { | |
| color: var(--error-color); | |
| } | |
| .stats-item.stats-neutral { | |
| color: var(--info-color); | |
| } | |
| .no-stats, .error-stats { | |
| text-align: center; | |
| padding: 2rem; | |
| color: var(--text-muted); | |
| background: var(--bg-card); | |
| border-radius: 16px; | |
| border: 1px solid var(--border-color); | |
| } | |
| /* Buttons */ | |
| .submit-btn { | |
| background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark)) !important; | |
| border: none !important; | |
| border-radius: 16px !important; | |
| padding: 1rem 2rem !important; | |
| color: var(--text-inverse) !important; | |
| font-weight: 600 !important; | |
| font-size: 1rem !important; | |
| cursor: pointer !important; | |
| transition: all 0.3s ease !important; | |
| box-shadow: var(--shadow-md) !important; | |
| } | |
| .submit-btn:hover { | |
| color: var(--text-inverse) !important; | |
| transform: translateY(-2px) !important; | |
| box-shadow: var(--shadow-lg) !important; | |
| background: linear-gradient(135deg, var(--primary-blue-light), var(--primary-blue)) !important; | |
| } | |
| /* Footer */ | |
| .footer { | |
| text-align: center; | |
| background: var(--bg-card); | |
| color: var(--text-inverse); | |
| padding: 2rem; | |
| border-radius: 20px; | |
| margin: 2rem; | |
| backdrop-filter: blur(10px); | |
| } | |
| .footer h3 { | |
| margin: 0 0 1rem; | |
| font-weight: 700; | |
| } | |
| .social-links { | |
| margin: 1rem 0; | |
| } | |
| .social-links a { | |
| color: var(--secondary-blue); | |
| text-decoration: none; | |
| margin: 0 1rem; | |
| font-weight: 600; | |
| transition: color 0.3s ease; | |
| } | |
| .social-links a:hover { | |
| color: var(--accent-blue); | |
| text-decoration: underline; | |
| } | |
| /* Theme toggle button */ | |
| .theme-toggle { | |
| margin-top: 1rem !important; | |
| background: var(--bg-card) !important; | |
| color: var(--text-primary) !important; | |
| padding: 0.5rem 1rem !important; | |
| border-radius: 8px !important; | |
| border: 1px solid var(--border-color) !important; | |
| cursor: pointer !important; | |
| transition: all 0.3s ease !important; | |
| } | |
| .theme-toggle:hover { | |
| background: var(--bg-hover) !important; | |
| border-color: var(--border-hover) !important; | |
| } | |
| /* Responsive design */ | |
| @media (max-width: 768px) { | |
| .header { | |
| margin: 1rem !important; | |
| padding: 2rem 1rem !important; | |
| } | |
| .header h1 { | |
| font-size: 2rem !important; | |
| } | |
| .header p { | |
| font-size: 1rem !important; | |
| } | |
| .input-container { | |
| margin: 0.5rem !important; | |
| padding: 1.5rem !important; | |
| } | |
| .sentiment-result { | |
| padding: 1.5rem !important; | |
| } | |
| .stats-container { | |
| padding: 1.5rem !important; | |
| } | |
| .footer { | |
| margin: 1rem !important; | |
| padding: 1.5rem !important; | |
| } | |
| /* Mobile radio buttons */ | |
| .gr-radio label { | |
| padding: 0.5rem 1rem !important; | |
| font-size: 0.9rem !important; | |
| } | |
| } | |
| /* Smooth transitions for theme switching */ | |
| * { | |
| transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease !important; | |
| } | |
| /* Fix for Gradio's default styles that might interfere */ | |
| .gradio-container * { | |
| box-sizing: border-box; | |
| } | |
| /* Additional fixes for Gradio components */ | |
| .gr-form { | |
| background: transparent !important; | |
| } | |
| .gr-panel { | |
| background: var(--bg-card) !important; | |
| border: 1px solid var(--border-color) !important; | |
| } | |
| /* Examples section - Main container */ | |
| .gr-examples, .examples-section { | |
| background: var(--bg-card) !important; | |
| border: 1px solid var(--border-color) !important; | |
| border-radius: 12px !important; | |
| padding: 1.5rem !important; | |
| margin-top: 1rem !important; | |
| box-shadow: var(--shadow-md) !important; | |
| } | |
| /* Examples label */ | |
| .gr-examples .gr-form > label, .examples-section .gr-form > label { | |
| color: var(--text-primary) !important; | |
| font-weight: 600 !important; | |
| font-size: 1rem !important; | |
| margin-bottom: 1rem !important; | |
| display: block !important; | |
| } | |
| /* Examples list container */ | |
| .gr-examples .gr-examples-list, .examples-section .gr-examples-list { | |
| background: transparent !important; | |
| border: none !important; | |
| padding: 0 !important; | |
| } | |
| /* Individual example buttons */ | |
| .gr-examples .gr-examples-list button, .examples-section .gr-examples-list button { | |
| background: var(--radio-bg) !important; | |
| border: 2px solid var(--radio-border) !important; | |
| color: var(--radio-text) !important; | |
| border-radius: 8px !important; | |
| padding: 0.75rem 1rem !important; | |
| margin: 0.25rem !important; | |
| transition: all 0.3s ease !important; | |
| font-weight: 500 !important; | |
| text-align: left !important; | |
| cursor: pointer !important; | |
| min-height: auto !important; | |
| white-space: normal !important; | |
| word-wrap: break-word !important; | |
| } | |
| /* Example button hover effect */ | |
| .gr-examples .gr-examples-list button:hover, .examples-section .gr-examples-list button:hover { | |
| background: var(--radio-hover) !important; | |
| border-color: var(--radio-selected) !important; | |
| transform: translateY(-1px) !important; | |
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important; | |
| color: var(--radio-text) !important; | |
| } | |
| /* Example button active/clicked state */ | |
| .gr-examples .gr-examples-list button:active, .examples-section .gr-examples-list button:active { | |
| transform: translateY(0) !important; | |
| background: var(--radio-selected-bg) !important; | |
| border-color: var(--radio-selected) !important; | |
| color: var(--radio-selected) !important; | |
| } | |
| /* Dark mode specific adjustments for examples */ | |
| .dark-mode .gr-examples .gr-examples-list button:hover, .dark-mode .examples-section .gr-examples-list button:hover { | |
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important; | |
| } | |
| @media (prefers-color-scheme: dark) { | |
| .gr-examples .gr-examples-list button:hover, .examples-section .gr-examples-list button:hover { | |
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important; | |
| } | |
| } | |
| /* Responsive design for examples */ | |
| @media (max-width: 768px) { | |
| .gr-examples, .examples-section { | |
| padding: 1rem !important; | |
| margin-top: 0.5rem !important; | |
| } | |
| .gr-examples .gr-examples-list button, .examples-section .gr-examples-list button { | |
| padding: 0.5rem 0.75rem !important; | |
| font-size: 0.9rem !important; | |
| margin: 0.2rem !important; | |
| } | |
| } | |
| """ |