/* Registration Form Styles */

/* Branded header - scoped to register page */
.app-container {
    padding-top: 0;
}

.app-header {
    background: var(--color-primary);
    margin: 0 auto 24px;
    padding: 20px 24px;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 900px;
    width: 100%;
}

.app-header .logo {
    color: var(--color-on-primary);
}

.app-header #orgLogoName {
    color: var(--color-on-primary) !important;
}

/* Step indicator */
.reg-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 24px;
    max-width: 320px;
}

.reg-step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.reg-step.active {
    opacity: 1;
}

.reg-step.completed {
    opacity: 0.7;
}

.reg-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-label);
    font-weight: 600;
    box-sizing: border-box;
}

.reg-step.active .reg-step-num {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-on-primary);
}

.reg-step-label {
    font-size: var(--font-size-label);
    font-weight: 500;
    color: var(--color-text);
}

.reg-step-line {
    flex: 1;
    height: 2px;
    background: rgba(37, 78, 72, 0.25);
    min-width: 30px;
}

/* Card sizing for registration */
.reg-card {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

/* Footer elements below the children grid - constrained to same width so they stay aligned */
.reg-page1-footer {
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
}

/* Children grid: single centered column by default, two columns when second child added */
.reg-children-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 560px;
    margin: 0 auto;
}

.reg-children-grid.two-children {
    grid-template-columns: 1fr 1fr;
    max-width: none;
    margin: 0;
}

/* Child col: no nested card chrome - just a plain grouping */
.reg-child-col {
    padding: 0;
}

.reg-child-col h3 {
    margin: 0 0 20px;
    font-size: var(--font-size-heading);
    font-weight: 600;
    color: var(--color-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-primary);
}

/* Parents grid: 2-3 columns */
.reg-parents-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.reg-parents-grid:has(#guardianCol:not([style*="display:none"])) {
    grid-template-columns: 1fr 1fr;
}

.reg-parent-col {
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-card);
}

.reg-parent-col h3 {
    margin: 0 0 16px;
    font-size: var(--font-size-heading);
    font-weight: 600;
    color: var(--color-primary);
}

/* Referral field - secondary, at bottom */
.reg-referral {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.reg-referral label {
    font-size: var(--font-size-label);
    font-weight: 500;
    color: var(--color-text-light);
}

/* Referral code box - shown when ?ref=CODE resolves to a real referrer */
.reg-referral-code-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.reg-referral-code-name {
    font-weight: 600;
}

.reg-referral-code-pill {
    font-size: var(--font-size-small);
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.reg-referral-code-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: var(--font-size-small);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

/* Form help text */
.form-help {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    margin: 4px 0 8px;
    line-height: 1.4;
}

/* Required asterisk */
.req {
    color: var(--color-error);
}

/* Segmented control */
.seg-control {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.seg-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: var(--color-card);
    font-size: var(--font-size-body);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s cubic-bezier(0.22, 1, 0.36, 1),
                color 0.15s cubic-bezier(0.22, 1, 0.36, 1);
    color: var(--color-text);
}

.seg-btn:not(:last-child) {
    border-right: 1px solid var(--color-border);
}

.seg-btn.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

@media (hover: hover) {
    .seg-btn:hover:not(.active) {
        background: var(--color-surface-alt);
    }
}

/* Trial dates - selection counter + Clear (trial.html) */
.trial-dates-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.trial-dates-count {
    font-size: var(--font-size-small);
    font-weight: 500;
    color: var(--color-text-light);
}

.trial-dates-clear {
    background: none;
    border: none;
    padding: 0;
    font-size: var(--font-size-small);
    font-weight: 500;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
    .trial-dates-clear:hover {
        opacity: 0.75;
    }
}

/* File upload */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--color-primary);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--color-text-light);
    font-size: var(--font-size-small);
}

.file-upload-label svg {
    color: var(--color-primary);
}

.file-upload-preview {
    font-size: var(--font-size-small);
    color: var(--color-primary);
    font-weight: 500;
}

/* Navigation buttons */
.reg-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

/* Add child/guardian - link style, not a button */
.reg-add-child-link {
    display: inline-block;
    margin-top: 20px;
    background: none;
    border: none;
    padding: 0;
    font-size: var(--font-size-body);
    font-weight: 500;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
    .reg-add-child-link:hover {
        opacity: 0.75;
    }
}

.reg-remove-child {
    margin-top: 12px;
    width: 100%;
}

/* Alerts - spacing within the reg form */
.reg-card > .alert.show {
    margin-top: 20px;
}

/* Error alert - prominent red banner */
.alert.error {
    background-color: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: 8px;
    padding: 12px 16px 12px 44px;
    font-size: var(--font-size-body);
    font-weight: 500;
    position: relative;
}

.alert.error::before {
    content: '!';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-error);
    color: var(--color-on-primary);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.alert.success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: var(--font-size-body);
    font-weight: 500;
}

/* Success page */
.reg-success {
    text-align: center;
    padding: 40px 20px;
}

.reg-success-icon {
    color: var(--color-primary);
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.reg-success h2 {
    margin-bottom: 12px;
    color: var(--color-primary);
}

.reg-success p {
    max-width: 400px;
    margin: 0 auto 12px;
    color: var(--color-text-light);
    line-height: 1.5;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .reg-children-grid,
    .reg-children-grid.two-children {
        grid-template-columns: 1fr;
        gap: 32px;
        max-width: none;
        margin: 0;
    }

    .reg-parents-grid,
    .reg-parents-grid:has(#guardianCol:not([style*="display:none"])) {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .reg-card {
        max-width: 100%;
    }

    .reg-steps {
        max-width: 100%;
    }

    .reg-step-label {
        font-size: var(--font-size-small);
    }
}

/* Spinner for submit button */
.reg-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-on-primary);
    border-radius: 50%;
    animation: reg-spin 0.6s linear infinite;
}

@keyframes reg-spin {
    to { transform: rotate(360deg); }
}

/* :has() validation-state affordances (STEWARDed from the has-glow dossier
   primitive, frontier-26-techniques.md #8). CSS-only, additive - register.js's
   own validation still owns Next/Submit gating and the alert messages; this
   only gives a live green/red cue on the field wrapper as it's filled in.
   :not(:placeholder-shown) is the load-bearing part: an untouched empty
   field always shows its placeholder, so it can never read as invalid
   before the parent has typed anything. input:not([type="file"]) excludes
   the birth-cert file upload - a required file input has no meaningful
   :placeholder-shown state, so without the exclusion it would read as
   invalid from first paint. --color-success / --color-error are already
   defined in both :root (css/style-01.css) and [data-theme="dark"]
   (css/style-04.css). */
@supports selector(:has(a)) {
    .form-group:has(input:not([type="file"]):valid:not(:placeholder-shown)),
    .form-group:has(textarea:valid:not(:placeholder-shown)) {
        box-shadow: inset 3px 0 0 var(--color-success);
        border-radius: 4px;
        padding-left: 8px;
    }
    .form-group:has(input:not([type="file"]):invalid:not(:placeholder-shown)),
    .form-group:has(textarea:invalid:not(:placeholder-shown)) {
        box-shadow: inset 3px 0 0 var(--color-error);
        border-radius: 4px;
        padding-left: 8px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reg-step,
    .seg-btn,
    .file-upload-area,
    .reg-add-child-link {
        transition: none;
    }
    .reg-spinner {
        animation: none;
        opacity: 0.6;
    }
}
