/*
 * Sign-in screen.
 *
 * A split: the product's own dashboard imagery on the left — proof of what is
 * behind the login — and a focused form on the right. On phones the imagery
 * steps aside entirely so the form is the whole screen.
 *
 * Scoped to .auth-* so it cannot reach any other screen.
 */

.auth-page {
    /* Brand values, taken from the GlobalIT mark. */
    --a-navy:   #234B77;
    --a-navy-2: #14304C;
    --a-teal:   #29ABC2;
    --a-accent: #4E73DF;

    --a-ink:     #10192A;
    --a-ink-2:   #43506A;
    --a-muted:   #7E8AA0;
    --a-line:    #E3E8F1;
    --a-surface: #FFFFFF;
    --a-ground:  #F6F8FC;

    --a-ease: cubic-bezier(.4, 0, .2, 1);

    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1.08fr 1fr;
    background: var(--a-ground);
    color: var(--a-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════ Showcase panel ════════════════════════════════ */

.auth-brand {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(760px 520px at 8% -6%, rgba(41, 171, 194, .34), transparent 62%),
        linear-gradient(152deg, #1E4468 0%, var(--a-navy-2) 62%, #0F2540 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 56px 64px;
    isolation: isolate;
}

/* Two slow-drifting washes of brand colour. They give the panel life without
   any imagery; the movement is far below the threshold that would compete
   with the form for attention. */
.auth-aurora {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.auth-aurora span {
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(70px);
    will-change: transform;
}

.auth-aurora span:nth-child(1) {
    width: 62%;
    aspect-ratio: 1;
    right: -20%;
    bottom: -26%;
    background: radial-gradient(circle, rgba(41, 171, 194, .55), transparent 68%);
    animation: auth-drift-a 26s ease-in-out infinite alternate;
}

.auth-aurora span:nth-child(2) {
    width: 52%;
    aspect-ratio: 1;
    left: -16%;
    top: -14%;
    background: radial-gradient(circle, rgba(78, 115, 223, .48), transparent 68%);
    animation: auth-drift-b 32s ease-in-out infinite alternate;
}

.auth-aurora span:nth-child(3) {
    width: 40%;
    aspect-ratio: 1;
    left: 32%;
    bottom: 6%;
    background: radial-gradient(circle, rgba(41, 171, 194, .26), transparent 70%);
    animation: auth-drift-c 38s ease-in-out infinite alternate;
}

@keyframes auth-drift-a {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-9%, -12%, 0) scale(1.14); }
}

@keyframes auth-drift-b {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(11%, 14%, 0) scale(1.1); }
}

@keyframes auth-drift-c {
    from { transform: translate3d(0, 0, 0) scale(.94); }
    to   { transform: translate3d(-14%, -8%, 0) scale(1.16); }
}

/* A faint dot field, echoing the sphere in the logo. */
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .09) 1.6px, transparent 1.7px);
    background-size: 24px 24px;
    mask-image: radial-gradient(130% 95% at 25% 5%, #000 18%, transparent 76%);
    -webkit-mask-image: radial-gradient(130% 95% at 25% 5%, #000 18%, transparent 76%);
    z-index: -1;
}

/* ── Logo lockup ──────────────────────────────────────────────────────── */

/* The logo art carries its own transparent margin, so the visual gap is
   larger than the box gap — this pulls the heading back up to compensate. */
.auth-brand-top {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    margin: 0 0 -6px -14px;
}

/* No plate behind the mark — it sits directly on the panel. The logo art is
   dark-on-transparent, so it is lifted to read against the navy. */
.auth-brand-logo {
    width: 290px;
    max-width: 74%;
    height: auto;
    filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(0, 0, 0, .35));
}

/* ── Message ──────────────────────────────────────────────────────────── */

.auth-brand-mid {
    flex: 0 0 auto;
    max-width: 520px;
}

/* The theme's global h1 colour is more specific than a bare element rule,
   so this is qualified enough to win without !important. */
.auth-page .auth-brand .auth-brand-mid h1 {
    font-size: clamp(26px, 2.6vw, 36px);
    line-height: 1.18;
    font-weight: 680;
    letter-spacing: -.7px;
    margin: 0 0 12px;
    color: #FFFFFF;
    text-wrap: balance;
}

.auth-page .auth-brand .auth-brand-mid p {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .74);
    margin: 0;
}

/* ── Feature list ─────────────────────────────────────────────────────── */

.auth-points {
    list-style: none;
    margin: 30px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px 20px;
    max-width: 520px;
}

.auth-points li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.35;
    color: rgba(255, 255, 255, .85);
}

.auth-points i {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #86DDE9;
}

.auth-brand-foot {
    position: absolute;
    left: 48px;
    bottom: 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, .42);
    z-index: 2;
}

/* ═══════════════════════ Form side ═════════════════════════════════════ */

.auth-form-side {
    display: flex;
    flex-direction: column;
    padding: 26px 32px;
    background: var(--a-surface);
    overflow-y: auto;
}

.auth-topbar {
    display: flex;
    justify-content: flex-end;
    min-height: 34px;
}

.auth-form-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.auth-card {
    width: 100%;
    max-width: 384px;
}

.auth-mobile-logo {
    display: none;
    margin-bottom: 26px;
}

.auth-mobile-logo img {
    width: 168px;
    max-width: 66%;
    height: auto;
}

.auth-card h2 {
    font-size: 26px;
    font-weight: 690;
    letter-spacing: -.6px;
    margin: 0 0 6px;
    color: var(--a-ink);
}

.auth-card .auth-sub {
    font-size: 14.5px;
    color: var(--a-muted);
    margin: 0 0 28px;
}

/* ── Fields ───────────────────────────────────────────────────────────── */

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

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 640;
    color: var(--a-ink-2);
    margin-bottom: 6px;
}

.auth-input-wrap { position: relative; }

.auth-page .form-control {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    font-size: 15px;
    color: var(--a-ink);
    background: var(--a-ground);
    border: 1px solid var(--a-line);
    border-radius: 10px;
    transition: border-color .15s var(--a-ease),
                box-shadow .15s var(--a-ease),
                background-color .15s var(--a-ease);
    -webkit-appearance: none;
    appearance: none;
}

.auth-page .form-control::placeholder { color: #A9B3C4; }

.auth-page .form-control:hover:not(:focus) { border-color: #CBD4E2; }

.auth-page .form-control:focus {
    outline: none;
    background: var(--a-surface);
    border-color: var(--a-accent);
    box-shadow: 0 0 0 3.5px rgba(78, 115, 223, .14);
}

.auth-page .form-control.is-invalid { border-color: #E24C3D; }

/* Password reveal */
.auth-input-wrap.has-toggle .form-control { padding-right: 46px; }

.auth-eye {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    background: none;
    color: #93A0B4;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: color .15s var(--a-ease), background-color .15s var(--a-ease);
}

.auth-eye:hover { color: var(--a-ink-2); background: #EDF1F7; }

/* ── Messages ─────────────────────────────────────────────────────────── */

.auth-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12.5px;
    color: #D33F30;
    margin-top: 6px;
    line-height: 1.45;
}

.auth-error i { font-size: 14px; margin-top: 1px; flex: 0 0 auto; }

.auth-alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 20px;
    background: #FDF1F0;
    color: #AE3226;
    border-left: 3px solid #E24C3D;
}

.auth-alert.is-info {
    background: #EEF4FF;
    color: #2B5CA6;
    border-left-color: var(--a-accent);
}

/* ── Remember / forgot row ────────────────────────────────────────────── */

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 24px;
    flex-wrap: wrap;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--a-ink-2);
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--a-accent);
    cursor: pointer;
}

.auth-link {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--a-accent);
    text-decoration: none;
}

.auth-link:hover { text-decoration: underline; }

/* ── Submit ───────────────────────────────────────────────────────────── */

.auth-page .btn-auth {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 10px;
    background: var(--a-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 640;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 3px 12px rgba(78, 115, 223, .26);
    transition: transform .12s var(--a-ease),
                box-shadow .18s var(--a-ease),
                filter .18s var(--a-ease);
}

.auth-page .btn-auth:hover {
    filter: brightness(1.06);
    box-shadow: 0 6px 20px rgba(78, 115, 223, .34);
}

.auth-page .btn-auth:active { transform: translateY(1px); }
.auth-page .btn-auth:disabled { opacity: .72; cursor: default; transform: none; }

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

.btn-auth.is-busy .auth-spin { display: block; }

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

.auth-foot {
    margin-top: 26px;
    text-align: center;
    font-size: 13px;
    color: var(--a-muted);
}

.auth-recaptcha { margin-bottom: 18px; }

/* ── Language picker ──────────────────────────────────────────────────── */

.auth-topbar .dropdown-toggle {
    border: 1px solid var(--a-line);
    border-radius: 9px;
    padding: 7px 13px;
    font-size: 13px;
    color: var(--a-ink-2);
    background: var(--a-surface);
}

.auth-topbar .dropdown-toggle:hover { background: var(--a-ground); }

/* ═══════════════════════ Responsive ════════════════════════════════════ */

@media (max-width: 1200px) {
    .auth-brand { padding: 38px 40px 0; }
    .auth-brand-logo { width: 178px; }
    .auth-brand-foot { left: 40px; }
}

@media (max-width: 1024px) {
    .auth-page { grid-template-columns: 1fr 1fr; }
    .auth-points { grid-template-columns: 1fr; gap: 9px; }
}

@media (max-width: 900px) {
    /* The panel becomes a header band; the form takes the page. */
    .auth-page { grid-template-columns: 1fr; }

    .auth-brand { padding: 24px 24px 26px; }

    .auth-brand-top { margin-bottom: 18px; }
    .auth-brand-logo { width: 150px; padding: 10px 14px; }

    .auth-brand-mid h1 { font-size: 22px; margin-bottom: 8px; }
    .auth-brand-mid p  { font-size: 13.5px; }

    .auth-points,
    .auth-brand-foot { display: none; }

    .auth-form-side { padding: 24px 22px 34px; }
    .auth-form-wrap { align-items: flex-start; padding-top: 6px; }
    .auth-card { max-width: 100%; }
}

@media (max-width: 560px) {
    /* Below this the band earns its space less than the form does. */
    .auth-brand { display: none; }
    .auth-mobile-logo { display: block; }

    .auth-page { background: var(--a-ground); }

    .auth-form-side {
        background: transparent;
        padding: calc(20px + env(safe-area-inset-top)) 20px
                 calc(28px + env(safe-area-inset-bottom));
    }

    .auth-form-wrap { align-items: center; }

    .auth-card {
        background: var(--a-surface);
        border: 1px solid var(--a-line);
        border-radius: 16px;
        padding: 28px 22px 24px;
        box-shadow: 0 4px 20px rgba(16, 25, 42, .06);
    }

    .auth-card h2 { font-size: 22px; }

    /* 16px stops iOS zooming when a field takes focus. */
    .auth-page .form-control { font-size: 16px; }
}

@media (max-width: 380px) {
    .auth-card { padding: 22px 18px 20px; }
    .auth-card h2 { font-size: 20px; }
}

/* Short viewports: tighten the panel rather than let it scroll. */
@media (max-height: 700px) and (min-width: 901px) {
    .auth-brand { padding-top: 36px; padding-bottom: 44px; }
    .auth-brand-top { margin-bottom: 24px; }
    .auth-points { margin-top: 18px; }
}

/* ═══════════════════════ Dark scheme ═══════════════════════════════════ */

/* Opt-in only. The OS preference is deliberately NOT honoured here: signing
   in happens before we know the user's own theme choice, and a dark form
   beside the dark brand panel loses the contrast the split depends on. */
:root[data-theme="dark"] .auth-page {
    --a-ink:     #ECF1F8;
    --a-ink-2:   #B9C4D6;
    --a-muted:   #838EA3;
    --a-line:    #26334C;
    --a-surface: #141D2E;
    --a-ground:  #0F1726;
}

:root[data-theme="dark"] .auth-page .form-control {
    background: var(--a-ground);
    border-color: var(--a-line);
    color: var(--a-ink);
}

:root[data-theme="dark"] .auth-page .form-control::placeholder { color: #6C778C; }
:root[data-theme="dark"] .auth-page .form-control:hover:not(:focus) { border-color: #35435F; }
:root[data-theme="dark"] .auth-page .form-control:focus { background: #172236; }

:root[data-theme="dark"] .auth-eye:hover { background: #1C2739; }

:root[data-theme="dark"] .auth-alert         { background: #2C1B1D; color: #F2ADA5; }
:root[data-theme="dark"] .auth-alert.is-info { background: #17253C; color: #A2C2F7; }

:root[data-theme="dark"] .auth-topbar .dropdown-toggle {
    background: var(--a-surface);
    border-color: var(--a-line);
    color: var(--a-ink-2);
}

@media (prefers-reduced-motion: reduce) {
    .auth-page * { transition: none !important; animation: none !important; }
}
