@extends('layouts.superadmin')
@section('title', 'Configurações')
@section('page-title', 'Configurações da plataforma')
@section('content')
    <form method="POST" action="{{ route('super-admin.settings.update') }}" class="max-w-xl space-y-4 rounded-xl border bg-white p-6 shadow-sm">
        @csrf
        <label class="flex items-center gap-2 text-sm"><input type="checkbox" name="maintenance_mode" value="1" @checked($maintenance)> Modo manutenção (login tenant)</label>
        <div>
            <label class="text-sm font-medium">IP allowlist (um por linha; vazio = liberado)</label>
            <textarea name="ip_allowlist" rows="4" class="mt-1 w-full rounded border px-3 py-2 text-sm font-mono">{{ $ipAllowlist }}</textarea>
        </div>
        <fieldset class="space-y-2 text-sm">
            <legend class="font-medium">Feature flags</legend>
            @foreach (['ai_auto_reply_default' => 'Atendimento automático padrão', 'new_signups' => 'Novos cadastros', 'public_registration' => 'Registro público'] as $key => $label)
                <label class="flex items-center gap-2"><input type="checkbox" name="flag_{{ $key }}" value="1" @checked($featureFlags[$key] ?? true)> {{ $label }}</label>
            @endforeach
        </fieldset>
        <button class="rounded-lg bg-emerald-600 px-4 py-2 text-sm font-semibold text-white">Salvar</button>
    </form>
@endsection
