ArtenTracker / src /styles.py
Johannes
Initial deployment (no data - downloaded from HF Dataset at startup)
0d4a0ba
import streamlit as st
_CSS = """
<style>
/* ── Fonts ─────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
html, body, [class*="css"], [class*="st-"] {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}
/* ── Main container ─────────────────────────────────────────────────────── */
.main .block-container {
padding: 2rem 2.5rem 3rem !important;
max-width: 1200px !important;
}
/* ── Typography ─────────────────────────────────────────────────────────── */
h1 { font-weight: 700 !important; letter-spacing: -0.4px !important; line-height: 1.2 !important; }
h2 { font-weight: 600 !important; color: #2d3748 !important; }
h3 { font-weight: 600 !important; }
[data-testid="stCaptionContainer"] p {
color: #64748b !important;
font-size: 0.85rem !important;
}
/* ── Sidebar ────────────────────────────────────────────────────────────── */
[data-testid="stSidebar"] {
border-right: 1px solid #e2e8f0 !important;
}
[data-testid="stSidebar"] > div:first-child {
padding-top: 1.5rem;
}
[data-testid="stSidebarUserContent"] h1 {
font-size: 1.3rem !important;
}
/* ── Metric cards ───────────────────────────────────────────────────────── */
[data-testid="stMetric"] {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 12px;
padding: 1.1rem 1.3rem !important;
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
[data-testid="stMetricValue"] {
font-size: 1.9rem !important;
font-weight: 700 !important;
color: #1e6b3b !important;
}
[data-testid="stMetricLabel"] {
font-size: 0.78rem !important;
font-weight: 500 !important;
color: #64748b !important;
text-transform: uppercase !important;
letter-spacing: 0.4px !important;
}
/* ── Tabs ───────────────────────────────────────────────────────────────── */
[data-testid="stTabs"] [role="tablist"] {
gap: 2px;
border-bottom: 2px solid #e2e8f0 !important;
padding-bottom: 0 !important;
}
[data-testid="stTabs"] button[role="tab"] {
border-radius: 8px 8px 0 0 !important;
font-weight: 500 !important;
padding: 0.55rem 1.1rem !important;
color: #64748b !important;
border: 1px solid transparent !important;
border-bottom: none !important;
transition: color 0.15s, background 0.15s;
}
[data-testid="stTabs"] button[role="tab"]:hover {
color: #1e6b3b !important;
background: #f4f7f5 !important;
}
[data-testid="stTabs"] button[role="tab"][aria-selected="true"] {
color: #1e6b3b !important;
font-weight: 600 !important;
background: #ffffff !important;
border-color: #e2e8f0 !important;
border-bottom-color: #ffffff !important;
margin-bottom: -2px;
}
/* ── Alerts (info / success / warning / error) ──────────────────────────── */
[data-testid="stAlert"] {
border-radius: 10px !important;
border-left-width: 4px !important;
padding: 0.75rem 1rem !important;
}
/* ── Buttons ────────────────────────────────────────────────────────────── */
[data-testid="stButton"] > button {
border-radius: 8px !important;
font-weight: 500 !important;
transition: filter 0.15s, transform 0.1s !important;
}
[data-testid="stButton"] > button:hover {
filter: brightness(0.92) !important;
transform: translateY(-1px) !important;
}
[data-testid="stButton"] > button[kind="primary"] {
padding: 0.5rem 1.4rem !important;
font-weight: 600 !important;
}
/* ── Select / Input ─────────────────────────────────────────────────────── */
[data-testid="stSelectbox"] > div > div,
[data-testid="stTextInput"] > div > div > input {
border-radius: 8px !important;
}
/* ── Divider ────────────────────────────────────────────────────────────── */
hr {
border-color: #e2e8f0 !important;
margin: 0.8rem 0 !important;
}
/* ── Home page cards ────────────────────────────────────────────────────── */
.at-card {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 14px;
padding: 1.5rem 1.75rem;
margin-bottom: 1.25rem;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.at-card h3 {
margin-top: 0 !important;
color: #1e6b3b !important;
}
.at-hero {
background: linear-gradient(135deg, #1e6b3b 0%, #2d9c59 100%);
border-radius: 16px;
padding: 2.5rem 2rem;
margin-bottom: 2rem;
color: #ffffff !important;
}
.at-hero h1, .at-hero p {
color: #ffffff !important;
margin: 0 !important;
}
.at-hero h1 { font-size: 2rem !important; margin-bottom: 0.5rem !important; }
.at-hero p { font-size: 1.05rem !important; opacity: 0.92; }
.at-feature-icon { font-size: 1.8rem; margin-bottom: 0.4rem; }
.at-feature-box {
background: #f4f7f5;
border-radius: 12px;
padding: 1.2rem 1rem;
text-align: center;
height: 100%;
}
.at-feature-box p { color: #4a5568 !important; font-size: 0.9rem !important; margin: 0 !important; }
.at-feature-box strong { color: #1a2332 !important; font-size: 0.95rem; }
/* ── Spinner ────────────────────────────────────────────────────────────── */
[data-testid="stSpinner"] > div { border-top-color: #1e6b3b !important; }
/* ── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
.main .block-container {
padding: 1rem 0.9rem 2rem !important;
}
h1 { font-size: 1.55rem !important; }
h2 { font-size: 1.15rem !important; }
/* Stack the 3-column metric row */
[data-testid="stHorizontalBlock"] {
flex-wrap: wrap !important;
gap: 0.6rem !important;
}
[data-testid="stHorizontalBlock"] > [data-testid="stColumn"] {
min-width: calc(50% - 0.3rem) !important;
flex: 1 1 calc(50% - 0.3rem) !important;
}
/* Smaller tab labels */
[data-testid="stTabs"] button[role="tab"] {
padding: 0.4rem 0.65rem !important;
font-size: 0.82rem !important;
}
/* Map iframe: shorter on phone */
.stFoliumChart iframe, iframe[title*="folium"] {
height: 340px !important;
}
.at-hero { padding: 1.5rem 1.25rem; }
.at-hero h1 { font-size: 1.5rem !important; }
.at-card { padding: 1.1rem 1.2rem; }
}
@media (max-width: 480px) {
[data-testid="stHorizontalBlock"] > [data-testid="stColumn"] {
min-width: 100% !important;
}
}
</style>
"""
_HIDE_SIDEBAR_CSS = """
<style>
[data-testid="stSidebar"] { display: none !important; }
[data-testid="stSidebarCollapsedControl"]{ display: none !important; }
.main .block-container { max-width: 900px !important; margin: 0 auto !important; }
</style>
"""
def inject_css() -> None:
st.markdown(_CSS, unsafe_allow_html=True)
def hide_sidebar() -> None:
st.markdown(_HIDE_SIDEBAR_CSS, unsafe_allow_html=True)