{{--
    Komponen alert flash message.
    Digunakan di layout utama, juga bisa dipanggil manual:

    @include('partials.alert')
--}}
@foreach(['success' => ['emerald', '✅'], 'warning' => ['amber', '⚠️'], 'error' => ['red', '❌'], 'info' => ['blue', 'ℹ️']] as $type => [$color, $icon])
    @if(session($type))
    <div x-data="{ show: true }" x-show="show" x-transition
         class="flex items-center gap-3 px-4 py-3 rounded-xl bg-{{ $color }}-50 border border-{{ $color }}-200 text-{{ $color }}-800 text-sm mb-3">
        <span>{{ $icon }}</span>
        <span class="flex-1">{{ session($type) }}</span>
        <button @click="show = false" class="text-{{ $color }}-400 hover:text-{{ $color }}-700 font-bold text-lg leading-none">×</button>
    </div>
    @endif
@endforeach

@if($errors->any())
<div class="px-4 py-3 rounded-xl bg-red-50 border border-red-200 text-red-800 text-sm mb-3">
    <div class="font-semibold mb-1">❌ Terdapat kesalahan:</div>
    <ul class="list-disc list-inside space-y-0.5">
        @foreach($errors->all() as $err)
        <li>{{ $err }}</li>
        @endforeach
    </ul>
</div>
@endif
