document.addEventListener("DOMContentLoaded", function () {
    // Get all the list items (li elements) inside the accordion
    const accordionItems = document.querySelectorAll('.accordion .tabs .single-tab');

    // Add click event listeners to each list item
    accordionItems.forEach((item, index) => {
        const title = item.querySelector('.title');

        title.addEventListener('click', () => {
            // Check if the clicked tab is already open
            const isOpen = item.classList.contains('open');

            // Close all tabs by removing the 'open' class from all items
            accordionItems.forEach((item) => {
                item.classList.remove('open');
            });

            // If the clicked tab was not already open, open it
            if (!isOpen) {
                item.classList.add('open');
            }
        });

        // Open the first item by default
        if (index === 0) {
            item.classList.add('open');
        }
    });
});
