/* Sign-in, sign-up and the other pages of Views/Shared/_LayoutAccount.cshtml (Areas/Identity/Pages/Account).
   Loaded after the dashboard bundles, which still provide the reset, the font and Bootstrap's modal.
   Only logical properties (inline-start/end) are used, so the same file serves right-to-left languages:
   there is no auth.rtl.css and it is not in rtl.build.js.
   Theme: <html data-theme="dark"> (pages/theme-mode.js). */

.auth-page {
    --auth-bg: #f5f7fa;
    --auth-surface: #ffffff;
    --auth-surface-border: #e6e9f0;
    --auth-text: #181c32;
    --auth-muted: #5e6278;
    --auth-placeholder: #9a9fb0;
    --auth-border: #d5dae4;
    --auth-border-strong: #b3bac9;
    --auth-input-bg: #ffffff;
    --auth-primary: #009ef7;
    --auth-primary-hover: #0089d6;
    --auth-primary-ring: rgba(0, 158, 247, 0.22);
    --auth-primary-soft: #e8f6fe;
    --auth-link: #0073ba;
    --auth-danger: #c81e4a;
    --auth-danger-bg: #fff4f7;
    --auth-danger-border: #f6c5d1;
    --auth-danger-ring: rgba(200, 30, 74, 0.18);
    --auth-success: #15734a;
    --auth-success-bg: #effaf4;
    --auth-success-border: #bfe6cf;
    --auth-info: #0a5f96;
    --auth-info-bg: #eef7fd;
    --auth-info-border: #bfdff5;
    --auth-brand-bg: #1e1e2d;
    --auth-brand-text: #c9ccda;
    --auth-tile: #f2f3f7;
    --auth-tile-hover: #eaecf2;
    --auth-tile-active: #e1e4ec;
    --auth-tile-edge: rgba(24, 28, 50, 0.05);
    --auth-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 16px 40px -18px rgba(16, 24, 40, 0.18);

    /* The dashboard bundle makes <body> a fixed-height flex box; here the page grows with its content, so the
       brand panel stays as tall as a form that is longer than the window. */
    display: block;
    height: auto;
    min-height: 100%;
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-text);
}

[data-theme=dark] .auth-page {
    --auth-bg: #151521;
    --auth-surface: #1e1e2d;
    --auth-surface-border: #2b2b40;
    --auth-text: #f5f6fa;
    --auth-muted: #a1a5b7;
    --auth-placeholder: #6d7087;
    --auth-border: #3a3a52;
    --auth-border-strong: #565674;
    --auth-input-bg: #171723;
    --auth-primary-soft: rgba(0, 158, 247, 0.16);
    --auth-link: #56bdff;
    --auth-danger: #ff6b8b;
    --auth-danger-bg: rgba(241, 65, 108, 0.12);
    --auth-danger-border: rgba(241, 65, 108, 0.35);
    --auth-danger-ring: rgba(241, 65, 108, 0.28);
    --auth-success: #5fd6a0;
    --auth-success-bg: rgba(80, 205, 137, 0.12);
    --auth-success-border: rgba(80, 205, 137, 0.35);
    --auth-info: #7fcbff;
    --auth-info-bg: rgba(0, 158, 247, 0.12);
    --auth-info-border: rgba(0, 158, 247, 0.35);
    --auth-brand-bg: #11111b;
    --auth-tile: rgba(255, 255, 255, 0.06);
    --auth-tile-hover: rgba(255, 255, 255, 0.1);
    --auth-tile-active: rgba(255, 255, 255, 0.14);
    --auth-tile-edge: rgba(255, 255, 255, 0.07);
    --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -18px rgba(0, 0, 0, 0.6);
}

/* ---------- Shell: brand strip on top (phones), brand panel beside the form (desktop) ---------- */

.auth-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--auth-brand-bg);
}

.auth-brand-logo {
    display: block;
    line-height: 0;
}

.auth-brand-logo img {
    display: block;
    width: auto;
    height: 68px;
}

.auth-brand-tagline {
    display: none;
}

.auth-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

/* The card is centred in the space between the brand and the footer, at every width. */
.auth-content {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 22px 18px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-surface-border);
    border-radius: 16px;
    box-shadow: var(--auth-shadow);
}

.auth-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px 16px;
}

.auth-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
}

.auth-footer-links a {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-muted);
    text-decoration: none;
}

.auth-footer-links a:hover,
.auth-footer-links a:focus-visible {
    color: var(--auth-link);
    text-decoration: underline;
}

@media (min-width: 576px) {
    .auth-content {
        padding: 24px;
    }

    .auth-card {
        padding: 28px 32px;
    }
}

@media (min-width: 992px) {
    .auth-shell {
        flex-direction: row;
    }

    .auth-main {
        order: 1;
        flex: 1 1 50%;
    }

    .auth-brand {
        order: 2;
        flex: 1 1 50%;
        flex-direction: column;
        gap: 22px;
        padding: 48px;
    }

    .auth-brand-logo img {
        height: 104px;
    }

    .auth-brand-tagline {
        display: block;
        max-width: 340px;
        margin: 0;
        font-size: 16px;
        line-height: 1.6;
        text-align: center;
        color: var(--auth-brand-text);
    }
}

/* ---------- Headings and text ---------- */

.auth-head {
    margin-bottom: 18px;
    text-align: center;
}

.auth-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--auth-text);
}

.auth-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--auth-muted);
}

.auth-card a.auth-link,
.auth-card a.link-primary,
.auth-subtitle a,
.auth-alt a,
.auth-note a,
.auth-terms a {
    font-weight: 600;
    color: var(--auth-link) !important;
    text-decoration: none;
}

.auth-card a.auth-link:hover,
.auth-card a.link-primary:hover,
.auth-subtitle a:hover,
.auth-alt a:hover,
.auth-note a:hover,
.auth-terms a:hover {
    text-decoration: underline;
}

.auth-card a:focus-visible,
.auth-footer a:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.auth-alt {
    margin: 14px 0 0;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    color: var(--auth-muted);
}

.auth-note {
    margin: 14px 0 0;
    font-size: 13.5px;
    line-height: 1.55;
    text-align: center;
    color: var(--auth-muted);
}

.auth-terms {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    text-align: center;
    color: var(--auth-muted);
}

/* ---------- Fields ---------- */

.auth-field {
    margin-bottom: 14px;
}

/* Two fields side by side (password and its repeat): half the height of two stacked fields. */
.auth-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 10px;
    align-items: start;
}

.auth-row + .auth-hint {
    margin: -8px 0 14px;
}

.auth-label {
    display: block;
    margin: 0 0 5px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--auth-text);
}

.auth-label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 12px;
    margin-bottom: 5px;
}

.auth-label-row .auth-label {
    margin: 0;
}

.auth-label-row .auth-link {
    font-size: 13px;
}

/* 16px keeps iOS Safari from zooming the page when a field gets focus. */
.auth-input {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    outline: 0;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
    color: var(--auth-placeholder);
    opacity: 1;
}

.auth-input:hover {
    border-color: var(--auth-border-strong);
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-ring);
}

.auth-input.input-validation-error {
    border-color: var(--auth-danger);
}

.auth-input.input-validation-error:focus {
    box-shadow: 0 0 0 3px var(--auth-danger-ring);
}

.auth-input-code {
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.28em;
    text-align: center;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .auth-input {
    padding-inline-end: 42px;
}

.auth-toggle {
    position: absolute;
    inset-block: 1px;
    inset-inline-end: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    padding: 0;
    color: var(--auth-muted);
    background: none;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.auth-toggle:hover {
    color: var(--auth-text);
}

.auth-toggle svg {
    width: 20px;
    height: 20px;
}

.auth-toggle .auth-eye-off,
.auth-toggle[aria-pressed=true] .auth-eye {
    display: none;
}

.auth-toggle[aria-pressed=true] .auth-eye-off {
    display: block;
}

.auth-hint {
    margin: 5px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--auth-muted);
}

.auth-card .field-validation-error {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--auth-danger) !important;
}

.auth-card .field-validation-valid {
    display: none;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--auth-text);
    cursor: pointer;
}

.auth-check input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--auth-primary);
}

/* ---------- Captcha: image, refresh and the answer on one row ---------- */

.auth-captcha {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

/* The generated image is 150x50 (Helpers/CaptchaHelper); it is shown at the height of the input. */
.auth-captcha img {
    flex: 0 0 auto;
    width: auto;
    max-width: 45%;
    height: 44px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
}

.auth-captcha-refresh {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--auth-link);
    background: transparent;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    cursor: pointer;
}

.auth-captcha-refresh:hover {
    background: var(--auth-bg);
    border-color: var(--auth-border-strong);
}

.auth-captcha-refresh:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--auth-primary-ring);
}

.auth-captcha-refresh svg {
    width: 16px;
    height: 16px;
}

.auth-captcha .auth-input {
    flex: 1 1 0;
    min-width: 0;
    letter-spacing: 0.12em;
}

/* ---------- Buttons ---------- */

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--auth-primary-ring);
}

.auth-btn-primary,
.auth-btn-primary:hover,
.auth-btn-primary:focus {
    color: #ffffff;
}

.auth-btn-primary {
    background: var(--auth-primary);
}

.auth-btn-primary:hover {
    background: var(--auth-primary-hover);
}

.auth-btn-light,
.auth-btn-light:hover,
.auth-btn-light:focus {
    color: var(--auth-text);
}

.auth-btn-light {
    background: var(--auth-surface);
    border-color: var(--auth-border);
}

.auth-btn-light:hover {
    background: var(--auth-bg);
    border-color: var(--auth-border-strong);
}

.auth-btn[disabled],
.auth-btn.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

.auth-btn-wait,
.auth-btn.is-busy .auth-btn-label {
    display: none;
}

.auth-btn.is-busy .auth-btn-wait {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner {
        animation-duration: 2s;
    }
}

/* ---------- Sign in with a provider ---------- */

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    color: var(--auth-muted);
}

.auth-divider::before,
.auth-divider::after {
    flex: 1 1 0;
    height: 1px;
    background: var(--auth-border);
    content: "";
}

/* One row of equal tiles, however many providers are registered (three today). Each tile is a soft fill with the
   provider's mark on a white app-icon chip and its name underneath, the way iOS draws a row of actions.
   The chip is white in both themes, so every mark keeps its own colours and the dark GitHub mark stays readable. */
.auth-providers {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 10px;
}

.auth-provider,
.auth-provider:hover,
.auth-provider:focus {
    color: var(--auth-text);
    text-decoration: none;
}

.auth-provider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 80px;
    padding: 12px 6px 10px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.005em;
    background: var(--auth-tile);
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px var(--auth-tile-edge);
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.2s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) {
    .auth-provider:hover {
        background: var(--auth-tile-hover);
    }
}

/* Pressed: the tile sinks a little and springs back on release. */
.auth-provider:active {
    background: var(--auth-tile-active);
    transform: scale(0.96);
    transition-duration: 0.08s;
}

.auth-provider:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 1px var(--auth-tile-edge), 0 0 0 3px var(--auth-primary-ring);
}

.auth-provider-mark {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #1b1f27;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 0 0.5px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.08), 0 4px 10px -4px rgba(16, 24, 40, 0.18);
}

.auth-provider-mark svg {
    display: block;
    width: 20px;
    height: 20px;
}

.auth-provider-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .auth-provider {
        transition: background-color 0.2s ease;
    }

    .auth-provider:active {
        transform: none;
    }
}

/* ---------- Messages ---------- */

.auth-alert,
.auth-card .alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 14px;
    padding: 10px 12px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
    text-align: start;
    overflow-wrap: anywhere;
    border: 1px solid;
    border-radius: 10px;
}

.auth-alert::before,
.auth-card .alert::before {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    background: currentColor;
    content: "";
    -webkit-mask: var(--auth-alert-icon) center / contain no-repeat;
    mask: var(--auth-alert-icon) center / contain no-repeat;
}

.auth-alert ul {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-alert-danger,
.auth-card .alert-danger {
    --auth-alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    color: var(--auth-danger);
    background: var(--auth-danger-bg);
    border-color: var(--auth-danger-border);
}

.auth-alert-success,
.auth-card .alert-success {
    --auth-alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
    color: var(--auth-success);
    background: var(--auth-success-bg);
    border-color: var(--auth-success-border);
}

.auth-alert-info {
    --auth-alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
    color: var(--auth-info);
    background: var(--auth-info-bg);
    border-color: var(--auth-info-border);
}

/* ---------- Pages without a form (check your email, confirmed, ...) ---------- */

.auth-state {
    text-align: center;
}

.auth-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    color: var(--auth-link);
    background: var(--auth-primary-soft);
    border-radius: 50%;
}

.auth-state-icon svg {
    width: 26px;
    height: 26px;
}

.auth-state .auth-head {
    margin-bottom: 0;
}

.auth-state .auth-alert,
.auth-state .alert {
    margin: 16px 0 0;
}

.auth-state-icon-danger {
    color: var(--auth-danger);
    background: var(--auth-danger-bg);
}

.auth-state-icon-success {
    color: var(--auth-success);
    background: var(--auth-success-bg);
}

/* Request id on the error page: one long token that has to wrap on a phone. */
.auth-card code.auth-code {
    display: inline-block;
    margin: 4px 0 0;
    font-weight: 500;
    box-shadow: none;
    max-width: 100%;
    padding: 2px 6px;
    font-size: 12px;
    color: var(--auth-text);
    overflow-wrap: anywhere;
    background: var(--auth-bg);
    border: 1px solid var(--auth-surface-border);
    border-radius: 6px;
}

/* ---------- Short windows: a laptop or a phone with the address bar showing ---------- */

@media (max-height: 760px) {
    .auth-content {
        padding-block: 12px;
    }

    .auth-card {
        padding-block: 18px;
    }

    .auth-head {
        margin-bottom: 14px;
    }

    .auth-field,
    .auth-check {
        margin-bottom: 12px;
    }

    .auth-row + .auth-hint {
        margin-bottom: 12px;
    }

    .auth-actions {
        margin-top: 14px;
    }

    .auth-footer {
        padding-bottom: 12px;
    }
}

@media (max-height: 760px) and (max-width: 991.98px) {
    .auth-brand {
        padding-block: 8px;
    }

    .auth-brand-logo img {
        height: 56px;
    }
}

/* Shorter still (a small phone, a laptop with toolbars): controls lose two pixels each. */
@media (max-height: 700px) {
    .auth-head {
        margin-bottom: 12px;
    }

    .auth-title {
        font-size: 20px;
    }

    .auth-field,
    .auth-check {
        margin-bottom: 10px;
    }

    .auth-row + .auth-hint {
        margin: -6px 0 10px;
    }

    .auth-label,
    .auth-label-row {
        margin-bottom: 4px;
    }

    .auth-input,
    .auth-captcha img,
    .auth-captcha-refresh {
        height: 42px;
    }

    .auth-captcha-refresh {
        width: 42px;
    }

    .auth-btn {
        min-height: 42px;
    }

    .auth-provider {
        gap: 6px;
        min-height: 72px;
        padding-block: 10px 8px;
    }

    .auth-provider-mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .auth-provider-mark svg {
        width: 18px;
        height: 18px;
    }

    .auth-divider {
        margin: 12px 0 8px;
    }

    .auth-alt {
        margin-top: 12px;
    }
}
