document.addEventListener('DOMContentLoaded', function () { document.querySelectorAll('.faq_block--content-wrapper-item').forEach(function (item) { const titleWrapper = item.querySelector('.faq_block--answear-title-wrapper'); const content = item.querySelector('.faq_block--content'); if (!titleWrapper || !content) return; // Hide content by default content.style.display = 'none'; // Style the title wrapper as clickable titleWrapper.style.cursor = 'pointer'; titleWrapper.style.display = 'flex'; titleWrapper.style.justifyContent = 'space-between'; titleWrapper.style.alignItems = 'center'; // Add arrow const arrow = document.createElement('span'); arrow.textContent = '\u25BC'; arrow.style.cssText = 'font-size:12px; transition: transform 0.2s; flex-shrink:0; margin-left:12px;'; titleWrapper.appendChild(arrow); // Toggle on click titleWrapper.addEventListener('click', function () { const isOpen = content.style.display !== 'none'; content.style.display = isOpen ? 'none' : 'block'; arrow.style.transform = isOpen ? 'rotate(0deg)' : 'rotate(180deg)'; }); }); });