/* ==========================================================================
   auth.css - shared styles for the three standalone account screens:
     Views/Account/Login.cshtml
     Views/Account/ForgetPassword.cshtml
     Views/Account/VerifyTwoFactor.cshtml

   These pages set Layout = null and no longer load Bootstrap, AdminLTE,
   Ionicons, Font Awesome or iCheck - everything they need is in this file.
   jQuery stays (validation + the OTP resend call).

   Height budget: the three marks are fixed at their natural sizes
   (CAMP 239x100, Azure badge 150x46, Choice IoT 300x75), so only the gaps
   between them are tunable. Sign-in totals ~646px, against ~660px of
   viewport on a maximised browser at 1366x768. The max-height rule at the
   bottom of this file buys back another ~46px for shorter screens.
   ========================================================================== */

:root {
    --auth-page: #102638;
    --auth-brand: #239BD6;
    --auth-brand-deep: #1B7FB0;
    --auth-brand-lift: #2BA6DE;
    --auth-text: #EAF3FA;
    --auth-text-dim: #9DB7CB;
    --auth-label: #8AA8BF;
    --auth-placeholder: #6E8CA4;
    --auth-icon: #6E93AF;
    --auth-field-bg: rgba(255, 255, 255, .06);
    --auth-field-border: rgba(163, 196, 220, .30);
    --auth-card-border: rgba(35, 155, 214, .26);
    --auth-rule: rgba(35, 155, 214, .32);
    --auth-error: #E8736F;
    --auth-error-text: #F3B4B1;
    --auth-success: #4FBD8B;
    --auth-success-text: #9FE0C1;
    --auth-disabled: #2C4B66;
    --auth-disabled-text: #87A3B9;
}

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

/* --------------------------------------------------------------- shell -- */

html,
body {
    height: 100%;
}

body.auth-page {
    margin: 0;
    background-color: var(--auth-page);
    background-image:
        radial-gradient(680px 340px at 50% -10%, rgba(35, 155, 214, .20), transparent 70%),
        radial-gradient(420px 300px at 108% 106%, rgba(35, 155, 214, .10), transparent 70%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--auth-text);
    font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Flex column replaces the old `height: calc(71vh - 151px)` arithmetic and
   the .login-wrapper that Login.cshtml styled but never rendered. */
.auth-shell {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px 16px;
}

/* --------------------------------------------------------------- brand -- */

/* SIZE LOCKED. LoginMiddle.png is 239x100 and renders at its natural size.
   max-width only engages below 271px of viewport, where the alternative is
   horizontal overflow. Do not add width/height rules here. */
.auth-brand {
    margin: 0 0 14px;
    text-align: center;
}

    .auth-brand img {
        display: block;
        margin: 0 auto;
        max-width: 100%;
        height: auto;
    }

/* ---------------------------------------------------------------- card -- */

.auth-card {
    width: 100%;
    max-width: 332px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .022));
    border: 1px solid var(--auth-card-border);
    border-radius: 14px;
    padding: 22px 22px 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .32);
}

.auth-card__title {
    font-size: 19px;
    font-weight: 500;
    color: var(--auth-text);
    margin: 0 0 18px;
    text-align: center;
}

    /* When a subtitle follows, the title gives up most of its bottom margin. */
    .auth-card__title.has-sub {
        margin-bottom: 5px;
    }

.auth-card__sub {
    font-size: 13px;
    color: var(--auth-text-dim);
    margin: 0 0 18px;
    text-align: center;
    line-height: 1.5;
}

    .auth-card__sub strong {
        color: #CFE4F3;
        font-weight: 500;
    }

/* -------------------------------------------------------------- fields -- */

.auth-field {
    position: relative;
    margin-bottom: 14px;
}

.auth-label {
    display: block;
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--auth-label);
    margin: 0 0 6px;
}

/* 37px = label (17) + its margin (6) + half the 44px input, less half the icon. */
.auth-field__icon {
    position: absolute;
    left: 12px;
    top: 37px;
    width: 15px;
    height: 15px;
    color: var(--auth-icon);
    pointer-events: none;
}

.auth-input {
    width: 100%;
    height: 44px;
    border-radius: 8px;
    padding: 0 42px 0 36px;
    background: var(--auth-field-bg);
    border: 1px solid var(--auth-field-border);
    color: var(--auth-text);
    font-size: 14.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

    .auth-input::placeholder {
        color: var(--auth-placeholder);
        opacity: 1;
    }

    .auth-input:focus {
        border-color: var(--auth-brand);
        background: rgba(35, 155, 214, .10);
        box-shadow: 0 0 0 3px rgba(35, 155, 214, .22);
    }

    /* jQuery Validate adds .error to the input it rejects. */
    .auth-input.error,
    .auth-input[aria-invalid="true"] {
        border-color: var(--auth-error);
        box-shadow: 0 0 0 3px rgba(232, 115, 111, .18);
    }

    /* Chrome's autofill repaints the field white; keep it on-theme. */
    .auth-input:-webkit-autofill,
    .auth-input:-webkit-autofill:hover,
    .auth-input:-webkit-autofill:focus {
        -webkit-text-fill-color: var(--auth-text);
        -webkit-box-shadow: 0 0 0 1000px #17324a inset;
        caret-color: var(--auth-text);
    }

.auth-toggle {
    position: absolute;
    right: 8px;
    top: 31px;
    background: none;
    border: 0;
    color: #7FA0BA;
    font-size: 10.5px;
    letter-spacing: .07em;
    text-transform: uppercase;
    font-family: inherit;
    padding: 5px 7px;
    cursor: pointer;
}

    .auth-toggle:hover {
        color: var(--auth-text);
    }

/* jQuery Validate appends <label class="error"> after the field. The old
   global `.error { color: red !important }` is gone with the inline styles. */
label.error,
.auth-err {
    display: block;
    color: var(--auth-error-text);
    font-size: 12px;
    font-weight: 400;
    margin: 6px 0 0;
}

.auth-hint {
    display: none;
    font-size: 12px;
    color: #E3BE7C;
    margin-top: 6px;
}

    .auth-hint.is-on {
        display: block;
    }

/* ------------------------------------------------------------- buttons -- */

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--auth-brand-lift), var(--auth-brand-deep));
    color: #fff;
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: .02em;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(27, 127, 176, .38);
    transition: transform .12s ease, box-shadow .12s ease;
    /* ForgetPassword's success state renders this as an <a>. */
    text-decoration: none;
}

    .auth-btn:hover,
    .auth-btn:focus {
        color: #fff;
        text-decoration: none;
    }

    .auth-btn:hover {
        box-shadow: 0 8px 20px rgba(27, 127, 176, .46);
        transform: translateY(-1px);
    }

    .auth-btn:active {
        transform: translateY(0);
        box-shadow: 0 4px 12px rgba(27, 127, 176, .38);
    }

    .auth-btn.is-busy,
    .auth-btn.is-busy:hover {
        background: var(--auth-brand-deep);
        color: #CFE6F4;
        box-shadow: none;
        transform: none;
        cursor: default;
    }

    .auth-btn:disabled,
    .auth-btn:disabled:hover {
        background: var(--auth-disabled);
        color: var(--auth-disabled-text);
        box-shadow: none;
        transform: none;
        cursor: not-allowed;
    }

.auth-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    display: inline-block;
    animation: auth-spin .7s linear infinite;
}

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

/* --------------------------------------------------------------- links -- */

.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 13px;
}

    .auth-links a {
        color: #5FB6E4;
        text-decoration: none;
    }

        .auth-links a:hover {
            color: #8CCDF0;
            text-decoration: underline;
        }

/* -------------------------------------------------------------- alerts -- */

.auth-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    max-width: 332px;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 14px;
}

    .auth-alert svg {
        flex: none;
        width: 16px;
        height: 16px;
        margin-top: 2px;
    }

.auth-alert--error {
    background: rgba(232, 115, 111, .13);
    border: 1px solid rgba(232, 115, 111, .42);
    color: var(--auth-error-text);
}

.auth-alert--success {
    background: rgba(79, 189, 139, .13);
    border: 1px solid rgba(79, 189, 139, .42);
    color: var(--auth-success-text);
}

/* ----------------------------------------------------------------- otp -- */

.auth-otp {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 4px;
}

.auth-otp__digit {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 21px;
    font-weight: 500;
    border-radius: 8px;
    background: var(--auth-field-bg);
    border: 1px solid var(--auth-field-border);
    color: var(--auth-text);
    font-family: inherit;
    outline: none;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

    .auth-otp__digit::-webkit-outer-spin-button,
    .auth-otp__digit::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .auth-otp__digit.is-filled {
        border-color: rgba(35, 155, 214, .55);
        background: rgba(35, 155, 214, .10);
    }

    .auth-otp__digit:focus {
        border-color: var(--auth-brand);
        background: rgba(35, 155, 214, .12);
        box-shadow: 0 0 0 3px rgba(35, 155, 214, .22);
    }

.auth-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--auth-label);
    margin: 14px 0;
}

    .auth-meta a {
        color: #5FB6E4;
        text-decoration: none;
    }

        .auth-meta a:hover {
            text-decoration: underline;
        }

.auth-chip {
    font-variant-numeric: tabular-nums;
    background: var(--auth-field-bg);
    border: 1px solid rgba(163, 196, 220, .22);
    border-radius: 999px;
    padding: 3px 10px;
    color: #AFC8DA;
    white-space: nowrap;
}

    .auth-chip.is-low {
        border-color: rgba(217, 163, 74, .45);
        color: #E3BE7C;
    }

.auth-meta__off {
    color: #5F7D95;
    white-space: nowrap;
}

/* -------------------------------------------------------------- footer -- */

/* Production order, unchanged: Azure badge, rule, Choice IoT mark.
   Both marks render at natural size (150x46 and 300x75). */
/* Stepped rather than fixed: the roomy gap only applies where the viewport can
   actually spare it. See the short-viewport rules at the bottom of this file. */
.auth-footer {
    margin-top: 44px;
    text-align: center;
    width: 100%;
}

    /* Centre only. Do NOT use the `margin` shorthand here: it outranks
       .auth-badge (0,1,1 vs 0,1,0) and silently zeroes its bottom margin,
       which drops the rule onto the badge. */
    .auth-footer img {
        display: block;
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
        height: auto;
    }

/* The two marks are padded differently inside their own PNGs - Badge.png
   carries 2px below its artwork, LoginFooter.png carries 9px above. These
   margins are set so the OPTICAL gap either side of the rule is ~18px. */
.auth-badge {
    opacity: .62;
    margin-bottom: 16px;
}

.auth-rule {
    border: 0;
    border-top: 1px solid var(--auth-rule);
    margin: 0 0 9px;
}

/* ---------------------------------------------------- dealer-skin variant -- */

.auth-dealer-hero {
    text-align: center;
    margin: 0 0 14px;
}

    .auth-dealer-hero img {
        display: block;
        margin: 0 auto;
        max-width: 100%;
        height: auto;
    }

.auth-dealer-title {
    text-align: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .04em;
    margin: 14px 0 2px;
}

.auth-dealer-sub {
    text-align: center;
    color: #8FB4CE;
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin: 0 0 14px;
}

/* ------------------------------------------------------------ a11y/misc -- */

.auth-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.auth-input:focus-visible,
.auth-otp__digit:focus-visible {
    outline: none; /* the focus ring above already carries it */
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner {
        animation: none;
    }

    .auth-btn,
    .auth-input,
    .auth-otp__digit {
        transition: none;
    }

        .auth-btn:hover {
            transform: none;
        }
}

/* --------------------------------------------------- short-viewport fit -- */

/* First step down, for viewports of roughly 700-760px. Anything shorter is
   caught by the compression block below, so this band has room to spare -
   it only needs to give back enough to stay comfortable, not to scrape by. */
@media (max-height: 760px) {
    .auth-footer {
        margin-top: 36px;
    }
}

/* Compresses the gaps and nothing else - the three marks never scale.
   Buys back ~46px, which covers 1280x720 and a browser carrying a
   bookmarks bar. Below ~600px of viewport the page scrolls rather than
   clipping the form, which is the correct failure. */
@media (max-height: 700px) {
    .auth-shell {
        padding: 12px 16px;
    }

    .auth-brand {
        margin-bottom: 10px;
    }

    .auth-card {
        padding: 16px 22px 14px;
    }

    .auth-card__title {
        margin-bottom: 14px;
    }

    .auth-field {
        margin-bottom: 12px;
    }

    .auth-footer {
        margin-top: 12px;
    }

    /* Same optical balance as above, tightened: ~14px either side. */
    .auth-badge {
        margin-bottom: 12px;
    }

    .auth-rule {
        margin-bottom: 5px;
    }
}

@media (max-width: 380px) {
    .auth-otp__digit {
        width: 40px;
        height: 48px;
        font-size: 19px;
    }

    .auth-otp {
        gap: 6px;
    }
}
