﻿:root {
    /* --- COLORS --- */
    --primary-blue: rgb(0, 64, 128);
    --bg-white: rgb(255, 255, 255);
    --row-odd: rgb(240, 248, 255);
    --border-color: rgb(70, 180, 220);
    --table-border: rgb(0, 64, 128);
    /* Focus Color (Light Green as requested) */
    --focus-bg: rgb(220, 255, 225);
    /* Gender Colors */
    --male-bg: rgb(64, 156, 255);
    --male-border: rgb(0, 90, 180);
    --female-bg: rgb(199, 21, 133);
    --female-border: rgb(139, 0, 139);
    --gender-text: rgb(255, 255, 255);
    --gender-unselected-bg: rgb(245, 245, 245);
    /* Validation */
    --error-red: rgb(220, 53, 69);
    --success-bg: rgb(200, 240, 220);
    /* UI Elements */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-white);
    padding: 10px;
    padding-bottom: 120px; /* Point 11: Extra space for fixed buttons */
    color: var(--primary-blue);
    line-height: 1.4;
}

.thyroid-container {
    max-width: 1000px;
    margin: 0 auto;
    /* Point 11: Push shared layout footer down */
    margin-bottom: 500px;
    background-color: rgb(205, 235, 245);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 2px solid var(--table-border);
    overflow: hidden;
}

.thyroid-header {
    background-color: rgb(50, 110, 130);
    color: white; /* Point 7: Force white text */
    padding: 15px;
    text-align: center;
}

    .thyroid-header h1 {
        font-size: 1.4rem;
        margin: 0;
        color: white;
    }

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    color: #f0f0f0;
}

.thyroid-main {
    padding: 15px;
}

.thyroid-form {
    display: grid;
    gap: 12px;
}

/* --- PC LAYOUT (Strict Grid Areas) --- */
@media (min-width: 769px) {
    .thyroid-form {
        grid-template-columns: 1fr 1fr;
        /* Points 1-5: Strict Rows */
        grid-template-areas:
            "gender pregnant"
            "age    tsh"
            "ft3    ft4"
            "hgb    hct"
            "weight height";
        gap: 15px;
    }

    /* Assign Areas */
    .area-gender {
        grid-area: gender;
    }

    .area-pregnant {
        grid-area: pregnant;
    }

    .area-age {
        grid-area: age;
    }

    .area-tsh {
        grid-area: tsh;
    }

    .area-ft3 {
        grid-area: ft3;
    }

    .area-ft4 {
        grid-area: ft4;
    }

    .area-hgb {
        grid-area: hgb;
    }

    .area-hct {
        grid-area: hct;
    }

    .area-weight {
        grid-area: weight;
    }

    .area-height {
        grid-area: height;
    }

    .input-group {
        padding: 5px 12px;
        min-height: 70px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

        .input-group label {
            font-size: 14px;
            margin-bottom: 2px;
        }

        .input-group input {
            font-size: 22px;
            height: 35px;
        }

    .gender-label {
        padding: 5px;
        min-height: 40px;
        font-size: 16px;
    }
}

/* --- MOBILE LAYOUT --- */
/* --- MOBILE LAYOUT --- */
@media (max-width: 768px) {
    .thyroid-form {
        grid-template-columns: 1fr;
        gap: 20px; /* Increased gap slightly for touch targets */
        grid-template-areas: none;
    }

    /* 1. Standard Input Fields Enlarge */
    .input-group {
        padding: 15px;
        min-height: 100px;
    }

        .input-group label {
            font-size: 18px;
            margin-bottom: 8px;
        }

        .input-group input {
            font-size: 28px;
            height: 45px;
        }

    /* 2. GENDER BUTTONS FIX */
    .area-gender {
        width: 100%;
        margin-bottom: 10px;
    }

    .gender-options {
        display: flex;
        width: 100%; /* Force container to full width */
        gap: 15px; /* Space between buttons */
        justify-content: space-between;
    }

    .gender-option {
        flex: 1; /* This forces them to split the width 50/50 */
    }

    .gender-label {
        width: 100%; /* Ensure label fills the option container */
        padding: 0; /* Reset padding to center text better with flex */
        font-size: 22px; /* Larger text */
        height: 70px; /* Taller button for easier tapping */
        display: flex !important;
        align-items: center; /* Centers vertically (Height) */
        justify-content: center; /* Centers horizontally (Width) */
        line-height: 1;
        text-align: center;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle lift */
    }

    /* 3. PREGNANT CHECKBOX FIX */
    .area-pregnant.clinical-context {
        padding: 10px 5px; /* Add breathing room */
        min-height: 60px;
        display: flex;
        align-items: center;
        /* "Shift left" logic: ensure it aligns with other inputs */
        justify-content: flex-start;
    }

    .checkbox-option {
        gap: 15px; /* Space between box and text */
        width: 100%;
        /* Make the whole row clickable/tappable */
        padding: 10px;
        background-color: rgba(240, 248, 255, 0.5); /* Very faint background to show click area */
        border-radius: var(--radius);
    }

        .checkbox-option input {
            /* Make the actual box HUGE */
            width: 35px;
            height: 35px;
            min-width: 35px; /* Prevent squishing */
            accent-color: var(--female-bg); /* Use the pink color for the check */
        }

        .checkbox-option label {
            font-size: 22px; /* Much larger text */
            font-weight: 600;
            color: var(--primary-blue);
        }
}

/* --- COMPONENT STYLES --- */
.input-group {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    transition: background-color 0.2s, border-color 0.2s;
    position: relative;
}

    /* Point 10: Light Green Background on Focus */
    .input-group:focus-within {
        border-color: rgb(40, 167, 69);
        background-color: var(--focus-bg);
    }

    .input-group label {
        font-weight: 600;
        color: var(--primary-blue);
        display: block;
    }

    /* Reverting to standard clean input style */
    .input-group input {
        width: 100%;
        border: none;
        background: transparent;
        font-weight: bold;
        color: var(--primary-blue);
        outline: none;
        padding-right: 10px;
        /* Standard Mobile Support */
        opacity: 1;
        -webkit-text-fill-color: var(--primary-blue);
    }

/* --- HINTS & ERRORS --- */

/* Point 8: Increase "Normal around" font size */
.field-hint {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 13px; /* Increased from 11px */
    font-weight: 500;
    color: rgb(100, 100, 100);
    pointer-events: none;
}

.text-danger, .input-error {
    display: block;
    position: absolute;
    bottom: 4px;
    right: 10px;
    font-size: 12px;
    color: var(--error-red);
    font-weight: bold;
    text-align: right;
    pointer-events: none;
    white-space: nowrap;
}

/* Gender Styles */
.gender-options {
    display: flex;
    gap: 10px;
    height: 100%;
    align-items: center;
}

.gender-option {
    flex: 1;
    position: relative;
}

    .gender-option input {
        position: absolute;
        opacity: 0;
    }

.gender-label {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gender-unselected-bg);
    border: 2px solid rgb(180, 180, 180);
    border-radius: var(--radius);
    color: rgb(80, 80, 80);
    cursor: pointer;
    font-weight: 600;
    width: 100%;
}

input[type="radio"]:checked + .male-label {
    background: var(--male-bg);
    border-color: var(--male-border);
    color: var(--gender-text);
}

input[type="radio"]:checked + .female-label {
    background: var(--female-bg);
    border-color: var(--female-border);
    color: var(--gender-text);
}

/* Pregnant Checkbox */
.area-pregnant.clinical-context {
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    padding-left: 10px;
}
/* Ensure it stays valid/invalid in the grid even if hidden content */
.area-pregnant:empty {
    border: 2px dashed #eee; /* Optional: show placeholder or keep transparent */
    background: #f9f9f9;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .checkbox-option input {
        width: 24px;
        height: 24px;
        cursor: pointer;
        accent-color: var(--female-bg);
    }

    .checkbox-option label {
        font-size: 16px;
        cursor: pointer;
    }

/* Validation Border */
.input-group.invalid {
    border-color: var(--error-red);
    background-color: rgb(255, 245, 245);
}

/* Buttons */
.action-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: transparent;
    z-index: 9999;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    pointer-events: none;
}

.btn {
    pointer-events: auto;
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-primary {
    background-color: var(--primary-blue);
    color: rgb(255, 255, 0);
    order: 2;
}

/* Point 6: Clear Button - Grey x Deep Green with transparency */
.btn-secondary {
    background-color: rgba(60, 90, 80, 0.9); /* Deep Green-Grey Mix */
    color: white;
    order: 1;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
}

    .btn-secondary:hover {
        background-color: rgba(60, 90, 80, 1);
    }

.result-container {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: var(--radius);
    background-color: var(--success-bg);
    border: 2px solid rgb(25, 135, 84);
}
/* Add to your CSS file */
.disclaimer-section {
    margin-top: 10px;
    padding-top: 10px;
    padding-left: 5px;
    text-align: left;
    font-size: 16px;
    color: rgb(100, 0, 150);
    border-top: 1px solid #eee; /* Subtle separator line */
    font-weight: 500;
}

.result-container {
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.dosage-info {
    text-align: left;
    padding: 1rem;
}

    .dosage-info strong {
        color: rgb(0, 64, 128) !important;
        display: block;
        margin-bottom: 0.5rem;
        font-size: 1.1rem;
    }

.badge-dose {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: bold;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-size: 1.5rem;
}

.badge-dose-normal {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.badge-dose-high {
    background: linear-gradient(135deg, #87ceeb, #4169e1);
    color: white;
    border: 2px solid #1e90ff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

    .badge-dose-high.badge-size-1 {
        font-size: 1.8rem;
        background: linear-gradient(135deg, #7ec8e3, #355ac7);
    }

    .badge-dose-high.badge-size-2 {
        font-size: 2rem;
        background: linear-gradient(135deg, #6dc1dc, #2a4bb3);
    }

    .badge-dose-high.badge-size-3 {
        font-size: 2.2rem;
        background: linear-gradient(135deg, #5cb9d4, #1f3c9f);
    }

    .badge-dose-high.badge-size-4 {
        font-size: 2.5rem;
        background: linear-gradient(135deg, #4ab2cc, #142d8b);
    }

.badge-dose-low {
    background: linear-gradient(135deg, #ffb347, #ff8c00);
    color: white;
    border: 2px solid #ff9500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

    .badge-dose-low.badge-size-1 {
        font-size: 1.8rem;
        background: linear-gradient(135deg, #ffaa3e, #f58200);
    }

    .badge-dose-low.badge-size-2 {
        font-size: 2rem;
        background: linear-gradient(135deg, #ffa135, #eb7800);
    }

    .badge-dose-low.badge-size-3 {
        font-size: 2.2rem;
        background: linear-gradient(135deg, #ff982c, #e16e00);
    }

    .badge-dose-low.badge-size-4 {
        font-size: 2.5rem;
        background: linear-gradient(135deg, #ff8f23, #d76400);
    }

