/* Add Patient wizard (Client/Pages/DetailView/CreatePatientWizard.razor). Opened from Patients in a
   ~1,180px dialog sized to its content (CssClass "cpw-dialog"); the header and the footer stay put while the
   body scrolls. Radzen theme variables keep it legible in light and dark themes. */
.cpw-dialog .rz-dialog-content { padding: 0; overflow: hidden; }

.cpw {
    --cpw-accent: var(--rz-primary, #1d4ed8);
    --cpw-text: var(--rz-text-color, #1e293b);
    --cpw-muted: var(--rz-text-secondary-color, #64748b);
    --cpw-border: var(--rz-base-300, #e2e8f0);
    --cpw-surface: var(--rz-base-background-color, #fff);
    --cpw-raised: var(--rz-base-50, #f8fafc);
    --cpw-ok: var(--rz-success, #16a34a);
    --cpw-warn: var(--rz-warning, #d97706);
    --cpw-bad: var(--rz-danger, #dc2626);
    display: flex;
    flex-direction: column;
    max-height: min(860px, calc(100vh - 64px));
    color: var(--cpw-text);
}

/* Header + stepper */
.cpw-head { padding: 16px 22px 12px; border-bottom: 1px solid var(--cpw-border); }
.cpw-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cpw-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.cpw-subtitle { font-size: 12.5px; color: var(--cpw-muted); margin-top: 2px; }
.cpw-close { border: 0; background: none; color: var(--cpw-muted); font-size: 18px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.cpw-close:hover { background: var(--cpw-raised); color: var(--cpw-text); }

.cpw-steps { display: flex; list-style: none; margin: 14px 0 0; padding: 0; gap: 8px; }
.cpw-step { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cpw-step:not(:last-child)::after { content: ""; flex: 1; height: 1px; background: var(--cpw-border); min-width: 12px; }
.cpw-step button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 2px; color: var(--cpw-muted);
    font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.cpw-step button:disabled { cursor: default; opacity: .6; }
.cpw-step-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 11.5px; font-weight: 700;
    background: var(--cpw-border); color: var(--cpw-muted); flex: 0 0 auto; }
.cpw-step.current button { color: var(--cpw-accent); font-weight: 700; }
.cpw-step.current .cpw-step-dot { background: var(--cpw-accent); color: #fff; }
.cpw-step.done button { color: var(--cpw-text); }
.cpw-step.done .cpw-step-dot { background: var(--cpw-ok); color: #fff; }

/* Body */
.cpw-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 22px 18px; min-height: 0; }
.cpw-step-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.cpw-step-head h2 { font-size: 19px; font-weight: 700; margin: 0; }
.cpw-step-head p { margin: 3px 0 0; font-size: 13px; color: var(--cpw-muted); }
.cpw-req-note { font-size: 12px; color: var(--cpw-muted); white-space: nowrap; }
.cpw-star { color: var(--cpw-bad); font-weight: 700; }
.cpw-optional-tag { font-weight: 600; color: var(--cpw-text); }

.cpw-group { border: 1px solid var(--cpw-border); border-radius: 10px; padding: 12px 16px 16px; margin-bottom: 14px; background: var(--cpw-surface); }
.cpw-group.cpw-fill { height: 100%; margin-bottom: 0; display: flex; flex-direction: column; gap: 10px; }
.cpw-group h3 { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.cpw-group.cpw-fill h3 { margin-bottom: 0; }
.cpw .rz-form-field { width: 100%; }

/* Required marker and inline errors */
.cpw-required .rz-form-field-label::after { content: " *"; color: var(--cpw-bad); font-weight: 700; }
.cpw-invalid .rz-form-field-content { border-color: var(--cpw-bad) !important; box-shadow: 0 0 0 1px var(--cpw-bad); }
.cpw-field-error, .cpw .validation-message { color: var(--cpw-bad); font-size: 12px; margin-top: 4px; }
.cpw-summary { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--cpw-bad) 45%, transparent); background: color-mix(in srgb, var(--cpw-bad) 8%, transparent);
    font-size: 13px; }
.cpw-summary > i { color: var(--cpw-bad); margin-top: 2px; }
.cpw-summary ul { margin: 4px 0 0; padding-left: 18px; }

.cpw-dob { display: flex; align-items: flex-end; gap: 12px; }
.cpw-dob .rz-form-field { flex: 1; }
.cpw-age { font-size: 12.5px; color: var(--cpw-muted); white-space: nowrap; padding-bottom: 10px; }
.cpw-hint { font-size: 12px; color: var(--cpw-muted); margin-top: 4px; }
.cpw-info { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--cpw-muted); margin: 4px 2px 0; }
.cpw-validate { margin-top: 2px; }

/* Badges */
.cpw-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.cpw-badge.ok { color: var(--cpw-ok); background: color-mix(in srgb, var(--cpw-ok) 12%, transparent); }
.cpw-badge.warn { color: #92400e; background: color-mix(in srgb, var(--cpw-warn) 18%, transparent); }
.cpw-badge.bad { color: var(--cpw-bad); background: color-mix(in srgb, var(--cpw-bad) 12%, transparent); }

/* Review */
.cpw-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px;
    background: color-mix(in srgb, var(--cpw-accent) 7%, transparent); }
.cpw-banner > i { color: var(--cpw-accent); }
.cpw-banner b { font-size: 15px; }
.cpw-muted { color: var(--cpw-muted); font-size: 12.5px; }
.cpw-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cpw-card { border: 1px solid var(--cpw-border); border-radius: 10px; padding: 12px 16px 14px; background: var(--cpw-surface); }
.cpw-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cpw-card h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin: 0; }
.cpw-card h3 i { color: var(--cpw-accent); }
.cpw-edit { border: 0; background: none; color: var(--cpw-accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.cpw-edit:hover { background: color-mix(in srgb, var(--cpw-accent) 9%, transparent); }
.cpw-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 18px; margin: 0 0 8px; font-size: 13px; }
.cpw-dl dt { color: var(--cpw-muted); font-weight: 400; }
.cpw-dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.cpw-np { font-weight: 400; color: var(--cpw-muted); }
.cpw-none { margin: 4px 0 0; }

/* Fixed footer */
.cpw-foot { display: flex; align-items: center; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--cpw-border); background: var(--cpw-surface); }
.cpw-adding { flex: 1; min-width: 0; font-size: 12.5px; color: var(--cpw-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; }

@media (max-width: 900px) {
    .cpw-step-label { display: none; }
    .cpw-step.current .cpw-step-label { display: inline; }
    .cpw-review-grid { grid-template-columns: minmax(0, 1fr); }
    .cpw-adding { display: none; }
    .cpw-foot { flex-wrap: wrap; }
    .cpw-foot > .rz-button:first-child { margin-right: auto; }
}

/* Full-screen positioning for the intake dialog opened after creation (moved from the page's inline style). */
.my-class { left: 0px !important; top: 0px !important; }
.my-class .rz-dialog-content { overflow: hidden; padding: 0; }
