@if (session()->has('success') || session()->has('error') || count($errors) > 0)
    <div class="alert {{ session()->has('success') ? 'alert-success' : 'alert-danger' }} alert-dismissible fade show position-fixed"
         role="alert"
         style="top: 20px; left: 50%; transform: translateX(-50%); z-index: 10000; min-width: 300px; max-width: 80%;">

        @if (session()->has('success'))
            <div class="d-flex align-items-center">
                <i class="fas fa-check-circle mr-2"></i>
                {{ session()->get('success') }}
            </div>
        @endif

        @if (session()->has('error'))
            <div class="d-flex align-items-center">
                <i class="fas fa-exclamation-circle mr-2"></i>
                {{ session()->get('error') }}
            </div>
        @endif

        @if (count($errors) > 0)
            <div class="d-flex align-items-center">
                <i class="fas fa-exclamation-circle mr-2"></i>
                <div>
                    @foreach ($errors->all() as $error)
                        <div>{{ $error }}</div>
                    @endforeach
                </div>
            </div>
        @endif

        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>

    <script>
        // Auto-dismiss after 5 seconds
        setTimeout(function() {
            $('.alert').alert('close');
        }, 5000);
    </script>
@endif
