/* Registration wizard - page-scoped styles only.
 *
 * The page extends base_public.html, so Bootstrap 5.3.2, tokens.css and
 * public.css are already loaded. Everything here builds on the design
 * tokens; no :root, no body rules, no Bootstrap component overrides.
 * registration_v2.js drives .form-step / .progress-bar / .step-indicator -
 * those class names are a JS contract and must not be renamed.
 */

/* ------------------------------------------------------------ card shell */
.registration-card {
    overflow: visible; /* the sticky progress bar must be able to stick */
}

/* ---------------------------------------------------- progress indicator */
.progress-container {
    position: sticky;
    top: var(--navbar-height); /* fixed navbar + body padding-top */
    z-index: 100;              /* below the navbar's 1030 */
    background: var(--card);
    border-bottom: 1px solid var(--border);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 1rem 1.25rem 0.75rem;
}

.progress {
    height: 6px;
    background-color: var(--border);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.75rem;
}

.progress-bar {
    background: var(--gradient-primary);
    border-radius: var(--border-radius-sm);
    transition: width 0.4s ease;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    gap: 0.25rem;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    color: var(--text-muted);
    transition: var(--transition);
}

.step-number {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-alt);
    border: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    transition: var(--transition);
}

.step-label {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.step-indicator.active {
    color: var(--primary-color);
    font-weight: 600;
}

.step-indicator.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-inverse);
}

.step-indicator.completed {
    color: var(--success-color);
}

.step-indicator.completed .step-number {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--text-inverse);
}

/* ------------------------------------------------------------ form steps */
.form-step {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.step-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
}

textarea.form-control {
    min-height: 6rem;
}

/* ------------------------------------------------------- navigation bar */
.form-navigation {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 0.75rem 0;
    margin-top: 1.5rem;
}

.form-navigation .btn {
    min-width: 8rem;
}

/* JS adds .loading to the submit button while the AJAX call runs */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading::after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    vertical-align: -0.15rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: wizard-spin 0.8s linear infinite;
}

@keyframes wizard-spin {
    to { transform: rotate(360deg); }
}

/* -------------------------------------------------- small JS-driven bits */
/* Live email format hint (registration_v2.js injects the icon + text) */
#email-check-result {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* infoBox character counter - the element is created by registration_v2.js */
.char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

.char-counter.warning { color: var(--warning-color); }
.char-counter.danger  { color: var(--danger-color); }

/* Screen-reader announcer appended by registration_v2.js (uses .sr-only,
 * which Bootstrap 5 no longer ships) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------- who the registration is for */
.who-choice legend {
    float: none;
    width: auto;
}

.who-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
    height: 100%;
    min-height: var(--touch-target-size);
    padding: 0.85rem 0.75rem;
    white-space: normal;
    border-width: 2px;
}

.who-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.who-card-title {
    font-weight: 600;
}

.who-card-sub {
    font-size: 0.85rem;
    opacity: 0.85;
}

.who-choice.is-invalid .who-card {
    border-color: var(--danger-color);
}

/* Persistent reminder above every step while registering a child */
.mode-pill {
    margin-bottom: 1rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 576px) {
    .step-label {
        display: none; /* numbers alone on small phones */
    }

    .progress-container {
        padding: 0.75rem 0.75rem 0.5rem;
        border-radius: 0;
    }

    .form-navigation {
        flex-wrap: wrap;
    }

    .form-navigation .btn {
        flex: 1 1 auto;
        min-width: 0;
    }
}

@media print {
    .progress-container,
    .form-navigation {
        display: none;
    }
}
