import { Link } from '@inertiajs/react';
import { Plus } from 'lucide-react';
import Reveal from '@/components/landing/reveal';
import SectionHeading from '@/components/landing/section-heading';
import { contact } from '@/routes';

const questions = [
    {
        question: 'What does “transparent” actually mean?',
        answer: 'Clear, fair terms with no hidden charges. Savings plans that allow it share in real profit, and financing is priced as a fixed, agreed amount instead of a rate that keeps growing over time.',
    },
    {
        question: 'Who can become a member?',
        answer: 'Any Nigerian resident aged 18 or over with a valid BVN and a government-issued ID, in any of the 36 states or the FCT.',
    },
    {
        question: 'How long does verification take?',
        answer: 'Most accounts are verified within 24–48 hours of submitting your BVN and ID. We will let you know by email as soon as you are approved.',
    },
    {
        question: 'How does Murabaha financing work?',
        answer: 'We buy the item you need and sell it to you at a cost-plus price agreed upfront. You repay in fixed instalments, and the agreed price never increases.',
    },
    {
        question: 'Are there any hidden fees?',
        answer: 'No. Any fee or profit margin is set out clearly — in your dashboard and in your agreement.',
    },
    {
        question: 'How do I withdraw my savings?',
        answer: 'Withdraw to your bank account from your dashboard. Some goal-based plans have notice periods, which are always shown before you subscribe.',
    },
] as const;

export default function FaqSection() {
    return (
        <section
            id="faq"
            aria-labelledby="faq-heading"
            className="px-5 py-20 sm:px-6 lg:px-10 lg:py-28"
        >
            <div className="mx-auto grid w-full max-w-6xl gap-12 lg:grid-cols-[0.8fr_1.2fr] lg:gap-20">
                <div className="lg:sticky lg:top-28 lg:self-start">
                    <SectionHeading
                        id="faq-heading"
                        eyebrow="FAQ"
                        title="Questions, answered."
                        description={
                            <>
                                Can’t find what you are looking for?{' '}
                                <Link
                                    href={contact()}
                                    className="font-semibold text-brand underline decoration-brand-border underline-offset-4 hover:decoration-brand"
                                >
                                    Contact our team
                                </Link>
                                .
                            </>
                        }
                    />
                </div>

                <Reveal delay={100}>
                    <ul className="divide-y divide-surface-200 border-y border-surface-200">
                        {questions.map((item) => (
                            <li key={item.question}>
                                <details className="group py-1">
                                    <summary className="flex cursor-pointer list-none items-center justify-between gap-6 rounded-landing-sm py-5 text-left font-display text-lg font-semibold text-ink transition-colors hover:text-brand focus-visible:ring-2 focus-visible:ring-highlight focus-visible:outline-none [&::-webkit-details-marker]:hidden">
                                        {item.question}
                                        <span className="flex size-8 shrink-0 items-center justify-center rounded-full border border-surface-200 text-ink-500 transition-transform duration-200 group-open:rotate-45 group-open:border-brand group-open:text-brand">
                                            <Plus
                                                className="size-4"
                                                aria-hidden="true"
                                            />
                                        </span>
                                    </summary>
                                    <p className="max-w-[62ch] pr-14 pb-6 text-[15px] leading-[1.75] text-ink-500">
                                        {item.answer}
                                    </p>
                                </details>
                            </li>
                        ))}
                    </ul>
                </Reveal>
            </div>
        </section>
    );
}
