Add dark mode with theme toggle

- Add dark theme CSS variables
- Theme toggle button in navbar and auth pages
- Persist theme preference in localStorage
- Update chart colors for dark mode
- Auto-detect theme changes via MutationObserver

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-20 14:27:17 -05:00
parent a2b0c2cc65
commit 4ef61517e3
5 changed files with 165 additions and 22 deletions

View file

@ -16,6 +16,24 @@
--border: #e2e8f0;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
--chart-grid: #e2e8f0;
--chart-text: #94a3b8;
}
[data-theme="dark"] {
--primary: #818cf8;
--primary-dark: #6366f1;
--secondary: #34d399;
--danger: #f87171;
--background: #0f172a;
--surface: #1e293b;
--text: #f1f5f9;
--text-muted: #94a3b8;
--border: #334155;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
--chart-grid: #334155;
--chart-text: #64748b;
}
body {
@ -69,6 +87,8 @@ input, button {
border: 1px solid var(--border);
border-radius: 0.5rem;
font-size: 1rem;
background-color: var(--surface);
color: var(--text);
transition: border-color 0.2s, box-shadow 0.2s;
}
@ -154,12 +174,24 @@ input, button {
border: 1px solid #fecaca;
}
[data-theme="dark"] .alert-error {
background-color: #450a0a;
color: #fca5a5;
border: 1px solid #7f1d1d;
}
.alert-success {
background-color: #f0fdf4;
color: #166534;
border: 1px solid #bbf7d0;
}
[data-theme="dark"] .alert-success {
background-color: #052e16;
color: #86efac;
border: 1px solid #166534;
}
/* Loading spinner */
.spinner {
display: inline-block;