﻿h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #2d8f53;
}

.invalid {
    outline: 1px solid #b4122b;
}

.validation-message {
    color: #8d1022;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ============================================================================
   Claim interview styling (BeyondOrdinary interview engine)
   The engine components emit Bootstrap-5 class names (form-control, form-check,
   accordion, btn ...) plus semantic iw-* hooks, but the app does not ship
   Bootstrap — everything the interview needs is defined here, scoped to the
   interview markup and themed to the AHIC/UEIC brand (see brand-theme.css).
   ========================================================================== */

/* ---- layout utility shims for the engine's Bootstrap utility classes ---- */
.claims-shell .d-flex { display: flex; }
.claims-shell .d-block { display: block; }
.claims-shell .align-items-center { align-items: center; }
.claims-shell .gap-1 { gap: 0.3rem; }
.claims-shell .gap-2 { gap: 0.55rem; }
.claims-shell .mt-1 { margin-top: 0.3rem; }
.claims-shell .mt-2 { margin-top: 0.55rem; }
.claims-shell .mt-3 { margin-top: 1rem; }
.claims-shell .ms-1 { margin-left: 0.3rem; }
.claims-shell .fw-bold { font-weight: 700; }
.claims-shell .text-muted { color: var(--brand-muted); }
.claims-shell .text-danger { color: #b4122b; }
.claims-shell .container-fluid { width: 100%; padding: 0; }

/* ---- form chrome ---- */
.iw-form-title {
    margin: 0 0 var(--spacing-md);
    padding-bottom: 0.55rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #154365;
    border-bottom: 3px solid var(--brand-accent);
}

.iw-form-description {
    margin: 0 0 var(--spacing-md);
    color: var(--brand-muted);
}

.iw-section {
    background: #FFFFFF;
    border: 1px solid #e3e8ec;
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 1px 3px rgba(1, 47, 70, 0.06);
}

.iw-section-title {
    margin: 0 0 var(--spacing-md);
    font-size: 1.05rem;
    font-weight: 700;
    color: #154365;
}

.iw-heading {
    margin: 1.6rem 0 0.9rem;
    padding-bottom: 0.4rem;
    font-size: 1.05rem;
    color: #154365;
    border-bottom: 1px solid #e3e8ec;
}

.iw-field--heading:first-child .iw-heading {
    margin-top: 0;
}

/* ---- fields ---- */
.iw-field {
    margin-bottom: 1.1rem;
}

.iw-field:last-child {
    margin-bottom: 0;
}

.iw-form .form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1a;
}

.iw-form .form-text {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: var(--brand-muted);
}

.iw-form .form-control,
.iw-form .form-select {
    display: block;
    width: 100%;
    padding: 0.58rem 0.7rem;
    font-family: inherit;
    font-size: 0.97rem;
    color: #1a1a1a;
    background: #FFFFFF;
    border: 1px solid #9bb0bd;
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.iw-form .form-control:hover,
.iw-form .form-select:hover {
    border-color: #154365;
}

.iw-form .form-control:focus,
.iw-form .form-select:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(0, 136, 186, 0.22);
}

.iw-form .form-control[readonly],
.iw-form .form-control:disabled,
.iw-form .form-select:disabled {
    background: #f3f5f7;
    color: #5a5a5a;
}

/* Keep single inputs comfortably narrow inside the wide card; grids and
   textareas keep the full width. */
.iw-field--text .form-control,
.iw-field--dropdown .form-select,
.iw-field--year .form-select,
.iw-field--yesno .form-control {
    max-width: 460px;
}

.iw-form textarea.form-control {
    max-width: 100%;
    min-height: 110px;
    resize: vertical;
}

.iw-form .form-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.4rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='none' stroke='%23154365' stroke-width='2' stroke-linecap='round' d='m1.5 1.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
}

/* ---- radios / checkboxes ---- */
.iw-form .form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.18rem 0;
}

.iw-form .form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0.18rem 0 0;
    flex-shrink: 0;
    accent-color: #154365;
    cursor: pointer;
}

.iw-form .form-check-label {
    cursor: pointer;
}

/* Vertical option lists render as selectable rows with a clear chosen state. */
.iw-form .form-check:not(.form-check-inline) {
    border: 1px solid #e3e8ec;
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.8rem;
    margin-bottom: 0.45rem;
    background: #FFFFFF;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.iw-form .form-check:not(.form-check-inline):hover {
    background: #f5f9fb;
    border-color: #b7cdd9;
}

.iw-form .form-check:not(.form-check-inline):has(.form-check-input:checked) {
    background: #eaf3f8;
    border-color: #154365;
}

.iw-form .form-check:not(.form-check-inline) .form-check-label {
    flex: 1;
}

/* Inline options (yes/no toggles, horizontal radio and checklist rows) render
   as selectable pills — the radio/checkbox itself is visually hidden but stays
   focusable for keyboard and screen-reader users. */
.iw-form .form-check-inline {
    display: inline-flex;
    position: relative;
    margin: 0 0.5rem 0.5rem 0;
    padding: 0;
}

.iw-form .form-check-inline .form-check-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.iw-form .form-check-inline .form-check-label {
    border: 1px solid #154365;
    border-radius: 999px;
    padding: 0.45rem 1.2rem;
    background: #FFFFFF;
    color: #154365;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.iw-form .form-check-inline .form-check-label:hover {
    background: #eaf3f8;
}

.iw-form .form-check-inline .form-check-input:checked + .form-check-label {
    background: #154365;
    border-color: #154365;
    color: #FFFFFF;
}

.iw-form .form-check-inline .form-check-input:focus-visible + .form-check-label {
    outline: 3px solid var(--brand-accent);
    outline-offset: 1px;
}

.iw-form .form-check-inline .form-check-input:disabled + .form-check-label {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---- composite (multi-part) fields like dates and times ---- */
.iw-multifield .form-control,
.iw-multifield .form-select {
    width: auto;
    min-width: 0;
}

.iw-separator {
    color: var(--brand-muted);
    font-weight: 700;
}

/* ---- field groups ---- */
.iw-group {
    border: 1px solid #e3e8ec;
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin: 0;
}

.iw-group-legend {
    padding: 0 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #154365;
}

/* ---- validation + notices ---- */
.iw-form .invalid-feedback {
    margin-top: 0.3rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #b4122b;
}

.iw-knockout,
.iw-form .alert-warning {
    margin-bottom: var(--spacing-md);
    padding: 0.875rem 1rem;
    border: 1px solid #e3c34c;
    border-left: 5px solid #d9a514;
    border-radius: var(--radius-sm);
    background: #fffae8;
    color: #5f4a00;
}

.iw-host-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--brand-muted);
}

/* ---- buttons ---- */
.iw-nav {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid #e3e8ec;
}

.iw-nav .btn {
    min-width: 120px;
}

.iw-form .btn,
.iw-nav .btn {
    font-size: 0.97rem;
}

.iw-form .btn-outline-secondary {
    border: 1px solid #154365;
    border-radius: 999px;
    background: #FFFFFF;
    color: #154365;
    font-family: inherit;
    font-weight: 700;
    padding: 0.45rem 1rem;
    cursor: pointer;
}

.iw-form .btn-outline-secondary:hover {
    background: #eaf3f8;
}

.iw-form .btn-sm {
    padding: 0.32rem 0.85rem;
    font-size: 0.88rem;
}

/* ---- accordions (group + dynamic repeat panels) ---- */
.iw-form .accordion {
    margin-bottom: var(--spacing-sm);
}

.iw-form .accordion-item {
    border: 1px solid #dde4e9;
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    margin-bottom: 0.6rem;
    overflow: hidden;
}

.iw-form .accordion-header {
    margin: 0;
    font-size: inherit;
}

.iw-form .accordion-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 0;
    background: #f2f6f9;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    color: #154365;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.iw-form .accordion-button:hover {
    background: #e7eff5;
}

.iw-form .accordion-button:focus-visible {
    outline: 3px solid var(--brand-accent);
    outline-offset: -3px;
}

.iw-form .accordion-button::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.iw-form .accordion-button.collapsed::after {
    transform: rotate(-45deg);
}

.iw-form .accordion-body {
    padding: var(--spacing-md);
}

/* The engine toggles panel visibility purely through these Bootstrap class
   names, so this rule is what actually opens and closes the panels. */
.iw-form .accordion-collapse.collapse:not(.show) {
    display: none;
}

/* ---- multi-column / multi-row grids ---- */
.iw-form .iw-grid {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-sm);
}

.iw-form .iw-grid th,
.iw-form .iw-grid td {
    padding: 0.55rem 0.65rem;
    text-align: left;
    vertical-align: middle;
}

.iw-form .iw-grid thead th {
    font-size: 0.92rem;
    color: #154365;
    border-bottom: 2px solid #dde4e9;
}

.iw-form .iw-grid tbody th,
.iw-form .iw-grid tbody td {
    border-bottom: 1px solid #edf1f4;
}

.iw-form .iw-grid tbody tr:hover {
    background: #f7fafc;
}

.iw-form .iw-grid .iw-field {
    margin-bottom: 0;
}

/* ---- live-rule reveal animation ---- */
@keyframes iw-reveal {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.iw-form .iw-field-reveal {
    animation: iw-reveal 0.25s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .iw-form .iw-field-reveal {
        animation: none;
    }
}

/* ---- small screens ---- */
@media (max-width: 768px) {
    .iw-section {
        padding: var(--spacing-md);
    }

    .iw-field--text .form-control,
    .iw-field--dropdown .form-select,
    .iw-field--year .form-select,
    .iw-field--yesno .form-control {
        max-width: 100%;
    }

    .iw-nav {
        flex-direction: column;
    }

    .iw-nav .btn {
        width: 100%;
    }
}

.iw-host-error {
    margin-bottom: 1rem;
    padding: 0.875rem 1rem;
    border: 1px solid #b4122b;
    border-left: 5px solid #b4122b;
    border-radius: var(--radius-sm);
    background: #fff4f5;
    color: #8d1022;
}

/* ===== Claim draft persistence: save-progress affordances and the resume code panel ===== */

.iw-draft-status {
    display: flex;
    align-items: center;
    /* Wraps rather than collides once the time and the button no longer fit side by side. */
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
    min-height: 1.5rem;
    font-size: 0.9rem;
    color: var(--brand-muted);
}

/* Tabular figures so the minute rolling over does not nudge the text sideways. */
.iw-draft-saved {
    font-variant-numeric: tabular-nums;
}

/*
    Outlined rather than filled, so it stays clearly subordinate to Next and Finish, which are the
    only filled buttons on the screen. The common case never needs the code, but the visitor who
    does need it is usually in a hurry.
*/
.iw-draft-code-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--brand-accent);
    border-radius: 999px;
    background: var(--brand-surface);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-accent);
    cursor: pointer;
}

.iw-draft-code-button:hover {
    background: #e8f6fb;
}

.iw-draft-code-button:focus {
    outline: 3px solid var(--brand-accent);
    outline-offset: 1px;
}

/* Inherits the button's colour through stroke="currentColor", including on hover and focus. */
.iw-draft-code-icon {
    flex: 0 0 auto;
}

.iw-draft-warning,
.iw-draft-conflict {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid #e0b95c;
    border-radius: var(--radius-sm);
    background: #fdf6e3;
    color: #6b5312;
    font-size: 0.92rem;
}

.iw-draft-dismiss {
    background: none;
    border: none;
    padding: 0 var(--spacing-xs);
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    cursor: pointer;
}

.iw-draft-code-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    background: rgba(1, 47, 70, 0.55);
    z-index: 1000;
}

.iw-draft-code-card {
    max-width: 26rem;
    width: 100%;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    background: var(--brand-surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.iw-draft-code-card h2 {
    margin-top: 0;
    font-size: 1.15rem;
    color: var(--brand-primary);
}

.iw-draft-code-value {
    margin: var(--spacing-md) 0;
    font-family: "Courier New", monospace;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--brand-primary);
    text-align: center;
}

.iw-draft-code-note {
    color: var(--brand-muted);
    font-size: 0.9rem;
}

.iw-draft-code-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

/* ===== Start page: claims in progress ===== */

.claims-resume-panel h2 {
    margin-top: 0;
    font-size: 1.05rem;
}

.claims-inprogress-row {
    padding: var(--spacing-md) 0;
    border-top: 1px solid #e3e8ec;
}

.claims-inprogress-row:first-of-type {
    border-top: none;
}

.claims-inprogress-detail {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.iw-draft-code-expiry {
    margin-bottom: var(--spacing-sm);
    font-size: 0.92rem;
}

.claims-inprogress-started {
    font-weight: 600;
}

.claims-inprogress-saved {
    font-size: 0.88rem;
    color: var(--brand-muted);
}

/*
    Reads as a warning rather than as more metadata: it only ever renders when the claim is close
    to running out, so it must not look like the "Last saved" line above it.
*/
.claims-inprogress-expiry {
    font-size: 0.88rem;
    font-weight: 600;
    color: #8d4a06;
}

.claims-inprogress-actions,
.claims-inprogress-challenge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
}

.claims-inprogress-challenge label {
    font-size: 0.9rem;
}

.claims-inprogress-challenge .form-input {
    max-width: 14rem;
}

/* Prerendering is on, so the panel paints before localStorage can be read. */
.claims-skeleton-line {
    height: 0.85rem;
    margin-bottom: var(--spacing-sm);
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #ececec 25%, #f6f6f6 37%, #ececec 63%);
    background-size: 400% 100%;
    animation: claims-skeleton-shimmer 1.4s ease infinite;
}

.claims-skeleton-line-short {
    width: 45%;
}

@keyframes claims-skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .claims-skeleton-line {
        animation: none;
    }
}

/* Switching between the remembered list and typed-code entry. */
.claims-resume-switch {
    border-top: 1px solid #e3e8ec;
    padding-top: var(--spacing-md);
}

.claims-resume-panel .field-group.full-width + .field-group.full-width {
    margin-top: var(--spacing-md);
}

@media (max-width: 640px) {
    .claims-inprogress-actions .btn,
    .claims-inprogress-challenge .btn {
        flex: 1 1 100%;
    }
}
