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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
This module contains the custom styling for the Daease app.
|
3 |
+
"""
|
4 |
+
|
5 |
+
def get_custom_css():
|
6 |
+
"""
|
7 |
+
Returns the custom CSS for styling the application with a pitch black theme and modern UI.
|
8 |
+
"""
|
9 |
+
return """
|
10 |
+
<style>
|
11 |
+
/* Import modern fonts */
|
12 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
13 |
+
|
14 |
+
/* Pitch black theme with improved UI */
|
15 |
+
body {
|
16 |
+
background-color: #000000 !important;
|
17 |
+
color: #f8f9fa !important;
|
18 |
+
font-family: 'Inter', sans-serif !important;
|
19 |
+
letter-spacing: -0.01em;
|
20 |
+
line-height: 1.6;
|
21 |
+
margin: 0;
|
22 |
+
padding: 0;
|
23 |
+
}
|
24 |
+
|
25 |
+
/* Main container styling with subtle gradient */
|
26 |
+
.main {
|
27 |
+
background: linear-gradient(135deg, rgba(20, 20, 20, 1), rgba(0, 0, 0, 1));
|
28 |
+
padding: 1.5rem !important;
|
29 |
+
max-width: 100%;
|
30 |
+
border-radius: 20px;
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Header & top content area */
|
34 |
+
.css-1v3fvcr, .css-1vq4p4l, .css-18e3th9, .css-1d391kg {
|
35 |
+
background-color: #000000 !important;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Sidebar styling with accent color */
|
39 |
+
section[data-testid="stSidebar"] {
|
40 |
+
background-color: #0a0a0a !important;
|
41 |
+
border-right: 1px solid rgba(122, 95, 255, 0.2);
|
42 |
+
}
|
43 |
+
|
44 |
+
/* App header - fix being cut off */
|
45 |
+
h1 {
|
46 |
+
font-family: 'Inter', sans-serif !important;
|
47 |
+
font-weight: 600 !important;
|
48 |
+
font-size: 1.8rem !important;
|
49 |
+
color: #ff6600 !important;
|
50 |
+
letter-spacing: -0.03em;
|
51 |
+
margin-bottom: 1rem !important;
|
52 |
+
margin-top: 1rem !important;
|
53 |
+
padding-top: 1.5rem !important;
|
54 |
+
-webkit-background-clip: initial !important;
|
55 |
+
-webkit-text-fill-color: initial !important;
|
56 |
+
overflow: visible !important;
|
57 |
+
}
|
58 |
+
|
59 |
+
/* Ensure header container has enough space */
|
60 |
+
.block-container > div:first-child {
|
61 |
+
padding-top: 1.5rem !important;
|
62 |
+
margin-top: 0.5rem !important;
|
63 |
+
overflow: visible !important;
|
64 |
+
}
|
65 |
+
|
66 |
+
/* Adjust block spacing */
|
67 |
+
.block-container {
|
68 |
+
padding-top: 1rem !important; /* Increased from 0.5rem */
|
69 |
+
max-width: 95% !important;
|
70 |
+
}
|
71 |
+
|
72 |
+
h2, h3, h4, h5, h6 {
|
73 |
+
font-family: 'Inter', sans-serif !important;
|
74 |
+
font-weight: 600 !important;
|
75 |
+
color: #f8f9fa !important;
|
76 |
+
letter-spacing: -0.02em;
|
77 |
+
}
|
78 |
+
|
79 |
+
p, li, div {
|
80 |
+
font-family: 'Inter', sans-serif !important;
|
81 |
+
color: #e0e0e0 !important;
|
82 |
+
font-size: 0.9rem !important;
|
83 |
+
}
|
84 |
+
|
85 |
+
/* Chat container with improved shadows */
|
86 |
+
.stChatFloatingInputContainer {
|
87 |
+
border-radius: 20px !important;
|
88 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
|
89 |
+
padding: 10px !important;
|
90 |
+
background-color: #0a0a0a !important;
|
91 |
+
border: 1px solid rgba(122, 95, 255, 0.15) !important;
|
92 |
+
}
|
93 |
+
|
94 |
+
/* Chat input with improved UI */
|
95 |
+
.stChatInputContainer {
|
96 |
+
padding: 0.5rem !important;
|
97 |
+
}
|
98 |
+
|
99 |
+
.stChatInputContainer textarea {
|
100 |
+
border-radius: 14px !important;
|
101 |
+
padding: 8px 12px !important;
|
102 |
+
background-color: #111111 !important;
|
103 |
+
border: 1px solid rgba(122, 95, 255, 0.2) !important;
|
104 |
+
color: #f0f0f0 !important;
|
105 |
+
font-family: 'Inter', sans-serif !important;
|
106 |
+
font-size: 0.9rem !important;
|
107 |
+
transition: all 0.2s ease !important;
|
108 |
+
}
|
109 |
+
|
110 |
+
.stChatInputContainer textarea:focus {
|
111 |
+
border: 1px solid rgba(122, 95, 255, 0.6) !important;
|
112 |
+
box-shadow: 0 0 0 2px rgba(122, 95, 255, 0.2) !important;
|
113 |
+
}
|
114 |
+
|
115 |
+
/* Chat messages with enhanced styling */
|
116 |
+
.chat-message {
|
117 |
+
padding: 0.8rem !important;
|
118 |
+
border-radius: 16px !important;
|
119 |
+
margin-bottom: 0.8rem !important;
|
120 |
+
display: flex !important;
|
121 |
+
flex-direction: column !important;
|
122 |
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
|
123 |
+
transition: all 0.3s ease-in-out !important;
|
124 |
+
}
|
125 |
+
|
126 |
+
/* Custom chat layout styles - forcing right/left alignment */
|
127 |
+
.stChatMessage {
|
128 |
+
max-width: 85% !important;
|
129 |
+
margin-bottom: 0.7rem !important;
|
130 |
+
border-radius: 16px !important;
|
131 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
|
132 |
+
}
|
133 |
+
|
134 |
+
/* Main chat container */
|
135 |
+
[data-testid="stChatContainer"] {
|
136 |
+
padding: 0 1rem !important;
|
137 |
+
row-gap: 0.5rem !important;
|
138 |
+
}
|
139 |
+
|
140 |
+
/* Force right alignment for user messages */
|
141 |
+
[data-testid="stChatContainer"] > div > [data-testid="stChatMessage"]:has([data-testid="userChatMessage"]) {
|
142 |
+
display: flex !important;
|
143 |
+
justify-content: flex-end !important;
|
144 |
+
width: 100% !important;
|
145 |
+
}
|
146 |
+
|
147 |
+
/* Force left alignment for assistant messages */
|
148 |
+
[data-testid="stChatContainer"] > div > [data-testid="stChatMessage"]:has([data-testid="assistantChatMessage"]) {
|
149 |
+
display: flex !important;
|
150 |
+
justify-content: flex-start !important;
|
151 |
+
width: 100% !important;
|
152 |
+
}
|
153 |
+
|
154 |
+
/* User message styling */
|
155 |
+
[data-testid="userChatMessage"] {
|
156 |
+
background-color: #191921 !important;
|
157 |
+
border-right: 3px solid #7A5FFF !important;
|
158 |
+
border-left: none !important;
|
159 |
+
border-top-right-radius: 4px !important;
|
160 |
+
margin-left: auto !important;
|
161 |
+
}
|
162 |
+
|
163 |
+
/* Assistant message styling */
|
164 |
+
[data-testid="assistantChatMessage"] {
|
165 |
+
background-color: #131419 !important;
|
166 |
+
border-left: 3px solid #00D1B2 !important;
|
167 |
+
border-top-left-radius: 4px !important;
|
168 |
+
margin-right: auto !important;
|
169 |
+
}
|
170 |
+
|
171 |
+
/* Buttons and toggles with gradient */
|
172 |
+
.stButton > button,
|
173 |
+
.stDownloadButton > button {
|
174 |
+
border-radius: 12px !important;
|
175 |
+
padding: 0.5rem 1.2rem !important;
|
176 |
+
background: linear-gradient(135deg, #7A5FFF, #00D1B2) !important;
|
177 |
+
color: white !important;
|
178 |
+
border: none !important;
|
179 |
+
font-weight: 500 !important;
|
180 |
+
font-family: 'Inter', sans-serif !important;
|
181 |
+
transition: all 0.3s ease !important;
|
182 |
+
transform: translateY(0) !important;
|
183 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
|
184 |
+
}
|
185 |
+
|
186 |
+
.stButton > button:hover,
|
187 |
+
.stDownloadButton > button:hover {
|
188 |
+
transform: translateY(-2px) !important;
|
189 |
+
box-shadow: 0 8px 16px rgba(122, 95, 255, 0.4) !important;
|
190 |
+
}
|
191 |
+
|
192 |
+
/* Toggle switch */
|
193 |
+
.stToggle {
|
194 |
+
color: #f8f9fa !important;
|
195 |
+
}
|
196 |
+
|
197 |
+
[data-baseweb="checkbox"] {
|
198 |
+
margin-right: 6px !important;
|
199 |
+
}
|
200 |
+
|
201 |
+
/* Sidebar headers and labels */
|
202 |
+
.sidebar .sidebar-content {
|
203 |
+
background-color: #0a0a0a !important;
|
204 |
+
}
|
205 |
+
|
206 |
+
[data-testid="stSidebar"] [data-testid="stMarkdownContainer"] h1,
|
207 |
+
[data-testid="stSidebar"] [data-testid="stMarkdownContainer"] h2 {
|
208 |
+
color: #f8f9fa !important;
|
209 |
+
font-size: 1.1rem !important;
|
210 |
+
font-weight: 600 !important;
|
211 |
+
margin-top: 0.5rem !important;
|
212 |
+
margin-bottom: 0.5rem !important;
|
213 |
+
}
|
214 |
+
|
215 |
+
/* Expander/Dropdown with improved styling */
|
216 |
+
.streamlit-expanderHeader {
|
217 |
+
border-radius: 12px !important;
|
218 |
+
background-color: #111111 !important;
|
219 |
+
border: 1px solid rgba(0, 209, 178, 0.2) !important;
|
220 |
+
color: #f0f0f0 !important;
|
221 |
+
font-weight: 500 !important;
|
222 |
+
padding: 1rem !important;
|
223 |
+
font-family: 'Inter', sans-serif !important;
|
224 |
+
}
|
225 |
+
|
226 |
+
.streamlit-expanderContent {
|
227 |
+
background-color: #0a0a0a !important;
|
228 |
+
border-radius: 0 0 12px 12px !important;
|
229 |
+
padding: 1.2rem !important;
|
230 |
+
border: 1px solid rgba(0, 209, 178, 0.2) !important;
|
231 |
+
border-top: none !important;
|
232 |
+
}
|
233 |
+
|
234 |
+
/* Citations and sources with improved styling */
|
235 |
+
a {
|
236 |
+
color: #00D1B2 !important;
|
237 |
+
text-decoration: none !important;
|
238 |
+
transition: all 0.2s ease !important;
|
239 |
+
}
|
240 |
+
|
241 |
+
a:hover {
|
242 |
+
text-decoration: underline !important;
|
243 |
+
color: #7A5FFF !important;
|
244 |
+
}
|
245 |
+
|
246 |
+
/* Italicize uncertainties with improved styling */
|
247 |
+
.uncertainty {
|
248 |
+
font-style: italic !important;
|
249 |
+
color: rgba(255, 107, 107, 0.9) !important;
|
250 |
+
}
|
251 |
+
|
252 |
+
/* Legal disclaimer with improved styling */
|
253 |
+
.footer-text {
|
254 |
+
font-size: 0.7rem !important;
|
255 |
+
color: rgba(240, 240, 240, 0.5) !important;
|
256 |
+
text-align: center !important;
|
257 |
+
padding: 12px !important;
|
258 |
+
position: fixed !important;
|
259 |
+
bottom: 0 !important;
|
260 |
+
width: 100% !important;
|
261 |
+
z-index: 99 !important;
|
262 |
+
background-color: rgba(0, 0, 0, 0.7) !important;
|
263 |
+
backdrop-filter: blur(5px) !important;
|
264 |
+
}
|
265 |
+
|
266 |
+
/* Hide empty elements and default header */
|
267 |
+
.element-container:has(h1:empty) {
|
268 |
+
display: none !important;
|
269 |
+
}
|
270 |
+
|
271 |
+
/* Custom scrollbar */
|
272 |
+
::-webkit-scrollbar {
|
273 |
+
width: 8px;
|
274 |
+
height: 8px;
|
275 |
+
}
|
276 |
+
|
277 |
+
::-webkit-scrollbar-track {
|
278 |
+
background: #0a0a0a;
|
279 |
+
}
|
280 |
+
|
281 |
+
::-webkit-scrollbar-thumb {
|
282 |
+
background: #333;
|
283 |
+
border-radius: 10px;
|
284 |
+
}
|
285 |
+
|
286 |
+
::-webkit-scrollbar-thumb:hover {
|
287 |
+
background: #444;
|
288 |
+
}
|
289 |
+
|
290 |
+
/* Typing indicator animation */
|
291 |
+
.typing-indicator {
|
292 |
+
display: flex;
|
293 |
+
align-items: center;
|
294 |
+
margin: 10px 0;
|
295 |
+
}
|
296 |
+
|
297 |
+
.typing-indicator span {
|
298 |
+
height: 8px;
|
299 |
+
width: 8px;
|
300 |
+
margin: 0 2px;
|
301 |
+
background-color: #00D1B2;
|
302 |
+
border-radius: 50%;
|
303 |
+
display: inline-block;
|
304 |
+
opacity: 0.6;
|
305 |
+
}
|
306 |
+
|
307 |
+
.typing-indicator span:nth-child(1) {
|
308 |
+
animation: pulse 1s infinite ease-in-out;
|
309 |
+
}
|
310 |
+
|
311 |
+
.typing-indicator span:nth-child(2) {
|
312 |
+
animation: pulse 1s infinite ease-in-out .2s;
|
313 |
+
}
|
314 |
+
|
315 |
+
.typing-indicator span:nth-child(3) {
|
316 |
+
animation: pulse 1s infinite ease-in-out .4s;
|
317 |
+
}
|
318 |
+
|
319 |
+
@keyframes pulse {
|
320 |
+
0% {
|
321 |
+
transform: scale(1);
|
322 |
+
opacity: 0.6;
|
323 |
+
}
|
324 |
+
50% {
|
325 |
+
transform: scale(1.3);
|
326 |
+
opacity: 1;
|
327 |
+
}
|
328 |
+
100% {
|
329 |
+
transform: scale(1);
|
330 |
+
opacity: 0.6;
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
/* Make components more compact instead of scaling */
|
335 |
+
.stApp {
|
336 |
+
max-width: 100% !important;
|
337 |
+
}
|
338 |
+
</style>
|
339 |
+
"""
|
340 |
+
|
341 |
+
def apply_styling():
|
342 |
+
"""
|
343 |
+
Apply the custom CSS styling to the Streamlit app.
|
344 |
+
"""
|
345 |
+
import streamlit as st
|
346 |
+
st.markdown(get_custom_css(), unsafe_allow_html=True)
|