<h5 class="fw-bold mb-1">Notification Preferences</h5>
<p class="text-muted small mb-4">
    Job-critical pushes (a new job, a cancellation, a fare change) always send. Everything below is optional —
    turn off what you don't want to be pinged about.
</p>

<form method="post" action="{{ route('profile.notification-preferences.update') }}">
    @csrf
    @method('put')

    @php $muted = $user->notification_preferences['muted'] ?? []; @endphp

    @foreach (\App\Models\User::OPTIONAL_NOTIFICATIONS as $type => $label)
        <div class="form-check form-switch mb-2">
            <input class="form-check-input" type="checkbox" name="enabled[]" value="{{ $type }}"
                   id="notif_{{ $type }}" @checked(! in_array($type, $muted, true))>
            <label class="form-check-label" for="notif_{{ $type }}">{{ $label }}</label>
        </div>
    @endforeach

    <div class="d-flex align-items-center gap-3 mt-3">
        <button type="submit" class="btn btn-dark">Save</button>

        @if (session('status') === 'notification-preferences-updated')
            <span class="text-success small">Saved.</span>
        @endif
    </div>
</form>
