document.addEventListener("DOMContentLoaded", function () {
    let message = localStorage.getItem("toastMessage");
    let type = localStorage.getItem("toastType");

    if (message) {
        Toastify({
            text: message,
            duration: 3000,
            close: true,
            gravity: "top",
            position: "right",
            style: {
                background: type === "success"
                    ? "linear-gradient(to right, #00b09b, #96c93d)"
                    : "linear-gradient(to right, #ff5f6d, #ffc371)",
                borderRadius: "5px",
                textTransform: "uppercase"
            }
        }).showToast();

        // Limpia el localStorage para que no muestre el mensaje en futuras recargas
        localStorage.removeItem("toastMessage");
        localStorage.removeItem("toastType");
    }
});
