@extends('layouts.super-admin', ['title' => 'Landing Page Settings - Booklio Super Admin', 'pageTitle' => 'Landing Page Settings', 'active' => 'landing'])

@section('content')
    <div class="space-y-5">
        @if (session('status'))
            <div class="rounded-lg border border-emerald-100 bg-emerald-50 px-4 py-3 text-sm font-bold text-emerald-700">{{ session('status') }}</div>
        @endif

        <form method="POST" action="{{ $formAction }}" class="space-y-5">
            @csrf
            <x-ui.card title="Landing Page Content" description="Control the SaaS marketing page shown before signup.">
                <div class="grid gap-4 md:grid-cols-2">
                    <x-form.input name="hero_title" label="Hero title" value="{{ $settings['hero_title'] ?? '' }}" />
                    <x-form.input name="hero_button" label="Primary button text" value="{{ $settings['hero_button'] ?? 'Start Free Trial' }}" />
                    <x-form.input name="hero_image" label="Hero image" value="{{ $settings['hero_image'] ?? '' }}" />
                    <x-form.input name="pricing_anchor" label="Pricing section anchor" value="{{ $settings['pricing_anchor'] ?? '#pricing' }}" />
                    <x-form.textarea class="md:col-span-2" name="hero_copy" label="Hero copy" value="{{ $settings['hero_copy'] ?? '' }}" rows="4" />
                </div>
            </x-ui.card>

            <x-ui.card title="Landing Page Sections" description="Enable or disable marketing sections.">
                <div class="grid gap-3 md:grid-cols-2 xl:grid-cols-3">
                    @foreach ([
                        'features_section' => 'Features section',
                        'pricing_section' => 'Pricing section',
                        'testimonials_section' => 'Testimonials section',
                        'faq_section' => 'FAQ section',
                        'codecanyon_license_block' => 'CodeCanyon license block',
                        'footer_newsletter' => 'Footer newsletter',
                    ] as $name => $label)
                        <label class="flex items-center justify-between gap-3 rounded-lg border border-booklio-border bg-slate-50 p-4">
                            <span class="text-sm font-bold text-slate-700">{{ $label }}</span>
                            <input name="{{ $name }}" value="1" type="checkbox" @checked((bool) ($settings[$name] ?? false)) class="h-4 w-4 rounded border-booklio-border text-booklio-primary focus:ring-booklio-primary">
                        </label>
                    @endforeach
                </div>
                <div class="mt-5 flex justify-end"><x-ui.button type="submit">Save Landing Page</x-ui.button></div>
            </x-ui.card>
        </form>
    </div>
@endsection
