/* ============================================================================
   Signed-out pages (login, register, forgot/reset password, 2FA challenge,
   magic link, resend verification, admin login): one clean centred card under
   the app's name.

   The look of mapplugin-symfony's sign-in pages (its public/mp/css/auth.css),
   redrawn for this app's bare boilerplate markup: base.html.twig wraps the page
   body in .auth-card when nobody is signed in, so no auth template needs its own
   wrapper. Loaded after app.css, tokens.css and admin-theme.css. Inter is the
   face (the rest of the theme's), not mapplugin's Nunito.

   Contrast: body text #212529 on white (16:1), muted text #5b6470 (5.9:1),
   links/buttons #3451d1 on white (6.3:1), errors #b42318 on #fef3f2 (6.1:1).
   ============================================================================ */

.layout:not(.layout--with-sidebar) {
    background: #f4f6fb;
}

.layout:not(.layout--with-sidebar) > .main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 16px;
}

.layout:not(.layout--with-sidebar) > .main > .auth-logo,
.layout:not(.layout--with-sidebar) > .main > .auth-card {
    width: 100%;
    max-width: 440px;
}

/* Brand line above the card: a neutral mark and the app's name. */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 20px;
    color: #212529;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-align: center;
}

.auth-logo .auth-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #3451d1;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* The card. Fluid: fits a 360px phone with a 16px gutter. */
.auth-card {
    box-sizing: border-box;
    padding: 36px 32px 32px;
    border: 1px solid #e3e7ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .08);
    color: #212529;
    font-size: 16px;
    line-height: 1.5;
    text-align: left;
}

.auth-card h1,
.auth-card h2:first-child {
    margin: 0 0 8px;
    color: #111827;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.015em;
    line-height: 1.2;
    text-align: left;
}

.auth-card h2 { font-size: 18px; font-weight: 700; }

.auth-card p {
    margin: 0 0 16px;
    color: #5b6470;
    font-size: 15px;
}

.auth-card h1 + form,
.auth-card h1 + .error,
.auth-card h1 + .success,
.auth-card h1 + div { margin-top: 18px; }

/* Forms: the bare boilerplate markup, one field per row. */
.auth-card form {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.auth-card form > div,
.auth-card .form-field { margin: 0 0 18px; }

.auth-card label {
    display: block;
    margin: 0 0 6px;
    padding: 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.auth-card input[type=email],
.auth-card input[type=text],
.auth-card input[type=password],
.auth-card input[type=number],
.auth-card input[type=tel],
.auth-card select {
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #aeb6c4;
    border-radius: 10px;
    background-color: #fff;
    color: #111827;
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color .12s, box-shadow .12s;
}

.auth-card input::placeholder { color: #7a8394; }
.auth-card input:not([type=checkbox]):not([type=radio]):hover { border-color: #7a8394; }

.auth-card input:not([type=checkbox]):not([type=radio]):focus,
.auth-card select:focus {
    border-color: #3451d1;
    box-shadow: 0 0 0 3px rgba(52, 81, 209, .28);
    outline: 0;
}

.auth-card input[aria-invalid=true] { border-color: #b42318; }

/* Checkbox rows ("Remember me", "Trust this device"). */
.auth-card .checkbox-row,
.auth-card label:has(> input[type=checkbox]) {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.3;
}

.auth-card input[type=checkbox] {
    width: 20px;
    height: 20px;
    border-color: #aeb6c4;
    border-radius: 5px;
}

.auth-card input[type=checkbox]:checked { background-color: #3451d1; border-color: #3451d1; }

/* The 2FA challenge's one-time code reads like a code. */
.auth-card input[autocomplete=one-time-code] {
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .35em;
    text-align: center;
}

/* The submit is the card's one primary action. */
.auth-card button,
.auth-card button[type=submit],
.auth-card input[type=submit] {
    width: 100%;
    height: 48px;
    padding: 0 18px;
    border: 1px solid #3451d1;
    border-radius: 10px;
    background: #3451d1;
    box-shadow: none;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    transition: background .12s, box-shadow .12s;
}

.auth-card button:hover,
.auth-card button[type=submit]:hover { background: #2a42b3; border-color: #2a42b3; color: #fff; }
.auth-card button:active { background: #223a9c; }
.auth-card button:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #3451d1; outline: 0; }

/* Links. The first paragraph after the form gets a rule above it, like the reference. */
.auth-card a { color: #3451d1; font-weight: 600; text-decoration: none; }
.auth-card a:hover { text-decoration: underline; }

.auth-card form + p {
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid #eceff5;
    font-size: 14px;
    text-align: center;
}

.auth-card form + p + p,
.auth-card form + p ~ p {
    margin: 10px 0 0;
    padding: 0;
    border: 0;
    font-size: 14px;
    text-align: center;
}

/* Messages: page-level boxes above the form; field errors inline under their field. */
.auth-card .error,
.auth-card .success,
.auth-card .flash-success,
.auth-card .flash-error,
.auth-card .flash-info,
.auth-card .flash-warning,
.auth-card .alert-error,
.auth-card .alert-success {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
}

.auth-card .error p,
.auth-card .success p { margin: 0; color: inherit; font-size: inherit; }

.auth-card .error,
.auth-card .flash-error,
.auth-card .alert-error { background: #fef3f2; border-color: #f4b9b3; color: #b42318; }

.auth-card .success,
.auth-card .flash-success,
.auth-card .alert-success { background: #ecfdf3; border-color: #a6e4c1; color: #05603a; }

.auth-card .flash-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.auth-card .flash-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }

.auth-card .field-error,
.auth-card .field-error.error {
    display: block;
    margin: 6px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: #b42318;
    font-size: 13px;
    font-weight: 600;
}

.auth-card code, .auth-card pre { font-size: 87.5%; }

@media (max-width: 420px) {
    .layout:not(.layout--with-sidebar) > .main { justify-content: flex-start; padding-top: 28px; }
    .auth-card { padding: 28px 20px 24px; }
    .auth-card h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card * { transition: none !important; }
}
