import { createContext, useContext, useState, useEffect } from 'react'; const ThemeContext = createContext(); export function ThemeProvider({ children }) { const [theme, setTheme] = useState(() => { return localStorage.getItem('llm-compare-theme') || 'light'; }); useEffect(() => { document.documentElement.setAttribute('data-theme', theme); localStorage.setItem('llm-compare-theme', theme); }, [theme]); const toggleTheme = () => setTheme(t => t === 'light' ? 'dark' : 'light'); return ( {children} ); } export const useTheme = () => useContext(ThemeContext);