/* ===================================================================
   TRA-9 login screen — Figma "Welcome Back" card.
   Scoped under .aaa-login so it does not leak into the app shell.
   Colours reuse the Figma v2 tokens from aaa-theme.css
   (--sb / --navy / --acc / --acc2 / --red / --txt).
   Shared by the AspNetUsers login page (Account/Login.cshtml) and the
   interactive login (LoginStyle.razor).
   =================================================================== */

/* The standalone cshtml page does not load Bootstrap, so it lacks the global
   border-box reset. Without it, the inputs' horizontal padding (notably the
   password field's 42px right padding for the eye toggle) overflows width:100%
   and the fields no longer line up. Scope the reset to the login screen. */
.aaa-login *,
.aaa-login *::before,
.aaa-login *::after {
    box-sizing: border-box;
}

.aaa-login {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px;
    overflow: auto;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--sb, #1e1b4b) 0%, #3b2f8f 55%, var(--acc2, #5b21b6) 100%);
}

/* Diagonal light sheen across the backdrop */
.aaa-login::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, .07) 50%, transparent 66%);
    pointer-events: none;
}

.aaa-login-card {
    position: relative;
    width: 100%;
    max-width: 384px;
    background: #e9e4f8;
    border-radius: 24px;
    padding: 36px 36px 28px;
    box-shadow: 0 24px 60px rgba(15, 12, 41, .45);
    text-align: center;
}

/* No plate behind the mark: it is drawn in the navy, violet and green of the light lockup, so it
   sits straight on the card. The heading carries the product name, so the mark is decorative and
   its img has an empty alt. */
.aaa-login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.aaa-login-logo img,
.aaa-login-logo .aaa-mark {
    /* Three chevrons at ~3.5:1, so 34px keeps them legible inside the 384px card */
    height: 34px;
    width: auto;
    display: block;
}

/* The mark holds still on these pages: at rest the card is waiting on the person, so there is nothing
   to report. It overrides the always-on jump in aaa-theme.css, which the app shell's start-up screen
   keeps because that screen only exists while the app is loading. */
.aaa-login-logo .aaa-mark-chevron {
    animation: none;
}

/* Once a submit is in flight the mark carries the wait along with the placeholder below it, jumping
   higher and quicker than the start-up screen does. Every property is set here rather than inherited,
   because the rule above resets the shorthand. */
.aaa-login-card.aaa-working .aaa-mark-chevron {
    animation: aaa-mark-bob-working 1s infinite;
}

.aaa-login-card.aaa-working .aaa-mark-chevron:nth-child(2) {
    animation-delay: .12s;
}

.aaa-login-card.aaa-working .aaa-mark-chevron:nth-child(3) {
    animation-delay: .24s;
}

@keyframes aaa-mark-bob-working {
    0% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(.16, .84, .44, 1);
    }

    30% {
        transform: translateY(-52px);
        animation-timing-function: cubic-bezier(.55, .06, .68, .19);
    }

    55% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(.16, .84, .44, 1);
    }

    70% {
        transform: translateY(-18px);
        animation-timing-function: cubic-bezier(.55, .06, .68, .19);
    }

    85%, 100% {
        transform: translateY(0);
    }
}

.aaa-login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy, #1e1b4b);
    margin: 0 0 6px;
}

/* The product name goes back to the home page. Colour is set rather than inherited: aaa-theme.css
   forces heading colours with !important, which a child link does not pick up. */
.aaa-login-title a {
    color: var(--navy, #1e1b4b);
    text-decoration: none;
}

.aaa-login-title a:hover {
    text-decoration: underline;
}

.aaa-login-title a:focus-visible {
    outline: 2px solid var(--acc, #6d28d9);
    outline-offset: 3px;
    border-radius: 4px;
}

.aaa-login-sub {
    font-size: 13px;
    color: #6b6291;
    line-height: 1.45;
    margin: 0 0 24px;
}

/* ---- Fields ---- */
.aaa-login .aaa-field {
    text-align: left;
    margin-bottom: 16px;
}

.aaa-login .aaa-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy, #1e1b4b);
    margin-bottom: 6px;
}

.aaa-login .aaa-input,
.aaa-login .rz-textbox {
    width: 100%;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #fff;
    padding: 0 14px;
    font-size: 13px;
    color: var(--txt, #111827);
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}

.aaa-login .aaa-input::placeholder,
.aaa-login .rz-textbox::placeholder {
    color: #9ca3af;
}

.aaa-login .aaa-input:focus,
.aaa-login .rz-textbox:focus,
.aaa-login .rz-state-focused .rz-textbox {
    border-color: var(--acc, #6d28d9);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .15);
}

.aaa-login .rz-textbox-wrapper,
.aaa-login .rz-dropdown {
    width: 100%;
    background: transparent;
    border: 0;
}

/* ---- Password field with show/hide toggle ---- */
.aaa-login .aaa-pw {
    position: relative;
}

.aaa-login .aaa-pw .aaa-input,
.aaa-login .aaa-pw .rz-textbox {
    padding-right: 42px;
}

.aaa-login .aaa-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
}

.aaa-login .aaa-eye:hover {
    color: var(--acc, #6d28d9);
}

/* Show the open eye when masked, the struck-through eye when revealed */
.aaa-login .aaa-eye .aaa-eye-off {
    display: none;
}

.aaa-login .aaa-eye.revealed .aaa-eye-open {
    display: none;
}

.aaa-login .aaa-eye.revealed .aaa-eye-off {
    display: block;
}

/* ---- Remember / forgot row ---- */
.aaa-login .aaa-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 20px;
    font-size: 12px;
}

.aaa-login .aaa-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4b4470;
    margin: 0;
}

.aaa-login .aaa-remember input {
    accent-color: var(--acc, #6d28d9);
    width: 14px;
    height: 14px;
    margin: 0;
}

.aaa-login .aaa-link {
    color: var(--acc, #6d28d9);
    font-weight: 700;
    text-decoration: none;
}

.aaa-login .aaa-link:hover {
    text-decoration: underline;
}

/* ---- Submit button ---- */
.aaa-login .aaa-submit {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #312a7a 0%, var(--navy, #1e1b4b) 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter .12s, transform .02s;
}

.aaa-login .aaa-submit:hover {
    filter: brightness(1.14);
}

.aaa-login .aaa-submit:active {
    transform: translateY(1px);
}

.aaa-login .aaa-submit:disabled {
    opacity: .7;
    cursor: default;
}

/* In-progress spinner: shown (and the arrow hidden) while the button is busy */
.aaa-login .aaa-spin {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aaa-login-spin .6s linear infinite;
    display: none;
}

.aaa-login .aaa-submit.busy .aaa-spin {
    display: inline-block;
}

.aaa-login .aaa-submit.busy .aaa-submit-arrow {
    display: none;
}

@keyframes aaa-login-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- "OR" divider between the password form and the provider buttons ---- */
.aaa-login .aaa-or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #8b83ad;
}

.aaa-login .aaa-or::before,
.aaa-login .aaa-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e2ef;
}

/* ---- Microsoft / Google buttons ---- */
.aaa-login .aaa-provider {
    width: 100%;
    height: 46px;
    margin-bottom: 10px;
    border: 1px solid #d9d5e6;
    border-radius: 14px;
    background: #fff;
    color: var(--txt, #111827);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: border-color .12s, box-shadow .12s;
}

.aaa-login .aaa-provider:hover {
    border-color: var(--acc, #6d28d9);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
}

.aaa-login .aaa-provider:active {
    transform: translateY(1px);
}

.aaa-login .aaa-provider:disabled {
    opacity: .7;
    cursor: default;
}

/* The personal Microsoft button names the domains beneath its label, so it needs a taller box and a
   left-aligned two-line stack rather than the single centred line the other buttons use. */
.aaa-login .aaa-provider .aaa-provider-hint {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 400;
    color: #6b6291;
}

.aaa-login .aaa-provider:has(.aaa-provider-hint) {
    height: auto;
    padding: 8px 14px;
    text-align: left;
}

/* The provider buttons carry no arrow, so the mark itself dims while the button is busy. Every
   button on the card is disabled during a submit, so the whole card reads as unavailable. */
.aaa-login .aaa-provider.busy svg {
    opacity: .4;
}

.aaa-login .aaa-provider:disabled svg {
    opacity: .5;
}

/* ---- Loading placeholder ----
   While a submit is in flight the form is swapped for shimmering bars in the same shape, so the card
   keeps its size and the wait reads as the card working rather than the page hanging. */
.aaa-login .aaa-login-loading {
    display: none;
}

.aaa-login-card.aaa-working .aaa-login-body {
    display: none;
}

.aaa-login-card.aaa-working .aaa-login-loading {
    display: block;
}

.aaa-login .aaa-skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(30, 27, 75, .09);
}

.aaa-login .aaa-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .7) 50%, transparent 100%);
    animation: aaa-login-shimmer 1.3s ease-in-out infinite;
}

/* Each bar stands in for the control beneath it, so the heights match the real fields. */
.aaa-login .aaa-skeleton-label {
    width: 38%;
    height: 10px;
    margin-bottom: 8px;
}

.aaa-login .aaa-skeleton-input {
    height: 44px;
    margin-bottom: 16px;
}

.aaa-login .aaa-skeleton-button {
    height: 46px;
    border-radius: 14px;
}

.aaa-login .aaa-skeleton-divider {
    width: 30%;
    height: 8px;
    margin: 18px auto 14px;
}

.aaa-login .aaa-skeleton-provider {
    height: 46px;
    border-radius: 14px;
    margin-bottom: 10px;
}

.aaa-login .aaa-login-working {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 18px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #4b4470;
}

/* The shared spinner is white for the navy submit button, so darken it on the light card. */
.aaa-login .aaa-login-working .aaa-spin {
    display: inline-block;
    border-color: rgba(30, 27, 75, .25);
    border-top-color: var(--acc, #6d28d9);
}

@keyframes aaa-login-shimmer {
    to {
        transform: translateX(100%);
    }
}

/* Movement is decoration here: without it the bars still show the card is busy. */
@media (prefers-reduced-motion: reduce) {
    .aaa-login .aaa-skeleton::after,
    .aaa-login .aaa-login-working .aaa-spin,
    .aaa-login-card.aaa-working .aaa-mark-chevron {
        animation: none;
    }
}

/* ---- Sign-in problem page ---- */
.aaa-login .aaa-problem {
    margin: 8px 0 22px;
    color: var(--navy, #1e1b4b);
}

.aaa-login .aaa-problem svg {
    color: var(--red, #ef4444);
    margin-bottom: 10px;
}

.aaa-login .aaa-problem h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
}

.aaa-login .aaa-problem p {
    font-size: 13px;
    line-height: 1.5;
    color: #6b6291;
    margin: 0;
}

/* The way back is a link, styled as the card's primary action. */
.aaa-login a.aaa-submit-link {
    text-decoration: none;
}

/* ---- Footer text / messages ---- */
.aaa-login .aaa-foot {
    margin: 20px 0 0;
    font-size: 12px;
    color: #6b6291;
    text-align: center;
}

.aaa-login .aaa-status {
    margin: 14px 0 0;
    font-size: 12px;
    text-align: center;
    color: #4b4470;
}

.aaa-login .aaa-error {
    margin: 14px 0 0;
    font-size: 12px;
    text-align: center;
    color: var(--red, #ef4444);
}

.aaa-login .aaa-val {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--red, #ef4444);
}

/* ---- Legal footer links beneath the card ---- */
.aaa-login-foot {
    position: relative;
    width: 100%;
    max-width: 384px;
    /* Footer sits on the dark gradient, so the PolarisU green can be the
       full-strength brand value rather than the light-surface fallback */
    --polarisu-green: #6dd185;
}

.aaa-login-foot a {
    color: rgba(255, 255, 255, .78);
    font-size: 11px;
    text-decoration: none;
}

.aaa-login-foot a:hover {
    color: #fff;
    text-decoration: underline;
}

/* AI assistant consent (/connect/consent): reading text, then Deny and Allow side by side. */
.aaa-login .aaa-consent p {
    font-size: 13px;
    line-height: 1.55;
    color: #4b4470;
    margin: 0 0 12px;
}

.aaa-login .aaa-consent-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.aaa-login .aaa-consent-actions .aaa-provider {
    margin-bottom: 0;
}

.aaa-login .aaa-consent details {
    margin-top: 20px;
    font-size: 13px;
    color: #4b4470;
}

.aaa-login .aaa-consent summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 8px;
}
