import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";

// Initialize theme before rendering to prevent flash
const initializeTheme = () => {
  const stored = localStorage.getItem("theme");
  const root = document.documentElement;
  
  if (stored === "light" || stored === "dark") {
    root.classList.add(stored);
  } else {
    // Default to dark (sesuai requirement)
    root.classList.add("dark");
  }
};

// Initialize theme immediately
initializeTheme();

createRoot(document.getElementById("root")!).render(<App />);
