        }

        function removeSite(site) {
            selectedSites.delete(site);
            updateHiddenInput();
            const siteElements = selectedSitesContainer.querySelectorAll('.selected-site');
            siteElements.forEach(el => {
                if (el.querySelector('.remove-site').dataset.site === site) {
                    el.remove();
                }
            });
        }

        siteInput.addEventListener('change', function (e) {
            const value = this.value.trim()