/* General container for the BMI Calculator - Compact & Clean Design */
#bmi-calculator-container {
  max-width: 650px;
  margin: 2rem auto; /* This centers the calculator block on the page */
  padding: 2.5rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  font-family: Arial, sans-serif;
  color: #333333;
  text-align: left; /* Ensures all content inside this container aligns LEFT by default */
}

h2 {
  color: #333333;
  margin-bottom: 2rem;
  font-size: 2.2rem;
  font-weight: bold;
  text-align: center; /* Keeping main title centered as it's a page title */
}

h3 {
  color: #555555;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: left; /* Ensures subheadings are left-aligned */
}

/* Input Section */
.input-section {
    margin-bottom: 2.5rem;
    text-align: left; /* Explicitly left-aligns content within input section */
}

.input-group {
    margin-bottom: 1.2rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: bold;
    color: #333333;
    font-size: 1rem;
    text-align: left; /* Explicitly left-aligns labels */
}

input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 1px solid #dddddd;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #f9f9f9;
    color: #333333;
    text-align: left; /* Ensures input text aligns left */
}

input[type="number"]:focus {
    border-color: #ff8c00;
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.15);
    outline: none;
    background-color: #ffffff;
}

/* Button Group */
.button-group {
  display: flex;
  justify-content: center; /* Keep buttons centered within their group */
  gap: 0.8rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.button-group button {
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  background-color: #ff8c00;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  min-width: 120px;
}

.button-group button:hover {
    background-color: #e67e00;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.button-group button:active {
    background-color: #cc7000;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Error Message */
.error-message {
    color: #e74c3c;
    font-size: 0.95rem;
    margin-top: 1rem;
    text-align: left; /* Error message should be left-aligned */
    font-weight: bold;
}

/* Output Section */
.output-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f5f5f5;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    text-align: left; /* Crucial: Align all content inside output section to the left */
}

#bmiResult {
  padding: 1rem;
  background-color: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 4px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Aligns flex items (the P tags) to the start (left) */
  justify-content: center;
  margin-bottom: 1.5rem;
  text-align: left; /* Ensures result text itself is left aligned */
}

#bmiResult .bmi-placeholder,
#bmiResult .bmi-value-display,
#bmiResult .bmi-category,
#bmiResult .bmi-advice {
    text-align: left; /* Explicitly ensure these specific result texts are left aligned */
    width: 100%; /* Ensure they take full width for alignment */
    /* Other styles like font-size, margin-bottom are maintained */
}


#bmiResult .bmi-value-display {
    font-size: 2rem;
    font-weight: bold;
    color: #333333;
    margin-bottom: 0.5rem;
}

#bmiResult .bmi-category {
    font-size: 1.2rem;
    font-weight: bold;
    color: #555555;
    margin-bottom: 0.5rem;
}

#bmiResult .bmi-advice {
    font-size: 0.85rem;
    color: #777777;
    line-height: 1.4;
    max-width: 90%;
}

/* BMI Range Bar */
.bmi-range-container {
  margin-top: 2rem;
  padding: 0 5px;
}

.bmi-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: #555555;
  font-weight: bold;
  flex-wrap: wrap;
  text-align: center; /* Keep range labels centered under their sections */
}

.bmi-range-labels span {
    flex: 1;
    text-align: center; /* Ensure labels are centered within their span */
    min-width: 60px;
}

#bmiBar {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: linear-gradient(
    to right,
    #f39c12 0%,    /* Underweight < 18.5 */
    #f39c12 18.5%,
    #2ecc71 18.5%,   /* Normal 18.5 - 24.9 */
    #2ecc71 24.9%,
    #f1c40f 24.9%,   /* Overweight 24.9 - 29.9 */
    #f1c40f 29.9%,
    #e74c3c 29.9%,   /* Obese >= 30 */
    #e74c3c 100%
  );
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}

#bmiIndicator {
  position: absolute;
  top: -3px;
  width: 5px;
  height: 24px;
  background-color: #000;
  border-radius: 2px;
  transition: left 0.5s ease-in-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 10;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #bmi-calculator-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }
    h2 {
        font-size: 1.8rem;
    }
    h3 {
        font-size: 1.3rem;
        text-align: center; /* On mobile, subheadings can be centered for better flow */
    }
    .input-group label {
        font-size: 0.95rem;
    }
    input[type="number"] {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    .button-group button {
        width: 100%;
        min-width: unset;
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }
    .button-group {
        gap: 0.6rem;
    }
    #bmiResult .bmi-value-display {
        font-size: 1.6rem;
    }
    #bmiResult .bmi-category {
        font-size: 1.1rem;
    }
    #bmiResult .bmi-advice {
        font-size: 0.8rem;
    }
    .bmi-range-labels {
        font-size: 0.7rem;
        gap: 4px;
    }
    .bmi-range-labels span {
        min-width: unset;
        flex: none;
        width: auto;
    }
    #bmiResult {
        align-items: center; /* On mobile, center the result content if preferred */
        text-align: center;
    }
    #bmiResult .bmi-value-display,
    #bmiResult .bmi-category,
    #bmiResult .bmi-advice,
    #bmiResult .bmi-placeholder {
        text-align: center; /* Center these on mobile for better readability */
    }
}

@media (max-width: 480px) {
    #bmi-calculator-container {
        padding: 1rem;
    }
    h2 {
        font-size: 1.6rem;
    }
    h3 {
        font-size: 1.2rem;
    }
    .input-group label {
        font-size: 0.85rem;
    }
    input[type="number"] {
        padding: 0.7rem;
        font-size: 0.8rem;
    }
    .button-group button {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
    #bmiResult .bmi-value-display {
        font-size: 1.4rem;
    }
    #bmiResult .bmi-category {
        font-size: 1rem;
    }
    #bmiResult .bmi-advice {
        font-size: 0.75rem;
    }
    .bmi-range-labels {
        font-size: 0.65rem;
        gap: 4px;
    }
}