
:root {
  --primary-color: #007bff;
  --primary-color-dark: #0056b3;
  --background-color: #f8f9fa;
  --surface-color: #ffffff;
  --text-color: #343a40;
  --border-color: #dee2e6;
  --error-color: #dc3545;

  --bmi-underweight: #3498db;
  --bmi-normal: #2ecc71;
  --bmi-overweight: #f1c40f;
  --bmi-obese: #e74c3c;
}



/* --- Inputs Section --- */
.bmi-inputs {
  display: flex;
  flex-direction: column;
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.input-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.input-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-color);
}
.unit-switcher label {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s, color 0.2s;
}
.unit-switcher label:first-of-type {
  border-radius: 6px 0 0 6px;
  border-right: none;
}
.unit-switcher label:last-of-type {
  border-radius: 0 6px 6px 0;
}
.unit-switcher input[type="radio"] {
  display: none;
}
.unit-switcher input[type="radio"]:checked + label {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

fieldset {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin: 0;
}
fieldset legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.input-group {
  margin-bottom: 1rem;
}
.input-group:last-child {
  margin-bottom: 0;
}
.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.input-group input, .input-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus, .input-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}
.height-inputs { display: flex; gap: 0.5rem; }
.hidden { display: none; }

.activity-group {
  margin-top: 1rem;
}

.actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}
.actions button {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}
.actions button:active { transform: scale(0.98); }

#calculate-btn {
  background-color: var(--primary-color);
  color: white;
}
#calculate-btn:hover { background-color: var(--primary-color-dark); }
#reset-btn {
  background-color: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}
#reset-btn:hover { background-color: #e9ecef; }

.error {
  color: var(--error-color);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  text-align: center;
  min-height: 1.2em;
}

/* --- Results Section --- */
.bmi-results {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: opacity 0.5s, transform 0.5s;
  opacity: 1;
  transform: translateY(0);
}
.bmi-results.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  display: none;
}
.result-main {
    text-align: center;
}
#bmi-gauge-container {
    width: 200px;
    height: 100px;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}
.gauge-bg {
    width: 100%;
    height: 100%;
    background: conic-gradient(
        from -90deg at 50% 100%, 
        var(--bmi-underweight) 0 45deg,
        var(--bmi-normal) 45deg 90deg,
        var(--bmi-overweight) 90deg 135deg,
        var(--bmi-obese) 135deg 180deg
    );
    border-radius: 200px 200px 0 0;
}
.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface-color);
    clip-path: polygon(50% 100%, 100% 100%, 100% 0, 0 0, 0 100%);
    transform-origin: 50% 100%;
    transition: transform 1s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.gauge-cover {
    position: absolute;
    width: 160px;
    height: 80px;
    background: var(--surface-color);
    border-radius: 160px 160px 0 0;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 0.5rem;
}
#bmi-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}
#bmi-category {
    font-size: 1rem;
    font-weight: 500;
}

.result-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.info-card {
  background-color: var(--background-color);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  text-align: center;
}
.info-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--primary-color);
}
.info-card p {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
}
.info-card small {
  font-size: 0.8rem;
  color: #6c757d;
}
#whr-risk {
  font-size: 0.9rem;
  font-weight: bold;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}
.risk-low { background-color: #d4edda; color: #155724; }
.risk-moderate { background-color: #fff3cd; color: #856404; }
.risk-high { background-color: #f8d7da; color: #721c24; }

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-flex;
  cursor: help;
  color: #6c757d;
}
.tooltip svg {
    vertical-align: middle;
}
.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-color);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: normal;
  white-space: nowrap;
  z-index: 10;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s;
}
.tooltip::after {
  content: '';
  opacity: 0;
  visibility: hidden;
}