html,body{
margin:0;
padding:0;
font-family:'Open Sans',sans-serif;
color:white;
background-color:black;
 }
#calorie-calculator{
max-width:100%;
padding:20px;
margin:0 auto;
 }
#calorie-calculator input,
#calorie-calculator select,
#calorie-calculator button{
width:100%;
padding:10px;
margin:6px 0 12px;
display:inline-block;
border:none;
border-radius:20px;
box-sizing:border-box;
background-color:transparent;
color:white;
font-size:16px;
 }
#calorie-calculator button{
background-color:#2acd35;
cursor:pointer;
font-weight:600;
 }
#calorie-calculator button:hover{
background-color:#28b831;
 }
#result,#bmi-result{
margin-top:10px;
font-size:18px;
 }
function calculateCalories() {
const gender = document.getElementById('gender').value;
const age = parseInt(document.getElementById('age').value, 10);
const weight = parseInt(document.getElementById('weight').value, 10);
const height = parseInt(document.getElementById('height').value, 10);
const activityLevel = parseFloat(document.getElementById('activity').value);
let bmr;
if (gender === 'male') {
bmr = 88.362 + (13.397 * weight) + (4.799 * height) - (5.677 * age);
} else {
bmr = 447.593 + (9.247 * weight) + (3.098 * height) - (4.330 * age);
}
const totalCalories = bmr * activityLevel;
document.getElementById('result').innerText = `Totale dagelijkse caloriebehoefte: ${totalCalories.toFixed(2)} calorieën.`;
// Bereken BMI
const heightInMeters = height / 100;
const bmi = weight / (heightInMeters * heightInMeters);
let bmiStatus = "";
if (bmi < 18.5) {
bmiStatus = "ondergewicht";
} else if (bmi >= 18.5 && bmi <= 24.9) {
bmiStatus = "een gezond gewicht";
} else if (bmi >= 25 && bmi <= 29.9) {
bmiStatus = "overgewicht";
} else if (bmi >= 30) {
bmiStatus = "obesitas";
}
document.getElementById('bmi-result').innerText = `Jouw BMI: ${bmi.toFixed(2)}, wat duidt op ${bmiStatus}.`;
}