@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: #cdcdcd;
  color: #000;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark {
  background-color: #1e1e1e;
  color: white;
}

.container {
  width: 90%;
  max-width: 500px;
  padding: 1rem;
}

#theme-toggle {
  float: right;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  margin-bottom: 10px;
  display: block;
}

.box {
  background-color: #fafafa;
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

body.dark .box {
  background-color: #2c2c2c;
}

h1 {
  font-size: 26px;
  margin-bottom: 1rem;
}

.theme-bar.column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.theme-bar.column #theme-toggle {
  font-size: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
}

body.dark .theme-bar {
  color: #fff;
}

body.dark .theme-bar #theme-toggle {
  color: #fff;
}

.input {
  margin-bottom: 1.2rem;
}

.input label {
  display: block;
  font-size: 16px;
  margin-bottom: 0.3rem;
}

.input input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  font-size: 16px;
  border: 1px solid #4f7df9;
  border-radius: 8px;
  text-align: center;
}

.input input[type="radio"] {
  margin-right: 0.4rem;
}

.input label input[type="radio"] {
  margin-right: 0.5rem;
}

.input:nth-child(1) label {
  display: inline-block;
  margin: 0 1rem;
}

button#calculate {
  width: 100%;
  padding: 0.8rem;
  font-size: 16px;
  background-color: #4f7df9;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button#calculate:hover {
  background-color: #0044ff;
}

button#calculate:active {
  transform: scale(0.98);
}

.result {
  margin-top: 1.5rem;
}

#result {
  font-size: 32px;
  font-weight: 800;
  background-color: #eaeaea;
  color: #4f7df9;
  padding: 0.5rem 1.5rem;
  border-radius: 30px;
  display: inline-block;
}

.comment {
  margin-top: 1rem;
  font-size: 16px;
  font-weight: 600;
}

#comment {
  color: #4f7df9;
  font-weight: bold;
}

/* BMI scale */
.bmi-scale {
  display: flex;
  position: relative;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  margin: 2rem 0 3rem;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
}

.range {
  flex: 1;
  padding: 5px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.underweight { background-color: #3cb1c7; }
.normal      { background-color: #30c473; }
.overweight  { background-color: #f0a500; }
.obese       { background-color: #e94e4e; }

#pointer {
  position: absolute;
  top: 100%;
  transform: translateY(5px);
  font-size: 16px;
  font-weight: bold;
  color: #4f7df9;
  transition: left 0.3s ease;
}

/* History */
.history {
  text-align: left;
}

.history h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.history ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid #ccc;
}

.history li {
  padding: 5px 0;
  font-size: 14px;
  border-bottom: 1px solid #eee;
}

/* Responsive */
@media (max-width: 500px) {
  h1 {
    font-size: 22px;
  }

  .bmi-scale {
    font-size: 10px;
  }

  .input label {
    font-size: 14px;
  }

  button#calculate {
    font-size: 14px;
    padding: 10px;
  }

  #result {
    font-size: 26px;
    padding: 0.4rem 1rem;
  }

  .comment {
    font-size: 14px;
  }

  #pointer {
    font-size: 14px;
  }
}
