@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600&display=swap");

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
* {
  font-family: "Poppins", sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;           /* FIX: era height:100vh — cortava conteúdo em telas pequenas */
  padding: 2rem 1rem;          /* FIX: respiro nas bordas em mobile */
  background-color: #18181b;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
#container {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  max-width: 1100px;
  width: 100%;
}

#img img {
  width: 32rem;
  max-width: 100%;
}

/* ─── Card da calculadora ───────────────────────────────────────────────────── */
#calculator {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  color: #f8fafc;
  background-color: #262626;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  flex-shrink: 0;
}

#form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Título ─────────────────────────────────────────────────────────────────── */
#title {
  font-size: 1.75rem;         /* FIX: estava grande demais e cortava em telas médias */
  position: relative;
  padding-bottom: 0.4rem;
}

#title::after {
  position: absolute;
  content: "";
  background-color: #17b8a6;
  width: 70%;
  height: 3px;
  bottom: 0;
  left: 0;
  border-radius: 3px;
}

/* ─── Toggle de unidade ────────────────────────────────────────────────────── */
#unit-toggle {
  display: flex;
  gap: 0.5rem;
}

.unit-btn {
  flex: 1;
  border: 1px solid #3f3f46;
  background: transparent;
  color: #a1a1aa;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.unit-btn:hover {
  border-color: #17b8a6;
  color: #f8fafc;
}

.unit-btn.active {
  background-color: #17b8a6;
  border-color: #17b8a6;
  color: #f8fafc;
  font-weight: 600;
}

/* ─── Inputs ─────────────────────────────────────────────────────────────────── */
.input-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-box label {
  font-size: 0.95rem;
  color: #cbd5ec;
  font-weight: 500;
}

.input-field {
  display: flex;
  align-items: center;
  background-color: #3f3f46;
  padding: 0.3rem;
  border-radius: 6px;
  gap: 8px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.input-field:focus-within {
  border-color: #17b8a6;      /* FIX: feedback visual de foco acessível */
}

.input-field span.unit-label,
.input-field i {
  color: #cbd5e1;
  font-size: 1.1rem;
  padding: 0.5rem 0.75rem;
  flex-shrink: 0;
}

.input-field input {
  background-color: transparent;
  border: none;
  width: 100%;
  font-size: 1.1rem;
  color: #f8fafc;
  padding: 0.3rem 0.5rem;
}

/* Remove setas do número */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input:focus {
  outline: none;
}

/* FIX: Mensagens de erro de campo (novidade) */
.field-error {
  font-size: 0.78rem;
  color: #f87171;
  min-height: 1rem;
}

/* ─── Botões ─────────────────────────────────────────────────────────────────── */
#btn-row {
  display: flex;
  gap: 0.75rem;
}

#calculate {
  flex: 1;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  background-color: #17b8a6;
  color: #f8fafc;
  padding: 0.6rem 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

#calculate:hover  { background-color: #14a496; }
#calculate:active { transform: scale(0.98); }

#reset {
  border: 1px solid #3f3f46;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  color: #a1a1aa;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

#reset:hover {
  border-color: #f87171;
  color: #f87171;
}

/* ─── Resultado ──────────────────────────────────────────────────────────────── */
#result {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  border-top: 1px solid #ffffff22;
  padding: 1rem 0 0.5rem;
}

#bmi {
  display: flex;
  align-items: center;
  flex-direction: column;
  font-size: 2.5rem;
  font-weight: 600;
  min-width: 5rem;
  text-align: center;
}

#bmi span:last-child {
  font-size: 0.75rem;
  color: #a1a1aa;
  font-weight: 400;
}

#description {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#classification {
  font-weight: 600;
  font-size: 1rem;
}

#detail {
  font-size: 0.82rem;
  color: #a1a1aa;
}

/* ─── Escala visual de IMC ──────────────────────────────────────────────────── */
#bmi-scale {
  position: relative;
  margin: 0.25rem 0 0.5rem;
}

.scale-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.scale-segment {
  flex: 1;
}

.seg-underweight { background-color: #60a5fa; }
.seg-normal      { background-color: #17b8a6; }
.seg-overweight  { background-color: #f59e0b; }
.seg-obese       { background-color: #ef4444; }

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #71717a;
  margin-top: 3px;
  padding: 0 25%;   /* alinha com as fronteiras 18.5 / 25 / 30 */
}

#scale-marker {
  position: absolute;
  top: -4px;
  transform: translateX(-50%);
  transition: left 0.4s ease;
}

.marker-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #262626;
  background-color: #17b8a6;
}

.marker-dot.normal    { background-color: #17b8a6; }
.marker-dot.anormal   { background-color: #f59e0b; }
.marker-dot.attention { background-color: #ef4444; }

/* ─── Link "Saiba mais" ─────────────────────────────────────────────────────── */
#more-info {
  text-align: center;
  border-top: 1px solid #ffffff22;
  padding-top: 1rem;
}

#more-info a {
  color: #17b8a6;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.3s;
}

#more-info a:hover { color: #cbd5e1; }

/* ─── Estados de cor do IMC ─────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.normal   { color: #17b8a6; }
.anormal  { color: #f59e0b; }
.attention{ color: #ef4444; }

/* ─── Responsividade ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #img { display: none; }

  #container {
    justify-content: center;
  }

  #calculator {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  #title { font-size: 1.4rem; }

  #bmi { font-size: 2rem; }
}
