`;
container.appendChild(card);
});
} else {
container.innerHTML = `
We couldn't find any products matching your specific criteria, but please try another combination!
`; } changeTab(2); }; window.downloadPDF = () => { if (recommendedProducts.length === 0) { alert('No recommendations to download. Please generate them first.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text('Your Personalized Recommendations', 105, 20, { align: 'center' }); doc.setFontSize(14); doc.text('Your Preferences', 14, 35); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); const budgetMap = {1: 'Under $25', 2: '$25 - $75', 3: '$75 - $150', 4: '$150+'}; doc.text(`Category: ${userPreferences.category}`, 14, 42); doc.text(`Budget: ${budgetMap[userPreferences.budget]}`, 14, 49); doc.text(`Vibe: ${userPreferences.vibe}`, 14, 56); doc.autoTable({ startY: 65, head: [['Product Name', 'Description', 'Price ($)']], body: recommendedProducts.map(p => [p.name, p.desc, p.price.toFixed(2)]), theme: 'striped', headStyles: { fillColor: [8, 145, 178] } // cyan-600 }); doc.save('My_Product_Recommendations.pdf'); }; // Initial setup changeTab(1); });