(function() {
    // Import Komponen Console
    const ConsoleSide = window.ConsoleSide;
    const ConsoleHead = window.ConsoleHead;

    const LayoutConsole = ({ children, activePage, setPage }) => {
        return (
            <div className="min-h-screen bg-[#0f0f1a] text-gray-100 flex font-sans">
                
                {/* 1. Sidebar Kiri (Fixed) */}
                {/* Mengirim state activePage untuk highlight menu */}
                <ConsoleSide activePage={activePage} setPage={setPage} />

                {/* 2. Main Content Area */}
                {/* Margin Left 64 (256px) untuk memberi ruang sidebar */}
                <div className="flex-1 ml-64 flex flex-col min-h-screen relative">
                    
                    {/* Header Atas (Sticky) */}
                    <ConsoleHead title={
                        activePage === 'dash' ? 'Dashboard Overview' :
                        activePage === 'films' ? 'Manajemen Film' : 
                        activePage === 'settings' ? 'Pengaturan Akun' : 'Console'
                    } />

                    {/* Content Scrollable */}
                    <main className="p-8 flex-1 overflow-y-auto animate-in fade-in slide-in-from-bottom-4 duration-500">
                        {children}
                    </main>

                    {/* Footer Kecil */}
                    <footer className="p-6 border-t border-white/5 text-center text-xs text-gray-600">
                        &copy; 2026 Cilacap Film Festival Hub. Engine v1.0 (Hybrid Monolith).
                    </footer>
                </div>

            </div>
        );
    };

    // Expose ke Global
    window.LayoutConsole = LayoutConsole;
})();
