/*
 * Sign-in journey shell: a showcase panel on the left (tenant background,
 * headline, three rotating awareness slides) and the form card on the right.
 * Used by registration/auth_base.html and every page that extends it.
 *
 * The child pages (2FA, password reset, invitations) were written against the
 * Bootstrap classes in login-style.css. The `.auth-card` rules at the bottom
 * restyle those classes inside the card, so the pages adopt the new look
 * without being rewritten.
 */

.auth-shell {
    --auth-ink: #1c1a19;
    --auth-muted: #6b6560;
    --auth-line: #e4e0dd;
    --auth-ok: #16a34a;
    /* The left panel wears the sidebar colours: background in the secondary
       colour, text in the menu font colour, so it reads like the signed-in
       app. The headline highlight and the pictograms stay in the primary. */
    --auth-panel: var(--secondary-color);
    --auth-panel-ink: var(--menu-font-color);
    --auth-panel-muted: color-mix(in srgb, var(--menu-font-color) 72%, transparent);
    --auth-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* login-style.css sets Lato on body, which is never loaded; without this the
       showcase text falls back to Arial while only inputs and buttons get Archivo. */
    font-family: 'Archivo', system-ui, sans-serif;

    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
    color: var(--auth-ink);
    background: var(--ground-color);
}
.auth-shell *, .auth-shell *::before, .auth-shell *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

/* ---------- Showcase panel ---------- */
.auth-showcase {
    position: relative;
    overflow: hidden;
    background-color: var(--auth-panel);
    background-image: var(--showcase-bg, none);
    background-size: cover;
    background-position: center;
    color: var(--auth-panel-ink);
    padding: 48px clamp(28px, 5vw, 72px);
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.auth-showcase::before {
    content: "";
    position: absolute; inset: 0;
    background:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 32px 32px;
    mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
    pointer-events: none;
}
.auth-showcase.has-bg::before {
    background: linear-gradient(160deg, rgba(23,21,20,.62), rgba(23,21,20,.88));
    mask-image: none;
    -webkit-mask-image: none;
}
.auth-showcase::after {
    content: "";
    position: absolute;
    width: 620px; height: 620px;
    right: -220px; bottom: -260px;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary-color) 38%, transparent), transparent 65%);
    filter: blur(20px);
    opacity: .5;
    pointer-events: none;
}
.auth-showcase > * { position: relative; z-index: 1; }

/* Pictogram pattern, shown when the tenant has no background image. Stroked
   in the primary colour and faded out towards the text at the bottom. */
.auth-showcase > .auth-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    color: var(--primary-color);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .28;
    mask-image: linear-gradient(to bottom, #000 25%, transparent 80%);
    -webkit-mask-image: linear-gradient(to bottom, #000 25%, transparent 80%);
    pointer-events: none;
}
/* One width for headline and subtitle, set on their shared container. */
.auth-pitch { margin-top: auto; max-width: 30rem; }

/* Tenant campaign message, above the headline. */
.auth-announce {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px !important;
    padding: 7px 14px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 55%, transparent);
    background: color-mix(in srgb, var(--primary-color) 18%, transparent);
    color: var(--auth-panel-ink) !important;
    font-size: .88rem !important;
    font-weight: 600;
    line-height: 1.35;
    max-width: 100% !important;
}
.auth-announce svg { flex: none; }

.auth-brand-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.auth-brand-row img { max-height: 40px; max-width: 220px; display: block; }
.auth-brand-row .name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }

.auth-pitch h1 {
    font-size: clamp(2rem, 3.4vw, 3.1rem);
    line-height: 1.05;
    letter-spacing: -.03em;
    margin: 0 0 14px;
    font-weight: 800;
    max-width: none;
    color: inherit;
}
.auth-pitch h1 em { font-style: normal; color: var(--primary-color); }
.auth-pitch p { color: var(--auth-panel-muted); margin: 0; line-height: 1.55; font-size: 1rem; }
/* Over a photo the dark overlay is fixed, so the text colours are too. */
.auth-showcase.has-bg { --auth-panel-ink: #f3f2f2; --auth-panel-muted: #d6cfca; }

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

/* ---------- Form panel ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px clamp(20px, 5vw, 64px);
}
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card-brand { display: none; margin-bottom: 24px; }
.auth-card-brand img { max-height: 44px; max-width: 220px; display: block; }

.auth-card h2, .auth-card h3 { font-size: 1.9rem; letter-spacing: -.025em; margin: 0 0 6px; font-weight: 800; color: var(--auth-ink); }
.auth-card .auth-sub, .auth-card .auth-hint, .auth-card .otp-hint { color: var(--auth-muted); font-size: .95rem; }
.auth-card .auth-sub { margin: 0 0 28px; }
.auth-card a.auth-hint { font-size: .85rem; color: var(--primary-color); font-weight: 600; text-decoration: none; }
.auth-card a.auth-hint:hover { text-decoration: underline; }

.auth-card .label, .auth-card label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; color: var(--auth-ink); text-transform: none; letter-spacing: 0; }
.auth-card .form-group { margin-bottom: 16px; }

.auth-card .form-control,
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    height: auto;
    width: 100%;
    padding: 13px 14px;
    font-size: 1rem;
    color: var(--auth-ink);
    background: #fff;
    border: 1.5px solid var(--auth-line);
    border-radius: 10px;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-card .form-control:focus,
.auth-card input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 14%, transparent);
    outline: none;
}

.auth-input { position: relative; display: flex; align-items: center; }
.auth-input input { padding-right: 46px !important; }
.auth-input .reveal { all: unset; cursor: pointer; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 8px; color: var(--auth-muted); display: grid; place-items: center; border-radius: 6px; }
.auth-input .reveal:focus-visible { outline: 2px solid var(--primary-color); }
.auth-caps { font-size: .75rem; margin-top: 6px; color: #b45309; }

.auth-card .btn,
.auth-btn {
    box-sizing: border-box;
    cursor: pointer;
    width: 100%;
    height: auto;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.auth-card .btn:active, .auth-btn:active { transform: translateY(1px); }
.auth-card .btn:focus-visible, .auth-btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }
.auth-card .btn.btn-primary, .auth-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--primary-color) 70%, transparent);
}
.auth-card .btn.btn-primary:hover, .auth-btn.primary:hover {
    background: color-mix(in srgb, var(--primary-color) 88%, #000);
    border-color: color-mix(in srgb, var(--primary-color) 88%, #000);
    color: #fff;
}
.auth-btn.primary[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.auth-btn.dark { background: var(--secondary-color); color: var(--menu-font-color); }
.auth-btn.dark:hover { background: color-mix(in srgb, var(--secondary-color) 85%, #fff); color: var(--menu-font-color); }
.auth-btn.ghost { background: #fff; color: var(--auth-ink); border-color: var(--auth-line); }
.auth-btn.ghost:hover { border-color: var(--auth-ink); }
.auth-btn .arrow { transition: transform .2s; }
.auth-btn:hover .arrow { transform: translateX(3px); }

.auth-who {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px 8px 8px;
    background: #fff;
    border: 1px solid var(--auth-line);
    border-radius: 999px;
    margin-bottom: 20px;
}
.auth-who .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--secondary-color); color: var(--menu-font-color); display: grid; place-items: center; font-weight: 700; font-size: .75rem; flex: none; text-transform: uppercase; }
.auth-who .addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; }
.auth-link { all: unset; cursor: pointer; color: var(--primary-color); font-weight: 600; font-size: .85rem; }
.auth-link:hover { text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 3px; }

.auth-or { display: flex; align-items: center; gap: 12px; color: var(--auth-muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; margin: 20px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--auth-line); }
.auth-card .auth-divider, .auth-card .otp-divider { border: 0; border-top: 1px solid var(--auth-line); margin: 1.25rem 0; }

.auth-card .alert {
    border-radius: 10px;
    font-size: .85rem;
    padding: 12px 14px;
    margin-bottom: 18px;
}
.auth-card .alert ul { margin: 0; padding-left: 1.1rem; }
.auth-card .alert ul.errorlist { list-style: none; padding: 0; }
.auth-card .alert-danger, .auth-card .alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.auth-error { color: #dc2626; font-size: .85rem; margin-top: 6px; }
.auth-error ul { list-style: none; padding: 0; margin: 0; }
.auth-help { color: var(--auth-muted); font-size: .75rem; margin-top: 6px; }
.auth-help ul { padding-left: 1.1rem; margin-bottom: 0; }
.auth-step { animation: auth-rise .35s ease both; }

.auth-foot {
    max-width: 400px; width: 100%;
    margin: 36px auto 0;
    display: flex; justify-content: flex-end; align-items: center;
}
.auth-lang { display: flex; gap: 2px; background: #fff; border: 1px solid var(--auth-line); border-radius: 999px; padding: 3px; margin: 0; }
.auth-lang button { all: unset; cursor: pointer; padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: .75rem; color: var(--auth-muted); }
.auth-lang button.on { background: var(--secondary-color); color: var(--menu-font-color); }
.auth-lang button:focus-visible { outline: 2px solid var(--primary-color); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-main { order: 1; padding: 24px 16px 32px; }
    .auth-showcase { order: 2; padding: 28px 16px; gap: 12px; }
    .auth-showcase .auth-brand-row,
    .auth-showcase > .auth-pattern { display: none; }
    .auth-pitch h1 { font-size: 1.4rem; max-width: none; margin-bottom: 8px; }
    .auth-pitch p { font-size: .9rem; }
    .auth-card-brand { display: block; }
}

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