docmind / ui /styles.py
AI Engineer
Initial commit for DocMind
6cca5b1
Raw
History Blame Contribute Delete
13.3 kB
"""
DocMind — Custom CSS Styles
Injected via st.markdown() for premium chat UI styling,
grounding bars, confidence badges, and document color tags.
"""
def get_custom_css() -> str:
"""Return the full custom CSS stylesheet as a string."""
return """
<style>
/* ─── Global ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
/* Streamlit main overrides to remove unnecessary padding */
.block-container {
padding-top: 2rem !important;
padding-bottom: 3rem !important;
}
/* ─── Sidebar branding ───────────────────────────────── */
.sidebar-logo {
text-align: center;
padding: 1rem 0 0.5rem;
}
.sidebar-logo h1 {
font-size: 2.2rem;
font-weight: 700;
background: linear-gradient(135deg, #818CF8, #C084FC);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.1rem;
letter-spacing: -0.02em;
}
.sidebar-tagline {
text-align: center;
font-size: 0.8rem;
color: #94A3B8;
letter-spacing: 0.05em;
margin-top: -0.2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
/* ─── Chat messages ──────────────────────────────────── */
.chat-container {
display: flex;
flex-direction: column;
gap: 1.5rem;
padding: 1rem 0;
}
.chat-msg {
display: flex;
max-width: 85%;
animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
margin-bottom: 1.5rem;
}
.chat-msg.user {
align-self: flex-end;
flex-direction: row-reverse;
}
.chat-msg.bot {
align-self: flex-start;
}
.chat-bubble {
padding: 1.1rem 1.4rem;
border-radius: 1.2rem;
font-size: 0.95rem;
line-height: 1.6;
word-wrap: break-word;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.chat-bubble.user {
background: linear-gradient(135deg, #6366F1, #8B5CF6);
color: white;
border-bottom-right-radius: 0.3rem;
}
.chat-bubble.bot {
background: rgba(30, 41, 59, 0.7);
color: #F8FAFC;
border: 1px solid rgba(255, 255, 255, 0.08);
border-bottom-left-radius: 0.3rem;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.chat-avatar {
width: 38px;
height: 38px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
margin: 0 0.75rem;
flex-shrink: 0;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.chat-avatar.user {
background: linear-gradient(135deg, #6366F1, #8B5CF6);
}
.chat-avatar.bot {
background: linear-gradient(135deg, #10B981, #059669);
}
/* ─── Confidence badges ──────────────────────────────── */
.badge {
display: inline-flex;
align-items: center;
gap: 0.4rem;
padding: 0.35rem 0.85rem;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.03em;
text-transform: uppercase;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.badge-high {
background: rgba(16, 185, 129, 0.15);
color: #34D399;
border: 1px solid rgba(52, 211, 153, 0.3);
}
.badge-moderate {
background: rgba(245, 158, 11, 0.15);
color: #FBBF24;
border: 1px solid rgba(251, 191, 36, 0.3);
}
.badge-low {
background: rgba(239, 68, 68, 0.15);
color: #F87171;
border: 1px solid rgba(248, 113, 113, 0.3);
}
/* ─── Grounding score bar ────────────────────────────── */
.grounding-bar-container {
width: 100%;
margin: 1.2rem 0;
}
.grounding-bar-label {
display: flex;
justify-content: space-between;
font-size: 0.8rem;
font-weight: 500;
color: #94A3B8;
margin-bottom: 0.5rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.grounding-bar-track {
width: 100%;
height: 8px;
background: rgba(15, 23, 42, 0.6);
border-radius: 4px;
overflow: hidden;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}
.grounding-bar-fill {
height: 100%;
border-radius: 4px;
transition: width 1s cubic-bezier(0.16, 1, 0.3, 1), background 0.5s ease;
}
.grounding-bar-fill.high { background: linear-gradient(90deg, #10B981, #34D399); }
.grounding-bar-fill.moderate { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.grounding-bar-fill.low { background: linear-gradient(90deg, #EF4444, #F87171); }
/* ─── Source cards ────────────────────────────────────── */
.source-card {
background: rgba(30, 41, 59, 0.5);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 0.75rem;
padding: 1rem;
margin: 0.5rem 0;
font-size: 0.85rem;
line-height: 1.6;
color: #CBD5E1;
backdrop-filter: blur(8px);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.source-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
border-color: rgba(99, 102, 241, 0.3);
}
.source-card-header {
display: flex;
align-items: center;
gap: 0.6rem;
margin-bottom: 0.6rem;
font-weight: 600;
font-size: 0.8rem;
}
.source-tag {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 6px;
font-size: 0.75rem;
font-weight: 700;
color: white;
letter-spacing: 0.02em;
}
/* Document color tags */
.doc-tag-0 { background: #3B82F6; box-shadow: 0 0 8px rgba(59,130,246,0.4); }
.doc-tag-1 { background: #10B981; box-shadow: 0 0 8px rgba(16,185,129,0.4); }
.doc-tag-2 { background: #F59E0B; box-shadow: 0 0 8px rgba(245,158,11,0.4); }
/* ─── Inline Citations ───────────────────────────────── */
.citation-badge {
display: inline-flex;
align-items: center;
justify-content: center;
background: rgba(99, 102, 241, 0.15);
color: #A78BFA;
border: 1px solid rgba(99, 102, 241, 0.3);
border-radius: 4px;
padding: 0.1rem 0.4rem;
font-size: 0.75rem;
font-weight: 600;
margin-left: 0.3rem;
vertical-align: baseline;
cursor: help;
transition: all 0.2s ease;
}
.citation-badge:hover {
background: rgba(99, 102, 241, 0.25);
border-color: rgba(99, 102, 241, 0.5);
}
/* ─── Document status cards ──────────────────────────── */
.doc-status {
background: rgba(30, 41, 59, 0.4);
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 0.75rem;
padding: 0.8rem 1rem;
margin: 0.5rem 0;
backdrop-filter: blur(8px);
}
.doc-status-name {
font-weight: 600;
font-size: 0.9rem;
color: #F8FAFC;
display: flex;
align-items: center;
gap: 0.5rem;
}
.doc-status-meta {
font-size: 0.78rem;
color: #94A3B8;
margin-top: 0.3rem;
margin-left: 1.8rem;
}
/* ─── Pipeline progress ──────────────────────────────── */
.pipeline-step {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.4rem 0;
font-size: 0.85rem;
}
.pipeline-step.active { color: #A78BFA; font-weight: 600; }
.pipeline-step.done { color: #34D399; }
.pipeline-step.pending { color: #475569; }
/* ─── Retrieval debug panel ──────────────────────────── */
.debug-panel {
background: rgba(15, 23, 42, 0.7);
border: 1px dashed rgba(99, 102, 241, 0.3);
border-radius: 0.5rem;
padding: 0.8rem 1rem;
font-family: 'JetBrains Mono', 'Fira Code', monospace;
font-size: 0.8rem;
color: #94A3B8;
margin: 1rem 0;
}
/* ─── Empty state ────────────────────────────────────── */
.empty-state {
text-align: center;
padding: 4rem 2rem;
background: rgba(30, 41, 59, 0.2);
border: 1px dashed rgba(255,255,255,0.08);
border-radius: 1.5rem;
margin-top: 2rem;
}
.empty-state-icon {
font-size: 4rem;
margin-bottom: 1rem;
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}
.empty-state-title {
font-size: 1.3rem;
font-weight: 600;
color: #E2E8F0;
margin-bottom: 0.5rem;
}
.empty-state-text {
font-size: 0.95rem;
color: #94A3B8;
line-height: 1.6;
max-width: 450px;
margin: 0 auto;
}
/* ─── Comparison table ───────────────────────────────── */
.comparison-table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
margin-top: 1rem;
}
.comparison-table th {
background: rgba(99, 102, 241, 0.15);
padding: 0.8rem 1rem;
text-align: left;
font-weight: 600;
color: #A78BFA;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.comparison-table td {
padding: 0.8rem 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
color: #CBD5E1;
}
/* ─── Animations ─────────────────────────────────────── */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
/* ─── Responsive tweaks ──────────────────────────────── */
@media (max-width: 768px) {
.chat-msg { max-width: 95%; }
.chat-bubble { font-size: 0.9rem; padding: 0.9rem 1.1rem; }
}
/* ─── Dashboard Metrics ──────────────────────────────── */
.metric-row {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
flex-wrap: wrap;
}
.metric-card {
flex: 1;
min-width: 150px;
background: rgba(30, 41, 59, 0.4);
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 1rem;
padding: 1.2rem;
backdrop-filter: blur(10px);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.metric-title {
font-size: 0.8rem;
color: #94A3B8;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 600;
}
.metric-value {
font-size: 1.8rem;
font-weight: 700;
color: #E2E8F0;
background: linear-gradient(135deg, #F8FAFC, #94A3B8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.metric-subtitle {
font-size: 0.75rem;
color: #34D399; /* Green by default for ready */
}
/* ─── Hero Feature Grid ──────────────────────────────── */
.hero-container {
text-align: center;
padding: 2rem 1rem 1rem;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
margin-top: 3rem;
text-align: left;
}
.feature-card {
background: rgba(30, 41, 59, 0.3);
border: 1px solid rgba(99, 102, 241, 0.15);
border-radius: 1rem;
padding: 1.5rem;
transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover {
transform: translateY(-5px);
border-color: rgba(99, 102, 241, 0.5);
background: rgba(30, 41, 59, 0.5);
}
.feature-icon {
font-size: 1.8rem;
margin-bottom: 1rem;
display: inline-flex;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
background: rgba(99, 102, 241, 0.1);
border-radius: 0.8rem;
}
.feature-title {
font-size: 1.1rem;
font-weight: 600;
color: #E2E8F0;
margin-bottom: 0.5rem;
}
.feature-desc {
font-size: 0.9rem;
color: #94A3B8;
line-height: 1.6;
}
/* ─── Streamlit Tabs Overrides ───────────────────────── */
div[data-testid="stTabs"] > div[role="tablist"] {
gap: 0.5rem;
border-bottom: 1px solid rgba(255,255,255,0.05);
padding-bottom: 0.5rem;
margin-bottom: 1.5rem;
}
div[data-testid="stTabs"] button[role="tab"] {
border-radius: 0.5rem;
padding: 0.4rem 1rem !important;
font-weight: 600 !important;
background: rgba(30, 41, 59, 0.4) !important;
border: 1px solid rgba(255, 255, 255, 0.05) !important;
transition: all 0.2s ease;
}
div[data-testid="stTabs"] button[role="tab"][aria-selected="true"] {
background: rgba(99, 102, 241, 0.15) !important;
border-color: rgba(99, 102, 241, 0.5) !important;
color: #A78BFA !important;
}
/* ─── Key Points Cards ───────────────────────────────── */
.keypoint-card {
background: rgba(15, 23, 42, 0.4);
border-left: 3px solid #818CF8;
padding: 1rem 1.2rem;
margin-bottom: 1rem;
border-radius: 0.5rem;
color: #CBD5E1;
font-size: 0.95rem;
line-height: 1.6;
display: flex;
gap: 1rem;
align-items: flex-start;
}
.keypoint-icon {
font-size: 1.2rem;
}
</style>
"""