/* ==========================================================================
   rushaid-auth.css: the sign-in family of pages (layouts/auth.blade.php)
   --------------------------------------------------------------------------
   Login, forgot and reset password, password confirm, two-step code, email
   verification, restore access and the school registration page.
   Colours come only from rushaid-tokens.css (--rs-*). Logical properties only,
   so the same rules serve Arabic (RTL) and English (LTR).
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.rs-auth {
    margin: 0;
    min-block-size: 100vh;
    min-block-size: 100dvh;
    background: var(--rs-bg);
    color: var(--rs-text);
    font-family: var(--rs-font);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

.rs-auth img,
.rs-auth svg {
    display: block;
    max-inline-size: 100%;
}

.rs-auth a {
    color: var(--rs-link);
    text-underline-offset: 3px;
}

.rs-auth a:hover {
    color: var(--rs-link-hover);
}

.rs-auth :focus-visible {
    outline: 3px solid var(--rs-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Skip link ---------- */
.rs-auth-skip {
    position: absolute;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    inset-inline-start: var(--rs-space-2);
    inset-block-start: -100px;
    z-index: 10;
    padding: var(--rs-space-1) var(--rs-space-2);
    background: var(--rs-surface);
    color: var(--rs-heading);
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow-lg);
}

.rs-auth-skip:focus {
    inset-block-start: var(--rs-space-2);
}

/* ---------- Shell: brand band first on small screens, two columns from 992px ---------- */
.rs-auth-shell {
    display: flex;
    flex-direction: column;
    min-block-size: 100vh;
    min-block-size: 100dvh;
}

.rs-auth-brand {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--rs-space-1);
    padding: var(--rs-space-3) var(--rs-space-2);
    background: var(--rs-sidebar-bg);
    color: var(--rs-on-walnut);
    text-align: center;
}

/* The eight-point star lattice of Iraqi tilework, drawn in a hairline on the walnut */
.rs-auth-brand__pattern {
    position: absolute;
    inset: 0;
    z-index: -1;
    inline-size: 100%;
    block-size: 100%;
    color: var(--rs-sidebar-divider);
    -webkit-mask-image: radial-gradient(ellipse at center, transparent 22%, black 78%);
    mask-image: radial-gradient(ellipse at center, transparent 22%, black 78%);
}

.rs-auth-brand__home {
    display: inline-flex;
    border-radius: var(--rs-radius);
}

.rs-auth-brand__home:focus-visible {
    outline-color: var(--rs-on-walnut);
}

.rs-auth-brand__wordmark {
    inline-size: 112px;
    block-size: auto;
}

.rs-auth-brand__custom-logo {
    max-inline-size: min(280px, 70%);
    max-block-size: 96px;
    object-fit: contain;
}

.rs-auth-brand__tagline {
    margin: 0;
    max-inline-size: 30ch;
    color: var(--rs-on-walnut-muted);
    font-size: 15px;
    line-height: 1.5;
}

.rs-auth-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
}

.rs-auth-topbar {
    display: flex;
    justify-content: flex-end;
    padding: var(--rs-space-1) var(--rs-space-2) 0;
}

.rs-auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--rs-space-2) var(--rs-space-2) var(--rs-space-4);
}

.rs-auth-main:focus {
    outline: none;
}

.rs-auth-card {
    inline-size: 100%;
    max-inline-size: 420px;
    margin-inline: auto;
}

.rs-auth--wide .rs-auth-card {
    max-inline-size: 680px;
}

.rs-auth-footer {
    padding: var(--rs-space-2);
    border-block-start: 1px solid var(--rs-border);
    color: var(--rs-text-muted);
    font-size: 13px;
    text-align: center;
}

.rs-auth-footer p {
    margin: 0;
}

@media (min-width: 768px) {
    .rs-auth-brand {
        padding-block: var(--rs-space-5);
    }

    .rs-auth-brand__wordmark {
        inline-size: 136px;
    }

    .rs-auth-topbar {
        padding: var(--rs-space-2) var(--rs-space-4) 0;
    }

    .rs-auth-main {
        padding: var(--rs-space-3) var(--rs-space-4) var(--rs-space-5);
    }
}

@media (min-width: 992px) {
    .rs-auth-shell {
        display: grid;
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }

    /* The form keeps the reading start; the walnut column sits at the end */
    .rs-auth-brand {
        order: 2;
        position: sticky;
        inset-block-start: 0;
        block-size: 100vh;
        block-size: 100dvh;
        gap: var(--rs-space-3);
        padding: var(--rs-space-6);
    }

    .rs-auth-brand__wordmark {
        inline-size: 240px;
    }

    .rs-auth-brand__custom-logo {
        max-block-size: 220px;
    }

    .rs-auth-brand__tagline {
        font-size: 19px;
    }
}

@media (min-width: 1600px) {
    .rs-auth-shell {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

/* ---------- Language switcher ---------- */
.rs-lang {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--rs-surface-2);
    border-radius: 999px;
}

.rs-lang a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: 44px;
    min-inline-size: 72px;
    padding-inline: var(--rs-space-2);
    border-radius: 999px;
    color: var(--rs-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.rs-lang a:hover {
    background: var(--rs-hover-fill);
    color: var(--rs-heading);
}

.rs-lang a[aria-current="true"] {
    background: var(--rs-surface);
    color: var(--rs-heading);
    font-weight: 700;
    box-shadow: var(--rs-shadow-sm);
}

/* ---------- Headings and text ---------- */
.rs-auth-title {
    margin: 0 0 var(--rs-space-1);
    color: var(--rs-heading);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
}

.rs-auth-lead {
    margin: 0 0 var(--rs-space-3);
    color: var(--rs-text-muted);
    font-size: 15px;
}

.rs-auth-section-title {
    margin: var(--rs-space-3) 0 var(--rs-space-2);
    padding-block-end: var(--rs-space-1);
    border-block-end: 1px solid var(--rs-border);
    color: var(--rs-heading);
    font-size: 18px;
    font-weight: 700;
}

.rs-auth-note {
    margin: var(--rs-space-3) 0 0;
    color: var(--rs-text-muted);
    font-size: 14px;
}

.rs-auth-alt {
    margin: var(--rs-space-3) 0 0;
    padding-block-start: var(--rs-space-2);
    border-block-start: 1px solid var(--rs-border);
    color: var(--rs-text);
    font-size: 15px;
    text-align: center;
}

.rs-auth-alt a,
.rs-auth-link {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    font-weight: 700;
}

.rs-auth-alt small {
    display: block;
    color: var(--rs-text-muted);
    font-size: 13px;
}

@media (min-width: 768px) {
    .rs-auth-title {
        font-size: 30px;
    }
}

/* ---------- Alerts (icon and text, never colour alone) ---------- */
.rs-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--rs-space-1);
    margin: 0 0 var(--rs-space-2);
    padding: 12px var(--rs-space-2);
    border: 1px solid transparent;
    border-inline-start-width: 4px;
    border-radius: var(--rs-radius);
    font-size: 15px;
    line-height: 1.5;
}

.rs-alert[hidden] {
    display: none;
}

.rs-alert svg {
    flex: none;
    inline-size: 20px;
    block-size: 20px;
    margin-block-start: 1px;
}

.rs-alert p {
    margin: 0;
}

.rs-alert--error {
    background: var(--rs-danger-soft);
    border-color: var(--rs-danger);
    color: var(--rs-danger-ink);
}

.rs-alert--success {
    background: var(--rs-success-soft);
    border-color: var(--rs-success);
    color: var(--rs-success-ink);
}

.rs-alert--info {
    background: var(--rs-info-soft);
    border-color: var(--rs-info);
    color: var(--rs-info-ink);
}

/* ---------- Fields ---------- */
.rs-form {
    margin: 0;
}

.rs-field {
    margin-block-end: var(--rs-space-2);
}

.rs-field__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rs-space-1);
}

.rs-label {
    display: block;
    margin-block-end: 6px;
    color: var(--rs-heading);
    font-size: 15px;
    font-weight: 500;
}

.rs-field__row .rs-label {
    margin-block-end: 0;
}

.rs-label .rs-required {
    color: var(--rs-danger);
    margin-inline-start: 2px;
}

.rs-label .rs-optional {
    color: var(--rs-text-muted);
    font-size: 13px;
    font-weight: 400;
}

.rs-input,
.rs-select {
    display: block;
    inline-size: 100%;
    min-block-size: 48px;
    padding: 10px 14px;
    border: 1px solid var(--rs-border-strong);
    border-radius: var(--rs-radius);
    background: var(--rs-surface);
    color: var(--rs-text);
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.rs-input {
    min-block-size: 96px;
    resize: vertical;
}

.rs-input::placeholder {
    color: var(--rs-text-muted);
    opacity: 1;
}

.rs-input:hover,
.rs-select:hover {
    border-color: var(--rs-walnut-300);
}

.rs-input:focus,
.rs-select:focus {
    outline: none;
    border-color: var(--rs-focus);
    box-shadow: var(--rs-focus-ring);
}

.rs-input[aria-invalid="true"],
.rs-select[aria-invalid="true"] {
    border-color: var(--rs-danger);
    border-width: 2px;
    padding: 9px 13px;
}

/* Email, phone and codes read left to right; in Arabic they still sit at the start of the line */
html[dir="rtl"] .rs-input[dir="ltr"] {
    text-align: end;
}

.rs-field__hint {
    margin: 6px 0 0;
    color: var(--rs-text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.rs-field__error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 6px 0 0;
    color: var(--rs-danger-ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.rs-field__error[hidden] {
    display: none;
}

.rs-field__error svg {
    flex: none;
    inline-size: 16px;
    block-size: 16px;
    margin-block-start: 2px;
}

/* Password with its show and hide button */
.rs-password {
    position: relative;
}

.rs-password .rs-input {
    padding-inline-end: 52px;
}

.rs-password .rs-input[aria-invalid="true"] {
    padding-inline-end: 51px;
}

.rs-pw-toggle {
    position: absolute;
    inset-block-start: 2px;
    inset-inline-end: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 44px;
    block-size: 44px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--rs-walnut-500);
    cursor: pointer;
}

.rs-pw-toggle:hover {
    background: var(--rs-hover-fill);
    color: var(--rs-heading);
}

.rs-pw-toggle svg {
    inline-size: 22px;
    block-size: 22px;
}

.rs-pw-toggle .rs-icon-hide,
.rs-pw-toggle[data-state="shown"] .rs-icon-show {
    display: none;
}

.rs-pw-toggle[data-state="shown"] .rs-icon-hide {
    display: block;
}

/* Phone: dial code and number side by side */
.rs-phone {
    display: grid;
    grid-template-columns: minmax(118px, 36%) minmax(0, 1fr);
    gap: var(--rs-space-1);
}

/* Checkboxes and radios */
.rs-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 4px var(--rs-space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.rs-choices legend {
    padding: 0;
}

.rs-check {
    display: inline-flex;
    align-items: center;
    gap: var(--rs-space-1);
    min-block-size: 44px;
    cursor: pointer;
}

.rs-check input {
    inline-size: 20px;
    block-size: 20px;
    margin: 0;
    accent-color: var(--rs-primary);
}

/* Two columns for the long registration form */
.rs-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: var(--rs-space-3);
}

@media (min-width: 640px) {
    .rs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rs-grid .rs-field--full {
        grid-column: 1 / -1;
    }
}

/* ---------- Buttons ---------- */
.rs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    inline-size: 100%;
    min-block-size: 50px;
    margin-block-start: var(--rs-space-1);
    padding: 12px var(--rs-space-3);
    border: 1px solid var(--rs-primary);
    border-radius: var(--rs-radius);
    background: var(--rs-primary);
    color: var(--rs-on-primary);
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.rs-btn:hover {
    background: var(--rs-primary-hover);
    border-color: var(--rs-primary-hover);
    color: var(--rs-on-primary);
}

.rs-btn:focus-visible {
    outline: 3px solid var(--rs-focus);
    outline-offset: 3px;
}

/* Links styled as buttons keep the button colours (.rs-auth a sets the link colour) */
.rs-auth a.rs-btn,
.rs-auth a.rs-btn:hover {
    color: var(--rs-on-primary);
    text-decoration: none;
}

.rs-auth a.rs-btn--quiet,
.rs-auth a.rs-btn--quiet:hover {
    color: var(--rs-heading);
}

.rs-btn[disabled] {
    cursor: progress;
    opacity: .85;
}

.rs-btn--quiet {
    background: transparent;
    color: var(--rs-heading);
    border-color: var(--rs-border-strong);
}

.rs-btn--quiet:hover {
    background: var(--rs-hover-fill);
    color: var(--rs-heading);
    border-color: var(--rs-walnut-300);
}

.rs-btn__spinner {
    display: none;
    inline-size: 18px;
    block-size: 18px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: rs-spin .8s linear infinite;
}

.rs-btn[aria-busy="true"] .rs-btn__spinner {
    display: inline-block;
}

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

@media (prefers-reduced-motion: reduce) {
    .rs-btn__spinner {
        animation-duration: 2.4s;
    }

    .rs-input,
    .rs-select,
    .rs-btn {
        transition: none;
    }
}

/* ---------- Demo shortcuts (demo builds only) ---------- */
.rs-demo {
    margin-block-start: var(--rs-space-3);
    padding-block-start: var(--rs-space-2);
    border-block-start: 1px dashed var(--rs-border-strong);
}

.rs-demo h2 {
    margin: 0 0 var(--rs-space-1);
    color: var(--rs-text-muted);
    font-size: 14px;
    font-weight: 500;
}

.rs-demo__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rs-space-1);
}

.rs-demo__buttons .rs-btn {
    inline-size: auto;
    min-block-size: 44px;
    margin: 0;
    padding-inline: var(--rs-space-2);
    font-size: 14px;
}

/* ---------- Success panel of the registration page ---------- */
.rs-done {
    text-align: center;
}

.rs-done svg {
    inline-size: 56px;
    block-size: 56px;
    margin: 0 auto var(--rs-space-2);
    color: var(--rs-success);
}

.rs-done[hidden],
.rs-form[hidden] {
    display: none;
}

.rs-sr-only {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Task 038: link to the user guides in the footer of the sign-in pages. */
.rs-auth-footer .rs-auth-footer__help {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    color: var(--rs-link);
    font-weight: 500;
}

.rs-auth-footer .rs-auth-footer__help:hover {
    color: var(--rs-link-hover);
}
