import { useEffect } from 'react';
import { reapplyTheme } from '@/hooks/use-appearance';
import AuthLayoutTemplate from '@/layouts/auth/auth-split-layout';

export default function AuthLayout({
    title = '',
    description = '',
    children,
}: {
    title?: string;
    description?: string;
    children: React.ReactNode;
}) {
    // Terapkan ulang tema sesuai preferensi pengguna (light/dark/system) —
    // dark mode kini aktif di halaman auth; konsisten saat navigasi SPA.
    useEffect(() => {
        reapplyTheme();
    }, []);

    return (
        <AuthLayoutTemplate title={title} description={description}>
            {children}
        </AuthLayoutTemplate>
    );
}
