import { Suspense } from "react";
import { getSemuaAnggotaParlemen, getSemuaProdukMumas, getProfilAktif } from "@/lib/data";
import { ParlemenTabs } from "@/components/public/parlemen-tabs";

export const dynamic = 'force-dynamic';

export default async function ParlemenPage() {
    const [anggotaParlemen, produkMumas, profil] = await Promise.all([
        getSemuaAnggotaParlemen(),
        getSemuaProdukMumas(),
        getProfilAktif()
    ]);

    return (
        <div data-theme="dark" className="min-h-screen bg-[#07090f] flex flex-col">
            {/* Hero Section Parlemen */}
            <main className="w-full min-h-[60vh] pt-32 pb-32 bg-[#07090f] overflow-hidden relative flex flex-col items-center justify-center">
                {/* Background: bg-hero.png + dark overlay */}
                <div className="absolute inset-0 z-0">
                    {/* eslint-disable-next-line @next/next/no-img-element */}
                    <img src="/bg-hero.png" alt="" className="w-full h-full object-cover object-center" />
                    {/* Dark overlay */}
                    <div className="absolute inset-0 bg-[#07090f]/82"></div>
                </div>

                {/* Bottom Fade Gradient for blending */}
                <div className="absolute bottom-0 left-0 w-full h-40 bg-gradient-to-t from-[#07090f] to-transparent z-10 pointer-events-none"></div>

                {/* Subtle grid */}
                <div className="absolute inset-0 z-[1] pointer-events-none">
                    <div className="absolute inset-0 opacity-[0.04]" style={{backgroundImage: 'linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px)', backgroundSize: '60px 60px'}}></div>
                </div>

                <div className="container px-4 md:px-8 relative z-20 w-full flex flex-col items-center text-center">

                    <h1 className="animate-in fade-in slide-in-from-bottom-6 duration-700 delay-100 font-sans leading-[1.05] tracking-tight mb-6">
                        <span className="block text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-black text-white">
                            Parlemen
                        </span>
                        <span className="block text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-black text-white/30">
                            HMF FPMIPA UPI
                        </span>
                    </h1>

                    <p className="animate-in fade-in slide-in-from-bottom-8 duration-700 delay-200 text-gray-400 text-lg md:text-xl font-light tracking-widest uppercase mb-12">
                        Dewan Perwakilan Mahasiswa
                    </p>
                </div>
            </main>

            <section className="w-full pb-24">
                <Suspense fallback={<div className="container px-4 text-center py-20 text-gray-500">Memuat data parlemen...</div>}>
                    <ParlemenTabs
                        anggotaParlemen={anggotaParlemen}
                        produkMumas={produkMumas}
                        organigramDpmUrl={profil?.organigramDpmUrl}
                    />
                </Suspense>
            </section>
        </div>
    );
}
