{{--
 * Blade Template
 *
 * Usage:       <x-globals::banner />
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @subpackage  Blades
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
--}}

<div
    x-data="{ style: '', message: '', show: false }"
    x-on:banner-message.window="
        style   = $event.detail.style;
        message = $event.detail.message;
        show    = true;
        setTimeout(() => show = false, 4000);
    "
    x-show="show"
    x-transition:enter="transition ease-out duration-300"
    x-transition:enter-start="opacity-0 -translate-y-2"
    x-transition:enter-end="opacity-100 translate-y-0"
    x-transition:leave="transition ease-in duration-200"
    x-transition:leave-start="opacity-100 translate-y-0"
    x-transition:leave-end="opacity-0 -translate-y-2"
    class="fixed top-4 inset-x-0 z-50 flex justify-center px-4"
    style="display: none;"
>
    <div
        x-bind:class="{
            'bg-green-500':  style === 'success',
            'bg-red-600':    style === 'danger',
            'bg-yellow-500': style === 'warning',
        }"
        class="flex items-center gap-3 rounded-lg px-5 py-3 text-sm font-medium text-white shadow-lg"
    >
        <span x-text="message"></span>

        <button
            type="button"
            x-on:click="show = false"
            class="ml-2 rounded p-0.5 opacity-70 hover:opacity-100 focus:outline-none"
            aria-label="Close"
        >
            <svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
            </svg>
        </button>
    </div>
</div>
