/* Login screen. Standalone: the page sets Layout = null, so nothing here is shared with
   the LeptonX theme and nothing here can leak into the rest of the MVC pages. */

/* The same two faces the app ships, served from this host so the sign-in page and the
   app it hands you to are set in one typeface. Self-hosted: no CDN call on the auth page. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Noto Sans Arabic";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/noto-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+200C-200E,
        U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}

/* The values below mirror the app's design tokens (frontend/src/styles.scss) one for one.
   The two stylesheets can't share a file — different hosts — so they share a palette instead:
   sign in here, land in the app, and nothing about the colour changes under you. */
:root {
    --vx-brand: #2563eb;
    --vx-brand-strong: #1d4ed8;
    --vx-brand-deep: #1e40af;
    --vx-accent: #0891b2;

    --vx-shell: #0f172a;

    --vx-surface: #ffffff;
    --vx-surface-2: #f8fafc;
    --vx-text: #0f172a;
    --vx-text-muted: #64748b;
    --vx-border: #e2e8f0;
    --vx-border-strong: #cbd5e1;
    --vx-ring: rgba(37, 99, 235, .18);

    --vx-danger: #dc2626;
    --vx-danger-bg: #fef2f2;
    --vx-warning: #d97706;
    --vx-warning-bg: #fffbeb;
    --vx-info: #0891b2;
    --vx-info-bg: #ecfeff;
    --vx-success: #059669;
    --vx-success-bg: #ecfdf5;

    --vx-radius: 12px;
    --vx-radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --vx-brand: #3b82f6;
        --vx-brand-strong: #60a5fa;
        --vx-brand-deep: #1e3a8a;

        --vx-surface: #131c2e;
        --vx-surface-2: #1a2439;
        --vx-text: #e2e8f0;
        --vx-text-muted: #94a3b8;
        --vx-border: #263349;
        --vx-border-strong: #35455f;
        --vx-ring: rgba(59, 130, 246, .25);

        --vx-danger: #f87171;
        --vx-danger-bg: #2c1214;
        --vx-warning: #fbbf24;
        --vx-warning-bg: #2a1e05;
        --vx-info: #22d3ee;
        --vx-info-bg: #08272e;
        --vx-success: #34d399;
        --vx-success-bg: #06281f;
    }
}

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

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    min-height: 100%;
    background: var(--vx-surface);
    color: var(--vx-text);
    font-family: "Inter", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

.vx-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 3.5rem;
    background: var(--vx-shell);
    color: #f8fafc;
    isolation: isolate;
}

/* Three slow-drifting blobs behind a blur. Cheap to run and it gives the panel depth
   without shipping an image. */
.vx-aurora {
    position: absolute;
    inset: -25%;
    z-index: -2;
    filter: blur(90px);
    opacity: .9;
}

.vx-aurora i {
    position: absolute;
    display: block;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    mix-blend-mode: screen;
    animation: vx-drift 22s ease-in-out infinite;
}

/* Blue, deep blue, and a single cyan — the same three hues the dashboard charts use.
   One accent is enough to keep the panel from going flat; a second would start a rainbow. */
.vx-aurora i:nth-child(1) { background: #2563eb; top: 6%;  left: 4%; }
.vx-aurora i:nth-child(2) { background: #1e40af; top: 34%; left: 42%; animation-delay: -7s;  animation-duration: 26s; }
.vx-aurora i:nth-child(3) { background: #0891b2; top: 58%; left: 10%; animation-delay: -14s; animation-duration: 30s; }

@keyframes vx-drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    33%      { transform: translate3d(14%, -10%, 0) scale(1.14); }
    66%      { transform: translate3d(-10%, 12%, 0) scale(.92); }
}

.vx-grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .16) 1px, transparent 0);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse at 25% 15%, #000, transparent 72%);
            mask-image: radial-gradient(ellipse at 25% 15%, #000, transparent 72%);
}

.vx-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .02em;
}

.vx-logo svg { width: 38px; height: 38px; flex: none; }

.vx-pitch h1 {
    margin: 0 0 1rem;
    max-width: 14ch;
    font-size: clamp(2rem, 3.1vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    background: linear-gradient(120deg, #ffffff 20%, #bfdbfe 55%, #67e8f9);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.vx-pitch p {
    margin: 0 0 2.25rem;
    max-width: 42ch;
    color: #94a3b8;
}

.vx-points {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vx-points li {
    display: flex;
    align-items: center;
    gap: .85rem;
    font-size: .95rem;
    color: #e2e8f0;
}

.vx-points span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .07);
    -webkit-backdrop-filter: blur(6px);
            backdrop-filter: blur(6px);
}

.vx-points svg { width: 17px; height: 17px; }

.vx-brand footer {
    font-size: .8rem;
    color: #64748b;
}

/* ----------------------------------------------------------------- form panel */

.vx-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    background: var(--vx-surface);
}

.vx-form {
    width: 100%;
    max-width: 27rem;
    margin-inline: auto;
}

.vx-form > * {
    animation: vx-rise .5s cubic-bezier(.22, 1, .36, 1) backwards;
}

.vx-form > :nth-child(2) { animation-delay: .05s; }
.vx-form > :nth-child(3) { animation-delay: .10s; }
.vx-form > :nth-child(4) { animation-delay: .15s; }

@keyframes vx-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.vx-title {
    margin: 0 0 .35rem;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.vx-subtitle {
    margin: 0 0 2rem;
    color: var(--vx-text-muted);
}

/* Alerts. ABP reports a bad username/password through IAlertManager rather than
   ModelState, so this block is the only thing that surfaces a failed sign-in. */
.vx-alert {
    display: flex;
    gap: .7rem;
    padding: .8rem .95rem;
    margin-bottom: 1.1rem;
    border: 1px solid currentColor;
    border-radius: var(--vx-radius);
    font-size: .9rem;
}

.vx-alert svg { width: 18px; height: 18px; flex: none; margin-top: .15rem; }
.vx-alert strong { display: block; }
.vx-alert--danger  { color: var(--vx-danger);  background: var(--vx-danger-bg); }
.vx-alert--warning { color: var(--vx-warning); background: var(--vx-warning-bg); }
.vx-alert--info    { color: var(--vx-info);    background: var(--vx-info-bg); }
.vx-alert--success { color: var(--vx-success); background: var(--vx-success-bg); }

/* Floating label. The input carries placeholder=" " so :placeholder-shown tracks
   emptiness, and the label is the input's next sibling so the raised state is pure CSS. */
.vx-field {
    position: relative;
    margin-bottom: 1.1rem;
}

.vx-field input[type="text"],
.vx-field input[type="password"] {
    width: 100%;
    padding: 1.5rem .95rem .55rem;
    border: 1px solid var(--vx-border);
    border-radius: var(--vx-radius);
    background: var(--vx-surface-2);
    color: var(--vx-text);
    font: inherit;
    line-height: 1.2;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

.vx-field input:hover { border-color: var(--vx-border-strong); }

.vx-field input:focus {
    outline: none;
    background: var(--vx-surface);
    border-color: var(--vx-brand);
    box-shadow: 0 0 0 4px var(--vx-ring);
}

/* Chrome paints autofilled inputs opaque white, which is unreadable against the dark
   scheme. Repaint them with the surface colour instead. */
.vx-field input:-webkit-autofill,
.vx-field input:-webkit-autofill:hover,
.vx-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--vx-text);
    -webkit-box-shadow: 0 0 0 1000px var(--vx-surface-2) inset;
    caret-color: var(--vx-text);
}

.vx-field label {
    position: absolute;
    top: .95rem;
    inset-inline-start: .95rem;
    color: var(--vx-text-muted);
    font-size: 1rem;
    pointer-events: none;
    transform-origin: left center;
    transition: transform .16s ease, color .16s ease;
}

[dir="rtl"] .vx-field label { transform-origin: right center; }

.vx-field input:focus + label,
.vx-field input:not(:placeholder-shown) + label {
    transform: translateY(-.62rem) scale(.76);
}

.vx-field input:focus + label { color: var(--vx-brand); }

.vx-field--password input { padding-inline-end: 3.1rem; }

.vx-reveal {
    position: absolute;
    top: .5rem;
    inset-inline-end: .5rem;
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    padding: 0;
    border: 0;
    border-radius: var(--vx-radius-sm);
    background: transparent;
    color: var(--vx-text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.vx-reveal:hover { background: var(--vx-border); color: var(--vx-text); }
.vx-reveal svg { width: 18px; height: 18px; }

.vx-error,
.field-validation-error {
    display: block;
    margin-top: .4rem;
    color: var(--vx-danger);
    font-size: .84rem;
}

/* The span is always rendered; only reserve space for it once it says something. */
.vx-error:empty { display: none; }

.vx-hint {
    display: none;
    margin-top: .4rem;
    color: var(--vx-warning);
    font-size: .84rem;
}

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

/* Always-on counterpart of .vx-hint, for the workspace field's "leave blank" explanation. */
.vx-note {
    display: block;
    margin-top: .4rem;
    color: var(--vx-text-muted);
    font-size: .82rem;
}

.validation-summary-valid { display: none; }

.validation-summary-errors ul {
    margin: 0 0 1.1rem;
    padding-inline-start: 1.1rem;
    color: var(--vx-danger);
    font-size: .88rem;
}

.vx-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.vx-check {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--vx-text-muted);
    font-size: .9rem;
    user-select: none;
}

.vx-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--vx-brand);
    cursor: pointer;
}

.vx-check label {
    margin: 0;
    cursor: pointer;
}

a {
    color: var(--vx-brand);
    text-decoration: none;
    font-weight: 500;
}

a:hover { text-decoration: underline; }

.vx-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .9rem 1rem;
    border: 0;
    border-radius: var(--vx-radius);
    background: linear-gradient(120deg, var(--vx-brand), var(--vx-brand-deep));
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px -10px rgba(37, 99, 235, .9);
    transition: transform .16s, box-shadow .16s, filter .16s;
}

.vx-btn:hover {
    transform: translateY(-1px);
    filter: saturate(1.1);
    box-shadow: 0 14px 26px -12px rgba(37, 99, 235, 1);
}

.vx-btn:active { transform: translateY(0); }

.vx-btn.is-busy {
    opacity: .75;
    cursor: progress;
    transform: none;
    pointer-events: none;
}

.vx-btn--ghost {
    margin-top: .6rem;
    background: transparent;
    border: 1px solid var(--vx-border);
    color: var(--vx-text-muted);
    box-shadow: none;
}

.vx-btn--ghost:hover { filter: none; background: var(--vx-surface-2); }

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

/* --------------------------------------------------------- external providers */

.vx-sep {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: 1.75rem 0 1.1rem;
    color: var(--vx-text-muted);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.vx-sep::before,
.vx-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--vx-border);
}

.vx-providers {
    display: grid;
    gap: .6rem;
}

/* ------------------------------------------------------------------- language */

.vx-lang {
    position: relative;
    margin-top: 2.25rem;
    font-size: .85rem;
}

.vx-lang summary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--vx-text-muted);
    cursor: pointer;
    list-style: none;
}

.vx-lang summary::-webkit-details-marker { display: none; }
.vx-lang summary:hover { color: var(--vx-text); }
.vx-lang svg { width: 15px; height: 15px; }

/* Opens upward: the switcher sits at the bottom of the form, so a downward menu would
   fall off the viewport. */
.vx-lang ul {
    position: absolute;
    bottom: 100%;
    inset-inline-start: 0;
    z-index: 5;
    min-width: 12rem;
    max-height: 15rem;
    margin: 0 0 .5rem;
    padding: .35rem;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--vx-border);
    border-radius: var(--vx-radius);
    background: var(--vx-surface);
    box-shadow: 0 18px 40px -18px rgba(15, 23, 42, .45);
}

.vx-lang li a {
    display: block;
    padding: .4rem .7rem;
    border-radius: var(--vx-radius-sm);
    color: var(--vx-text);
    font-weight: 400;
}

.vx-lang li a:hover {
    background: var(--vx-surface-2);
    text-decoration: none;
}

/* ----------------------------------------------------------------- responsive */

@media (max-width: 980px) {
    body { grid-template-columns: 1fr; }

    .vx-brand {
        gap: 1.25rem;
        padding: 2rem 1.75rem;
    }

    .vx-pitch p,
    .vx-points,
    .vx-brand footer { display: none; }

    .vx-pitch h1 { font-size: 1.6rem; max-width: none; }

    .vx-panel { padding: 2.25rem 1.75rem 3rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
