🏗️ Area & Price Calculator
📐 Enter Dimensions
💰 Price Breakdown
function fmt(v){return v.toFixed(2)}
function calcArea(){const L=parseFloat(document.getElementById('length').value)||0;const W=parseFloat(document.getElementById('width').value)||0;const H=parseFloat(document.getElementById('height').value)||0;
const floor=L*W;const wall=2*(L+W)*H;const roof=L*W;const total=floor+wall+roof;
document.getElementById('floorArea').textContent=fmt(floor);document.getElementById('wallArea').textContent=fmt(wall);document.getElementById('roofArea').textContent=fmt(roof);document.getElementById('totalArea').textContent=fmt(total);
calcPrice()}
function calcPrice(){const totalPrice=parseFloat(document.getElementById('totalPrice').value)||0;const L=parseFloat(document.getElementById('length').value)||0;const W=parseFloat(document.getElementById('width').value)||0;const H=parseFloat(document.getElementById('height').value)||0;
const floor=L*W;const total=floor+2*(L+W)*H+floor;
const priceResults=document.getElementById('priceResults');if(totalPrice>0&&total>0){priceResults.style.display='grid';document.getElementById('pricePerFloor').textContent=fmt(totalPrice/floor)+' /m²';document.getElementById('pricePerSurface').textContent=fmt(totalPrice/total)+' /m²'}else{priceResults.style.display='none'}}
calcArea();