/* Login page stylesheet. Standalone — independent of the SPA's
   Tailwind bundle. Brand colours hardcoded as oklch literals from
   the same palette as `frontend/src/index.css` (`.theme-violet-deep.dark`);
   keep the two in sync when the brand evolves. Geist is intentionally
   skipped here to avoid pulling a font bundle for one page;
   `system-ui` keeps first-paint instant. */

:root {
    --bg: oklch(0.165 0.008 285);
    --fg: oklch(0.96 0.005 285);
    --card: oklch(0.205 0.01 285);
    --muted-fg: oklch(0.7 0.012 285);
    --border: oklch(1 0 0 / 10%);
    --primary: oklch(0.58 0.20 349);
    --primary-hover: oklch(0.65 0.20 349);
    --primary-fg: oklch(0.99 0 0);
    --ring: oklch(0.58 0.20 349 / 30%);
    --destructive: oklch(0.74 0.18 22);
    --destructive-bg: oklch(0.74 0.18 22 / 16%);
    --destructive-border: oklch(0.74 0.18 22 / 60%);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.login-layout {
    position: relative;
    display: grid;
    height: 100svh;
    width: 100%;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
@media (min-width: 1024px) {
    .login-layout { grid-template-columns: 1.2fr 1fr; }
}

/* Zero-JS <details> disclosure — the login page ships no framework. */
.login-lang {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 3;
}
.login-lang-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-fg);
    background: oklch(0.165 0.008 285 / 45%);
    backdrop-filter: blur(4px);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color 150ms, border-color 150ms;
}
.login-lang-trigger::-webkit-details-marker { display: none; }
.login-lang-trigger:hover { color: var(--fg); border-color: oklch(1 0 0 / 22%); }
.login-lang-globe { width: 1rem; height: 1rem; }
.login-lang-caret { width: 0.85rem; height: 0.85rem; transition: transform 150ms; }
.login-lang[open] .login-lang-caret { transform: rotate(180deg); }

.login-lang-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    min-width: 9rem;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: oklch(0.2 0.01 285 / 96%);
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 30px oklch(0 0 0 / 35%);
}
.login-lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.875rem;
    color: var(--muted-fg);
    text-decoration: none;
    transition: background 120ms, color 120ms;
}
.login-lang-item:hover { background: oklch(1 0 0 / 8%); color: var(--fg); }
.login-lang-item.is-active { color: var(--fg); }
.login-lang-check { width: 1rem; height: 1rem; color: var(--primary); }

/* Single atmospheric overlay across the whole image. Asymmetric so the
   form side gets slightly more darkening (legibility for the glass card)
   without making the brand side look murky. */
.login-layout::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(13, 8, 32, 0.55) 0%,
        rgba(13, 8, 32, 0.30) 45%,
        rgba(13, 8, 32, 0.60) 100%
    );
    pointer-events: none;
    z-index: 0;
}
/* Stronger bottom darkening so the tagline reads cleanly. */
.login-layout::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 50%;
    background: linear-gradient(
        to top,
        rgba(10, 5, 24, 0.85),
        rgba(10, 5, 24, 0.40),
        transparent
    );
    pointer-events: none;
    z-index: 0;
}

/* ── LEFT — brand text (lg+ only). No background here anymore — the
   image lives on .login-layout so it bleeds full-width behind the
   glass card on the right. ─────────────────────────────────────── */

.login-brand {
    display: none;
}
@media (min-width: 1024px) {
    .login-brand {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-start;
        padding: 3rem 3rem clamp(6rem, 12vh, 10rem) 3rem;
    }
}
.login-brand-logo {
    height: 88px;
    width: auto;
    color: #fff;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.55));
}
.login-brand-tagline {
    max-width: 48rem;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.login-brand-eyebrow {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.85);
}
.login-brand-headline {
    margin: 1rem 0;
    font-size: clamp(1.75rem, 2.4vw, 2.25rem);
    font-weight: 600;
    line-height: 1.15;
    color: #fff;
}
.login-brand-copy {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* ── RIGHT — form panel ──────────────────────────────────────────── */

.login-form-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}
@media (min-width: 640px) {
    .login-form-panel { padding-inline: 2.5rem; }
}
/* Desktop: the panel becomes a full-height glass column. Soft left edge
   via mask-image so the column emerges from the image instead of cutting
   against it. The form lives inside the panel; its own card chrome is
   removed at this breakpoint (see below). */
@media (min-width: 1024px) {
    .login-form-panel {
        padding-inline: 3rem;
        background-color: oklch(0.15 0.008 285 / 55%);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        -webkit-mask-image: linear-gradient(to right, transparent 0, black 20px);
        mask-image: linear-gradient(to right, transparent 0, black 20px);
    }
}

/* Mobile-only logo above the form (the brand panel is hidden below lg). */
.login-form-panel .login-brand-logo {
    height: 64px;
    margin-bottom: 2.5rem;
    color: var(--fg);
}
@media (min-width: 1024px) {
    .login-form-panel .login-brand-logo { display: none; }
}

/* Mobile (below lg): the card keeps glass chrome so the form is
   readable on top of the full-bleed image. On lg+ the panel itself
   carries the glass effect (see .login-form-panel above), so we strip
   the card chrome there to avoid a glass-on-glass look. */
.login-form-card {
    width: 100%;
    max-width: 24rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2.5rem;
    border-radius: 16px;
    background-color: oklch(0.15 0.008 285 / 55%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 24px 60px -12px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}
@media (min-width: 1024px) {
    .login-form-card {
        padding: 0;
        border-radius: 0;
        background-color: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 0;
        box-shadow: none;
        max-width: 28rem;
    }
}
.login-form-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.login-form-header p {
    margin: 0;
    font-size: 1rem;
    color: var(--muted-fg);
}

.login-error {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    border: 1px solid var(--destructive-border);
    background-color: var(--destructive-bg);
    color: var(--destructive);
    border-radius: 8px;
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.4;
}
.login-error-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.login-field { display: flex; flex-direction: column; gap: 0.5rem; }
.login-field label {
    font-size: 0.9375rem;
    font-weight: 500;
}
.login-field input {
    display: block;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--fg);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    font: inherit;
    font-size: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10);
    transition: border-color 150ms, box-shadow 150ms, background-color 150ms;
}
.login-field input::placeholder { color: var(--muted-fg); }
.login-field input:focus {
    outline: none;
    border-color: oklch(0.58 0.20 349 / 60%);
    background-color: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 0 2px var(--ring);
}

/* Inline required-field message. Shown by the form's submit handler
   when a `required` input is empty; cleared on the next keystroke in
   that field. `novalidate` on the form suppresses the browser's
   native bubble so this is the only visual error surface. */
.login-field-error {
    margin: 0.375rem 0 0 0;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: var(--destructive);
}
.login-field--invalid input {
    border-color: var(--destructive-border);
}
.login-field--invalid input:focus {
    border-color: var(--destructive);
    box-shadow: 0 0 0 2px oklch(0.74 0.18 22 / 30%);
}

/* Password input + show/hide toggle. Wrapper is `position:relative`;
   the button overlays the right edge of the input. The input gets
   right padding so the typed text never collides with the button. */
.login-field-pwd { position: relative; }
.login-field-pwd input { padding-right: 3rem; }
.login-field-pwd-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--muted-fg);
    cursor: pointer;
    border-radius: 0 10px 10px 0;
    transition: color 150ms;
}
.login-field-pwd-toggle:hover { color: var(--fg); }
.login-field-pwd-toggle:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: -2px;
}
.login-field-pwd-toggle svg { width: 18px; height: 18px; }
.login-field-pwd-toggle .icon-eye-off { display: none; }
.login-field-pwd-toggle[aria-pressed="true"] .icon-eye { display: none; }
.login-field-pwd-toggle[aria-pressed="true"] .icon-eye-off { display: block; }

.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 3rem;
    border: 0;
    border-radius: 10px;
    background-color: var(--primary);
    color: var(--primary-fg);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color 150ms;
}
.login-submit:hover { background-color: var(--primary-hover); }
.login-submit:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
a.login-submit { text-decoration: none; }
