/* =====================================================
   HHPS — Multi-Step Registration Wizard
   Mobile-first. Badge-type themed via CSS variables.
   ===================================================== */

/* ── Theme Tokens ── */
:root {
    --reg-primary:       #16b143;
    --reg-primary-dark:  #13993b;
    --reg-primary-light: rgba(22, 177, 67, .12);
    --reg-primary-ring:  rgba(22, 177, 67, .25);
    --reg-success:       #27ae60;
    --reg-success-light: rgba(39, 174, 96, .10);
    --reg-error:         #e74c3c;
}

body.badge-buddy {
    --reg-primary:       #2769ba;
    --reg-primary-dark:  #1f55a0;
    --reg-primary-light: rgba(39, 105, 186, .12);
    --reg-primary-ring:  rgba(39, 105, 186, .25);
}

body.badge-care {
    --reg-primary:       #b8258b;
    --reg-primary-dark:  #9a1e75;
    --reg-primary-light: rgba(184, 37, 139, .12);
    --reg-primary-ring:  rgba(184, 37, 139, .25);
}

/* ── Page Shell ── */
.reg-page {
    min-height: 100vh;
    background: #f0f2f5;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px 48px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.reg-wrap {
    width: 100%;
    max-width: 520px;
}

/* ── Logo ── */
.reg-logo {
    text-align: center;
    margin-bottom: 24px;
}
.reg-logo img { height: 56px; width: auto; }

/* ── Card ── */
.reg-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
    position: relative;
}

/* ── Stepper ── */
.reg-stepper-wrap {
    padding: 28px 28px 0;
}

.reg-stepper {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.reg-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
}

.reg-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #d0d5dd;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #98a2b3;
    transition: background .25s, border-color .25s, color .25s;
    position: relative;
    z-index: 1;
}

.reg-step.is-active .reg-step-dot {
    border-color: var(--reg-primary);
    background: var(--reg-primary);
    color: #fff;
}

.reg-step.is-done .reg-step-dot {
    border-color: var(--reg-success);
    background: var(--reg-success);
    color: #fff;
}

.step-check { display: none; }

.reg-step-label {
    font-size: 10px;
    font-weight: 500;
    color: #98a2b3;
    margin-top: 5px;
    white-space: nowrap;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.reg-step.is-active .reg-step-label { color: var(--reg-primary); font-weight: 600; }
.reg-step.is-done   .reg-step-label { color: var(--reg-success); }

.reg-step-line {
    flex: 1;
    height: 2px;
    background: #d0d5dd;
    margin: 0 4px;
    margin-bottom: 17px;
    transition: background .3s;
}
.reg-step-line.is-done { background: var(--reg-success); }

.reg-step-counter {
    text-align: center;
    font-size: 12px;
    color: #98a2b3;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ── Panels ── */
.reg-panels { position: relative; min-height: 200px; }

.reg-panel {
    padding: 8px 28px 28px;
    display: none;
    animation: panelIn .3s ease both;
}
.reg-panel.is-active  { display: block; }
.reg-panel.slide-back { animation: panelInBack .3s ease both; }

@keyframes panelIn     { from { opacity:0; transform:translateX(32px);  } to { opacity:1; transform:translateX(0); } }
@keyframes panelInBack { from { opacity:0; transform:translateX(-32px); } to { opacity:1; transform:translateX(0); } }

/* ── Panel typography ── */
.reg-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: #101828;
    margin: 16px 0 4px;
}
.reg-panel-sub {
    font-size: 13px;
    color: #667085;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ── Form fields ── */
.reg-field { margin-bottom: 16px; }

.reg-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 6px;
}
.reg-field label .opt { font-weight:400; color:#98a2b3; font-size:12px; margin-left:4px; }

.reg-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    color: #101828;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
}
.reg-input:focus      { border-color: var(--reg-primary); box-shadow: 0 0 0 3px var(--reg-primary-light); }
.reg-input.is-valid   { border-color: var(--reg-success); }
.reg-input.is-invalid { border-color: var(--reg-error); }
.reg-input:disabled   { background: #f9fafb; color: #667085; cursor: not-allowed; }

.reg-input-wrap   { position: relative; }

.reg-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #98a2b3;
    font-size: 15px;
    pointer-events: none;
}
.reg-input-status {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}
.reg-field-hint           { font-size: 12px; color: #98a2b3; margin-top: 4px; }
.reg-field-hint.is-error  { color: var(--reg-error); }

/* ── Buttons ── */
.reg-actions { margin-top: 24px; display: flex; gap: 10px; }

.btn-reg-back {
    flex: 0 0 auto;
    padding: 11px 18px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: #344054;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}
.btn-reg-back:hover { background:#f9fafb; border-color:#b0b8c4; }

.btn-reg-continue {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--reg-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, opacity .2s, transform .1s;
    letter-spacing: .2px;
}
.btn-reg-continue:hover:not(:disabled)  { background: var(--reg-primary-dark); }
.btn-reg-continue:active:not(:disabled) { transform: scale(.98); }
.btn-reg-continue:disabled { background: #b0cdd3; cursor: not-allowed; }

.btn-reg-submit { background: var(--reg-success); }
.btn-reg-submit:hover:not(:disabled)  { background: #229a55; }
.btn-reg-submit:disabled { background: #95d4b0; }

/* ── Sign-in link (step 1 footer) ── */
.reg-signin-row {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #667085;
}
.reg-signin-row a {
    color: var(--reg-primary);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}
.reg-signin-row a:hover { text-decoration: underline; }

/* ── Loading overlay ── */
.reg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
}
.reg-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e0eaf1;
    border-top-color: var(--reg-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Avatar (Step 2 – Profile) ── */
.reg-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.reg-avatar-ring {
    position: relative;
    width: 88px;
    height: 88px;
    margin-bottom: 8px;
}

.reg-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    background: var(--reg-primary);
    transition: background .3s;
    user-select: none;
    overflow: hidden;
}

.reg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.reg-avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--reg-primary);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: background .2s, transform .15s;
    padding: 0;
    line-height: 1;
}
.reg-avatar-upload-btn:hover { background: var(--reg-primary-dark); transform: scale(1.1); }
.reg-avatar-upload-btn:focus { outline: 2px solid var(--reg-primary-ring); }

.reg-avatar-hint { font-size: 12px; color: #98a2b3; text-align: center; }

/* ── Card selector (Unit / Discipline) ── */
.reg-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    font-size: 13px;
    color: #101828;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    margin-bottom: 12px;
    transition: border-color .2s;
}
.reg-search-input:focus { border-color: var(--reg-primary); }

.reg-search-wrap { position: relative; }
.reg-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #98a2b3;
    font-size: 13px;
    pointer-events: none;
}

.reg-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 2px;
}
.reg-card-grid::-webkit-scrollbar { width: 4px; }
.reg-card-grid::-webkit-scrollbar-track { background: #f1f1f1; border-radius:4px; }
.reg-card-grid::-webkit-scrollbar-thumb { background: #c4cdd6; border-radius:4px; }

.reg-choice-card {
    padding: 12px 10px;
    border: 1.5px solid #e4e7ec;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #344054;
    background: #fff;
    transition: border-color .18s, background .18s, color .18s;
    line-height: 1.35;
    word-break: break-word;
    position: relative;
}
.reg-choice-card:hover { border-color: var(--reg-primary); background: var(--reg-primary-light); }
.reg-choice-card.is-selected {
    border-color: var(--reg-primary);
    background: var(--reg-primary-light);
    color: var(--reg-primary);
    font-weight: 600;
}
.reg-choice-card.is-selected::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 11px;
    color: var(--reg-primary);
    font-weight: 700;
}

.reg-no-results { grid-column: 1 / -1; text-align:center; color:#98a2b3; font-size:13px; padding:16px 0; }

.reg-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin: 20px 0 10px;
}
.reg-section-label:first-child { margin-top: 0; }

/* ── Verify step ── */
.reg-code-sent-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--reg-success-light);
    color: var(--reg-success);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
}

.reg-code-input {
    width: 100%;
    padding: 14px;
    text-align: center;
    font-size: 22px;
    letter-spacing: 8px;
    font-weight: 600;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    outline: none;
    color: #101828;
    transition: border-color .2s;
    box-sizing: border-box;
}
.reg-code-input:focus { border-color: var(--reg-primary); box-shadow: 0 0 0 3px var(--reg-primary-light); }

.reg-resend-row { margin-top:12px; text-align:center; font-size:13px; color:#667085; }
.reg-resend-row a { color: var(--reg-primary); text-decoration:none; font-weight:600; margin-left:4px; }
.reg-resend-row a:hover { text-decoration: underline; }
.reg-resend-row a.disabled { color:#98a2b3; pointer-events:none; }
.reg-resend-countdown { font-size:12px; color:#98a2b3; margin-left:4px; }

/* ── Confirm step ── */
.reg-summary {
    background: #f9fafb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.reg-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #e4e7ec;
    gap: 12px;
}
.reg-summary-row:last-child  { border-bottom: none; padding-bottom: 0; }
.reg-summary-row:first-child { padding-top: 0; }
.reg-summary-key { font-size:12px; font-weight:600; color:#667085; text-transform:uppercase; letter-spacing:.4px; white-space:nowrap; }
.reg-summary-val { font-size:13px; color:#101828; font-weight:500; text-align:right; word-break:break-word; }

.reg-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}
.reg-checkbox-row input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--reg-primary);
    cursor: pointer;
}
.reg-checkbox-row span { font-size:13px; color:#344054; line-height:1.5; }
.reg-checkbox-row a    { color: var(--reg-primary); font-weight:600; }

/* ── Alert banner ── */
.reg-alert {
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: none;
}
.reg-alert.is-visible { display: block; }
.reg-alert.is-error   { background:#fef3f2; color:#b42318; border:1px solid #fecdca; }
.reg-alert.is-info    { background:#eff8ff; color:#1d4ed8; border:1px solid #bfdbfe; }
.reg-alert.is-success { background:#ecfdf3; color:#166534; border:1px solid #bbf7d0; }

/* ── Existing-user badge ── */
.reg-existing-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eff8ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #1d4ed8;
    font-weight: 500;
}
.reg-existing-badge .badge-icon { font-size:20px; flex-shrink:0; }

/* ── Success panel ── */
.reg-success-wrap { text-align:center; padding:32px 24px; }

.reg-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #ecfdf3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
    animation: successPop .45s cubic-bezier(.175,.885,.32,1.275) both;
    box-shadow: 0 0 0 12px rgba(39,174,96,.08);
}
@keyframes successPop { from { transform:scale(0); opacity:0; } to { transform:scale(1); opacity:1; } }

.reg-success-title { font-size:20px; font-weight:700; color:#101828; margin-bottom:8px; }
.reg-success-sub   { font-size:14px; color:#667085; line-height:1.6; margin-bottom:28px; }

.reg-success-links { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px; }
.reg-success-links a {
    display:block; padding:11px;
    border-radius:8px;
    border:1.5px solid #e4e7ec;
    color:#344054; font-size:14px; font-weight:500;
    text-decoration:none;
    transition: background .2s, border-color .2s;
}
.reg-success-links a:hover { background:#f9fafb; border-color:#b0b8c4; }
.reg-success-links a.primary-link {
    background: var(--reg-primary);
    border-color: var(--reg-primary);
    color: #fff;
}
.reg-success-links a.primary-link:hover { background: var(--reg-primary-dark); border-color: var(--reg-primary-dark); }

/* ── Mobile ── */
@media (max-width: 480px) {
    .reg-page         { padding: 16px 12px 32px; }
    .reg-stepper-wrap { padding: 20px 20px 0; }
    .reg-panel        { padding: 8px 20px 24px; }
    .reg-card-grid    { grid-template-columns: 1fr 1fr; max-height: 220px; }
    .reg-panel-title  { font-size: 16px; }
}
.reg-choice-title {
    font-weight: 600;
    line-height: 1.2;
}

.reg-choice-desc {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.35;
    color: #777;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}