Marital Property System
The U.S. has two systems. Your state, ${userProfile.state}, is a ${communityPropertyStates.includes(userProfile.state) ? 'Community Property' : 'Common Law'} state. This affects how marital assets are divided upon death or divorce.
State Estate Tax
The federal government has an estate tax, but some states also impose their own. Your state, ${userProfile.state}, ${hasStateEstateTax.includes(userProfile.state) ? 'currently has' : 'does NOT currently have'} its own estate tax. Tax laws change frequently, so this should be verified with a professional. The current Federal Estate Tax exemption for 2025 is $13.61 million per individual.
`;
stateInfoContainer.innerHTML = infoHTML;
}
function downloadPDF() {
if (typeof jspdf === 'undefined' || typeof jspdf.jsPDF === 'undefined') {
console.error("jsPDF is not loaded.");
return;
}
const { jsPDF } = jspdf;
const doc = new jsPDF();
// Header
doc.setFontSize(20);
doc.setFont("helvetica", "bold");
doc.text("Estate Planning Compliance Summary", 105, 20, { align: 'center' });
doc.setFontSize(10);
doc.setFont("helvetica", "normal");
doc.text(`Generated on: ${new Date().toLocaleDateString('en-US')}`, 105, 27, { align: 'center' });
// User Profile Section
doc.setFontSize(16);
doc.setFont("helvetica", "bold");
doc.text("User Profile", 14, 40);
doc.setFontSize(12);
doc.setFont("helvetica", "normal");
doc.text(`State of Residence: ${userProfile.state}`, 14, 48);
doc.text(`Marital Status: ${userProfile.maritalStatus}`, 14, 56);
// Checklist Section
doc.setFontSize(16);
doc.setFont("helvetica", "bold");
doc.text("Essential Documents Status", 14, 70);
const tableBody = checklistItems.map(item => [item.text, item.checked ? 'Completed / Reviewed' : 'Pending']);
doc.autoTable({
startY: 75,
head: [['Document', 'Status']],
body: tableBody,
theme: 'grid',
headStyles: { fillColor: [37, 99, 235] }, // Blue header
});
// Custom Notes Section
const notes = customNotesEl ? customNotesEl.value : '';
if (notes.trim() !== '') {
const finalY = doc.lastAutoTable.finalY || 90;
doc.setFontSize(16);
doc.setFont("helvetica", "bold");
doc.text("Custom Notes & Action Items", 14, finalY + 15);
doc.setFontSize(12);
doc.setFont("helvetica", "normal");
const splitNotes = doc.splitTextToSize(notes, 180);
doc.text(splitNotes, 14, finalY + 22);
}
// Footer Disclaimer
const finalYPos = doc.internal.pageSize.height - 20;
doc.setFontSize(8);
doc.setTextColor(150);
doc.text("This summary is for informational and educational purposes only and does not constitute legal or financial advice.", 105, finalYPos, { align: 'center' });
doc.save('Estate_Planning_Summary.pdf');
}
// --- EVENT LISTENERS ---
if (nextBtn) nextBtn.addEventListener('click', () => showTab(currentTab + 1));
if (prevBtn) prevBtn.addEventListener('click', () => showTab(currentTab - 1));
if (downloadBtn) downloadBtn.addEventListener('click', downloadPDF);
if (stateSelect) stateSelect.addEventListener('change', updateStateInfo);
if (maritalSelect) maritalSelect.addEventListener('change', updateStateInfo);
// --- INITIAL RENDER ---
initialize();
});