<?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);
        }
    </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 Item & Hallway/Doorway Details</h2>
                <p class="text-gray-500 mb-8 text-lg">Input dimensions to check if your item can pass through the hallway or doorway, accounting for turning angles.</p>
                <form id="hallwayClearanceForm" class="space-y-8">
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                        <div class="space-y-3">
                            <label for="itemWidth" class="block text-sm font-medium text-gray-700">Item Width (ft)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="package" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="itemWidth" 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="3.0" step="0.1" min="1" max="6" value="3.0" required>
                            </div>
                            <input type="range" id="itemWidthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="1" max="6" step="0.1" value="3">
                            <p id="itemWidthValue" class="text-sm text-gray-500">3.0 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="itemDepth" class="block text-sm font-medium text-gray-700">Item 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="itemDepth" 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="4" value="2.0" required>
                            </div>
                            <input type="range" id="itemDepthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="1" max="4" step="0.1" value="2">
                            <p id="itemDepthValue" class="text-sm text-gray-500">2.0 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="itemHeight" class="block text-sm font-medium text-gray-700">Item Height (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="itemHeight" 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="3.0" step="0.1" min="1" max="8" value="3.0" required>
                            </div>
                            <input type="range" id="itemHeightRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="1" max="8" step="0.1" value="3">
                            <p id="itemHeightValue" class="text-sm text-gray-500">3.0 ft</p>
                        </div>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                        <div class="space-y-3">
                            <label for="hallwayWidth" class="block text-sm font-medium text-gray-700">Hallway/Doorway Width (ft)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="door-open" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="hallwayWidth" 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="3.5" step="0.1" min="2" max="8" value="3.5" required>
                            </div>
                            <input type="range" id="hallwayWidthRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="2" max="8" step="0.1" value="3.5">
                            <p id="hallwayWidthValue" class="text-sm text-gray-500">3.5 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="hallwayHeight" class="block text-sm font-medium text-gray-700">Hallway/Doorway Height (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="hallwayHeight" 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="6.8" step="0.1" min="5" max="10" value="6.8" required>
                            </div>
                            <input type="range" id="hallwayHeightRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="5" max="10" step="0.1" value="6.8">
                            <p id="hallwayHeightValue" class="text-sm text-gray-500">6.8 ft</p>
                        </div>
                        <div class="space-y-3">
                            <label for="turningAngle" class="block text-sm font-medium text-gray-700">Max Turning Angle (°)</label>
                            <div class="relative flex items-center">
                                <i data-lucide="rotate-cw" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                                <input type="number" id="turningAngle" 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="45" step="1" min="0" max="90" value="45" required>
                            </div>
                            <input type="range" id="turningAngleRange" class="range-input w-full h-2 bg-gray-200 rounded-lg cursor-pointer" min="0" max="90" step="1" value="45">
                            <p id="turningAngleValue" class="text-sm text-gray-500">45°</p>
                        </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 Hallway Clearance
                    </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 Hallway Clearance 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 moving and interior design guidelines.</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="package" class="mr-3 text-blue-500 h-6 w-6"></i>
                        Interactive Item & Hallway/Doorway Visualization
                    </h3>
                    <div class="relative w-full h-96 bg-gray-200 rounded-xl overflow-hidden shadow-lg">
                        <canvas id="hallwayCanvas" class="w-full h-full"></canvas>
                    </div>
                    <p class="text-sm text-gray-600 mt-4">Visualization showing the item passing through the hallway or doorway with turning angle.</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 Moving Large Items
                    </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 0.2 ft buffer for safe maneuvering.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Turning:</strong> Rotate item to minimize effective width in tight spaces.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Height:</strong> Ensure item height fits under doorway or hallway ceiling.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Protection:</strong> Use padding to protect walls and item during movement.</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="check" class="mr-2 text-green-500 h-5 w-5"></i>
                            <span><strong>Teamwork:</strong> Use multiple people for heavy or bulky items.</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

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

        // Sync range and number inputs
        function syncInputs(numberId, rangeId, valueId, unit = 'ft') {
            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('itemWidth', 'itemWidthRange', 'itemWidthValue');
        syncInputs('itemDepth', 'itemDepthRange', 'itemDepthValue');
        syncInputs('itemHeight', 'itemHeightRange', 'itemHeightValue');
        syncInputs('hallwayWidth', 'hallwayWidthRange', 'hallwayWidthValue');
        syncInputs('hallwayHeight', 'hallwayHeightRange', 'hallwayHeightValue');
        syncInputs('turningAngle', 'turningAngleRange', 'turningAngleValue', '°');

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

        function calculateHallwayClearance() {
            const itemWidth = parseFloat(document.getElementById('itemWidth').value);
            const itemDepth = parseFloat(document.getElementById('itemDepth').value);
            const itemHeight = parseFloat(document.getElementById('itemHeight').value);
            const hallwayWidth = parseFloat(document.getElementById('hallwayWidth').value);
            const hallwayHeight = parseFloat(document.getElementById('hallwayHeight').value);
            const turningAngle = parseFloat(document.getElementById('turningAngle').value);

            if (!itemWidth || !itemDepth || !itemHeight || !hallwayWidth || !hallwayHeight || !turningAngle ||
                itemWidth < 1 || itemDepth < 1 || itemHeight < 1 || hallwayWidth < 2 || hallwayHeight < 5 || turningAngle < 0 || turningAngle > 90) {
                alert('Please enter valid values (Item Width/Depth/Height ≥ 1 ft, Hallway Width ≥ 2 ft, Height ≥ 5 ft, Turning Angle 0-90°).');
                return;
            }

            // Calculate effective width with turning angle
            const angleRad = turningAngle * Math.PI / 180;
            const effectiveWidth = itemWidth * Math.cos(angleRad) + itemDepth * Math.sin(angleRad);
            const clearanceBuffer = 0.2; // Standard buffer for safe maneuvering
            const widthFit = effectiveWidth + clearanceBuffer <= hallwayWidth;
            const heightFit = itemHeight + clearanceBuffer <= hallwayHeight;
            const overallFit = widthFit && heightFit ? 'Yes' : 'No';

            // Calculate clearances
            const widthClearance = hallwayWidth - effectiveWidth - clearanceBuffer;
            const heightClearance = hallwayHeight - itemHeight - clearanceBuffer;

            // 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">Item Dimensions</p>
                        <p class="text-xl text-blue-600 font-semibold">${itemWidth.toFixed(1)} x ${itemDepth.toFixed(1)} x ${itemHeight.toFixed(1)} ft</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Hallway/Doorway Dimensions</p>
                        <p class="text-lg">${hallwayWidth.toFixed(1)} x ${hallwayHeight.toFixed(1)} ft</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Turning Angle</p>
                        <p class="text-lg">${turningAngle.toFixed(0)}°</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Effective Width (with angle)</p>
                        <p class="text-lg">${effectiveWidth.toFixed(1)} ft</p>
                    </div>
                    <div>
                        <p class="font-medium text-gray-700">Clearance Assessment</p>
                        <p class="text-lg ${overallFit === 'Yes' ? 'text-green-600' : 'text-red-600'} font-semibold">
                            ${overallFit === 'Yes' ? 'Can Pass Through' : 'May Not Pass Comfortably'}
                        </p>
                        <p class="text-sm text-gray-600">${
                            overallFit === 'Yes'
                                ? `The item can pass with ${widthClearance.toFixed(1)} ft width clearance and ${heightClearance.toFixed(1)} ft height clearance.`
                                : `Issues: ${
                                    !widthFit ? `Insufficient width clearance (need ≤${(effectiveWidth + clearanceBuffer).toFixed(1)} ft, have ${hallwayWidth.toFixed(1)} ft). ` : ''
                                }${
                                    !heightFit ? `Insufficient height clearance (need ≤${(itemHeight + clearanceBuffer).toFixed(1)} ft, have ${hallwayHeight.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> Test different turning angles to find the optimal orientation for moving the item.</p>
                </div>
            `;

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

            // Draw visualization
            drawVisualization(itemWidth, itemDepth, itemHeight, hallwayWidth, hallwayHeight, turningAngle, effectiveWidth);

            // Setup PDF download
            setupPdfDownload(itemWidth, itemDepth, itemHeight, hallwayWidth, hallwayHeight, turningAngle, effectiveWidth, overallFit, widthClearance, heightClearance);
        }

        function drawVisualization(itemWidth, itemDepth, itemHeight, hallwayWidth, hallwayHeight, turningAngle, effectiveWidth) {
            const canvas = document.getElementById('hallwayCanvas');
            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 / (hallwayWidth * 1.5); // Scale to fit canvas
            const itemW = itemWidth * scale;
            const itemD = itemDepth * scale;
            const hallwayW = hallwayWidth * scale;
            const hallwayH = hallwayHeight * scale * 0.5; // Perspective scaling for height

            // Draw background
            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 hallway floor
            ctx.fillStyle = 'rgba(120, 113, 108, 0.2)';
            ctx.fillRect(0, canvas.height * 0.7, canvas.width, canvas.height * 0.3);

            // Draw hallway/doorway outline (perspective view)
            ctx.strokeStyle = '#1e40af';
            ctx.lineWidth = 2;
            ctx.setLineDash([5, 5]);
            ctx.beginPath();
            ctx.moveTo(canvas.width * 0.55, canvas.height * 0.2);
            ctx.lineTo(canvas.width * 0.55 + hallwayW, canvas.height * 0.2);
            ctx.lineTo(canvas.width * 0.55 + hallwayW * 0.9, canvas.height * 0.2 + hallwayH);
            ctx.lineTo(canvas.width * 0.55 + hallwayW * 0.1, canvas.height * 0.2 + hallwayH);
            ctx.closePath();
            ctx.stroke();
            ctx.fillStyle = '#bfdbfe';
            ctx.globalAlpha = 0.3;
            ctx.fill();
            ctx.globalAlpha = 1.0;
            ctx.setLineDash([]);

            // Draw item with rotation
            ctx.save();
            ctx.shadowColor = 'rgba(0, 0, 0, 0.4)';
            ctx.shadowBlur = 15;
            ctx.shadowOffsetX = 8;
            ctx.shadowOffsetY = 8;
            ctx.fillStyle = '#4b5563';
            const itemX = canvas.width * 0.55 + hallwayW / 2;
            const itemY = canvas.height * 0.2 + hallwayH / 2;
            ctx.translate(itemX, itemY);
            ctx.rotate((turningAngle * Math.PI) / 180);
            ctx.fillRect(-itemW / 2, -itemD / 2, itemW, itemD);
            ctx.restore();

            // Draw item texture
            ctx.save();
            ctx.translate(itemX, itemY);
            ctx.rotate((turningAngle * Math.PI) / 180);
            const itemGradient = ctx.createLinearGradient(-itemW / 2, -itemD / 2, itemW / 2, itemD / 2);
            itemGradient.addColorStop(0, 'rgba(255, 255, 255, 0.15)');
            itemGradient.addColorStop(1, 'rgba(255, 255, 255, 0.05)');
            ctx.fillStyle = itemGradient;
            ctx.fillRect(-itemW / 2 + 5, -itemD / 2 + 5, itemW - 10, itemD - 10);
            ctx.restore();

            // Draw text
            ctx.shadowColor = 'transparent';
            ctx.fillStyle = '#ffffff';
            ctx.font = 'bold 18px Poppins';
            ctx.textAlign = 'center';
            ctx.fillText(`Item (${itemWidth.toFixed(1)} x ${itemDepth.toFixed(1)} ft)`, itemX, itemY);
            ctx.fillStyle = '#1e40af';
            ctx.fillText(`Hallway/Doorway (${hallwayWidth.toFixed(1)} x ${hallwayHeight.toFixed(1)} ft)`, canvas.width * 0.55 + hallwayW / 2, canvas.height * 0.2 + hallwayH / 2 + 20);
            ctx.font = '14px Poppins';
            ctx.fillStyle = '#4b5563';
            ctx.fillText(`Angle: ${turningAngle.toFixed(0)}°, Effective Width: ${effectiveWidth.toFixed(1)} ft`, canvas.width / 2, canvas.height - 30);
        }

        function setupPdfDownload(itemWidth, itemDepth, itemHeight, hallwayWidth, hallwayHeight, turningAngle, effectiveWidth, overallFit, widthClearance, heightClearance) {
            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 - Hallway Clearance 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 Hallway Clearance Assessment', 20, 40);

                doc.setFontSize(11);
                doc.text(`Item Dimensions: ${itemWidth.toFixed(1)} x ${itemDepth.toFixed(1)} x ${itemHeight.toFixed(1)} ft`, 20, 50);
                doc.text(`Hallway/Doorway Dimensions: ${hallwayWidth.toFixed(1)} x ${hallwayHeight.toFixed(1)} ft`, 20, 58);
                doc.text(`Turning Angle: ${turningAngle.toFixed(0)}°`, 20, 66);
                doc.text(`Effective Width (with angle): ${effectiveWidth.toFixed(1)} ft`, 20, 74);
                doc.text(`Clearance Assessment: ${overallFit === 'Yes' ? 'Can Pass Through' : 'May Not Pass Comfortably'}`, 20, 82);
                doc.text(`Clearances: ${widthClearance.toFixed(1)} ft (width), ${heightClearance.toFixed(1)} ft (height)`, 20, 90);
                doc.text(`Recommendation: ${
                    overallFit === 'Yes'
                        ? 'The item can pass through the hallway or doorway with the specified angle.'
                        : 'Adjust the turning angle or consider a smaller item.'
                }`, 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 0.2 ft buffer for safe maneuvering.', 20, 118);
                doc.text('• Turning: Rotate item to minimize effective width in tight spaces.', 20, 126);
                doc.text('• Height: Ensure item height fits under doorway or hallway ceiling.', 20, 134);
                doc.text('• Protection: Use padding to protect walls and item during movement.', 20, 142);
                doc.text('• Teamwork: Use multiple people for heavy or bulky items.', 20, 150);

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