/*
 * auth.css — Admin.Web authentication surface (login, fallback, lockout).
 * First introduction of the Ekhtabrny brand palette into Admin.Web,
 * scoped to the sign-in experience only. "Egyptian Classroom" system:
 * navy school-uniform authority, gold-star accent, warm exam-paper ground.
 * All colors live as custom properties; never hardcode hex in markup.
 */

:root {
    /* Navy — authority, primary actions, focus */
    --auth-primary: #1e3a5f;
    --auth-primary-hover: #2a5080;
    --auth-primary-active: #17304f;
    --auth-primary-deep: #142942;

    /* Gold — accent for fills, dividers and large marks only (never body text) */
    --auth-accent: #c8952e;
    --auth-accent-soft: #d4a843;

    /* Warm neutrals — exam-paper ground, never pure white/black */
    --auth-surface: #faf8f4;
    --auth-surface-raised: #ffffff;
    --auth-ink: #1a1815;
    --auth-ink-secondary: #5c5650;
    --auth-ink-muted: #8c857c;
    --auth-ink-inverted: #ffffff;
    --auth-on-navy: rgba(255, 255, 255, 0.82);
    --auth-on-navy-muted: rgba(255, 255, 255, 0.55);

    --auth-border: #e5e2dc;
    --auth-border-focus: #1e3a5f;

    /* Red-pen error */
    --auth-error: #b83b3b;
    --auth-error-ink: #7a2222;
    --auth-error-bg: #fdeaea;
    --auth-error-border: #f0cccc;

    --auth-radius: 8px;
    --auth-radius-sm: 6px;
    --auth-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --auth-shadow-focus: 0 4px 14px rgba(30, 58, 95, 0.28);
}

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

.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--auth-font);
    color: var(--auth-ink);
    background: var(--auth-surface);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ------------------------------------------------------------------ *
 * Shell — split panel
 * ------------------------------------------------------------------ */
.auth-shell {
    display: flex;
    min-height: 100vh;
}

/* --- Brand panel (left) --------------------------------------------- */
.auth-brand {
    flex: 0 0 44%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    padding: 56px 56px 40px;
    color: var(--auth-ink-inverted);
    position: relative;
    overflow: hidden;
    border-inline-end: 3px solid var(--auth-accent);
    /* Same-hue tonal depth (navy -> deeper navy), not a rainbow gradient,
       layered over faint ruled-paper lines evoking an exam sheet. */
    background-color: var(--auth-primary);
    background-image:
        repeating-linear-gradient(to bottom,
            transparent 0, transparent 31px,
            rgba(255, 255, 255, 0.035) 31px, rgba(255, 255, 255, 0.035) 32px),
        radial-gradient(120% 90% at 15% 0%, rgba(200, 149, 46, 0.14) 0%, transparent 45%),
        linear-gradient(160deg, var(--auth-primary) 0%, var(--auth-primary-deep) 100%);
}

.auth-brand-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-logo {
    /* Official wordmark lockup (360x80 viewBox) — dark-surface variant */
    width: 230px;
    max-width: 100%;
    height: auto;
    display: block;
}

.auth-brand-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 26rem;
}

.auth-headline {
    margin: 0;
    font-size: clamp(1.9rem, 3.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.auth-rule {
    display: block;
    width: 48px;
    height: 3px;
    margin: 22px 0;
    border-radius: 2px;
    background: var(--auth-accent);
}

.auth-tagline {
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--auth-on-navy);
    max-width: 30ch;
}

.auth-brand-foot {
    font-size: 0.8125rem;
    color: var(--auth-on-navy-muted);
    letter-spacing: 0.01em;
}

/* --- Form panel (right) --------------------------------------------- */
.auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--auth-surface);
}

.auth-content {
    width: 100%;
    max-width: 380px;
}

.auth-heading {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--auth-ink);
}

.auth-subheading {
    margin: 0 0 28px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--auth-ink-secondary);
}

/* --- Fields --------------------------------------------------------- */
.auth-field {
    margin-bottom: 20px;
}

.auth-field label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--auth-ink-secondary);
}

.auth-content .form-control {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--auth-font);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--auth-ink);
    background: var(--auth-surface-raised);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
}

.auth-content .form-control::placeholder {
    color: var(--auth-ink-muted);
}

.auth-content .form-control:focus,
.auth-content .form-control:focus-visible {
    outline: 2px solid var(--auth-border-focus);
    outline-offset: 2px;
    border-color: var(--auth-primary);
    box-shadow: none;
}

.auth-content .form-control.input-validation-error {
    border-color: var(--auth-error);
}

/* jquery-validation writes .field-validation-error on the span */
.auth-error-text,
.auth-content .field-validation-error {
    display: block;
    margin-top: 7px;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--auth-error);
}

/* --- Remember-me checkbox ------------------------------------------- */
.auth-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0 26px;
}

.auth-check input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-check label {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--auth-ink-secondary);
    cursor: pointer;
    user-select: none;
}

/* --- Submit button -------------------------------------------------- */
.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    font-family: var(--auth-font);
    font-size: 1rem;
    font-weight: 600;
    color: var(--auth-ink-inverted);
    background: var(--auth-primary);
    border: 1px solid var(--auth-primary);
    border-radius: var(--auth-radius);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
    background: var(--auth-primary-hover);
    border-color: var(--auth-primary-hover);
}

.auth-submit:active {
    background: var(--auth-primary-active);
    transform: none;
}

.auth-submit:focus-visible {
    outline: 2px solid var(--auth-border-focus);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    .auth-submit:hover {
        transform: translateY(-1px);
        box-shadow: var(--auth-shadow-focus);
    }
}

/* --- Error summary alert (server-side ModelState) ------------------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--auth-error-ink);
    background: var(--auth-error-bg);
    border: 1px solid var(--auth-error-border);
    border-radius: var(--auth-radius-sm);
}

.auth-alert .auth-alert-icon {
    color: var(--auth-error);
    font-size: 1rem;
    line-height: 1.5;
    flex-shrink: 0;
}

.auth-alert ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-alert li + li {
    margin-top: 4px;
}

/* --- Secondary link / divider (fallback + lockout) ----------------- */
.auth-divider {
    height: 1px;
    margin: 26px 0 22px;
    background: var(--auth-border);
    border: 0;
}

.auth-link {
    color: var(--auth-primary);
    font-weight: 500;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
    text-decoration-color: var(--auth-accent);
    text-underline-offset: 3px;
}

.auth-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
}

/* --- Lockout state -------------------------------------------------- */
.auth-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 22px;
    border-radius: 14px;
    font-size: 1.5rem;
    color: var(--auth-error);
    background: var(--auth-error-bg);
    border: 1px solid var(--auth-error-border);
}

.auth-body-text {
    margin: 0 0 14px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--auth-ink-secondary);
}

.auth-actions {
    margin-top: 26px;
}

/* Button rendered as a link (lockout / return actions) */
a.auth-submit {
    text-decoration: none;
}

.auth-submit.auth-submit-inline {
    width: auto;
}

/* ------------------------------------------------------------------ *
 * Responsive — brand panel folds to a compact top band
 * ------------------------------------------------------------------ */
@media (max-width: 860px) {
    .auth-shell {
        flex-direction: column;
    }

    .auth-brand {
        flex: 0 0 auto;
        max-width: none;
        padding: 28px 28px 26px;
        border-inline-end: 0;
        border-bottom: 3px solid var(--auth-accent);
    }

    .auth-brand-main {
        margin-top: 22px;
    }

    .auth-headline {
        font-size: 1.6rem;
    }

    .auth-rule {
        margin: 16px 0;
    }

    .auth-brand-foot {
        display: none;
    }

    .auth-panel {
        padding: 36px 24px 48px;
        align-items: flex-start;
    }
}

@media (max-width: 420px) {
    .auth-brand {
        padding: 24px 22px;
    }

    .auth-heading {
        font-size: 1.5rem;
    }
}

/* ------------------------------------------------------------------ *
 * Language switcher — shared button + auth placement
 * ------------------------------------------------------------------ */
.language-switcher-form {
    margin: 0;
}

.language-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: var(--auth-surface-raised);
    color: var(--auth-ink-secondary);
    font-size: 0.875rem;
    line-height: 1.2;
    cursor: pointer;
}

.language-switcher-btn:hover,
.language-switcher-btn:focus-visible {
    color: var(--auth-primary);
    border-color: var(--auth-primary);
    outline: none;
}

.auth-language-switcher {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
}

.auth-language-switcher .language-switcher-btn {
    background: var(--auth-surface-raised);
}

.auth-language-switcher .language-switcher-btn:hover,
.auth-language-switcher .language-switcher-btn:focus-visible {
    background: var(--auth-surface);
}
