/* Azimut Suite — Registration
   AzimutSuite / GWS design language: white card on slate, navy accents,
   IBM Plex Sans, hairline borders. Matches the 2FA pages, dashboard and
   confirmation page. Class names are preserved so the registration JS
   (password-strength meter, show/hide toggle, username error) still works. */

.auth-stage {
    --ar-navy: #2C3E50;
    --ar-navy-deep: #1a2836;
    --ar-bg: #f8f9fa;
    --ar-card: #ffffff;
    --ar-surface: #f8fafc;
    --ar-ink: #1e293b;
    --ar-muted: #64748b;
    --ar-faint: #94a3b8;
    --ar-line: #e2e8f0;
    --ar-line-strong: #cbd5e1;
    --ar-success: #10B981;
    --ar-error: #EF4444;
    --ar-radius: 10px;
    --ar-radius-sm: 8px;
    --ar-ring: 0 0 0 3px rgba(44, 62, 80, 0.10);
    --ar-ease: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    max-width: 640px;
    margin: 1.5rem auto 2.5rem;
    background: var(--ar-card);
    border: 1px solid var(--ar-line);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-radius: var(--ar-radius);
    overflow: hidden;
}

.auth-stage__form {
    padding: 2.5rem 2.75rem;
    background: var(--ar-card);
    color: var(--ar-ink);
    font-family: var(--sans);
}
@media (max-width: 700px) { .auth-stage__form { padding: 2rem 1.5rem; } }
@media (max-width: 480px) { .auth-stage__form { padding: 1.5rem 1.2rem; } }

.auth-form__heading {
    margin-bottom: 2rem; padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--ar-line);
}
.auth-form__heading h1 {
    font-family: var(--sans); font-weight: 600; font-size: 1.6rem;
    letter-spacing: -0.01em; margin: 0 0 0.4rem; color: var(--ar-ink); line-height: 1.2;
}
.auth-form__heading p {
    font-size: 0.92rem; color: var(--ar-muted); margin: 0; line-height: 1.6;
}

.form-section { margin-bottom: 1.75rem; }
.form-section__label {
    display: flex; align-items: center; gap: 0.75rem; margin: 0 0 1.1rem;
    font-family: var(--sans); font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--ar-muted);
}
.form-section__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem; flex-shrink: 0;
    background: var(--ar-navy); color: #fff; border-radius: 6px;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.form-section__divider { flex: 1; height: 1px; background: var(--ar-line); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 540px) { .field-grid { grid-template-columns: 1fr; } }

.ar-field { margin-bottom: 1.1rem; position: relative; }
.ar-field__label {
    display: block; font-size: 0.82rem; font-weight: 500;
    color: var(--ar-ink); margin-bottom: 0.4rem;
}
.ar-field__label .req { color: var(--ar-error); margin-left: 2px; }

/* Bordered inputs (GWS style) */
.ar-input,
.ar-select {
    width: 100%; box-sizing: border-box;
    border: 1.5px solid var(--ar-line); background: #fff;
    padding: 0.65rem 0.8rem;
    font-family: var(--sans); font-size: 0.92rem; color: var(--ar-ink);
    border-radius: var(--ar-radius-sm); outline: none;
    transition: border-color var(--ar-ease), box-shadow var(--ar-ease);
}
.ar-input::placeholder { color: var(--ar-faint); }
.ar-input:focus,
.ar-select:focus { border-color: var(--ar-navy); box-shadow: var(--ar-ring); }
.ar-input.is-invalid { border-color: var(--ar-error); }
.ar-input.is-valid { border-color: var(--ar-success); }

.ar-select {
    appearance: none; -webkit-appearance: none;
    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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.7rem center;
    padding-right: 2rem; cursor: pointer;
}
.ar-select:invalid { color: var(--ar-faint); }
.ar-select option { color: var(--ar-ink); background: #fff; }

/* Password */
.ar-password-wrap { position: relative; }
.ar-password-wrap .ar-input { padding-right: 2.75rem; }
.ar-password-toggle {
    position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--ar-muted);
    cursor: pointer; padding: 0; transition: color var(--ar-ease);
}
.ar-password-toggle:hover { color: var(--ar-navy); }
.ar-password-toggle:focus-visible { outline: 1px solid var(--ar-navy); outline-offset: 2px; border-radius: 4px; }
.ar-password-toggle .ar-eye-off { display: none; }
.ar-password-toggle.is-showing .ar-eye { display: none; }
.ar-password-toggle.is-showing .ar-eye-off { display: inline; }

.ar-password-reqs {
    margin-top: 0.85rem; padding: 0.85rem 1rem;
    background: var(--ar-surface); border: 1px solid var(--ar-line);
    border-radius: var(--ar-radius-sm);
    font-size: 0.8rem; line-height: 1.7;
}
.ar-password-reqs__title {
    color: var(--ar-muted); font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.45rem;
}
.ar-password-reqs ul {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem 0.85rem;
}
@media (max-width: 540px) { .ar-password-reqs ul { grid-template-columns: 1fr; } }
.ar-password-reqs li {
    display: flex; align-items: center; gap: 0.55rem;
    color: var(--ar-muted); transition: color var(--ar-ease);
}
.ar-password-reqs li::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--ar-line-strong); flex-shrink: 0;
    transition: background-color var(--ar-ease), transform var(--ar-ease);
}
.ar-password-reqs li.is-met { color: var(--ar-ink); }
.ar-password-reqs li.is-met::before { background: var(--ar-success); transform: scale(1.15); }

/* Terms */
.ar-terms {
    display: flex; align-items: flex-start; gap: 0.7rem;
    padding: 1.1rem 0; margin: 0.5rem 0 1.5rem;
    border-top: 1px solid var(--ar-line); border-bottom: 1px solid var(--ar-line);
    font-size: 0.86rem; color: var(--ar-muted); line-height: 1.6; cursor: pointer;
}
.ar-terms input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 18px; height: 18px; flex-shrink: 0; margin-top: 0.1rem;
    border: 1.5px solid var(--ar-line-strong); border-radius: 5px;
    cursor: pointer; position: relative; background: white; transition: all var(--ar-ease);
}
.ar-terms input[type="checkbox"]:hover { border-color: var(--ar-navy); }
.ar-terms input[type="checkbox"]:checked { background: var(--ar-navy); border-color: var(--ar-navy); }
.ar-terms input[type="checkbox"]:checked::after {
    content: ''; position: absolute; inset: 2px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 6l3 3 5-7' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
.ar-terms a {
    color: var(--ar-navy); font-weight: 500; text-decoration: underline;
    text-decoration-thickness: 1px; text-underline-offset: 2px;
}
.ar-terms a:hover { color: var(--ar-navy-deep); }

/* Submit */
.ar-submit {
    width: 100%; padding: 0.85rem 1.5rem;
    background: var(--ar-navy); color: #fff;
    border: none; border-radius: var(--ar-radius-sm);
    font-family: var(--sans); font-size: 0.9rem; font-weight: 600; cursor: pointer;
    transition: background-color var(--ar-ease);
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.ar-submit:hover { background: var(--ar-navy-deep); }
.ar-submit:disabled { background: #94a3b8; cursor: not-allowed; }
.ar-submit__arrow { transition: transform var(--ar-ease); font-size: 1.05rem; }
.ar-submit:hover .ar-submit__arrow { transform: translateX(4px); }

/* Login link */
.ar-login-link { margin-top: 1.5rem; text-align: center; font-size: 0.86rem; color: var(--ar-muted); }
.ar-login-link a {
    color: var(--ar-navy); font-weight: 600; text-decoration: none;
    border-bottom: 1px solid var(--ar-line); padding-bottom: 1px;
    transition: border-color var(--ar-ease);
}
.ar-login-link a:hover { border-bottom-color: var(--ar-navy); }

/* Inline username error */
.ar-username-error { color: var(--ar-error); font-size: 0.78rem; margin-top: 0.4rem; display: none; }
.ar-username-error.is-active { display: block; }

/* Inline password error (client-side pre-submit guard) */
.ar-password-error {
    display: none;
    margin-top: 0.6rem; padding: 0.6rem 0.8rem;
    background: #fef2f2; border: 1px solid var(--ar-error);
    border-radius: var(--ar-radius-sm);
    color: var(--ar-error); font-size: 0.8rem; line-height: 1.5;
}
.ar-password-error.is-active { display: block; }

/* Motion */
@keyframes ar-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.auth-stage { animation: ar-fade-up 0.4s ease-out both; }
@media (prefers-reduced-motion: reduce) { .auth-stage { animation: none; } }
