/* ============================================================
   Auth Split Layout — Suite AuthServer
   Colors come from tokens.css only; no color literal belongs in this file.

   Three layouts, one markup (_AuthSplitLayout.cshtml):
     - Desktop (>= 992px): full-height split; branded column on the left, form on the right.
     - Tablet  (576px - 991.98px): the branded panel becomes a banner above the form, the PDCA circle
       beside the headline; the footer moves under the form.
     - Phone   (< 576px): the form alone, with the logo above it and the footer under it.
   auth-split.js animates the PDCA circle only while the branded panel is visible (>= 576px).
   ============================================================ */

/* ============================================================
   PAGE WRAPPER
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    background: var(--auth-surface);
}

/* ============================================================
   SPLIT FRAME
   ============================================================ */
.auth-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ============================================================
   LEFT PANEL
   ============================================================ */
.auth-split__left {
    width: 52%;
    flex-shrink: 0;
    background: var(--auth-color-primary);
    color: rgb(var(--auth-on-primary-rgb));
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: clamp(2.25rem, 4vw, 3.5rem) clamp(2.25rem, 4vw, 3.75rem) 2.25rem;
}

.auth-split__left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, rgba(var(--auth-shadow-rgb), 0.28) 0%, transparent 55%, rgba(var(--auth-shadow-rgb), 0.12) 100%);
    pointer-events: none;
    z-index: 0;
}

.auth-split__left > * {
    position: relative;
    z-index: 1;
}

/* Logo */
.auth-split__left-logo {
    display: flex;
    align-items: center;
}

.auth-split__left-logo img {
    height: 46px;
    filter: brightness(0) invert(1);
    max-width: 200px;
    object-fit: contain;
}

/* Headline */
.auth-split__headline {
    margin-top: 1.5rem;
    max-width: 440px;
}

.auth-split__headline h2 {
    font-size: clamp(1.875rem, 2.5vw, 2.375rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
    color: rgba(var(--auth-on-primary-rgb), 0.92);
}

.auth-split__headline h2 strong {
    font-weight: 700;
    color: rgb(var(--auth-on-primary-rgb));
}

.auth-split__headline p {
    margin: 1rem 0 0;
    font-size: 0.9rem;
    color: rgba(var(--auth-on-primary-rgb), 0.72);
    line-height: 1.6;
    max-width: 420px;
}

/* ---- PDCA Circle ----
   On desktops it sits in the column flow; its auto margins center it in the free space between the
   headline and the footer, so it can never overlap either of them. */
.auth-split__pdca {
    position: relative;
    flex-shrink: 0;
    margin: auto;
    width: clamp(270px, 23vw, 340px);
    aspect-ratio: 1;
}

.pdca-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.pdca-arc {
    fill: none;
    stroke: rgba(var(--auth-on-primary-rgb), 0.22);
    stroke-width: 1.5;
    stroke-linecap: round;
    transition: stroke 0.5s ease, stroke-width 0.5s ease;
}

.pdca-arc.active {
    stroke: rgba(var(--auth-on-primary-rgb), 0.9);
    stroke-width: 2.5;
}

.pdca-dot {
    fill: rgb(var(--auth-on-primary-rgb));
    filter: drop-shadow(0 0 4px rgba(var(--auth-on-primary-rgb), 0.8));
}

/* SVG user units: scaled with the circle (about 1.2px per unit on desktops). */
.pdca-label {
    fill: rgba(var(--auth-on-primary-rgb), 0.5);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: fill 0.5s ease;
}

.pdca-label.active {
    fill: rgb(var(--auth-on-primary-rgb));
    font-weight: 600;
}

.pdca-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    width: 70%;
}

.pdca-phase-title {
    font-size: clamp(1.5rem, 2vw, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    color: rgb(var(--auth-on-primary-rgb));
    transition: opacity 0.35s ease;
    white-space: nowrap;
}

.pdca-phase-desc {
    font-size: clamp(0.85rem, 1.05vw, 0.95rem);
    color: rgba(var(--auth-on-primary-rgb), 0.72);
    margin-top: 0.25rem;
    line-height: 1.4;
    transition: opacity 0.35s ease;
}

.pdca-text-hidden {
    opacity: 0;
}

/* ---- Floating Documents ---- */
.auth-split__docs {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.floating-doc {
    position: absolute;
    bottom: -58px;
    width: 42px;
    height: 50px;
    background: rgba(var(--auth-on-primary-rgb), 0.06);
    border: 1px solid rgba(var(--auth-on-primary-rgb), 0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--auth-on-primary-rgb), 0.35);
    font-size: 21px;
    animation: float-up var(--duration, 18s) var(--delay, 0s) linear infinite;
}

@keyframes float-up {
    0%   { transform: translateX(-50%) translateY(0) rotate(0deg);              opacity: 0; }
    6%   {                                                                       opacity: 0.54; }
    38%  { transform: translateX(-50%) translateY(-200px) rotate(var(--tilt, 0deg)); opacity: 0.48; }
    60%  { transform: translateX(-50%) translateY(-310px) rotate(var(--tilt, 0deg)); opacity: 0.18; }
    80%  { transform: translateX(-50%) translateY(-420px) rotate(var(--tilt, 0deg)); opacity: 0; }
    100% { transform: translateX(-50%) translateY(-520px) rotate(var(--tilt, 0deg)); opacity: 0; }
}

/* ---- Footer (shared by the left panel and the copy under the form) ---- */
.auth-split__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    font-size: 0.75rem;
}

.auth-split__left .auth-split__footer {
    padding-top: 1.1rem;
    border-top: 1px solid rgba(var(--auth-on-primary-rgb), 0.2);
    color: rgba(var(--auth-on-primary-rgb), 0.6);
    position: relative;
    z-index: 2;
}

/* ============================================================
   RIGHT PANEL
   ============================================================ */
.auth-split__right {
    flex: 1;
    min-width: 0;
    background: var(--auth-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 3rem clamp(2rem, 4vw, 4rem) 4.5rem;   /* extra bottom padding for the ticker */
}

/* ---- Top shimmer border ---- */
.auth-split__shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.25px;
    overflow: hidden;
    pointer-events: none;
}

.auth-split__shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 180px;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--auth-color-primary-rgb), 0.9) 50%,
        transparent 100%
    );
    animation: auth-shimmer 5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes auth-shimmer {
    from { left: -180px; }
    to   { left: 100%; }
}

/* ---- Right inner content ---- */
.auth-split__right-inner {
    width: 100%;
    max-width: 428px;
    position: relative;
    z-index: 2;
}

.auth-split__right-logo {
    margin-bottom: 2.25rem;
}

.auth-split__right-logo img {
    height: 46px;
    max-width: 220px;
    object-fit: contain;
}

/* The footer copy under the form: only shown once the left panel is no longer a full column. */
.auth-split__right-footer {
    display: none;
    width: 100%;
    max-width: 460px;
    margin-top: 2.5rem;
    position: relative;
    z-index: 2;
}

.auth-split__right-footer .auth-split__footer {
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    text-align: center;
    color: var(--auth-muted-color);
}

/* ---- Language picker (top right of the form panel) ---- */
.auth-lang {
    position: absolute;
    top: 1.25rem;
    right: clamp(1.25rem, 3vw, 2rem);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.1875rem;
    border: 1px solid rgba(var(--auth-shadow-rgb), 0.08);
    border-radius: 999px;
    background: var(--auth-input-bg);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.auth-lang__icon {
    padding: 0 0.25rem 0 0.375rem;
    font-size: 1rem;
    color: var(--auth-muted-color);
}

.auth-lang__item {
    padding: 0.375rem 0.625rem;
    border-radius: 999px;
    color: var(--auth-muted-color);
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.auth-lang__item:hover,
.auth-lang__item:focus-visible {
    color: var(--auth-color-primary);
    background: rgba(var(--auth-color-primary-rgb), 0.08);
}

.auth-lang__item--current,
.auth-lang__item--current:hover {
    color: rgb(var(--auth-on-primary-rgb));
    background: var(--auth-color-primary);
}

/* ---- Right panel heading ---- */
.auth-split__heading {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.32;
    color: var(--auth-heading-color);
    margin-bottom: 0.3rem;
}

.auth-split__heading .accent {
    color: var(--auth-color-primary);
}

/* The login welcome: a regular first line and the bold accent on a line of its own. */
.auth-split__heading--welcome {
    font-size: clamp(1.75rem, 2.3vw, 2.125rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.auth-split__heading--welcome .accent {
    display: block;
    font-weight: 700;
}

.auth-split__subtext {
    font-size: 0.82rem;
    color: var(--auth-muted-color);
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

/* ---- Bottom scrolling ticker ---- */
.auth-split__ticker {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 34px;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(var(--auth-color-primary-rgb), 0.06);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
}

.auth-split__ticker-track {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 24s linear infinite;
    will-change: transform;
}

.auth-split__ticker-track span {
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    color: rgba(var(--auth-color-primary-rgb), 0.30);
    text-transform: uppercase;
    padding: 0 3rem 0 0;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================================
   FORM OVERRIDES (right panel)
   ============================================================ */
.auth-split__right .form-control:focus {
    border-color: var(--auth-color-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--auth-color-primary-rgb), 0.14);
}

.auth-split__right .btn-primary {
    background-color: var(--auth-color-primary);
    border-color: var(--auth-color-primary);
}

.auth-split__right .btn-primary:hover:not(:disabled) {
    background-color: var(--auth-color-primary-hover);
    border-color: var(--auth-color-primary-hover);
}

.auth-split__right .g-recaptcha {
    position: relative;
    z-index: 100;
    display: flex;
    justify-content: center;
    will-change: transform;
    contain: layout style paint;
}

.auth-split__right .g-recaptcha iframe {
    will-change: auto;
}

.auth-split__right .btn .spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.125em;
}

/* ---- Login form (_LoginForm.cshtml) ---- */
.auth-login .auth-split__subtext {
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.auth-login .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--auth-heading-color);
    margin-bottom: 0.45rem;
}

.auth-login .form-control,
.auth-login .form-select {
    min-height: 46px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    padding-left: 1rem;
    border-radius: 8px;
    background-color: var(--auth-input-bg);
    font-size: 0.9375rem;
}

.auth-login .form-control {
    padding-right: 1rem;
}

.auth-login .form-select {
    padding-right: 2.5rem;
}

.auth-login__options {
    font-size: 0.8125rem;
}

.auth-login__options .form-check-label {
    color: var(--auth-muted-color);
}

.auth-login .login-button {
    min-height: 48px;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.auth-login__register {
    font-size: 0.8125rem;
    color: var(--auth-muted-color);
}

.auth-login__register a {
    font-weight: 600;
}

/* The link that opens the mobile app QR view; hidden on phones, which cannot scan their own screen. */
.auth-login__qr {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.auth-login__qr-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--auth-color-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.auth-login__qr-link:hover {
    color: var(--auth-color-primary-hover);
}

.auth-login__qr-link:focus-visible {
    outline: 2px solid rgba(var(--auth-color-primary-rgb), 0.45);
    outline-offset: 2px;
}

.auth-login__qr-link svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* ============================================================
   MOBILE APP QR VIEW (_MobileAppQr.cshtml, auth-mobile-qr.js)
   auth-mobile-qr.js sets data-view="qr" on the right panel; the form, the logo above it and the ticker
   give way to the QR card while the left panel stays as it is.
   ============================================================ */
.auth-split__right[data-view="qr"] {
    justify-content: center;
}

.auth-split__right[data-view="qr"] .auth-lang,
.auth-split__right[data-view="qr"] .auth-split__right-logo,
.auth-split__right[data-view="qr"] .auth-login,
.auth-split__right[data-view="qr"] .auth-split__ticker,
.auth-split__right[data-view="qr"] .auth-split__right-footer {
    display: none;
}

.auth-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-qr[hidden] {
    display: none;
}

/* The white card holding the code, with four primary-colored corner brackets just outside it. */
.auth-qr__frame {
    --auth-qr-size: 208px;
    position: relative;
    padding: 1rem;
    margin: 0.75rem;
    border-radius: 16px;
    background: var(--auth-input-bg);
    box-shadow:
        0 10px 30px rgba(var(--auth-color-primary-rgb), 0.12),
        0 2px 6px rgba(var(--auth-shadow-rgb), 0.06);
}

.auth-qr__corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 0 solid var(--auth-color-primary);
    pointer-events: none;
}

.auth-qr__corner--tl { top: -10px;    left: -10px;  border-top-width: 2.5px;    border-left-width: 2.5px;  border-top-left-radius: 10px; }
.auth-qr__corner--tr { top: -10px;    right: -10px; border-top-width: 2.5px;    border-right-width: 2.5px; border-top-right-radius: 10px; }
.auth-qr__corner--bl { bottom: -10px; left: -10px;  border-bottom-width: 2.5px; border-left-width: 2.5px;  border-bottom-left-radius: 10px; }
.auth-qr__corner--br { bottom: -10px; right: -10px; border-bottom-width: 2.5px; border-right-width: 2.5px; border-bottom-right-radius: 10px; }

.auth-qr__code {
    width: var(--auth-qr-size);
    height: var(--auth-qr-size);
}

/* qrcode.js renders a canvas and an image of it at device resolution; both are scaled to the box. */
.auth-qr__code canvas,
.auth-qr__code img {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* The brand mark over the centre: about a fifth of the code, well inside what level H error correction restores. */
.auth-qr__logo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 46px;
    height: 46px;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--auth-color-primary);
    box-shadow: 0 0 0 4px var(--auth-input-bg);
}

.auth-qr__logo img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.auth-qr__hint {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 1.25rem 0 0.6rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--auth-color-primary);
}

.auth-qr__hint::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(var(--auth-color-primary-rgb), 0.35);
}

.auth-qr__title {
    margin: 0 0 0.6rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--auth-heading-color);
}

.auth-qr__desc {
    max-width: 330px;
    margin: 0 0 1.25rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--auth-muted-color);
}

.auth-qr__desc strong {
    font-weight: 700;
    color: var(--auth-heading-color);
}

.auth-qr__close {
    min-width: 76px;
    padding: 0.45rem 1rem;
    border: 1px solid rgba(var(--auth-shadow-rgb), 0.12);
    border-radius: 8px;
    background: var(--auth-input-bg);
    color: var(--auth-heading-color);
    font-size: 0.8125rem;
    font-weight: 600;
}

.auth-qr__close:hover {
    border-color: rgba(var(--auth-color-primary-rgb), 0.4);
    color: var(--auth-color-primary);
}

/* ============================================================
   TABLET — the left panel becomes a banner above the form
   ============================================================ */
@media (max-width: 991.98px) {
    .auth-split {
        flex-direction: column;
    }

    .auth-split__left {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto 1fr;
        column-gap: 2.5rem;
        padding: 2.5rem clamp(1.75rem, 6vw, 3rem) 2.75rem;
    }

    .auth-split__left-logo {
        grid-column: 1;
        grid-row: 1;
    }

    .auth-split__left-logo img {
        height: 40px;
    }

    .auth-split__headline {
        grid-column: 1;
        grid-row: 2;
        margin-top: 1.25rem;
    }

    .auth-split__headline h2 {
        font-size: clamp(1.625rem, 4vw, 2rem);
    }

    .auth-split__headline p {
        font-size: 0.875rem;
    }

    .auth-split__pdca {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: center;
        width: clamp(160px, 23vw, 190px);
        margin: 0 1.5rem 0 0;   /* room for the right-hand labels, which hang outside the circle */
    }

    /* About 0.7px per unit at this size. */
    .pdca-label {
        font-size: 16px;
    }

    .pdca-phase-title {
        font-size: 1rem;
    }

    .pdca-phase-desc {
        font-size: 0.5625rem;
        margin-top: 0.1rem;
    }

    .auth-split__left .auth-split__footer {
        display: none;
    }

    .auth-split__right {
        justify-content: flex-start;
        padding: 3.25rem 2rem 4.5rem;
    }

    /* The banner already carries the logo. */
    .auth-split__right-logo {
        display: none;
    }

    .auth-split__right-inner {
        max-width: 460px;
    }

    .auth-split__right-footer {
        display: block;
    }
}

/* ============================================================
   PHONE — the form alone
   ============================================================ */
@media (max-width: 575.98px) {
    .auth-split__left {
        display: none !important;
    }

    .auth-split__right {
        padding: 2.5rem 1.75rem 4.5rem;
    }

    .auth-split__right-logo {
        display: block;
        margin-bottom: 1.75rem;
    }

    .auth-split__right-logo img {
        height: 40px;
    }

    .auth-split__right-inner {
        max-width: 100%;
    }

    .auth-split__heading--welcome {
        font-size: 1.75rem;
    }

    .auth-login .auth-split__subtext {
        margin-bottom: 1.75rem;
    }

    /* A phone cannot scan the QR code on its own screen. */
    .auth-login__qr {
        display: none;
    }
}

/* ============================================================
   REDUCED MOTION
   auth-split.js also leaves the PDCA dot still under this preference.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .floating-doc,
    .auth-split__shimmer::after,
    .auth-split__ticker-track {
        animation: none;
    }

    .pdca-arc,
    .pdca-label,
    .pdca-phase-title,
    .pdca-phase-desc {
        transition: none;
    }
}
