/* AH Weight Screening — front-end styles */

.ahws-card {
    --ahws-primary: #111111;
    --ahws-accent: #ecf5e3;
    --ahws-border: #e6e8ec;
    --ahws-muted: #8a94a6;
    --ahws-track: #e3e6eb;
    box-sizing: border-box;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(20, 32, 58, 0.08);
    font-family: inherit;
    color: var(--ahws-primary);
    -webkit-font-smoothing: antialiased;
}

.ahws-card *,
.ahws-card *::before,
.ahws-card *::after {
    box-sizing: border-box;
}

/* Per-step card widths. */
.ahws-card.ahws-step1 {
    max-width: 420px;
}

.ahws-card.ahws-step2,
.ahws-card.ahws-form-card {
    max-width: 800px;
}

/* ----------------------------------------------------------------------- *
 * Buttons
 * ----------------------------------------------------------------------- */
.ahws-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 24px;
    border: 0;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: linear 0.2s ease;
    font-family: inherit;
    text-transform: unset;
    background: var(--ahws-primary);
    color: #fff;
}

.ahws-btn:active {
    transform: translateY(1px);
}

.ahws-btn-ghost {
    width: auto;
    background: transparent;
    color: var(--ahws-muted);
    font-weight: 600;
    padding: 18px 18px;
}

.ahws-btn-ghost:hover,
.ahws-btn-ghost:focus {
    color: var(--ahws-primary);
    background: transparent;
}

.ahws-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ahws-arrow {
    font-size: 1.1em;
}

/* ----------------------------------------------------------------------- *
 * Range sliders (shared)
 * ----------------------------------------------------------------------- */
.ahws-slider-wrap {
    margin: 26px 0 8px;
}

.ahws-card .ahws-range {
    -webkit-appearance: none !important;
    appearance: none !important;
    accent-color: auto;
    width: 100%;
    height: 16px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background-color: var(--ahws-track) !important;
    box-shadow: none !important;
    filter: none !important;
    outline: none;
    margin: 6px 0 4px;
    /* --ahws-fill is updated by JS to show progress */
    background-image: linear-gradient(
        var(--ahws-primary),
        var(--ahws-primary)
    ) !important;
    background-repeat: no-repeat !important;
    background-size: var(--ahws-fill, 0%) 100% !important;
}

.ahws-card .ahws-range-light {
    height: 16px !important;
}

/* Neutralise any native track styling the theme may add, and pin an explicit
   height so the thumb can be centred deterministically. */
.ahws-card .ahws-range::-webkit-slider-runnable-track,
.ahws-card .ahws-range-light::-webkit-slider-runnable-track {
    -webkit-appearance: none !important;
    height: 16px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
.ahws-card .ahws-range::-moz-range-track,
.ahws-card .ahws-range-light::-moz-range-track {
    height: 16px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Both steps share the same large grab handle with a grip (||) icon.
   Scoped under .ahws-card + !important so the theme's own range-thumb
   styling (e.g. the green native accent-color thumb) cannot win. */
.ahws-card .ahws-range::-webkit-slider-thumb,
.ahws-card .ahws-range-light::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 42px !important;
    height: 42px !important;
    margin-top: -13px !important; /* centre 42px thumb on 16px track */
    border-radius: 50% !important;
    border: 0 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='20'%3E%3Cg%20stroke='%2316243d'%20stroke-width='2'%20stroke-linecap='round'%3E%3Cline%20x1='8'%20y1='6'%20x2='8'%20y2='14'/%3E%3Cline%20x1='12'%20y1='6'%20x2='12'%20y2='14'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    box-shadow: 0 4px 12px rgba(20, 32, 58, 0.18) !important;
    cursor: grab !important;
}

.ahws-card .ahws-range::-moz-range-thumb,
.ahws-card .ahws-range-light::-moz-range-thumb {
    -moz-appearance: none !important;
    appearance: none !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    border: 0 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='20'%3E%3Cg%20stroke='%2316243d'%20stroke-width='2'%20stroke-linecap='round'%3E%3Cline%20x1='8'%20y1='6'%20x2='8'%20y2='14'/%3E%3Cline%20x1='12'%20y1='6'%20x2='12'%20y2='14'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    box-shadow: 0 4px 12px rgba(20, 32, 58, 0.18) !important;
    cursor: grab !important;
}

.ahws-range:active::-webkit-slider-thumb {
    cursor: grabbing;
}

.ahws-slider-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    color: var(--ahws-muted);
    font-size: 13px;
    font-weight: 600;
}

/* ----------------------------------------------------------------------- *
 * Step 1 — current weight
 * ----------------------------------------------------------------------- */
.ahws-step1-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ahws-step1-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.ahws-step1-value {
    font-weight: 800;
    line-height: 1;
}

.ahws-weight-num {
    font-size: 32px;
}

.ahws-unit {
    font-size: 16px;
    color: var(--ahws-muted);
    margin-left: 4px;
    font-weight: 800;
}

.ahws-loss-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 30px 0;
    padding: 20px;
    background: var(--ahws-accent);
    border: 1px solid rgba(20, 32, 58, 0.05);
    border-radius: 18px;
}

.ahws-loss-label {
    font-size: 20px;
    font-weight: 800;
    max-width: 7em;
    margin: 0;
}

.ahws-loss-value {
    font-size: 50px;
    font-weight: 800;
    line-height: 1;
}

.ahws-footnote {
    margin: 22px 0 0;
    text-align: center;
    color: var(--ahws-muted);
    font-size: 13px;
    line-height: 1.55;
}

/* ----------------------------------------------------------------------- *
 * Step 2 — BMI calculator
 * ----------------------------------------------------------------------- */
.ahws-step2-title {
    margin: 0 0 24px;
    font-size: 28px;
    font-weight: 800;
}

.ahws-step2-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    align-items: start;
}

.ahws-bmi-control {
    margin-bottom: 26px;
}

.ahws-bmi-control-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.ahws-bmi-label {
    font-weight: 800;
    font-size: 16px;
    margin: 0;
}

.ahws-bmi-input-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--ahws-border);
    border-radius: 10px;
    padding: 6px 10px;
    background: #fff;
}

.ahws-bmi-input {
    border: 0 !important;
    outline: none;
    padding: 0 !important;
    font-size: 16px;
    font-weight: 600;
    text-align: right;
    color: var(--ahws-primary) !important;
    background: transparent !important;
    font-family: inherit;
}

/* Hide number-spinners for a cleaner look */
.ahws-bmi-input::-webkit-outer-spin-button,
.ahws-bmi-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ahws-bmi-input {
    -moz-appearance: textfield;
}

.ahws-bmi-input-unit {
    color: var(--ahws-muted);
    font-size: 14px;
    font-weight: 800;
}

.ahws-bmi-help {
    margin: 0;
    color: var(--ahws-muted);
    font-size: 14px;
    font-weight: 800;
}

.ahws-step2-result {
    background: var(--ahws-accent);
    border-radius: 18px;
    padding: 30px;
}

.ahws-result-label {
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.02em;
    margin: 0;
}

.ahws-result-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 2px;
}

.ahws-result-unit {
    font-size: 16px;
}

.ahws-result-sub {
    display: block;
    color: var(--ahws-muted);
    font-size: 14px;
    margin-top: 2px;
    font-weight: 800;
}

/* Static decorative separator under the BMI value. */
.ahws-result-bar {
    width: 48px;
    height: 4px;
    background: var(--ahws-primary);
    border-radius: 999px;
    margin: 30px 0;
    overflow: hidden;
}

.ahws-result-bar span {
    display: none;
}

.ahws-result-category {
    margin: 0 0 18px;
    font-weight: 700;
    font-size: 15px;
    min-height: 1.2em;
}

.ahws-result-heading {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}

.ahws-result-text {
    margin: 0 0 20px;
    color: var(--ahws-primary);
    font-size: 14px;
    line-height: 1.25;
}

/* ----------------------------------------------------------------------- *
 * Screening form
 * ----------------------------------------------------------------------- */
.ahws-progress {
    margin-bottom: 26px;
}

.ahws-progress-bar {
    height: 8px;
    background: var(--ahws-track);
    border-radius: 999px;
    overflow: hidden;
}

.ahws-progress-bar span {
    display: block;
    height: 100%;
    width: 7%;
    background: var(--ahws-primary);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.ahws-progress-text {
    margin-top: 10px;
    color: var(--ahws-muted);
    font-size: 14px;
    font-weight: 800;
}

.ahws-form-step {
    display: none;
    animation: ahws-fade 0.25s ease;
}

.ahws-form-step.is-active {
    display: block;
}

@keyframes ahws-fade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ahws-form-step-title {
    margin: 0 0 24px;
    font-size: 28px;
    font-weight: 800;
}

.ahws-question {
    margin-bottom: 26px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--ahws-border);
}

.ahws-question:last-of-type {
    border-bottom: 0;
    margin-bottom: 8px;
}

.ahws-question.is-hidden {
    display: none;
}

.ahws-question-label {
    margin: 0 0 4px !important;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.4;
}

.ahws-req {
    color: #d2392b;
    margin-left: 2px;
}

.ahws-question-help {
    margin: 0 0 14px;
    color: var(--ahws-muted);
    font-size: 14px;
    font-weight: 800;
}

.ahws-question-field {
    margin-top: 12px;
}

/* Choices */
.ahws-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ahws-choice {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--ahws-border);
    border-radius: 12px;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        background 0.15s ease;
    font-size: 16px;
    line-height: 1.4;
}

.ahws-choice:hover {
    border-color: #c3cbd8;
}

.ahws-choice input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ahws-choice-box {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 2px solid #c3cbd8;
    border-radius: 6px;
    position: relative;
    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.ahws-choices-radio .ahws-choice-box {
    border-radius: 50%;
}

.ahws-choice-box::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.ahws-choices-checkbox .ahws-choice-box::after {
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.ahws-choices-radio .ahws-choice-box::after {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
}

.ahws-choice input:checked ~ .ahws-choice-box {
    background: var(--ahws-primary);
    border-color: var(--ahws-primary);
}

.ahws-choice input:checked ~ .ahws-choice-box::after {
    opacity: 1;
}

.ahws-choice input:checked ~ .ahws-choice-text {
    font-weight: 600;
}

.ahws-choice:has(input:checked) {
    border-color: var(--ahws-primary);
    background: rgba(20, 32, 58, 0.03);
}

.ahws-choice input:focus-visible ~ .ahws-choice-box {
    box-shadow: 0 0 0 3px rgba(20, 32, 58, 0.2);
}

/* Text inputs */
.ahws-text,
.ahws-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--ahws-border);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    color: var(--ahws-primary);
    background: #fff;
    transition: border-color 0.15s ease;
}

.ahws-text:focus,
.ahws-textarea:focus {
    outline: none;
    border-color: var(--ahws-primary);
}

.ahws-textarea {
    resize: vertical;
    min-height: 90px;
}

/* Invalid state */
.ahws-question.ahws-invalid .ahws-question-label {
    color: #d2392b;
}

.ahws-question.ahws-invalid .ahws-choice,
.ahws-question.ahws-invalid .ahws-text,
.ahws-question.ahws-invalid .ahws-textarea {
    border-color: #e6a59f;
}

/* Nav */
.ahws-form-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
}

.ahws-form-nav .ahws-btn-next,
.ahws-form-nav [data-ahws-next] {
    margin-left: auto;
    width: auto;
}

.ahws-form-error {
    margin-top: 18px;
    padding: 12px 16px;
    background: #fdeceb;
    border: 1px solid #f3b9b3;
    color: #b32d20;
    border-radius: 10px;
    font-size: 15px;
}

/* Success */
.ahws-form-success {
    text-align: center;
    padding: 30px 10px;
}

.ahws-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--ahws-accent);
    color: #1f8a4c;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ahws-form-success h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
}

.ahws-form-success p {
    margin: 0;
    color: var(--ahws-muted);
    font-weight: 800;
    font-size: 16px;
}

/* ----------------------------------------------------------------------- *
 * Responsive
 * ----------------------------------------------------------------------- */
@media (max-width: 640px) {
    .ahws-step2-grid {
        grid-template-columns: 1fr;
    }
    /* 
    .ahws-card {
        border-radius: 16px;
        padding: 20px 16px;
    }

    .ahws-form-nav {
        flex-wrap: wrap;
    }

    .ahws-form-nav [data-ahws-next] {
        width: 100%;
        min-width: 0;
    }

    .ahws-btn {
        font-size: 16px;
        padding: 16px 20px;
    } */
}
