/* Patient registration site. Colors, radius and shadows follow the main system (custom.css / design-system.css). */
:root {
    --app-primary: #6258d9;
    --app-primary-dark: #4e45bd;
    --app-ink: #1d2340;
    --app-muted: #72798f;
    --app-border: #e7e9f1;
    --app-surface: #fff;
    --app-hover-bg: #f1f2f8;
    --app-radius: 20px;
    --app-shadow: 0 24px 70px rgba(37, 45, 91, .11), 0 4px 14px rgba(37, 45, 91, .04);
    --bs-primary: var(--app-primary);
    --bs-primary-rgb: 98, 88, 217;
    --bs-link-color: var(--app-primary);
}

body.reg-page {
    min-height: 100vh;
    color: var(--app-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(ellipse at 12% 12%, rgba(119, 108, 230, .13), transparent 34%),
        radial-gradient(ellipse at 88% 88%, rgba(105, 179, 218, .12), transparent 34%),
        #f6f7fb;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
    --bs-btn-active-bg: var(--app-primary-dark);
    --bs-btn-active-border-color: var(--app-primary-dark);
    --bs-btn-disabled-bg: var(--app-primary);
    --bs-btn-disabled-border-color: var(--app-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary);
    --bs-btn-hover-border-color: var(--app-primary);
    --bs-btn-active-bg: var(--app-primary-dark);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #a9a3ee;
    box-shadow: 0 0 0 .22rem rgba(98, 88, 217, .16);
}

.form-check-input:checked {
    border-color: var(--app-primary);
    background-color: var(--app-primary);
}

.form-label {
    margin-bottom: .3rem;
    font-size: .88rem;
    font-weight: 600;
}

.form-control,
.form-select {
    border-color: #d9dcea;
    border-radius: 12px;
    padding: .6rem .85rem;
}

.form-control:disabled {
    background-color: var(--app-hover-bg);
}

/* ----- Header ----- */
.reg-header {
    border-bottom: 1px solid var(--app-border);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
}

.reg-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

.reg-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.reg-brand img {
    max-height: 64px;
    width: auto;
}

.reg-brand h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.reg-brand p {
    margin: .15rem 0 0;
    color: var(--app-muted);
    font-size: .82rem;
}

.reg-main {
    max-width: 1100px;
    padding: 1.75rem 1.25rem 3rem;
}

/* ----- Step indicator ----- */
.reg-steps {
    display: flex;
    gap: .75rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.reg-steps li {
    display: flex;
    flex: 1;
    align-items: center;
    gap: .65rem;
    padding: .65rem .85rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    color: var(--app-muted);
    background: rgba(255, 255, 255, .7);
    font-size: .88rem;
    font-weight: 600;
}

.reg-steps .reg-step-number {
    display: inline-grid;
    flex: none;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    color: var(--app-muted);
    background: var(--app-hover-bg);
    font-size: .8rem;
}

.reg-steps li.is-active {
    border-color: #cfcaf6;
    color: var(--app-ink);
    background: #fff;
    box-shadow: 0 6px 18px rgba(98, 88, 217, .1);
}

.reg-steps li.is-active .reg-step-number,
.reg-steps li.is-done .reg-step-number {
    color: #fff;
    background: var(--app-primary);
}

.reg-steps li.is-done {
    color: var(--app-ink);
}

/* ----- Cards ----- */
.reg-card {
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--app-shadow);
}

.reg-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
}

.reg-card-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.reg-card-header p {
    margin: .25rem 0 0;
    color: var(--app-muted);
    font-size: .88rem;
}

.reg-card-body {
    padding: 1.5rem;
}

.reg-card-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 1.5rem 1.5rem;
}

.reg-section-title {
    margin: 0 0 1rem;
    color: var(--app-primary-dark);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.reg-section + .reg-section {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--app-border);
}

.reg-step[hidden] {
    display: none;
}

/* ----- Photo ----- */
.photo-picker {
    display: grid;
    justify-items: center;
    gap: .5rem;
    text-align: center;
}

.photo-button {
    position: relative;
    width: 200px;
    height: 200px;
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--app-hover-bg);
    box-shadow: 0 0 0 2px #d9dcea, 0 10px 24px rgba(37, 45, 91, .12);
    cursor: pointer;
}

.photo-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-button-badge {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--app-primary);
    box-shadow: 0 6px 14px rgba(98, 88, 217, .35);
}

/* ----- Questions ----- */
.question {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .5rem 1rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--app-border);
}

.question:last-child {
    border-bottom: 0;
}

.question-label {
    margin: 0;
    font-weight: 600;
}

.question-detail {
    grid-column: 1 / -1;
}

.allergy-grid,
.condition-grid {
    display: grid;
    gap: .35rem 1.25rem;
}

.allergy-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.condition-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ----- Consent text ----- */
.consent-text {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fbfbfe;
    font-size: .92rem;
    line-height: 1.6;
    text-align: justify;
}

.consent-text p:last-child {
    margin-bottom: 0;
}

/* ----- Signature ----- */
.signature-box {
    display: grid;
    width: 100%;
    height: 96px;
    place-items: center;
    padding: .35rem;
    border: 2px dashed #cfd3e6;
    border-radius: 14px;
    color: var(--app-muted);
    background: #fff;
    font-size: .88rem;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, background-color .15s;
}

.signature-box:hover {
    border-color: var(--app-primary);
    background: #faf9ff;
}

.signature-box img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
}

.signature-box.is-static {
    cursor: default;
}

.signature-pad {
    display: block;
    width: 100%;
    height: 220px;
    border: 1px solid #d9dcea;
    border-radius: 12px;
    background: #fff;
    touch-action: none;
}

/* ----- Camera ----- */
.camera-video {
    display: block;
    width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    background: #111;
    object-fit: cover;
}

/* ----- Patient search (waiver) ----- */
.patient-results {
    position: absolute;
    z-index: 20;
    top: 100%;
    right: 0;
    left: 0;
    margin-top: .25rem;
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 36px rgba(37, 45, 91, .16);
}

.patient-results button {
    display: block;
    width: 100%;
    padding: .6rem .85rem;
    border: 0;
    color: var(--app-ink);
    background: transparent;
    text-align: left;
}

.patient-results button:hover,
.patient-results button:focus-visible {
    background: var(--app-hover-bg);
}

.patient-results .patient-empty {
    padding: .6rem .85rem;
    color: var(--app-muted);
    font-size: .88rem;
}

.reg-error {
    margin-top: 1rem;
}

/* Hidden spam trap: people never see it. */
.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 767.98px) {
    .reg-steps li span.reg-step-label {
        display: none;
    }

    .reg-steps li {
        justify-content: center;
    }

    .allergy-grid,
    .condition-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question {
        grid-template-columns: 1fr;
    }

    .reg-card-body {
        padding: 1.1rem;
    }

    .reg-card-footer .btn {
        flex: 1;
    }
}

@media (max-width: 479.98px) {
    .allergy-grid,
    .condition-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .reg-header,
    .reg-steps,
    .reg-card-footer {
        display: none;
    }
}
