Spaces:
Running
Running
File size: 16,501 Bytes
4af2457 134ff3d 4af2457 2156541 134ff3d 2156541 134ff3d 4af2457 2156541 134ff3d 4af2457 2156541 134ff3d 2156541 134ff3d 2156541 4af2457 2156541 134ff3d 4af2457 2156541 4af2457 2156541 4af2457 2156541 134ff3d 2156541 134ff3d 4af2457 2156541 134ff3d 4af2457 2156541 134ff3d 2156541 134ff3d 4af2457 134ff3d 4af2457 2156541 134ff3d 4af2457 2156541 134ff3d 2156541 134ff3d 2156541 5059b8f 2156541 4af2457 5059b8f 4af2457 2156541 134ff3d 4af2457 2156541 4af2457 5059b8f 134ff3d 2156541 4af2457 134ff3d 2156541 4af2457 134ff3d 4af2457 2156541 5059b8f 2156541 4af2457 2156541 134ff3d 2156541 4af2457 2156541 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | import streamlit as st
import base64
import os
def apply_custom_css():
"""Apply shared CSS styles to the current page."""
logo_b64 = ""
if os.path.exists("assets/logo.png"):
try:
with open("assets/logo.png", "rb") as f:
logo_b64 = base64.b64encode(f.read()).decode()
except:
pass
st.markdown("""
<style>
/* -------------------------------------------------------------------------- */
/* CORE ANIMATIONS */
/* -------------------------------------------------------------------------- */
@keyframes gradient-xy {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
/* -------------------------------------------------------------------------- */
/* GLOBAL THEME ENGINE */
/* -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');
:root {
--primary-glow: 56, 189, 248; /* Sky Blue */
--secondary-glow: 139, 92, 246; /* Violet */
--bg-deep: #050608;
--glass-border: rgba(255, 255, 255, 0.08);
--glass-bg: rgba(15, 23, 42, 0.6);
}
.stApp {
background: radial-gradient(circle at 10% 20%, rgba(13, 17, 28, 1) 0%, rgba(5, 6, 8, 1) 90%);
font-family: 'Outfit', sans-serif;
}
/* BACKGROUND WATERMARK */
.stApp::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 70vh; /* Slightly smaller to fit nicely */
height: 70vh;
background-image: url("data:image/png;base64,LOGO_BASE64_PLACEHOLDER");
background-position: center;
background-repeat: no-repeat;
background-size: contain;
opacity: 0.08; /* Subtle but visible color */
pointer-events: none;
z-index: 0;
border-radius: 50%; /* Force Circular Shape */
}
/* Sidebar Logo - Standard Shape */
[data-testid="stSidebar"] img {
border-radius: 12px; /* Slight rounded corners for better aesthetics, but not circular */
box-shadow: 0 0 20px rgba(56, 189, 248, 0.3); /* Neon Glow */
border: 1px solid rgba(56, 189, 248, 0.5);
}
/* Global Text Override */
p, div, span, label, h1, h2, h3, h4, h5, h6, .stMarkdown {
color: #E2E8F0 !important;
text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
/* -------------------------------------------------------------------------- */
/* SIDEBAR */
/* -------------------------------------------------------------------------- */
section[data-testid="stSidebar"] {
background: rgba(11, 12, 16, 0.85);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-right: 1px solid var(--glass-border);
box-shadow: 5px 0 30px rgba(0,0,0,0.5);
}
section[data-testid="stSidebar"] h1 {
background: linear-gradient(to right, #38BDF8, #8B5CF6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 800;
font-size: 2rem !important;
padding-bottom: 0.5rem;
}
/* -------------------------------------------------------------------------- */
/* INPUTS & FORMS */
/* -------------------------------------------------------------------------- */
.stTextInput input, .stSelectbox div[data-baseweb="select"], .stTextArea textarea {
background-color: rgba(30, 41, 59, 0.5) !important;
border: 1px solid var(--glass-border) !important;
color: #F8FAFC !important;
border-radius: 12px !important;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
backdrop-filter: blur(10px);
}
.stTextInput input:focus, .stTextArea textarea:focus, .stSelectbox div[data-baseweb="select"]:focus-within {
border-color: #38BDF8 !important;
box-shadow: 0 0 15px rgba(var(--primary-glow), 0.3);
transform: translateY(-1px);
}
/* -------------------------------------------------------------------------- */
/* MEDIA UPLOADS */
/* -------------------------------------------------------------------------- */
[data-testid="stFileUploader"] {
background-color: rgba(30, 41, 59, 0.4);
border: 1px dashed var(--glass-border);
border-radius: 12px;
padding: 20px;
}
/* FORCE TEXT COLOR FOR FILE UPLOADER */
[data-testid="stFileUploader"] section > div,
[data-testid="stFileUploader"] section > div > span,
[data-testid="stFileUploader"] section > div > small,
[data-testid="stFileUploader"] div[data-testid="stMarkdownContainer"] p {
color: #E2E8F0 !important; /* Bright Slate */
opacity: 1 !important;
-webkit-text-fill-color: #E2E8F0 !important;
}
[data-testid="stFileUploader"] button {
background: rgba(56, 189, 248, 0.2);
color: #38BDF8 !important;
border: 1px solid #38BDF8;
}
/* -------------------------------------------------------------------------- */
/* DROPDOWN & SELECT */
/* -------------------------------------------------------------------------- */
/* 1. The Box Itself */
.stSelectbox div[data-baseweb="select"] {
background-color: #1E293B !important; /* Solid Slate-800 for contrast */
border: 1px solid #475569 !important;
color: white !important;
}
/* 2. The Text INSIDE the Box (Critical Fix) */
.stSelectbox div[data-baseweb="select"] div[data-testid="stMarkdownContainer"] > p {
color: #F8FAFC !important; /* White */
font-weight: 500 !important;
}
/* 3. The Dropdown Menu (Popup) */
div[data-baseweb="popover"], div[data-baseweb="menu"], ul[data-baseweb="menu"] {
background-color: #0F172A !important;
border: 1px solid #334155 !important;
}
/* 4. Options in the Menu */
li[data-baseweb="option"], div[data-baseweb="option"] {
color: #CBD5E1 !important; /* Light Slate */
}
/* 5. Start/Icons in Menu */
li[data-baseweb="option"] *, div[data-baseweb="option"] * {
color: #CBD5E1 !important;
}
/* 6. Selected/Hovered Option */
li[data-baseweb="option"][aria-selected="true"],
li[data-baseweb="option"]:hover,
div[data-baseweb="option"]:hover {
background-color: #38BDF8 !important;
color: white !important;
}
/* 7. SVG Arrow Icon */
.stSelectbox svg {
fill: #94A3B8 !important;
}
/* -------------------------------------------------------------------------- */
/* BUTTONS */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* BUTTONS */
/* -------------------------------------------------------------------------- */
/* Primary Actions (Gradient) */
.stButton button[kind="primary"] {
background: linear-gradient(135deg, #0EA5E9 0%, #2563EB 100%);
color: white !important;
border: none;
border-radius: 8px;
padding: 0.6rem 1.2rem;
font-weight: 600;
letter-spacing: 0.5px;
transition: all 0.3s ease;
box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
text-transform: uppercase;
font-size: 0.85rem;
}
/* Secondary Actions (File Explorer Items) */
.stButton button[kind="secondary"] {
background: transparent !important;
border: 1px solid transparent !important;
color: #94A3B8 !important; /* Slate 400 */
text-align: left !important;
display: flex !important;
justify-content: flex-start !important;
padding: 8px 12px !important; /* Bigger padding */
font-size: 15px !important; /* Bigger Font */
font-family: 'JetBrains Mono', monospace !important; /* Monospace for files */
transition: all 0.2s ease;
box-shadow: none !important;
}
.stButton button[kind="secondary"]:hover {
background: rgba(56, 189, 248, 0.1) !important;
color: #38BDF8 !important;
transform: translateX(4px); /* Slide effect */
}
/* Generic overrides if kind is not caught */
.stButton button:hover {
/* Handled by specific kinds above */
}
.stButton button:active {
transform: translateY(0);
}
/* -------------------------------------------------------------------------- */
/* CHAT BUBBLES */
/* -------------------------------------------------------------------------- */
.stChatMessage {
background: var(--glass-bg);
border: 1px solid var(--glass-border);
border-radius: 16px;
backdrop-filter: blur(10px);
margin-bottom: 1rem;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
animation: fadeInUp 0.4s ease-out forwards;
}
.stChatMessage[data-testid="stChatMessage"]:nth-child(even) {
border-left: 3px solid #38BDF8;
background: linear-gradient(90deg, rgba(56, 189, 248, 0.05) 0%, rgba(15, 23, 42, 0.6) 100%);
}
/* -------------------------------------------------------------------------- */
/* CODE & CHIPS */
/* -------------------------------------------------------------------------- */
code {
font-family: 'JetBrains Mono', monospace !important;
background: #0B0E14 !important;
border: 1px solid #1E293B;
border-radius: 6px;
color: #7DD3FC !important;
}
/* Source Chips with Glow */
.source-container {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(255,255,255,0.05);
}
.source-chip {
background: rgba(30, 41, 59, 0.6);
border: 1px solid rgba(56, 189, 248, 0.2);
border-radius: 20px;
padding: 6px 14px;
font-size: 0.8rem;
color: #94A3B8;
display: flex;
align-items: center;
transition: all 0.3s ease;
cursor: pointer;
backdrop-filter: blur(5px);
}
.source-chip:hover {
background: rgba(56, 189, 248, 0.15);
border-color: #38BDF8;
color: #38BDF8;
box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
transform: translateY(-1px);
}
.source-icon {
margin-right: 8px;
opacity: 0.7;
}
/* Hiding Streamlit Branding */
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
/* -------------------------------------------------------------------------- */
/* IDE-STYLE PANEL LAYOUT */
/* -------------------------------------------------------------------------- */
/* Main content area - fixed height */
.main .block-container {
max-height: calc(100vh - 80px);
overflow: hidden;
padding-top: 1rem;
}
/* Make columns scrollable independently */
/* Make columns scrollable independently */
[data-testid="column"] {
max-height: calc(100vh - 120px);
overflow-y: auto;
overflow-x: auto; /* Changed from hidden to auto to prevent cutoff */
scrollbar-width: thin;
scrollbar-color: #475569 transparent;
}
/* Custom scrollbar for webkit browsers */
[data-testid="column"]::-webkit-scrollbar {
width: 6px;
height: 6px; /* Added height for horizontal scrollbar */
}
[data-testid="column"]::-webkit-scrollbar-track {
background: transparent;
}
[data-testid="column"]::-webkit-scrollbar-thumb {
background: #475569;
border-radius: 3px;
}
[data-testid="column"]::-webkit-scrollbar-thumb:hover {
background: #64748b;
}
/* Code viewer specific - scrollable code block */
.stCode {
max-height: 60vh;
overflow-y: auto !important;
overflow-x: auto !important; /* Ensure horizontal scroll works */
}
/* -------------------------------------------------------------------------- */
/* HORIZONTAL TABS */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* HORIZONTAL TABS */
/* -------------------------------------------------------------------------- */
/* Tab List Container */
.stTabs [data-baseweb="tab-list"] {
gap: 8px;
background-color: transparent;
padding-bottom: 4px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* Individual Tab (Inactive) */
.stTabs [data-baseweb="tab"] {
height: 40px;
white-space: pre-wrap;
border-radius: 6px;
gap: 6px;
padding: 0px 16px;
color: #94A3B8 !important; /* Slate 400 */
font-weight: 500;
background: transparent;
border: 1px solid transparent;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Tab Hover State */
.stTabs [data-baseweb="tab"]:hover {
background: rgba(255, 255, 255, 0.05);
color: #E2E8F0 !important;
}
/* Active Tab (Selected) */
.stTabs [data-baseweb="tab"][aria-selected="true"] {
background: rgba(56, 189, 248, 0.15) !important;
color: #38BDF8 !important; /* Sky Blue */
border: 1px solid rgba(56, 189, 248, 0.3);
font-weight: 600;
box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}
/* Tab Icons styling fix */
.stTabs [data-baseweb="tab"] p {
font-size: 0.95rem;
}
</style>
""".replace("LOGO_BASE64_PLACEHOLDER", logo_b64), unsafe_allow_html=True)
|