/* BMI Calculator Widget Styles */

.calc-container {
    --primary-color: #6b97c0;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-radius: 12px;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);

    /* BMI Colors */
    --color-underweight: #87b1d9;
    --color-healthy: #3dd365;
    --color-overweight: #eee133;
    --color-obese: #f95e5e;
}

.calc-container * {
    box-sizing: border-box;
}

.calc-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Header */
.calc-header {
    background: #25456A;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.calc-header h2 {
    color: #ffffff;
    margin-bottom: 10px;
    margin-top: 0;
}

.calc-header p {
    margin: 0;
    color: #ffffff;
}

.header-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-image img {
    max-height: 80px;
    height: 80px;
    width: auto;
    display: block;
}

/* Body Layout */
.calc-body {
    display: flex;
    flex-wrap: wrap;
}

.calc-inputs, .calc-results {
    padding: 30px;
    flex: 1;
    min-width: 300px;
}

.calc-inputs {
    border-right: 1px solid #eee;
}

/* Inputs */
.input-group {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.input-group.active {
    display: block;
}

.input-field {
    margin-bottom: 20px;
}

.input-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-wrapper input.error {
    border-color: #e74c3c;
    border-width: 2px;
}

.input-wrapper .suffix {
    position: absolute;
    right: 45px;
    color: #888;
    pointer-events: none;
}

.flex-row {
    display: flex;
    gap: 15px;
}

.error-msg {
    color: #e74c3c;
    font-size: 0.8rem;
    display: none; /* Controlled by JS */
    margin-top: 5px;
}

.error-msg.show {
    display: block;
}

/* Button */
.calc-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.calc-button:hover {
    background-color: #25456A;
}

/* Results */
.calc-results {
    background-color: #fcfcfc;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.result-placeholder {
    text-align: center;
    color: #aaa;
}

.hidden {
    display: none !important;
}

.bmi-score {
    text-align: center;
}

.bmi-score .label {
    font-size: 0.9rem;
    color: #666;
}

.bmi-score h3 {
    font-size: 3rem;
    color: var(--primary-color);
    margin: 10px 0;
}

.bmi-category {
    margin-bottom: 30px;
    font-size: 1.1rem;
    text-align: center;
}

.bmi-category .label {
    color: #666;
}

/* Visual Bar Chart */
.bmi-chart {
    margin: 30px 0;
    position: relative;
}

.chart-bar {
    height: 15px;
    width: 100%;
    border-radius: 10px;
    background: linear-gradient(to right,
    var(--color-underweight) 0% 18.5%,
    var(--color-healthy) 18.5% 49%,
    var(--color-overweight) 49% 70%,
    var(--color-obese) 70% 100%);
    position: relative;
}

.marker {
    position: absolute;
    top: -25px; /* Sits on top of bar */
    left: 0; /* JS will update this */
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.5s ease-out;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #777;
}

.healthy-range {
    margin-top: 20px;
    padding: 15px;
    background: #ecf0f1;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.healthy-range p {
    margin: 0;
}

/* Mobile Tweak */
@media (max-width: 700px) {
    .calc-body {
        flex-direction: column;
    }
    .calc-inputs {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    .calc-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
