
<div id="cookie-banner" class="fixed bottom-4 right-4 w-full max-w-sm p-6 bg-card-bg/90 backdrop-blur-sm border border-gray-700 rounded-2xl shadow-lg z-50 transform translate-y-full transition-transform duration-500 ease-out" style="display: none;">
    <div class="flex flex-col items-start">
        <div class="flex-shrink-0 mb-4">
            <i class="fas fa-cookie-bite text-primary text-3xl"></i>
        </div>
        <div class="flex-grow">
            <h3 class="text-lg font-semibold text-white mb-2">Cookie Consent</h3>
            <p class="text-sm text-gray-300 mb-4">We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies. <a href="/privacy-policy" class="text-primary hover:underline">Learn more</a></p>
        </div>
        <div class="w-full mt-2">
            <button id="accept-cookies" class="w-full bg-primary hover:bg-secondary text-white font-bold py-2 px-4 rounded-lg transition duration-300 ease-in-out transform hover:scale-105 shadow-neon focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                Accept & Close
            </button>
        </div>
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        const cookieBanner = document.getElementById('cookie-banner');
        const acceptCookiesButton = document.getElementById('accept-cookies');

        if (!getCookie('cookies_accepted')) {
            // Show banner with animation
            cookieBanner.style.display = 'block';
            setTimeout(() => {
                cookieBanner.style.transform = 'translateY(0)';
            }, 100);
        }

        acceptCookiesButton.addEventListener('click', function() {
            setCookie('cookies_accepted', 'true', 365);
            // Hide banner with animation
            cookieBanner.style.transform = 'translateY(100%)';
            setTimeout(() => {
                cookieBanner.style.display = 'none';
            }, 500);
        });

        function setCookie(name, value, days) {
            let expires = "";
            if (days) {
                const date = new Date();
                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
                expires = "; expires=" + date.toUTCString();
            }
            document.cookie = name + "=" + (value || "") + expires + "; path=/";
        }

        function getCookie(name) {
            const nameEQ = name + "=";
            const ca = document.cookie.split(';');
            for (let i = 0; i < ca.length; i++) {
                let c = ca[i];
                while (c.charAt(0) === ' ') c = c.substring(1, c.length);
                if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
            }
            return null;
        }
    });
</script>
