<x-app-layout title="Security settings">
    <x-settings.page title="Meeting security" description="Organization-wide defaults for {{ $organization->name }}.">
        <form method="POST" action="{{ route('meet.settings.security.update') }}">
            @csrf @method('PUT')

            <x-settings.card title="Policy defaults" description="Applied to new meetings unless overridden per meeting.">
                <div class="space-y-4">
                    <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="org_only" value="1" @checked($policy['org_only'] ?? false) class="rounded border-slate-300"> Ladill accounts only</label>
                    <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="authenticated_only" value="1" @checked($policy['authenticated_only'] ?? false) class="rounded border-slate-300"> Authenticated users only</label>
                    <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="recording_host_only" value="1" @checked($policy['recording_host_only'] ?? true) class="rounded border-slate-300"> Host-only recording</label>
                    <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="watermark_enabled" value="1" @checked($policy['watermark_enabled'] ?? false) class="rounded border-slate-300"> Show watermark in meetings</label>
                    <div>
                        <label class="block text-sm font-medium text-slate-700">Allowed email domains (comma-separated)</label>
                        <input type="text" name="allowed_domains" value="{{ implode(', ', $policy['allowed_domains'] ?? []) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm" placeholder="example.com, company.org">
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-slate-700">Session idle timeout (minutes)</label>
                        <input type="number" name="session_idle_minutes" value="{{ $policy['session_idle_minutes'] ?? 120 }}" min="15" max="480" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
                    </div>
                    <button type="submit" class="btn-primary">Save policy</button>
                </div>
            </x-settings.card>
        </form>
    </x-settings.page>
</x-app-layout>
