/* ==========================================================================
   TakeCare website: health calculator pages (calculator-*.html)
   Loaded after site.css. Layout uses .calc / .calc-panel / .calc-result /
   .field / .segmented from site.css; the result widgets below keep the class
   names the calculators' scripts read and toggle.
   ========================================================================== */

.calc-section { padding-top: 56px; }
.calc-panel h2, .calc-result h2 { font-size: 20px; font-weight: 800; margin-bottom: 20px; }

/* Unit toggle */
.unit-toggle.segmented { display: flex; width: 100%; margin-bottom: 24px; }
.unit-toggle.segmented .unit-btn { flex: 1; }

/* Fields */
.calculator-form .field { margin-bottom: 20px; }
.calculator-form .field > label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.input-row { display: flex; gap: 12px; }
.input-with-unit { position: relative; flex: 1; }
.field .input-with-unit input { padding-right: 52px; }
.unit-label { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--muted); pointer-events: none; }
.calculator-form select { width: 100%; height: 48px; padding: 0 44px 0 14px; border: 1px solid #d3d3e2; border-radius: 10px; font: 400 16px var(--font); color: var(--ink); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d6d82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 12px center / 20px no-repeat; appearance: none; cursor: pointer; }
.calculator-form select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(86 86 224 / .15); }
.radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-option { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border: 1px solid #d3d3e2; border-radius: 10px; cursor: pointer; background: #fff; }
.radio-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.radio-option input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.radio-label { font-weight: 500; color: var(--ink); }
.calculator-form .btn-block { margin-top: 8px; }

/* Result column: placeholder until the script shows #results-card */
.calc-side { display: grid; gap: 20px; }
.calc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 360px; padding: 36px; border-radius: var(--radius); border: 1px dashed #cfcfe2; background: var(--bg-soft); text-align: center; color: var(--muted); font-size: 15px; }
.calc-empty .icon-tile { width: 52px; height: 52px; border-radius: 14px; }
.calc-empty strong { display: block; color: var(--ink); font-size: 16px; }
.calc-side:has(> .calc-result[style*="block"]) .calc-empty { display: none; }
@media (max-width: 860px) { .calc-empty { display: none; } }

/* Explanatory content below the calculator */
.calc-info .info-card + .info-card { margin-top: 2.4em; padding-top: 2em; border-top: 1px solid var(--line); }
.calc-info .info-card > h2:first-child { margin-top: 0; }
.calc-info .info-card > * + * { margin-top: 1em; }
.bf-category-header > :not(:first-child) { text-align: center; }

/* ---------- Result widgets (from the previous stylesheet, re-tokened) ---------- */
/* Results Card Styles */
.bmi-result {
    text-align: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}

.bmi-value-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.bmi-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
}

.bmi-label {
    font-size: 0.875rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bmi-category {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
}

.bmi-category.underweight {
    background: #dbeafe;
    color: #1e40af;
}

.bmi-category.normal {
    background: #dcfce7;
    color: #166534;
}

.bmi-category.overweight {
    background: #fef3c7;
    color: #92400e;
}

.bmi-category.obese {
    background: #fee2e2;
    color: #991b1b;
}

/* BMI Scale */
.bmi-scale {
    position: relative;
    margin-bottom: 24px;
}

.bmi-scale-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.bmi-scale-segment {
    flex: 1;
}

.bmi-scale-segment.underweight {
    background: #3b82f6;
}

.bmi-scale-segment.normal {
    background: #22c55e;
}

.bmi-scale-segment.overweight {
    background: #f59e0b;
}

.bmi-scale-segment.obese {
    background: #ef4444;
}

.bmi-scale-marker {
    position: absolute;
    top: -4px;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--ink);
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}

.bmi-scale-marker.underweight {
    border-color: #1e40af;
}

.bmi-scale-marker.normal {
    border-color: #166534;
}

.bmi-scale-marker.overweight {
    border-color: #92400e;
}

.bmi-scale-marker.obese {
    border-color: #991b1b;
}

.bmi-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}

.bmi-scale-labels span {
    flex: 1;
    line-height: 1.4;
}

.bmi-interpretation {
    color: var(--body);
    line-height: 1.7;
}

.bmi-interpretation p {
    margin-bottom: 12px;
}

.bmi-interpretation p:last-child {
    margin-bottom: 0;
}


/* BMI Categories List */
.bmi-categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bmi-category-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bmi-category-item.underweight .category-dot {
    background: #3b82f6;
}

.bmi-category-item.normal .category-dot {
    background: #22c55e;
}

.bmi-category-item.overweight .category-dot {
    background: #f59e0b;
}

.bmi-category-item.obese .category-dot {
    background: #ef4444;
}

.category-info {
    display: flex;
    flex-direction: column;
}

.category-info strong {
    font-size: 0.925rem;
    color: var(--ink);
}

.category-info span {
    font-size: 0.825rem;
    color: var(--muted);
}

/* BMR Calculator Styles */
.bmr-result,
.tdee-result,
.ideal-weight-summary {
    text-align: center;
    padding: 30px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}

.bmr-value-container,
.tdee-value-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bmr-value,
.tdee-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1;
}

.bmr-unit,
.tdee-unit {
    font-size: 1.125rem;
    color: var(--muted);
    font-weight: 500;
}

.bmr-description,
.tdee-description {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.925rem;
}

.formula-comparison {
    margin-bottom: 24px;
}

.formula-comparison h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--ink);
}

.formula-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.formula-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-soft);
    border-radius: 12px;
}

.formula-name {
    font-weight: 500;
    color: var(--ink);
}

.formula-value {
    font-weight: 600;
    color: var(--brand);
}

.bmr-interpretation h3,
.tdee-interpretation h3,
.ideal-weight-interpretation h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--ink);
}

.bmr-interpretation p,
.tdee-interpretation p,
.ideal-weight-interpretation p {
    margin-bottom: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.result-note {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 0 12px 12px 0;
    margin-top: 16px;
}

.result-note strong {
    color: #92400e;
}

/* TDEE Calculator Styles */
.calorie-goals {
    margin-bottom: 24px;
}

.calorie-goals h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--ink);
}

.goal-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.goal-card {
    text-align: center;
    padding: 16px 12px;
    border-radius: 12px;
    background: var(--bg-soft);
}

.goal-card.lose {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.goal-card.maintain {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.goal-card.gain {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.goal-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--body);
}

.goal-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.goal-note {
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 4px;
}

.tdee-breakdown {
    margin-bottom: 24px;
}

.tdee-breakdown h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--ink);
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.breakdown-label {
    color: var(--muted);
}

.breakdown-value {
    font-weight: 600;
    color: var(--ink);
}

/* Activity Guide Styles */
.activity-guide {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item strong {
    display: block;
    color: var(--ink);
    margin-bottom: 4px;
}

.activity-item p {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}

/* Formula Explanation Styles */
.formula-explanation h4 {
    font-size: 0.925rem;
    margin: 16px 0 8px;
    color: var(--ink);
}

.formula-explanation h4:first-child {
    margin-top: 0;
}

.formula-explanation p {
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.formula-explanation ul {
    font-size: 0.825rem;
    color: var(--muted);
    padding-left: 20px;
    list-style: disc;
}

.formula-explanation li {
    margin-bottom: 4px;
}

/* Ideal Weight Calculator Styles */
.weight-range-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.range-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand);
}

.range-label {
    font-size: 0.925rem;
    color: var(--muted);
}

.formula-results-grid {
    margin-bottom: 24px;
}

.formula-results-grid h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--ink);
}

.formula-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-soft);
    border-radius: 12px;
    margin-bottom: 10px;
}

.formula-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.formula-info .formula-name {
    font-weight: 600;
    font-size: 0.925rem;
}

.formula-info .formula-desc {
    font-size: 0.75rem;
    color: var(--muted);
}

/* Body Fat Calculator Styles */
.body-fat-result {
    text-align: center;
    padding: 30px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}

.body-fat-value-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.body-fat-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1;
}

.body-fat-unit {
    font-size: 1.125rem;
    color: var(--muted);
    font-weight: 500;
}

.body-fat-category {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.925rem;
}

.body-fat-category.essential {
    background: #fef3c7;
    color: #92400e;
}

.body-fat-category.athletic {
    background: #d1fae5;
    color: #065f46;
}

.body-fat-category.fitness {
    background: #dbeafe;
    color: #1e40af;
}

.body-fat-category.average {
    background: #e0e7ff;
    color: #3730a3;
}

.body-fat-category.obese {
    background: #fee2e2;
    color: #991b1b;
}

/* Body Fat Scale */
.body-fat-scale {
    position: relative;
    margin: 30px 0;
}

.body-fat-scale-bar {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.bf-scale-segment {
    flex: 1;
}

.bf-scale-segment.essential {
    background: #fcd34d;
}

.bf-scale-segment.athletic {
    background: #34d399;
}

.bf-scale-segment.fitness {
    background: #60a5fa;
}

.bf-scale-segment.average {
    background: #a78bfa;
}

.bf-scale-segment.obese {
    background: #f87171;
}

.body-fat-scale-marker {
    position: absolute;
    top: -8px;
    width: 16px;
    height: 36px;
    background: var(--ink);
    border-radius: 8px;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: left 0.5s ease;
}

.body-fat-scale-marker.essential {
    background: #b45309;
}

.body-fat-scale-marker.athletic {
    background: #047857;
}

.body-fat-scale-marker.fitness {
    background: #1d4ed8;
}

.body-fat-scale-marker.average {
    background: #5b21b6;
}

.body-fat-scale-marker.obese {
    background: #b91c1c;
}

.body-fat-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.7rem;
    color: var(--muted);
    text-align: center;
}

.body-fat-scale-labels span {
    flex: 1;
    line-height: 1.3;
}

/* Body Composition */
.body-composition {
    margin-bottom: 24px;
}

.body-composition h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--ink);
}

.composition-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.composition-item {
    background: var(--bg-soft);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.composition-label {
    display: block;
    font-size: 0.825rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.composition-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.body-fat-interpretation h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--ink);
}

.body-fat-interpretation p {
    margin-bottom: 12px;
    color: var(--muted);
    line-height: 1.6;
}

/* Body Fat Categories Table */
.bf-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bf-category-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.bf-category-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    order: -1;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--line);
}

.bf-cat-name {
    font-weight: 500;
    color: var(--ink);
}

.bf-cat-male,
.bf-cat-female {
    font-size: 0.875rem;
    color: var(--muted);
    text-align: center;
}

/* Measurement Guide */
.measurement-guide {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.measurement-item strong {
    display: block;
    color: var(--ink);
    margin-bottom: 4px;
}

.measurement-item p {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}

.tip {
    font-size: 0.825rem;
    color: var(--brand);
    font-style: italic;
}

/* Radio Group Styles */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--brand);
}

.radio-label {
    font-weight: 500;
    color: var(--ink);
}

/* ---------- Small screens ---------- */
@media (max-width: 768px) {
    .calc-panel, .calc-result { padding: 22px; }
    .bmi-value, .bmr-value, .tdee-value, .body-fat-value { font-size: 3rem; }
    .bmi-scale-labels, .body-fat-scale-labels { font-size: 0.7rem; }
    .goal-cards { grid-template-columns: 1fr; gap: 8px; }
    .range-value { font-size: 1.5rem; }
}
@media (max-width: 480px) {
    .input-row { flex-direction: column; }
    .radio-group { flex-direction: column; }
    .composition-items { grid-template-columns: 1fr; }
    .bf-category-row, .bf-category-header { font-size: 0.75rem; }
}
