/* ============================================================
   CryoLynx — Authentication pages (login / register /
   forgot password / reset password).

   Shared on purpose: the four auth views have Layout = null, so
   anything written inline in one of them has to be copy-pasted
   into the other three and then drifts. Keep the design system
   here and let the views stay markup-only.

   Loaded AFTER main.css. scripts.js injects the active dore
   theme stylesheet *before* main.css (see loadStyle()), so
   everything in this file already outranks the theme in the
   cascade — no !important needed except where dore uses inline
   or id-level rules.

   Palette matches the modernised home page (Views/Home/Index).
   ============================================================ */

.auth-modern {
    --accent: #4E71DD;
    --accent-2: #8B5CF6;
    --accent-3: #22D3EE;
    --grad-primary: linear-gradient(135deg, #4E71DD 0%, #8B5CF6 50%, #22D3EE 100%);
    --glow: 0 0 40px rgba(78, 113, 221, 0.35);
    --glow-soft: 0 0 22px rgba(78, 113, 221, 0.22);
    --danger: #EA3943;
    --success: #16C784;
    /* Light theme is the default; body.dark-theme overrides below. */
    --surface: rgba(255, 255, 255, 0.86);
    --surface-2: rgba(255, 255, 255, 0.6);
    --hairline: rgba(15, 23, 42, 0.08);
    --text: #1b2033;
    --text-muted: #5d6478;
    --text-faint: #858ca1;
    --field-bg: rgba(255, 255, 255, 0.75);
    --field-border: rgba(15, 23, 42, 0.12);
    --card-shadow: 0 24px 60px rgba(20, 28, 60, 0.18);
    --scrim: rgba(248, 249, 253, 0.35);

    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

body.dark-theme .auth-modern {
    --surface: rgba(24, 25, 31, 0.72);
    --surface-2: rgba(255, 255, 255, 0.04);
    --hairline: rgba(255, 255, 255, 0.09);
    --text: #eef1f8;
    --text-muted: #a8afc2;
    --text-faint: #838a9d;
    --field-bg: rgba(255, 255, 255, 0.05);
    --field-border: rgba(255, 255, 255, 0.14);
    --card-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    --scrim: rgba(10, 11, 16, 0.45);
}

/* ---------- Background: scrim + drifting gradient blobs ----------
   .fixed-background (main.css) still paints the themed gradient
   image; this layer only adds depth and keeps the card legible. */
.auth-aurora {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    background: var(--scrim);
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    will-change: transform;
}

.auth-blob--a {
    width: 520px;
    height: 520px;
    top: -160px;
    left: -140px;
    background: radial-gradient(circle at 30% 30%, #4E71DD 0%, transparent 62%);
    animation: auth-drift-a 22s ease-in-out infinite alternate;
}

.auth-blob--b {
    width: 480px;
    height: 480px;
    top: 40px;
    right: -180px;
    background: radial-gradient(circle at 70% 40%, #8B5CF6 0%, transparent 62%);
    animation: auth-drift-b 26s ease-in-out infinite alternate;
}

.auth-blob--c {
    width: 420px;
    height: 420px;
    bottom: -200px;
    left: 32%;
    background: radial-gradient(circle at 50% 50%, #22D3EE 0%, transparent 62%);
    opacity: 0.32;
    animation: auth-drift-a 30s ease-in-out infinite alternate-reverse;
}

@keyframes auth-drift-a {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    100% {
        transform: translate3d(80px, 60px, 0) scale(1.15);
    }
}

@keyframes auth-drift-b {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    100% {
        transform: translate3d(-60px, 40px, 0) scale(1.1);
    }
}

/* ---------- Back button (top-left on every auth page) ---------- */
.auth-back {
    position: fixed;
    top: 22px;
    left: 22px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px 0 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 24px rgba(20, 28, 60, 0.14);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.auth-back svg {
    width: 16px;
    height: 16px;
    transition: transform 0.22s ease;
}

.auth-back:hover,
.auth-back:focus {
    color: var(--accent);
    border-color: rgba(78, 113, 221, 0.55);
    box-shadow: var(--glow-soft);
    text-decoration: none;
    transform: translateY(-1px);
}

    .auth-back:hover svg,
    .auth-back:focus svg {
        transform: translateX(-3px);
    }

@media (max-width: 575px) {
    .auth-back {
        top: 14px;
        left: 14px;
        height: 38px;
        padding: 0 14px 0 11px;
    }

        .auth-back .auth-back-label {
            display: none;
        }
}

/* ---------- Page shell ---------- */
.auth-main {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 88px 16px 40px;
    margin: 0 !important;
    height: auto !important;
}

.auth-shell {
    width: 100%;
    max-width: 440px;
}

.auth-shell--wide {
    max-width: 560px;
}

/* ---------- The card ---------- */
.auth-card-modern {
    position: relative;
    background: var(--surface);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    border: 1px solid var(--hairline);
    border-radius: 24px;
    padding: 38px 34px 32px;
    box-shadow: var(--card-shadow);
    animation: auth-card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Gradient hairline, same trick as the home page glass cards. */
.auth-card-modern::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(78,113,221,0.65), rgba(139,92,246,0.25), rgba(34,211,238,0.45));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 575px) {
    .auth-card-modern {
        padding: 30px 22px 26px;
        border-radius: 20px;
    }
}

/* ---------- Brand block ---------- */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.auth-logo {
    width: 66px;
    height: 66px;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(78, 113, 221, 0.45));
}

.auth-wordmark {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Shown only while DAL EnviromentSettings.IsDev is on (Login.cshtml). The API login inlines a copy. */
.auth-dev-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #B45309;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.45);
}

.auth-dev-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #F59E0B;
}

body.dark-theme .auth-dev-pill {
    color: #FBBF24;
}

@keyframes auth-spin360 {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin-logo {
    animation: auth-spin360 1s ease-in-out forwards;
}

/* ---------- Headings ---------- */
.auth-head {
    text-align: center;
    margin-bottom: 26px;
}

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 5px 13px;
    border-radius: 999px;
    background: rgba(78, 113, 221, 0.12);
    border: 1px solid rgba(78, 113, 221, 0.35);
    color: var(--accent);
    margin-bottom: 12px;
}

body.dark-theme .auth-eyebrow {
    color: #A7B7F5;
}

.auth-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-3);
    box-shadow: 0 0 10px var(--accent-3);
}

.auth-title {
    /* dore sets headings to inline-block, which would drop the title onto the
       same line as the eyebrow pill. */
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 8px;
    color: var(--text);
}

.auth-sub {
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
}

/* ---------- Fields ---------- */
.auth-field {
    margin-bottom: 16px;
}

.auth-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 7px;
}

.auth-label .auth-optional {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--text-faint);
    opacity: 0.8;
}

.auth-control {
    position: relative;
}

.auth-modern .form-control,
.auth-modern input.form-control {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 12px;
    outline: none;
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-modern .form-control::placeholder {
    color: var(--text-faint);
    opacity: 0.75;
}

.auth-modern .form-control:focus {
    background: var(--field-bg);
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(78, 113, 221, 0.18);
    color: var(--text);
}

.auth-modern .form-control:-webkit-autofill,
.auth-modern .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    box-shadow: 0 0 0 1000px var(--field-bg) inset, 0 0 0 3px rgba(78, 113, 221, 0.18);
    transition: background-color 9999s ease-in-out 0s;
}

.auth-modern .form-control.invalid,
.auth-modern input.invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(234, 57, 67, 0.16);
    outline: none !important;
}

/* Field with a trailing icon button (password reveal) */
.auth-control--pwd .form-control {
    padding-right: 46px;
}

.auth-eye {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.auth-eye:hover,
.auth-eye:focus {
    color: var(--accent);
    background: rgba(78, 113, 221, 0.1);
    outline: none;
}

/* ---------- Inline validation ---------- */
.auth-error {
    display: block;
    min-height: 0;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--danger);
    margin-top: 6px;
    background: none;
    padding: 0;
}

.auth-error:empty {
    display: none;
}

.auth-hint {
    display: block;
    font-size: 0.72rem;
    color: var(--text-faint);
    margin-top: 6px;
}

/* ---------- Password strength meter ---------- */
.auth-strength {
    margin-top: 10px;
}

.auth-modern .progress-bar_wrap {
    display: flex;
    gap: 6px;
    margin: 0 0 6px;
}

.auth-modern .progress-bar_item {
    flex: 1 1 0;
    height: 4px;
    border-radius: 999px;
    background: var(--field-border);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.auth-modern .progress-bar_item.active {
    background: var(--grad-primary);
    box-shadow: 0 0 10px rgba(78, 113, 221, 0.4);
}

.auth-modern .progress-bar_textpw {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-faint);
}

/* ---------- Remember me ---------- */
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.auth-check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.auth-check .auth-check-box {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 6px;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-check .auth-check-box::after {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0.6);
    opacity: 0;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.auth-check input:checked + .auth-check-box {
    background: var(--grad-primary);
    border-color: transparent;
    box-shadow: var(--glow-soft);
}

.auth-check input:checked + .auth-check-box::after {
    opacity: 1;
    transform: rotate(-45deg) scale(1);
}

.auth-check input:focus-visible + .auth-check-box {
    box-shadow: 0 0 0 3px rgba(78, 113, 221, 0.25);
}

/* ---------- Buttons ---------- */
.auth-modern .auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 48px;
    padding: 0 22px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--grad-primary);
    background-size: 200% 100%;
    border: 0;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(78, 113, 221, 0.32);
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-position 0.6s ease, opacity 0.2s ease;
}

.auth-modern .auth-btn:hover,
.auth-modern .auth-btn:focus {
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    background-position: 100% 0;
    box-shadow: 0 14px 40px rgba(78, 113, 221, 0.45);
}

.auth-modern .auth-btn:active {
    transform: translateY(0);
}

.auth-modern .auth-btn:disabled,
.auth-modern .auth-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-modern .auth-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 22px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--field-border);
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s ease;
}

.auth-modern .auth-btn-ghost:hover,
.auth-modern .auth-btn-ghost:focus {
    color: var(--accent);
    border-color: rgba(78, 113, 221, 0.5);
    background: rgba(78, 113, 221, 0.08);
    box-shadow: var(--glow-soft);
    text-decoration: none;
}

/* Two buttons side by side, stacking on very small screens. */
.auth-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.auth-actions > * {
    flex: 1 1 0;
    min-width: 0;
}

@media (max-width: 420px) {
    .auth-actions {
        flex-direction: column-reverse;
    }
}

/* ---------- Links ---------- */
.auth-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.auth-modern a.auth-link {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.auth-modern a.auth-link:hover,
.auth-modern a.auth-link:focus {
    color: var(--accent-2);
    text-decoration: none;
}

.auth-foot {
    margin: 20px 0 0;
    text-align: center;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.auth-foot a {
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.auth-foot a:hover,
.auth-foot a:focus {
    color: var(--accent-2);
    text-decoration: none;
}

/* ---------- Divider ---------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--hairline);
}

/* ---------- Two-column field grid (register) ---------- */
.auth-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

@media (max-width: 480px) {
    .auth-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ---------- Requirements list (reset / register password rules) ---------- */
.auth-reqs {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}

@media (max-width: 420px) {
    .auth-reqs {
        grid-template-columns: 1fr;
    }
}

.auth-reqs li {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-faint);
    transition: color 0.2s ease;
}

.auth-reqs li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--field-border);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.auth-reqs li.met {
    color: var(--success);
}

.auth-reqs li.met::before {
    background: var(--success);
    box-shadow: 0 0 8px rgba(22, 199, 132, 0.6);
}

/* ---------- Server-side summary message ---------- */
.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
    font-weight: 600;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.auth-note--error {
    color: var(--danger);
    background: rgba(234, 57, 67, 0.1);
    border: 1px solid rgba(234, 57, 67, 0.3);
}

.auth-note--info {
    color: var(--accent);
    background: rgba(78, 113, 221, 0.1);
    border: 1px solid rgba(78, 113, 221, 0.28);
}

/* asp-validation-summary renders a <ul>; strip the default list chrome. */
.auth-note ul,
.auth-note .validation-summary-errors ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.auth-note li + li {
    margin-top: 4px;
}

/* The tag helper leaves an empty <ul> behind when there is nothing to show. */
.auth-modern .validation-summary-valid {
    display: none;
}

/* ---------- The password-requirements vendor plugin popup ----------
   jquery.passwordRequirements injects its own tooltip; make it sit on
   the glass instead of fighting it. */
.auth-modern .pr-box {
    border-radius: 12px !important;
    border: 1px solid var(--field-border) !important;
    background: var(--surface) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    color: var(--text) !important;
    box-shadow: 0 12px 30px rgba(20, 28, 60, 0.2) !important;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .auth-blob,
    .auth-card-modern,
    .spin-logo {
        animation: none !important;
    }

    .auth-modern * {
        transition-duration: 0.01ms !important;
    }
}
