<div class="p-5 sm:p-6">
    <div class="flex items-start gap-3.5">
        <span class="grid h-10 w-10 shrink-0 place-items-center rounded-md border border-accent/30 bg-accent/10 text-accent-text">
            <x-icon name="shield" class="h-5 w-5" />
        </span>
        <div class="min-w-0 flex-1">
            <h2 class="font-display text-base font-semibold text-ink">{{ $heading ?: __('modals.hardening_action.title_fallback') }}</h2>
            @if ($description)
                <p class="mt-1 text-sm leading-relaxed text-ink-2">{{ $description }}</p>
            @endif
        </div>
    </div>

    @if ($error)
        <div class="mt-4 flex items-center gap-2.5 rounded-md border border-offline/25 bg-offline/10 px-3.5 py-3">
            <x-icon name="alert" class="h-4 w-4 shrink-0 text-offline" />
            <p class="text-sm text-ink-2">{{ $error }}</p>
        </div>
    @elseif ($done)
        <div @class([
            'mt-4 flex items-start gap-2.5 rounded-md border px-3.5 py-3',
            'border-online/25 bg-online/10' => $ok,
            'border-offline/25 bg-offline/10' => ! $ok,
        ])>
            <x-icon :name="$ok ? 'activity' : 'alert'" @class(['mt-0.5 h-4 w-4 shrink-0', 'text-online' => $ok, 'text-offline' => ! $ok]) />
            <div class="min-w-0">
                <p @class(['text-sm', 'text-online' => $ok, 'text-offline' => ! $ok])>{{ $ok ? __('modals.hardening_action.result_ok') : __('modals.hardening_action.result_failed') }}</p>
                @if (! $ok && $output !== '')
                    <p class="mt-1 break-words font-mono text-[11px] text-ink-3">{{ $output }}</p>
                @endif
            </div>
        </div>
    @endif

    <div class="mt-6 flex items-center justify-end gap-2">
        @if ($done)
            <x-btn variant="primary" wire:click="$dispatch('closeModal')">{{ __('common.close') }}</x-btn>
        @else
            <x-btn variant="secondary" wire:click="$dispatch('closeModal')">{{ __('common.cancel') }}</x-btn>
            @unless ($error)
                <x-btn variant="primary" wire:click="apply" wire:target="apply" wire:loading.attr="disabled">
                    <x-icon name="shield" class="h-3.5 w-3.5" wire:loading.remove wire:target="apply" />
                    <svg wire:loading wire:target="apply" class="h-3.5 w-3.5 animate-spin" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M21 12a9 9 0 1 1-6.219-8.56" stroke-linecap="round" /></svg>
                    {{ __('common.apply') }}
                </x-btn>
            @endunless
        @endif
    </div>
</div>
