<script setup>
    import { useNotificationsStore } from '../../stores/notifications';
    const notifications = useNotificationsStore();
</script>
<template>
    <div class="noty-fixed">
        <div class="content-noty" v-if="notifications.show">
            <div class="body">
                <i v-if="notifications.error === false" class="fa-regular fa-circle-check text-success icon-category"></i>
                <i v-else class="fa-solid fa-circle-exclamation text-danger"></i>
                <div>
                    <h4 class="noty-title">Notificación</h4>
                    <p class="noty-body">{{ notifications.text }}</p>
                </div>
                <i class="fa-solid fa-xmark close-icon" @click="notifications.show = false"></i>
            </div>
        </div>
    </div>
</template>


<style scoped>
    .noty-fixed {
        position: fixed;
        right: 100px;
        top: 50px;
    }
    .content-noty {
        width: 100%;
        max-width: 500px;
        padding: 16px 32px;
        background-color: white;
        border-radius: 8px;

        box-shadow: -5px 5px 9px -1px rgba(0,0,0,0.20);
        -webkit-box-shadow: -5px 5px 9px -1px rgba(0,0,0,0.20);
        -moz-box-shadow: -5px 5px 9px -1px rgba(0,0,0,0.20);
    }

    .body {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        /* align-content: center; */
        justify-content: space-between;
    }

    .noty-title {
        font-size: 1.2rem;
        color: black;
        margin: 0px;
        margin-bottom: 4px;
    }
    .noty-body {
        font-size: 1rem;
        color: black;
        margin: 0px;
    }
    .icon-category {
        font-size: 24px;
    }
    .close-icon {
        position: absolute;
        right: 12px;
        top: 10px;
        font-size: 20px;
        cursor: pointer;
    }

    @media (max-width: 768px) {
        .noty-fixed {
            right: 20px;
            top: 30px;
        }

        .content-noty {
            width: 100%;
            max-width: 320px;
            padding: 14px 16px;
            background-color: white;
            border-radius: 8px;
        }
    }
</style>