function updateCounter() {
    const targetDate = new Date('2026-07-23T13:00:00').getTime();
    const now = new Date().getTime();
    const difference = targetDate - now;

    const counter = document.querySelector('.counter');

    if (difference <= 0) {
        counter.innerHTML = "<h1>Događaj je počeo!</h1>";
        return;
    }

    const totalMinutes = Math.floor(difference / (1000 * 60));

    const days = Math.floor(totalMinutes / (60 * 24));
    const hours = Math.floor((totalMinutes % (60 * 24)) / 60);
    const minutes = totalMinutes % 60;

    document.getElementById('days').innerText = String(days).padStart(2, '0');
    document.getElementById('hours').innerText = String(hours).padStart(2, '0');
    document.getElementById('minutes').innerText = String(minutes).padStart(2, '0');
}

updateCounter();
setInterval(updateCounter, 1000);




document.addEventListener('DOMContentLoaded', function () {
    const choiceButtons = document.querySelectorAll('.rsvp-choice');
    const statusInput = document.getElementById('status-input');
    const pratiociBox = document.getElementById('pratioci-box');

    choiceButtons.forEach(button => {
        button.addEventListener('click', function () {
            choiceButtons.forEach(btn => btn.classList.remove('active'));
            this.classList.add('active');

            const status = this.getAttribute('data-status');
            statusInput.value = status;

            if (status === 'otkazano') {
                pratiociBox.style.display = 'none';
            } else {
                pratiociBox.style.display = 'block';
            }
        });
    });
});