             storage.setItem('search_history', JSON.stringify(searchHistory));
            }

            // Add search term to history
            function addToSearchHistory(term) {
                if (!term || term.trim() === '') return;

                // Remove existing entry if it exists
                searchHistory = searchHistory.filter(item => item.term !== term);

                // Add new entry at the beginning
                searchHistory.unshift({
                    term: term,
           