function faq() {

    const quest = document.querySelectorAll(".faq_quests");
    const aswer = document.querySelectorAll(".aswer");
    //const img_icon = document.querySelectorAll('.img_icon');

    for (let i = 0; i < quest.length; i++) {

        quest[i].addEventListener("click", () => {

            if (quest[i].classList.contains("close")) {
                quest[i].classList.toggle("close");
                aswer[i].classList.toggle("open");
                //img_icon[i].src = 'img/set.svg';
            } else {
                quest[i].classList.add("close");
                aswer[i].classList.add("open");

                //img_icon[i].src = 'img/-.svg';
            }


        });

    }


}
faq();

function startTimer(duration, display) {
    let timer = duration;

    const updateDisplay = () => {
        const minutes = String(Math.floor(timer / 60)).padStart(2, '0');
        const seconds = String(timer % 60).padStart(2, '0');
        if (display) display.innerHTML = `${minutes}:${seconds}`;
    };

    updateDisplay(); // Atualiza imediatamente a interface antes de iniciar o intervalo

    const interval = setInterval(() => {
        if (timer > 0) {
            timer--;
            updateDisplay();
        } else {
            clearInterval(interval); // Para o timer ao atingir zero
        }
    }, 1000);
}

window.onload = function () {
    var duration = 60 * 30; //Em segundos
    var duration_2 = 60 * 4; //Em segundos

    var display = document.querySelectorAll('.count p'); //Elemento para exibir
    var display_2 = document.querySelector('.count_2'); //Elemento para exibir

    for (let i = 0; i < display.length; i++) {
        startTimer(duration, display[i]);
    }

    startTimer(duration_2, display_2);
}
