    selectedTags.delete(tag);
                        pill.remove();
                    };
                    pill.appendChild(removeBtn);
                    selectedContainer.appendChild(pill);
                }
                input.value = '';
                dropdown.style.display = 'none';
            };

            input.addEventListener('focus', () => {
                dropdown.innerHTML = '';
                const availableTags = [...allTags].filter(tag => !selectedTags.has(tag));
              