<?php include "../autoload.php"; ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
        .gradient-bg {
            background: linear-gradient(135deg, #1e40af 0%, #60a5fa 100%);
        }
        .result-card {
            background: linear-gradient(145deg, #ffffff, #f0f7ff);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
            transition: transform 0.3s ease, opacity 0.3s ease;
        }
        .result-card.hidden {
            transform: translateY(20px);
            opacity: 0;
        }
        .result-card:not(.hidden) {
            transform: translateY(0);
            opacity: 1;
        }
        .input-container {
            background: linear-gradient(145deg, #ffffff, #f9fafb);
            transition: all 0.3s ease;
        }
        .input-container:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
        }
        .range-input::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            background: #1e40af;
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        }
        .range-input::-moz-range-thumb {
            width: 20px;
            height: 20px;
            background: #1e40af;
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        }
        .btn-primary {
            transition: all 0.3s ease;
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        }
        .visual-container {
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="%23f3f4f6" width="100" height="100"/><circle cx="50" cy="50" r="30" fill="%23dbeafe" opacity="0.5"/></svg>') repeat;
            border-radius: 12px;
            box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
        }
        select {
            appearance: none;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="%234b5563" d="M7 10l5 5 5-5H7z"/></svg>');
            background-repeat: no-repeat;
            background-position: right 0.75rem center;
            background-size: 12px;
        }
    </style>

    <div class="x">
        <div class="x">
            <!-- Input Form -->
            <div class="mb-12">
                <h2 class="text-3xl font-semibold text-gray-800 mb-6">Enter Your Car, Storage & Garage Details</h2>
                <p class="text-gray-500 mb-8 text-lg">Input dimensions to check if your car and storage solutions fit in your garage.</p>
                <form id="garageFitForm" class="space-y-8">
                    <div class="grid grid-cols-1 md:grid-cols-4 gap-6">
                        <div class="space-y-3">
                            <label for="carModel" class="block text-sm font-medium text-gray-700">Car Model</label>
                            <div class="relative flex items-center">
                                <i data-lucide="car" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <select id="carModel" class="pl-12 pr-10 py-3 block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-600 focus:ring focus:ring-blue-600 focus:ring-opacity-50 text-lg" required>
                                    <option value="Toyota Camry" selected>Toyota Camry</option>
                                    <option value="Honda Civic">Honda Civic</option>
                                    <option value="Ford F-150">Ford F-150</option>
                                    <option value="Tesla Model 3">Tesla Model 3</option>
                                    <option value="Subaru Outback">Subaru Outback</option>
                                </select>
                            </div>
                        </div>
                        <div class="space-y-3">
                            <label for="storageWidth" class="block text-sm font-medium text-gray-700">Storage Width (ft)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="archive" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="storageWidth" class="pl-12 pr-4 py-3 block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-600 focus:ring focus:ring-blue-600 focus:ring-opacity-50 text-lg" placeholder="4.0" step="0.1" min="2" max="10" value="4.0" required>
                            </div>
                            <input type="range" id="storageWidthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="2" max="10" step="0.1" value="4">
                            <p id="storageWidthValue" class="text-sm text-gray-500">4.0 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="storageDepth" class="block text-sm font-medium text-gray-700">Storage Depth (ft)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="expand" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="storageDepth" class="pl-12 pr-4 py-3 block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-600 focus:ring focus:ring-blue-600 focus:ring-opacity-50 text-lg" placeholder="2.0" step="0.1" min="1" max="8" value="2.0" required>
                            </div>
                            <input type="range" id="storageDepthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="1" max="8" step="0.1" value="2">
                            <p id="storageDepthValue" class="text-sm text-gray-500">2.0 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="garageWidth" class="block text-sm font-medium text-gray-700">Garage Width (ft)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="warehouse" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="garageWidth" class="pl-12 pr-4 py-3 block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-600 focus:ring focus:ring-blue-600 focus:ring-opacity-50 text-lg" placeholder="22.0" step="0.1" min="10" max="30" value="22.0" required>
                            </div>
                            <input type="range" id="garageWidthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="10" max="30" step="0.1" value="22">
                            <p id="garageWidthValue" class="text-sm text-gray-500">22.0 ft</p>
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div class="space-y-3">
                            <label for="garageDepth" class="block text-sm font-medium text-gray-700">Garage Depth (ft)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="ruler" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="garageDepth" class="pl-12 pr-4 py-3 block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-600 focus:ring focus:ring-blue-600 focus:ring-opacity-50 text-lg" placeholder="20.0" step="0.1" min="10" max="30" value="20.0" required>
                            </div>
                            <input type="range" id="garageDepthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="10" max="30" step="0.1" value="20">
                            <p id="garageDepthValue" class="text-sm text-gray-500">20.0 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="storagePosition" class="block text-sm font-medium text-gray-700">Storage Position</label>
                            <div class="relative flex items-center">
                                <i data-lucide="layout" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <select id="storagePosition" class="pl-12 pr-10 py-3 block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-600 focus:ring focus:ring-blue-600 focus:ring-opacity-50 text-lg" required>
                                    <option value="Side" selected>Side (Along Width)</option>
                                    <option value="Back">Back (Along Depth)</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <button type="submit" class="btn-primary w-full bg-blue-600 text-white py-4 px-8 rounded-xl hover:bg-blue-700 flex items-center justify-center text-lg">
                        <i data-lucide="search" class="mr-3 h-5 w-5"></i>
                        Check Garage Fit
                    </button>
                </form>
            </div>

            <!-- Result Section -->
            <div id="resultSection" class="result-card rounded-2xl p-10 hidden">
                <h2 class="text-3xl font-semibold text-gray-800 mb-6 flex items-center">
                    <i data-lucide="check-circle-2" class="mr-3 text-green-500 h-7 w-7"></i>
                    Your Garage Fit Assessment
                </h2>
                <div id="resultOutput" class="text-gray-700 space-y-6 text-base">
                    <!-- Results will be dynamically inserted here -->
                </div>
                <div class="mt-10 flex flex-col md:flex-row justify-between items-center gap-6">
                    <div class="flex items-center text-blue-600">
                        <i data-lucide="info" class="mr-2 h-5 w-5"></i>
                        <p class="text-sm font-medium">Based on standard garage and vehicle dimensions.</p>
                    </div>
                    <button id="downloadPdf" class="btn-primary bg-green-600 text-white py-3 px-8 rounded-xl hover:bg-green-700 flex items-center text-base">
                        <i data-lucide="download" class="mr-2 h-5 w-5"></i>
                        Download PDF Report
                    </button>
                </div>
                <!-- Visual Representation -->
                <div class="mt-10 visual-container p-8">
                    <h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center">
                        <i data-lucide="car" class="mr-3 text-blue-500 h-6 w-6"></i>
                        Interactive Garage & Storage Visualization
                    </h3>
                    <div class="relative w-full h-96 bg-gray-200 rounded-xl overflow-hidden shadow-lg">
                        <canvas id="garageCanvas" class="w-full h-full"></canvas>
                    </div>
                    <p class="text-sm text-gray-600 mt-4">Visualization showing the car and storage scaled to the garage width.</p>
                </div>
                <!-- Expert Insights -->
                <div class="mt-10 bg-blue-50 p-8 rounded-xl shadow-sm">
                    <h3 class="text-xl font-medium text-gray-800 mb-4 flex items-center">
                        <i data-lucide="lightbulb" class="mr-3 text-yellow-500 h-6 w-6"></i>
                        Expert Insights for Garage Organization
                    </h3>
                    <ul class="list-none space-y-4 text-gray-700 text-sm">
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Clearance:</strong> Allow 2 ft around car for access and door opening.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Storage Placement:</strong> Side storage maximizes depth; back storage saves width.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Vertical Space:</strong> Use wall-mounted or overhead storage to save floor space.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Safety:</strong> Ensure storage is secure to prevent tipping or obstruction.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Access:</strong> Maintain clear pathways for easy entry and exit.</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Initialize Lucid Icons
        lucide.createIcons();

        // Car dimensions (in feet, approximate averages from manufacturer data)
        const carDimensions = {
            'Toyota Camry': { width: 6.1, length: 16.0 },
            'Honda Civic': { width: 5.9, length: 15.3 },
            'Ford F-150': { width: 6.7, length: 17.4 },
            'Tesla Model 3': { width: 6.0, length: 15.4 },
            'Subaru Outback': { width: 6.1, length: 15.9 }
        };

        // Sync range and number inputs
        function syncInputs(numberId, rangeId, valueId, unit) {
            const numberInput = document.getElementById(numberId);
            const rangeInput = document.getElementById(rangeId);
            const valueDisplay = document.getElementById(valueId);

            numberInput.addEventListener('input', () => {
                rangeInput.value = numberInput.value;
                valueDisplay.textContent = `${parseFloat(numberInput.value).toFixed(1)} ${unit}`;
            });
            rangeInput.addEventListener('input', () => {
                numberInput.value = rangeInput.value;
                valueDisplay.textContent = `${parseFloat(rangeInput.value).toFixed(1)} ${unit}`;
            });
        }

        syncInputs('storageWidth', 'storageWidthRange', 'storageWidthValue', 'ft');
        syncInputs('storageDepth', 'storageDepthRange', 'storageDepthValue', 'ft');
        syncInputs('garageWidth', 'garageWidthRange', 'garageWidthValue', 'ft');
        syncInputs('garageDepth', 'garageDepthRange', 'garageDepthValue', 'ft');

        // Form Submission
        document.getElementById('garageFitForm').addEventListener('submit', function (e) {
            e.preventDefault();
            calculateGarageFit();
        });

        function calculateGarageFit() {
            const carModel = document.getElementById('carModel').value;
            const storageWidth = parseFloat(document.getElementById('storageWidth').value);
            const storageDepth = parseFloat(document.getElementById('storageDepth').value);
            const garageWidth = parseFloat(document.getElementById('garageWidth').value);
            const garageDepth = parseFloat(document.getElementById('garageDepth').value);
            const storagePosition = document.getElementById('storagePosition').value;

            if (!carModel || !storageWidth || !storageDepth || !garageWidth || !garageDepth ||
                storageWidth < 2 || storageDepth < 1 || garageWidth < 10 || garageDepth < 10) {
                alert('Please enter valid values (Storage Width ≥ 2 ft, Depth ≥ 1 ft, Garage Width/Depth ≥ 10 ft).');
                return;
            }

            const car = carDimensions[carModel];

            // Calculate total space needed (2 ft clearance around car)
            let totalWidth, totalDepth;
            if (storagePosition === 'Side') {
                totalWidth = car.width + storageWidth + 4; // 2 ft clearance each side
                totalDepth = Math.max(car.length, storageDepth) + 4; // 2 ft front/back
            } else {
                totalWidth = car.width + 4; // 2 ft clearance each side
                totalDepth = car.length + storageDepth + 4; // 2 ft front/back
            }

            // Check fit
            const widthFit = garageWidth >= totalWidth;
            const depthFit = garageDepth >= totalDepth;
            const overallFit = widthFit && depthFit ? 'Yes' : 'No';

            // Calculate clearances
            const widthClearance = garageWidth - totalWidth;
            const depthClearance = garageDepth - totalDepth;

            // Generate output
            const output = `
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6 bg-white p-6 rounded-xl shadow-sm">
                    <div>
                        <p class="font-medium text-gray-700">Car Model</p>
                        <p class="text-lg">${carModel}</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Car Dimensions</p>
                        <p class="text-lg">${car.width.toFixed(1)} x ${car.length.toFixed(1)} ft</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Storage Dimensions & Position</p>
                        <p class="text-xl text-blue-600 font-semibold">${storageWidth.toFixed(1)} x ${storageDepth.toFixed(1)} ft, ${storagePosition}</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Garage Dimensions</p>
                        <p class="text-lg">${garageWidth.toFixed(1)} x ${garageDepth.toFixed(1)} ft</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Fit Assessment</p>
                        <p class="text-lg ${overallFit === 'Yes' ? 'text-green-600' : 'text-red-600'} font-semibold">
                            ${overallFit === 'Yes' ? 'Perfect Fit' : 'May Not Fit Comfortably'}
                        </p>
                        <p class="text-sm text-gray-600">${
                            overallFit === 'Yes' 
                                ? `The car and storage fit with ${widthClearance.toFixed(1)} ft width clearance and ${depthClearance.toFixed(1)} ft depth clearance.`
                                : `Issues: ${
                                    !widthFit ? `Insufficient width clearance (need ≥${totalWidth.toFixed(1)} ft, have ${garageWidth.toFixed(1)} ft). ` : ''
                                }${
                                    !depthFit ? `Insufficient depth clearance (need ≥${totalDepth.toFixed(1)} ft, have ${garageDepth.toFixed(1)} ft). ` : ''
                                }`
                        }</p>
                    </div>
                </div>
                <div class="bg-blue-50 p-4 rounded-lg">
                    <p class="text-sm"><span class="font-medium">Tip:</span> Measure garage door width to ensure car entry; consider overhead storage for extra space.</p>
                </div>
            `;

            document.getElementById('resultOutput').innerHTML = output;
            document.getElementById('resultSection').classList.remove('hidden');

            // Draw visualization
            drawVisualization(car.width, car.length, storageWidth, storageDepth, garageWidth, storagePosition);

            // Setup PDF download
            setupPdfDownload(carModel, car.width, car.length, storageWidth, storageDepth, storagePosition, garageWidth, garageDepth, overallFit, widthClearance, depthClearance);
        }

        function drawVisualization(carWidth, carLength, storageWidth, storageDepth, garageWidth, storagePosition) {
            const canvas = document.getElementById('garageCanvas');
            const ctx = canvas.getContext('2d');
            canvas.width = canvas.offsetWidth;
            canvas.height = canvas.offsetHeight;

            // Clear canvas
            ctx.clearRect(0, 0, canvas.width, canvas.height);

            // Scale factors
            const scale = canvas.width / (garageWidth * 1.5); // Scale to fit canvas
            const carW = carWidth * scale;
            const carH = carLength * scale;
            const storageW = storageWidth * scale;
            const storageH = storageDepth * scale;
            const garageW = garageWidth * scale;

            // Draw background with garage texture
            const gradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
            gradient.addColorStop(0, '#e5e7eb');
            gradient.addColorStop(1, '#d1d5db');
            ctx.fillStyle = gradient;
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            // Draw floor
            ctx.fillStyle = 'rgba(120, 113, 108, 0.2)';
            ctx.fillRect(0, canvas.height * 0.7, canvas.width, canvas.height * 0.3);

            // Draw garage outline (dashed)
            ctx.strokeStyle = '#1e40af';
            ctx.lineWidth = 2;
            ctx.setLineDash([5, 5]);
            ctx.strokeRect(canvas.width * 0.55, canvas.height * 0.2, garageW, carH + storageH + 20);
            ctx.fillStyle = '#bfdbfe';
            ctx.globalAlpha = 0.3;
            ctx.fillRect(canvas.width * 0.55, canvas.height * 0.2, garageW, carH + storageH + 20);
            ctx.globalAlpha = 1.0;
            ctx.setLineDash([]);

            // Draw car with realistic effects
            ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';
            ctx.shadowBlur = 15;
            ctx.shadowOffsetX = 8;
            ctx.shadowOffsetY = 8;
            ctx.fillStyle = '#4b5563';
            const carX = storagePosition === 'Side' ? canvas.width * 0.15 + storageW : canvas.width * 0.15;
            const carY = canvas.height * 0.3;
            ctx.fillRect(carX, carY, carW, carH);

            // Draw car texture
            const carGradient = ctx.createLinearGradient(carX, carY, carX + carW, carY + carH);
            carGradient.addColorStop(0, 'rgba(255, 255, 255, 0.15)');
            carGradient.addColorStop(1, 'rgba(255, 255, 255, 0.05)');
            ctx.fillStyle = carGradient;
            ctx.fillRect(carX + 5, carY + 5, carW - 10, carH - 10);

            // Draw storage
            ctx.fillStyle = '#2d3748';
            const storageX = storagePosition === 'Side' ? canvas.width * 0.15 : canvas.width * 0.15;
            const storageY = storagePosition === 'Side' ? carY : carY + carH;
            ctx.fillRect(storageX, storageY, storageW, storageH);

            // Draw storage texture
            const storageGradient = ctx.createLinearGradient(storageX, storageY, storageX + storageW, storageY + storageH);
            storageGradient.addColorStop(0, 'rgba(255, 255, 255, 0.15)');
            storageGradient.addColorStop(1, 'rgba(255, 255, 255, 0.05)');
            ctx.fillStyle = storageGradient;
            ctx.fillRect(storageX + 5, storageY + 5, storageW - 10, storageH - 10);

            // Draw text
            ctx.shadowColor = 'transparent';
            ctx.fillStyle = '#ffffff';
            ctx.font = 'bold 18px Poppins';
            ctx.textAlign = 'center';
            ctx.fillText(`Car (${carWidth.toFixed(1)} x ${carLength.toFixed(1)} ft)`, carX + carW / 2, carY + carH / 2);
            ctx.fillText(`Storage (${storageWidth.toFixed(1)} x ${storageDepth.toFixed(1)} ft)`, storageX + storageW / 2, storageY + storageH / 2);
            ctx.fillStyle = '#1e40af';
            ctx.fillText(`Garage (${garageWidth.toFixed(1)} ft)`, canvas.width * 0.55 + garageW / 2, canvas.height * 0.2 + (carH + storageH + 20) / 2);
            ctx.font = '14px Poppins';
            ctx.fillStyle = '#4b5563';
            ctx.fillText(`Car & Storage vs. Garage Width`, canvas.width / 2, canvas.height - 30);
        }

        function setupPdfDownload(carModel, carWidth, carLength, storageWidth, storageDepth, storagePosition, garageWidth, garageDepth, overallFit, widthClearance, depthClearance) {
            document.getElementById('downloadPdf').onclick = function () {
                const { jsPDF } = window.jspdf;
                const doc = new jsPDF();

                // Header
                doc.setFont('helvetica', 'bold');
                doc.setFontSize(20);
                doc.setTextColor(31, 64, 175);
                doc.text('HomeFit Tools - Garage Fit Assessment Report', 20, 20);

                doc.setFont('helvetica', 'normal');
                doc.setFontSize(10);
                doc.setTextColor(100, 100, 100);
                doc.text(`Generated on: ${new Date().toLocaleString()}`, 20, 28);

                // Results
                doc.setFontSize(14);
                doc.setTextColor(0, 0, 0);
                doc.text('Your Garage Fit Assessment', 20, 40);

                doc.setFontSize(11);
                doc.text(`Car Model: ${carModel}`, 20, 50);
                doc.text(`Car Dimensions: ${carWidth.toFixed(1)} x ${carLength.toFixed(1)} ft`, 20, 58);
                doc.text(`Storage Dimensions: ${storageWidth.toFixed(1)} x ${storageDepth.toFixed(1)} ft (${storagePosition})`, 20, 66);
                doc.text(`Garage Dimensions: ${garageWidth.toFixed(1)} x ${garageDepth.toFixed(1)} ft`, 20, 74);
                doc.text(`Fit Assessment: ${overallFit === 'Yes' ? 'Perfect Fit' : 'May Not Fit Comfortably'}`, 20, 82);
                doc.text(`Clearance: ${widthClearance.toFixed(1)} ft (width), ${depthClearance.toFixed(1)} ft (depth)`, 20, 90);
                doc.text(`Recommendation: ${
                    overallFit === 'Yes' 
                        ? 'The car and storage fit well in your garage.' 
                        : 'Consider adjusting storage size or placement.'
                }`, 20, 98);

                // Expert Insights
                doc.setFont('helvetica', 'bold');
                doc.setFontSize(12);
                doc.text('Expert Insights', 20, 110);
                doc.setFont('helvetica', 'normal');
                doc.setFontSize(10);
                doc.text('• Clearance: Allow 2 ft around car for access.', 20, 118);
                doc.text('• Storage Placement: Side saves depth; back saves width.', 20, 126);
                doc.text('• Vertical Space: Use wall-mounted/overhead storage.', 20, 134);
                doc.text('• Safety: Secure storage to prevent tipping.', 20, 142);
                doc.text('• Access: Maintain clear pathways for entry/exit.', 20, 150);

                doc.save('HomeFit_Garage_Fit_Assessment.pdf');
            };
        }
    </script>