document.querySelectorAll('.faq-question').forEach((question) => {
    question.addEventListener('click', () => {
      const activeQuestion = document.querySelector('.faq-question.active');
      if (activeQuestion && activeQuestion !== question) {
        activeQuestion.classList.remove('active');
        activeQuestion.nextElementSibling.style.maxHeight = null;
      }
  
      question.classList.toggle('active');
  
      const answer = question.nextElementSibling;
      if (question.classList.contains('active')) {
        answer.style.maxHeight = answer.scrollHeight + 'px';
      } else {
        answer.style.maxHeight = null;
      }
    });
  });