 </div>
 
 <script>
 // Real-time Search Logic
 document.addEventListener('DOMContentLoaded', () => {
 const searchInputs = document.querySelectorAll('input[name="search"]');
 
 searchInputs.forEach(input => {
 let timeout = null;
 const form = input.closest('form');
 
 if (form) {
 input.addEventListener('input', () => {
 clearTimeout(timeout);
 timeout = setTimeout(() => {
 form.submit();
 }, 500); // 500ms debounce
 });

 // Keep cursor at the end of input after reload
 if (input.value) {
 input.focus();
 input.setSelectionRange(input.value.length, input.value.length);
 }
 }
 });
 });
 </script>
</body>
</html>
