ocompleteList.querySelectorAll("li");
        items.forEach((item, i) => {
            if (i === index) {
                item.classList.add("highlighted");
                item.scrollIntoView({ block: "nearest" });
            } else {
                item.classList.remove("highlighted");
            }
        });
    }

    // Add event listeners for search bar input and keydown
    searchBar.addEventListener("input", () => {
        const query = searchBar.value.trim();
        if (query) updateAutocompl