/* ═══════════════════════════════════════════
   PATIENT REGISTRATION — STYLES
   Depends on: common.css (variables, reset,
   typography, .btn, .glass-card, animations)
═══════════════════════════════════════════ */

/* ── Backgrounds ── */
#bgCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

.bg-radial {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 65% 55% at 10% 20%, rgba(30, 106, 255, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 55% 45% at 90% 80%, rgba(0, 212, 170, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 60% 10%, rgba(0, 194, 255, 0.04) 0%, transparent 70%);
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 194, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 194, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ── Page layout ── */
.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 60px;
}

/* ── Registration card ── */
.reg-card {
    width: 100%;
    max-width: 860px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    backdrop-filter: blur(24px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--glass-border);
    overflow: hidden;
}

/* ── Header ── */
.reg-header {
    padding: 32px 40px 28px;
    background: linear-gradient(180deg, rgba(0, 212, 170, 0.04) 0%, transparent 100%);
    border-bottom: 1px solid var(--glass-border);
}

.reg-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--text-bright);
}

.reg-sub {
    font-size: 0.88rem;
    color: var(--text-dim);
    margin-bottom: 28px;
}

/* ── Steps bar ── */
.steps {
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 2px;
}

.steps::-webkit-scrollbar {
    height: 0;
}

.step-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 8px;
    flex-shrink: 0;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: var(--glass);
    color: var(--text-dim);
    transition: all 0.3s var(--ease);
    flex-shrink: 0;
}

.step-circle.active {
    border-color: var(--teal);
    background: rgba(0, 212, 170, 0.12);
    color: var(--teal);
    box-shadow: 0 0 16px rgba(0, 212, 170, 0.3);
}

.step-circle.done {
    border-color: var(--teal);
    background: var(--teal);
    color: #020817;
}

.step-circle.done svg {
    width: 14px;
    height: 14px;
}

.step-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.3s;
    white-space: nowrap;
}

.step-btn.active .step-label,
.step-btn.done .step-label {
    color: var(--teal);
}

.step-line {
    flex: 1;
    height: 2px;
    min-width: 24px;
    max-width: 60px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 4px 20px;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.step-line-fill {
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--teal), var(--cyan));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--spring);
}

.step-line.done .step-line-fill {
    transform: scaleX(1);
}

/* ── Form body ── */
.reg-body {
    padding: 36px 40px;
}

/* ── Step panels ── */
.step-panel {
    display: none;
    animation: panelIn 0.4s var(--spring) both;
}

.step-panel.active {
    display: block;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ── Panel header ── */
.panel-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-bright);
}

.panel-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.pi-teal {
    background: var(--teal-dim);
    border: 1px solid rgba(0, 212, 170, 0.22);
}

.pi-blue {
    background: rgba(30, 106, 255, 0.12);
    border: 1px solid rgba(30, 106, 255, 0.22);
}

.pi-cyan {
    background: var(--cyan-dim);
    border: 1px solid rgba(0, 194, 255, 0.22);
}

.pi-purple {
    background: var(--purple-dim);
    border: 1px solid rgba(124, 58, 237, 0.22);
}

.panel-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 28px;
}

/* ── Form grid ── */
.form-grid {
    display: grid;
    gap: 18px;
}

.col-2 {
    grid-template-columns: 1fr 1fr;
}

.col-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.span-2 {
    grid-column: span 2;
}

.span-full {
    grid-column: 1 / -1;
}

/* ── Fields ── */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.field label .req {
    color: var(--teal);
    font-size: 0.85em;
}

.field-input {
    background: var(--glass-2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: var(--font);
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text-bright);
    outline: none;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
}

.field-input::placeholder {
    color: var(--text-dim);
}

.field-input:focus {
    border-color: rgba(0, 212, 170, 0.38);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.08);
    background: var(--glass-3);
}

.field-error {
    font-size: 0.72rem;
    color: #ef4444;
    font-weight: 600;
    display: none;
}

.field.has-error .field-error {
    display: block;
}

.field.has-error .field-input {
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

select.field-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(240,246,255,0.4)' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select.field-input option {
    background: #0a1f3a;
    color: var(--text-bright);
}

textarea.field-input {
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
}

/* ── Radio & Checkbox groups ── */
.radio-group,
.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}

.radio-opt,
.check-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-mid);
    user-select: none;
}

.radio-opt:hover,
.check-opt:hover {
    background: var(--glass-2);
    border-color: rgba(0, 212, 170, 0.22);
    color: var(--text-bright);
}

.radio-opt input,
.check-opt input {
    display: none;
}

.radio-opt.selected,
.check-opt.selected {
    background: rgba(0, 212, 170, 0.1);
    border-color: rgba(0, 212, 170, 0.3);
    color: var(--teal);
}

.review-summary {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
}

.review-block {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 22px;
}

.review-block h3 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    color: var(--teal);
}

.review-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-bright);
}

.review-key {
    font-weight: 700;
}

.review-val {
    text-align: right;
    color: var(--text-dim);
}

/* Radio dot */
.radio-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.radio-opt.selected .radio-dot {
    border-color: var(--teal);
}

.radio-dot::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal);
    opacity: 0;
    transition: opacity 0.2s;
}

.radio-opt.selected .radio-dot::after {
    opacity: 1;
}

/* Checkbox box */
.check-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.check-opt.selected .check-box {
    background: var(--teal);
    border-color: var(--teal);
}

.check-box svg {
    width: 9px;
    height: 9px;
    opacity: 0;
    transition: opacity 0.2s;
}

.check-opt.selected .check-box svg {
    opacity: 1;
}

/* ── Section divider ── */
.form-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 22px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

/* ── Review step ── */
.review-section {
    margin-bottom: 20px;
}

.review-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-grid {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
}

.review-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
}

.review-row:last-child {
    border-bottom: none;
}

.review-key {
    color: var(--text-dim);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 120px;
}

.review-val {
    color: var(--text-bright);
    font-weight: 600;
    text-align: right;
}

/* ── Consent box ── */
.consent-box {
    background: rgba(0, 212, 170, 0.05);
    border: 1px solid rgba(0, 212, 170, 0.18);
    border-radius: 14px;
    padding: 18px 20px;
    margin-top: 20px;
}

.consent-box p {
    font-size: 0.83rem;
    color: var(--text-mid);
    line-height: 1.7;
    margin-bottom: 14px;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.consent-check input {
    display: none;
}

.consent-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 2px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.consent-check.checked .consent-checkbox {
    background: var(--teal);
    border-color: var(--teal);
}

.consent-check.checked .consent-checkbox svg {
    opacity: 1;
}

.consent-checkbox svg {
    width: 11px;
    height: 11px;
    opacity: 0;
    transition: opacity 0.2s;
}

.consent-text {
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.6;
    font-weight: 500;
}

/* ── Success screen ── */
.success-screen {
    display: none;
    text-align: center;
    padding: 60px 20px;
    animation: panelIn 0.5s var(--spring) both;
}

.success-screen.show {
    display: block;
}

.success-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 194, 255, 0.1));
    border: 2px solid rgba(0, 212, 170, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    animation: heartbeat 2.5s ease-in-out infinite;
    position: relative;
}

.success-ring::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 170, 0.15);
    animation: ring-pulse 2.5s ease-out infinite;
}

@keyframes ring-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

@keyframes heartbeat {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0);
    }

    40% {
        box-shadow: 0 0 0 14px rgba(0, 212, 170, 0.07);
    }
}

.success-ring svg {
    width: 44px;
    height: 44px;
}

.success-screen h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 12px;
    color: var(--text-bright);
}

.success-screen p {
    font-size: 0.95rem;
    color: var(--text-mid);
    max-width: 400px;
    margin: 0 auto 28px;
    line-height: 1.7;
}

.success-id {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--glass-2);
    border: 1px solid var(--glass-border-2);
    border-radius: 12px;
    padding: 12px 20px;
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--teal);
    margin-bottom: 32px;
}

/* ── Footer nav ── */
.reg-footer {
    padding: 24px 40px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(0deg, rgba(0, 212, 170, 0.02) 0%, transparent 100%);
}

/* ── Auth CTA (login link) ── */
.auth-cta {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    position: relative;
    z-index: 2;
    padding-bottom: 22px;
}

.auth-cta-text {
    margin: 0;
    color: var(--text-dim);
    font-weight: 600;
}

.auth-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding: 10px 14px;
    border-radius: 10px;
}

/* Ensure CTA glow isn't clipped by reg-card's rounded edges */
.reg-card { overflow: visible; }

.step-counter {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
}

.step-counter span {
    color: var(--teal);
}

.footer-btns {
    display: flex;
    gap: 10px;
}

/* ── Page-specific button overrides ── */
/* Ghost/back button */
.btn-ghost {
    background: var(--glass-2);
    color: var(--text-mid);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: var(--glass-3);
    color: var(--text-bright);
    transform: translateY(-1px);
}

/* Teal CTA */
.btn-teal {
    background: linear-gradient(135deg, #00d4aa, #00a882);
    color: #020817;
    font-weight: 700;
    box-shadow: var(--glow-teal), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-teal:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(0, 212, 170, 0.5), 0 0 80px rgba(0, 212, 170, 0.18);
}

.btn-teal:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 720px) {
    .page {
        padding: 20px 14px 50px;
    }

    .reg-header {
        padding: 24px 22px 22px;
    }

    .reg-body {
        padding: 24px 22px;
    }

    .reg-footer {
        padding: 18px 22px;
    }

    .col-2,
    .col-3 {
        grid-template-columns: 1fr;
    }

    .span-2,
    .span-full {
        grid-column: auto;
    }

    .step-label {
        display: none;
    }

    .step-line {
        min-width: 16px;
    }

    .reg-title {
        font-size: 1.2rem;
    }

    .review-key {
        min-width: 90px;
    }
}

@media (max-width: 420px) {
    .footer-btns .btn {
        padding: 11px 16px;
        font-size: 0.82rem;
    }

    .radio-group,
    .check-group {
        gap: 7px;
    }

    .radio-opt,
    .check-opt {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}