/* Genidom auth pages (login / register / forgot password) — white, centered, calm.
   Palette mirrors landing.css: dark ink on light surfaces, blue accents. */

:root {
    --au-ink: #0f172a;
    --au-ink-soft: #475569;
    --au-ink-mute: #64748b;
    --au-accent: #2563eb;
    --au-accent-deep: #1d4ed8;
    --au-accent-2: #0ea5e9;
    --au-line: rgba(15, 23, 42, 0.08);
    --au-line-strong: rgba(15, 23, 42, 0.16);
    --au-blue-50: #eff6ff;
    --au-blue-100: #dbeafe;
    --au-danger: #b91c1c;
    --au-danger-border: #fecaca;
    --au-danger-bg: #fef2f2;
    --au-warn: #b45309;
    --au-warn-border: #fde68a;
    --au-warn-bg: #fffbeb;
    /* severity colour of a status page — overridden per page on .auth-panel */
    --au-tone: #2563eb;
}

body.auth {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: var(--au-ink);
    font-family: var(--ds-font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* brand stripe across the very top */
body.auth::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--au-accent), var(--au-accent-2));
    z-index: 10;
}

/* ---- Top bar ---- */
.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem clamp(1rem, 4vw, 2.5rem) 0.25rem;
}

.auth-brand img { display: block; height: 40px; width: auto; }

.auth-lang { display: inline-flex; gap: 0.45rem; color: var(--au-ink-soft); font-size: 0.9rem; }
.auth-lang a { color: inherit; text-decoration: none; font-weight: 500; }
.auth-lang a:hover { color: var(--au-ink); }
.auth-lang a.active { color: var(--au-accent); font-weight: 700; }

/* ---- Centered main ---- */
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2rem) 1rem 3rem;
}

.auth-panel {
    width: 100%;
    max-width: var(--au-width, 28rem);
    text-align: center;
}

.auth-figure { margin-bottom: 0.25rem; }
.auth-figure svg { width: min(320px, 86%); height: auto; }

.auth-title {
    font-size: clamp(1.55rem, 4vw, 1.9rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.5rem 0 0.4rem;
}

.auth-sub {
    color: var(--au-ink-soft);
    font-size: 0.98rem;
    line-height: 1.55;
    max-width: 34rem;
    margin: 0 auto 1.6rem;
}

/* localized messages may carry inline links (e.g. "click here to log in") */
.auth-sub a { color: var(--au-accent); font-weight: 600; text-decoration: none; }
.auth-sub a:hover { color: var(--au-accent-deep); text-decoration: underline; }

/* ---- Card ---- */
.auth-card {
    background: #ffffff;
    border: 1px solid var(--au-line);
    border-radius: 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    padding: clamp(1.4rem, 4vw, 2rem);
    text-align: left;
}

/* ---- Form sections (register) ---- */
.auth-section-head {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    margin-bottom: 1.1rem;
}

.auth-section-icon {
    flex: 0 0 auto;
    width: 2.3rem;
    height: 2.3rem;
    display: grid;
    place-items: center;
    border-radius: 0.7rem;
    font-size: 1.1rem;
    color: var(--au-accent);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.12));
}

.auth-section-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.1rem 0 0.2rem; }
.auth-section-desc { color: var(--au-ink-soft); font-size: 0.88rem; line-height: 1.5; margin: 0; }
.auth-card-divider { border: 0; border-top: 1px solid var(--au-line); margin: 1.6rem 0; opacity: 1; }

/* ---- Inputs ---- */
.auth-card .form-control {
    border-radius: 0.7rem;
    border-color: var(--au-line-strong);
    color: var(--au-ink);
}

.auth-card .form-control:focus {
    border-color: var(--au-accent);
    box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.13);
}

.auth-card .form-floating > label { color: var(--au-ink-mute); }
.auth-hint { color: var(--au-ink-mute); font-size: 0.82rem; margin: 0.35rem 0.25rem 0; }

/* standalone label for fields that don't use .form-floating (e.g. the PIN field) */
.auth-field-label {
    display: block;
    color: var(--au-ink-soft);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

/* ---- Code / PIN field ----
   One plain input, widely tracked and centered so a short numeric code reads as
   a code. Symmetric inline padding keeps the text optically centered next to the
   reveal toggle. */
.auth-code .form-control {
    font-family: var(--ds-font-mono);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-align: center;
    padding: 0.85rem 3.1rem;
    text-indent: 0.4em; /* compensate the trailing letter-spacing gap */
}

.auth-code .form-control::placeholder { letter-spacing: 0.3em; font-size: 1.1rem; color: #cbd5e1; }
.auth-code .auth-pass-toggle { top: 50%; transform: translateY(-50%); }

.auth-card .form-check-input:checked { background-color: var(--au-accent); border-color: var(--au-accent); }
.auth-card .form-check-input:focus { border-color: var(--au-accent); box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.13); }
.auth-card .form-check-label { color: var(--au-ink-soft); font-size: 0.92rem; }

/* ---- Password visibility toggle ---- */
.auth-pass-wrap { position: relative; }
.auth-pass-wrap > .form-control { padding-right: 3.1rem; }

.auth-pass-toggle {
    position: absolute;
    top: 0.68rem;
    right: 0.6rem;
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--au-ink-mute);
    font-size: 1.05rem;
    transition: color 0.15s ease, background 0.15s ease;
}

.auth-pass-toggle:hover,
.auth-pass-toggle:focus-visible { color: var(--au-accent); background: var(--au-blue-50); }

/* ---- Remember-me / forgot-password row ---- */
.auth-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---- Primary button ---- */
.btn-auth {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 999px;
    padding: 0.78rem 1.6rem;
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
    background: var(--au-accent);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.btn-auth:hover {
    background: var(--au-accent-deep);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.36);
}

.btn-auth:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }
.btn-auth .bi { font-size: 1.05rem; transition: transform 0.15s ease; }
.btn-auth:hover .bi { transform: translateX(3px); }
.btn-auth-inline { width: auto; padding-inline: 2.1rem; }

/* secondary action next to a .btn-auth (decline, log out, cancel) */
.btn-auth-ghost {
    background: #ffffff;
    color: var(--au-ink-soft);
    border: 1px solid var(--au-line-strong);
    box-shadow: none;
}

.btn-auth-ghost:hover {
    background: #ffffff;
    color: var(--au-ink);
    border-color: var(--au-ink-mute);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.btn-auth-ghost:hover .bi { transform: none; }

/* A row of actions. Buttons keep their natural width and never wrap their own
   label — equal-width stretching squeezed the longest label onto two lines.
   The row itself may still wrap onto a second line on a narrow viewport.
   Their icons sit left of the label, so the forward nudge .btn-auth applies
   is wrong here. */
.auth-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.auth-actions > .btn-auth, .auth-actions > form { flex: 0 1 auto; width: auto; }
.auth-actions > form { display: flex; }
.auth-actions > form > .btn-auth { width: auto; }
.auth-actions .btn-auth { white-space: nowrap; }
.auth-actions .btn-auth:hover .bi { transform: none; }

/* ---- Links ---- */
.auth-link { color: var(--au-accent); font-weight: 600; text-decoration: none; }
.auth-link:hover { color: var(--au-accent-deep); text-decoration: underline; }
.auth-link-sm { font-size: 0.9rem; }
.auth-link-muted { color: var(--au-ink-mute); text-decoration: none; }
.auth-link-muted:hover { color: var(--au-accent); text-decoration: underline; }

.auth-alt { margin: 1.4rem 0 0; color: var(--au-ink-soft); font-size: 0.95rem; }
.auth-alt-sm { margin-top: 0.55rem; font-size: 0.85rem; }

/* back-link that leads one step up inside the same page */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    padding: 0;
    background: none;
    color: var(--au-ink-mute);
    font-size: 0.9rem;
    text-decoration: none;
}

.auth-back:hover { color: var(--au-accent); }
.auth-back .bi { transition: transform 0.15s ease; }
.auth-back:hover .bi { transform: translateX(-3px); }

/* ---- Choice list — pick one of several routes into the app ---- */
.auth-choice-list { display: grid; gap: 0.6rem; }

.auth-choice {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--au-line-strong);
    border-radius: 0.9rem;
    background: #ffffff;
    color: var(--au-ink);
    text-align: left;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.auth-choice:hover {
    color: var(--au-ink);
    border-color: var(--au-accent);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.auth-choice:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }

/* the route we want most people to take */
.auth-choice-primary {
    border-color: rgba(37, 99, 235, 0.35);
    background: linear-gradient(180deg, var(--au-blue-50), #ffffff);
}

.auth-choice-ico {
    flex: 0 0 auto;
    width: 2.6rem;
    height: 2.6rem;
    display: grid;
    place-items: center;
    border-radius: 0.75rem;
    font-size: 1.15rem;
    color: var(--au-accent);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.12));
}

.auth-choice-body { flex: 1 1 auto; min-width: 0; }
.auth-choice-title { display: block; font-weight: 600; font-size: 0.98rem; letter-spacing: -0.01em; }
.auth-choice-desc { display: block; color: var(--au-ink-mute); font-size: 0.84rem; line-height: 1.45; }

.auth-choice-go {
    flex: 0 0 auto;
    color: var(--au-ink-mute);
    font-size: 1.05rem;
    transition: transform 0.15s ease, color 0.15s ease;
}

.auth-choice:hover .auth-choice-go { color: var(--au-accent); transform: translateX(3px); }

/* ---- Summary (read-only context above a form: who sent this, what it is) ---- */
.auth-summary {
    display: grid;
    gap: 0.5rem;
    border: 1px solid var(--au-line);
    border-radius: 1rem;
    background: linear-gradient(180deg, var(--au-blue-50), #ffffff);
    padding: 0.9rem 1.05rem;
    text-align: left;
}

.auth-summary-row { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; align-items: baseline; }

.auth-summary-label {
    flex: 0 0 7rem;
    color: var(--au-ink-mute);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-summary-value { flex: 1 1 10rem; min-width: 0; color: var(--au-ink); font-weight: 600; font-size: 0.95rem; }

/* ---- Status pages (error, 403/404/500, access denied) ----
   The severity colour rides on --au-tone, set per page on .auth-panel; the
   primary action stays on the regular blue .btn-auth so the page keeps one
   accent rather than two. */
.auth-badge {
    width: 9.5rem;
    height: 9.5rem;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    margin-bottom: 0.4rem;
    background: radial-gradient(circle at 30% 30%,
        color-mix(in srgb, var(--au-tone) 20%, transparent),
        color-mix(in srgb, var(--au-tone) 4%, transparent));
    box-shadow: 0 8px 24px color-mix(in srgb, var(--au-tone) 18%, transparent);
}

.auth-badge svg { width: 5.2rem; height: 5.2rem; color: var(--au-tone); }

.auth-eyebrow {
    color: var(--au-tone);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0.6rem 0 0.4rem;
}

/* Stays narrow while the panel around it widens for the action row. */
.auth-tips {
    max-width: 30rem;
    margin-inline: auto;
    border: 1px solid var(--au-line);
    border-radius: 1rem;
    background: #f8fafc;
    padding: 1.05rem 1.25rem;
    text-align: left;
}

.auth-tips-title {
    color: var(--au-ink-mute);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}

.auth-tips ul { margin: 0; padding-left: 1.15rem; color: var(--au-ink-soft); font-size: 0.88rem; line-height: 1.7; }

.auth-requestid {
    font-family: var(--ds-font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--au-ink-mute);
    margin: 1.1rem 0 0;
}

/* ---- Notice (non-form status message inside a card) ---- */
.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    font-size: 0.92rem;
    text-align: left;
}

.auth-notice .bi { flex: 0 0 auto; font-size: 1.05rem; line-height: 1.45; }

.auth-notice-danger {
    background: var(--au-danger-bg);
    border: 1px solid var(--au-danger-border);
    color: var(--au-danger);
}

.auth-notice-warning {
    background: var(--au-warn-bg);
    border: 1px solid var(--au-warn-border);
    color: var(--au-warn);
}

/* the localized body may carry <strong> around the address */
.auth-notice strong { font-weight: 700; }

/* ---- Multi-step panel (choice → detail, swapped client-side) ---- */
.auth-step-in { animation: auth-up 0.4s cubic-bezier(0.22, 0.7, 0.3, 1); }

/* ---- Validation ---- */
.auth-validation { display: none; }

.auth-validation.validation-summary-errors {
    display: block;
    background: var(--au-danger-bg);
    border: 1px solid var(--au-danger-border);
    color: var(--au-danger);
    border-radius: 0.75rem;
    padding: 0.7rem 0.95rem;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.auth-validation ul { margin: 0; padding: 0; list-style: none; }

.auth-card .field-validation-error {
    display: block;
    color: var(--au-danger);
    font-size: 0.84rem;
    margin: 0.3rem 0.25rem 0;
}

.auth-card .input-validation-error { border-color: #dc2626; }
.auth-card .input-validation-error:focus { border-color: #dc2626; box-shadow: 0 0 0 0.22rem rgba(220, 38, 38, 0.12); }

/* ---- Footer ---- */
.auth-footer {
    padding: 1.1rem 1rem 1.4rem;
    text-align: center;
    color: var(--au-ink-mute);
    font-size: 0.85rem;
}

/* ---- Entrance animation (staggered) ---- */
@keyframes auth-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.auth-stagger > * { opacity: 0; animation: auth-up 0.55s cubic-bezier(0.22, 0.7, 0.3, 1) forwards; }
.auth-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.auth-stagger > *:nth-child(2) { animation-delay: 0.13s; }
.auth-stagger > *:nth-child(3) { animation-delay: 0.21s; }
.auth-stagger > *:nth-child(4) { animation-delay: 0.29s; }
.auth-stagger > *:nth-child(5) { animation-delay: 0.37s; }
.auth-stagger > *:nth-child(6) { animation-delay: 0.45s; }

/* ---- Illustration effects ----
   .ill-draw requires pathLength="1" on the element (solid strokes only —
   the dasharray trick would override a dashed stroke pattern). */
@keyframes ill-draw { to { stroke-dashoffset: 0; } }

.ill-draw {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: ill-draw 1.1s ease-out forwards;
    animation-delay: var(--d, 0s);
}

@keyframes ill-fade { to { opacity: 1; } }
.ill-fade { opacity: 0; animation: ill-fade 0.7s ease forwards; animation-delay: var(--d, 0.45s); }

@keyframes ill-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.ill-float { animation: ill-float 3.8s ease-in-out infinite; }

@keyframes ill-sway {
    0%, 100% { transform: rotate(1.5deg); }
    50% { transform: rotate(-1.5deg); }
}

.ill-sway { animation: ill-sway 4.5s ease-in-out infinite; transform-box: view-box; }

@media (prefers-reduced-motion: reduce) {
    .auth-stagger > *, .ill-fade { animation: none; opacity: 1; }
    .ill-draw { animation: none; stroke-dashoffset: 0; }
    .ill-float, .ill-sway { animation: none; }
    .auth-step-in { animation: none; }
    .btn-auth, .btn-auth .bi, .auth-pass-toggle { transition: none; }
    .btn-auth:hover { transform: none; }
    .btn-auth:hover .bi { transform: none; }
    .auth-choice, .auth-choice-go, .auth-back .bi { transition: none; }
    .auth-choice:hover { transform: none; }
    .auth-choice:hover .auth-choice-go, .auth-back:hover .bi { transform: none; }
}

@media (max-width: 575.98px) {
    .auth-card { border-radius: 1rem; }
    .auth-figure svg { width: 80%; }
}
