/* ── Registration flow component styles ────────────────────────────────────
   Uses Tessera brand tokens from landing.css. Follows GOV.UK question-per-page
   UX pattern with Tessera visual language (rounded corners, blue/terracotta).
   ────────────────────────────────────────────────────────────────────────── */

/* Back link */
.reg-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.875rem;
    color: #4468BC;
    text-decoration: none;
    margin-bottom: 1.5rem;
}
.reg-back-link:hover { text-decoration: underline; }

/* Fieldset reset — the legend IS the h1 */
.reg-fieldset {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.reg-legend {
    padding: 0;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: #1E293B;
    margin-bottom: 0.5rem;
}

.reg-hint {
    font-size: 0.9375rem;
    color: #1E293B;
    opacity: 0.55;
    line-height: 1.55;
    margin-bottom: 1.75rem;
    max-width: 52ch;
}

/* Error summary — GOV.UK pattern, Tessera colour */
.reg-error-summary {
    border-left: 4px solid #DC2626;
    background: #FEF2F2;
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}
.reg-error-summary__title {
    font-size: 1rem;
    font-weight: 600;
    color: #DC2626;
    margin: 0 0 0.5rem;
}
.reg-error-summary__list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9375rem;
}
.reg-error-summary__list li { margin-bottom: 0.2rem; }
.reg-error-summary__list a { color: #DC2626; }

/* Per-field error message */
.reg-error-message {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #DC2626;
    margin-bottom: 0.5rem;
}

/* Radio group */
.reg-radios { list-style: none; margin: 0; padding: 0; }

/* Each radio option is a full-width card label */
label.reg-radio-item {
    display: grid;
    grid-template-columns: 1.25rem 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 1rem 1.125rem;
    border: 1.5px solid rgba(30, 41, 59, 0.14);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
label.reg-radio-item:last-child { margin-bottom: 0; }
label.reg-radio-item:hover { border-color: rgba(68, 104, 188, 0.5); }

/* Checked state — blue border + tint */
label.reg-radio-item:has(.reg-radio-input:checked) {
    border-color: #4468BC;
    background-color: #EBF0FA;
}

/* Focus ring on the card when radio is focused */
label.reg-radio-item:has(.reg-radio-input:focus-visible) {
    outline: 3px solid #4468BC;
    outline-offset: 2px;
}

/* Error state — red border on the card group */
.reg-radios--error label.reg-radio-item {
    border-color: rgba(220, 38, 38, 0.35);
}
.reg-radios--error label.reg-radio-item:has(.reg-radio-input:checked) {
    border-color: #4468BC;
    background-color: #EBF0FA;
}

.reg-radio-input {
    margin-top: 3px;
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    accent-color: #4468BC;
    cursor: pointer;
}

.reg-radio-text {
    font-size: 0.9375rem;
    line-height: 1.45;
    color: #1E293B;
}

/* Pain score — compact horizontal numbers on wider screens */
.reg-radios--scale {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
@media (min-width: 480px) {
    .reg-radios--scale { flex-direction: row; gap: 0.5rem; }

    .reg-radios--scale label.reg-radio-item {
        flex: 1;
        flex-direction: column;
        grid-template-columns: 1fr;
        align-items: center;
        justify-items: center;
        text-align: center;
        padding: 1.125rem 0.75rem;
        gap: 0.375rem;
    }

    .reg-radios--scale .reg-radio-input { margin-top: 0; }

    .reg-radios--scale .reg-radio-text {
        font-size: 0.8125rem;
        line-height: 1.3;
        opacity: 0.7;
    }
}

/* Continue button — Terracotta primary */
.reg-continue-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #E35335;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(227, 83, 53, 0.2);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    min-height: 44px;
}
.reg-continue-btn:hover {
    background-color: #C4412A;
    box-shadow: 0 4px 18px rgba(227, 83, 53, 0.3);
}
.reg-continue-btn:focus-visible {
    outline: 3px solid #4468BC;
    outline-offset: 3px;
}

/* Check-your-answers summary list */
.reg-summary-list {
    border-top: 1px solid rgba(30, 41, 59, 0.1);
    margin-bottom: 2.5rem;
}
.reg-summary-list__row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 1rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(30, 41, 59, 0.08);
    align-items: baseline;
    font-size: 0.9375rem;
}
.reg-summary-list__key {
    font-weight: 500;
    color: #1E293B;
}
.reg-summary-list__value {
    color: #1E293B;
    opacity: 0.75;
}
.reg-summary-list__action a {
    color: #4468BC;
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
}
.reg-summary-list__action a:hover { text-decoration: underline; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Not-answered pill */
.reg-not-answered {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #1E293B;
    opacity: 0.38;
    font-style: italic;
}

/* Step actions row */
.reg-actions {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* ── Checkbox group (feature priorities) ────────────────────────────────── */
.reg-checkboxes { list-style: none; margin: 0; padding: 0; }

label.reg-checkbox-item {
    display: grid;
    grid-template-columns: 1.25rem 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 1rem 1.125rem;
    border: 1.5px solid rgba(30, 41, 59, 0.14);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
label.reg-checkbox-item:last-child { margin-bottom: 0; }
label.reg-checkbox-item:hover { border-color: rgba(68, 104, 188, 0.5); }

label.reg-checkbox-item:has(.reg-checkbox-input:checked) {
    border-color: #4468BC;
    background-color: #EBF0FA;
}
label.reg-checkbox-item:has(.reg-checkbox-input:focus-visible) {
    outline: 3px solid #4468BC;
    outline-offset: 2px;
}

.reg-checkboxes--error label.reg-checkbox-item {
    border-color: rgba(220, 38, 38, 0.35);
}
.reg-checkboxes--error label.reg-checkbox-item:has(.reg-checkbox-input:checked) {
    border-color: #4468BC;
    background-color: #EBF0FA;
}

.reg-checkbox-input {
    margin-top: 3px;
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    accent-color: #4468BC;
    cursor: pointer;
}

.reg-checkbox-text {
    font-size: 0.9375rem;
    line-height: 1.45;
    color: #1E293B;
}

/* ── Text inputs and textareas ──────────────────────────────────────────── */
.reg-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1E293B;
    margin-bottom: 0.375rem;
}

.reg-text-input,
.reg-textarea {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid rgba(30, 41, 59, 0.2);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #1E293B;
    background: #fff;
    transition: border-color 0.12s ease, outline-color 0.12s ease;
    -webkit-appearance: none;
}
.reg-text-input { max-width: 34ch; }
.reg-textarea   { max-width: 52ch; resize: vertical; min-height: 120px; }

.reg-text-input:focus,
.reg-textarea:focus {
    outline: 3px solid #4468BC;
    outline-offset: 0;
    border-color: #4468BC;
}
.reg-text-input--error,
.reg-textarea--error {
    border-color: #DC2626;
}

/* ── Field group (label + error + input stacked) ────────────────────────── */
.reg-field-group { margin-bottom: 1.75rem; }

/* ── Opt-in checkboxes (contact step) ───────────────────────────────────── */
.reg-opt-ins { margin-bottom: 0.25rem; }

.reg-opt-in-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 0.875rem;
    cursor: pointer;
}

.reg-opt-in-input {
    margin-top: 3px;
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    flex-shrink: 0;
    accent-color: #4468BC;
    cursor: pointer;
}

.reg-opt-in-text {
    font-size: 0.9375rem;
    line-height: 1.45;
    color: #1E293B;
}
