Source code for kaxanuk.attribution_analysis.dashboard.styles

"""
Dashboard styles and CSS configuration.
"""

from kaxanuk.attribution_analysis.dashboard.constants import PROFESSIONAL_COLORS


[docs] def get_tab_style() -> dict[str, str]: """ Style for an unselected `dcc.Tab` in the analysis tab bar. Returns ------- dict[str, str] Dash-compatible CSS-in-JS style mapping. """ return { 'fontWeight': '600', 'fontSize': '14px', 'color': '#64748b', 'backgroundColor': '#f8f9fa', 'border': '1px solid #e2e8f0', 'padding': '12px 20px', 'boxShadow': 'none', }
[docs] def get_selected_tab_style() -> dict[str, str]: """ Style for the currently selected `dcc.Tab` in the analysis tab bar. Returns ------- dict[str, str] Dash-compatible CSS-in-JS style mapping. """ return { 'backgroundColor': '#e84328', 'color': 'white', 'fontWeight': 'bold', 'border': '1px solid #e84328', 'padding': '12px 20px', 'boxShadow': 'inset 0 -3px 0 0 #e84328', }
[docs] def get_data_table_style() -> dict[str, str]: """ Style applied to each data cell of the statistics `DataTable`. Returns ------- dict[str, str] Dash-compatible CSS-in-JS style mapping. """ return { 'textAlign': 'left', 'padding': '15px 20px', 'fontFamily': 'Segoe UI, Arial, sans-serif', 'border': f'1px solid {PROFESSIONAL_COLORS["border"]}', 'fontSize': '14px', 'fontWeight': '500', 'lineHeight': '1.4', }
[docs] def get_data_table_header_style() -> dict[str, str]: """ Style applied to the header row of the statistics `DataTable`. Returns ------- dict[str, str] Dash-compatible CSS-in-JS style mapping. """ return { 'backgroundColor': '#e84328', 'fontWeight': 'bold', 'color': 'white', 'textAlign': 'center', 'fontSize': '16px', 'fontFamily': 'Segoe UI, Arial, sans-serif', 'padding': '18px 20px', 'letterSpacing': '0.5px', }
[docs] def get_table_container_style() -> dict[str, str]: """ Style for the container `html.Div` wrapping the statistics table. Returns ------- dict[str, str] Dash-compatible CSS-in-JS style mapping. """ return { 'borderRadius': '12px', 'overflow': 'hidden', 'boxShadow': '0 8px 25px rgba(0, 0, 0, 0.15)', 'backgroundColor': 'white', }
INDEX_STRING = ''' <!DOCTYPE html> <html> <head> {%metas%} <title>{%title%}</title> {%favicon%} {%css%} <style> body, * { font-family: 'Montserrat', Arial, sans-serif !important; } .dashboard-container { font-family: 'Montserrat', Arial, sans-serif; margin: 20px; background: #fafbfc; min-height: 100vh; } .header { text-align: center; margin-bottom: 40px; background: white; padding: 40px 30px 30px 30px; margin: -20px -20px 40px -20px; border-bottom: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); position: relative; } .header-content { display: flex; align-items: center; justify-content: center; width: 100%; position: relative; } .logo-section { position: absolute; top: 0; left: 0; margin: 0; padding: 10px; } .logo-section img { height: 60px !important; width: auto; } .title-section { flex-grow: 1; text-align: center; } .dashboard-main-title { color: #e84328; margin: 0 0 6px 0; font-size: 2.4rem; font-weight: 400; letter-spacing: -0.5px; } .dashboard-subtitle { color: #64748b; margin: 0 0 16px 0; font-size: 1.5rem; font-weight: 300; opacity: 0.9; } .date-range { color: #94a3b8; font-size: 14px; font-weight: 400; margin: 0; padding: 10px 20px; background: #f8fafc; border-radius: 18px; display: inline-block; border: 1px solid #e2e8f0; } .metrics-row { display: flex; justify-content: space-around; margin-bottom: 30px; flex-wrap: wrap; } .metric-card { background: white; border-radius: 12px; padding: 20px; margin: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); text-align: center; min-width: 160px; transition: all 0.3s ease; border: 1px solid #e2e8f0; } .metric-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); } .metric-title { margin: 0 0 12px 0; color: #64748b; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; } .metric-value { margin: 0; font-weight: 700; font-size: 1.8rem; line-height: 1; } .metric-value.success { color: #059669; } .metric-value.info { color: #0284c7; } .metric-value.warning { color: #d97706; } .metric-value.danger { color: #dc2626; } .metric-value.secondary { color: #64748b; } .metric-value.accent { color: #7c3aed; } .section-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent 0%, #e2e8f0 20%, #e84328 50%, #e2e8f0 80%, transparent 100%); margin: 40px 0; opacity: 0.8; } .charts-row { display: flex; margin-bottom: 30px; gap: 20px; align-items: flex-start; } .chart-container-large { flex: 1 1 58%; min-width: 0; } .chart-container-small { flex: 1 1 38%; min-width: 0; } .main-chart, .side-chart { width: 100%; height: 100%; } .chart-title { color: #0f172a; margin-bottom: 15px; font-size: 1.4rem; font-weight: 600; } .stats-section { background: white; border-radius: 16px; padding: 30px; margin-bottom: 30px; border-left: 4px solid #e84328; box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05); border: 1px solid #e2e8f0; } .analysis-section { background: white; border-radius: 16px; padding: 30px; margin-bottom: 30px; border-left: 4px solid #e84328; box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05); border: 1px solid #e2e8f0; } .section-title { color: #0f172a; margin-bottom: 15px; font-size: 1.5rem; font-weight: 600; } .instruction-text { color: #64748b; font-style: italic; margin-bottom: 10px; font-size: 14px; } .placeholder-text { color: #64748b; font-style: italic; line-height: 1.5; } .tabs-section { margin-top: 30px; background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05); border: 1px solid #e2e8f0; } @media (max-width: 768px) { .header-content { flex-direction: column; text-align: center; } .logo-section { position: static; margin-right: 0; margin-bottom: 15px; padding: 0; } .logo-section img { height: 50px !important; } .charts-row { flex-direction: column; gap: 20px; } .chart-container-large, .chart-container-small { flex: none; } .metrics-row { flex-direction: column; align-items: center; } .dashboard-main-title { font-size: 2rem; } .dashboard-subtitle { font-size: 1.2rem; } .dashboard-container { margin: 10px; } .header { padding: 30px 15px 20px 15px; } } </style> </head> <body> {%app_entry%} <footer> {%config%} {%scripts%} {%renderer%} </footer> </body> </html> '''