/*
 * Full-screen auth layout: sign in (member/chooser), administrator sign in,
 * registration and trial-registration pages - loaded via
 * views/layouts/auth-header.php/auth-footer.php, NOT the app shell's
 * header.php/footer.php, so there is no navbar or page container to fight
 * with. Scoped under .auth-shell regardless, so nothing here can bleed into
 * the dashboard/admin UI if a class name is ever reused.
 *
 * Composition follows the supplied Claude Design "Bowlio Club App" SignIn
 * screen exactly: the whole viewport is a two-column grid - a plain form
 * column (badge, eyebrow, heading, fields) and a full-bleed photographic
 * hero column with a bottom-anchored gradient caption - not a centered card
 * floating on a grey page background.
 */

.auth-shell {
    --auth-green-950: #002617;
    --auth-green-900: #003020;
    --auth-green-800: #064027;
    --auth-green-700: #0b5533;
    --auth-red-700: #a90320;
    --auth-red-600: #d90429;
    --auth-red-500: #ef233c;
    --auth-red-100: #fde3e7;
    --auth-ink-900: #1c1e2d;
    --auth-ink-700: #3c3f57;
    --auth-slate-600: #5b6579;
    --auth-slate-500: #8d99ae;
    --auth-slate-400: #a7b1c2;
    --auth-slate-300: #c3cbd7;
    --auth-slate-200: #dae0e8;
    --auth-mist-50: #edf2f4;
    --auth-gold-500: #e9c46a;
    --auth-radius-sm: 6px;
    --auth-radius-md: 10px;
    --auth-radius-lg: 14px;
    --auth-radius-xl: 20px;
    --auth-shadow-xs: 0 1px 2px rgba(28, 30, 45, 0.08);
    --auth-shadow-sm: 0 1px 3px rgba(28, 30, 45, 0.09), 0 1px 1px rgba(28, 30, 45, 0.05);
    --auth-shadow-md: 0 4px 12px rgba(28, 30, 45, 0.1);
    --auth-shadow-lg: 0 12px 32px rgba(28, 30, 45, 0.14);
    --auth-shadow-focus: 0 0 0 0.2rem rgba(217, 4, 41, 0.22);

    min-height: 100vh;
    background: #fff;
    font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-card {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}

/* ---- Form column (first in markup = left on desktop) ---- */

.auth-form-panel {
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-form-panel-inner {
    width: 100%;
    max-width: 440px;
}

.auth-form-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
}

.auth-eyebrow {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-family: 'Montserrat', 'Barlow', sans-serif;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--auth-slate-600);
    margin-bottom: 12px;
}

.auth-eyebrow.is-inverse {
    color: var(--auth-mist-50);
}

.auth-form-panel h1,
.auth-form-panel h2,
.auth-form-panel h3 {
    font-family: 'Montserrat', 'Barlow', sans-serif;
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--auth-ink-900);
    font-weight: 800;
}

.auth-form-intro {
    color: var(--auth-slate-600);
    font-size: 1rem;
    margin-bottom: 28px;
}

.auth-form-panel .form-label {
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--auth-ink-900);
}

.auth-form-panel .form-control {
    border-radius: var(--auth-radius-sm);
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--auth-slate-300);
    box-shadow: var(--auth-shadow-xs);
    font-size: 0.875rem;
}

.auth-form-panel .form-control:focus {
    border-color: var(--auth-green-700);
    box-shadow: var(--auth-shadow-focus);
}

.auth-field-icon {
    position: relative;
}

.auth-field-icon > i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-slate-600);
    font-size: 0.85rem;
    pointer-events: none;
}

.auth-field-icon > .form-control {
    padding-left: 2.35rem;
}

.auth-form-panel .form-check-input {
    width: 1.15em;
    height: 1.15em;
    margin-top: 0.15em;
    border-radius: 4px;
    border: 1px solid var(--auth-slate-300);
    box-shadow: var(--auth-shadow-xs);
}

.auth-form-panel .form-check-input:checked {
    background-color: var(--auth-green-900);
    border-color: var(--auth-green-900);
}

.auth-form-panel .form-check-input:focus {
    border-color: var(--auth-green-700);
    box-shadow: var(--auth-shadow-focus);
}

.auth-form-panel .form-check-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-ink-900);
}

.auth-inline-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-red-600);
    text-decoration: none;
}

.auth-inline-link:hover {
    color: var(--auth-red-700);
    text-decoration: underline;
}

.auth-trust-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--auth-slate-600);
    font-size: 0.8125rem;
    margin-top: 20px;
}

.auth-trust-line i {
    color: var(--auth-slate-500);
}

.btn-auth-primary {
    background: var(--auth-green-900);
    border: 1px solid var(--auth-green-900);
    color: #fff;
    font-family: 'Montserrat', 'Barlow', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.7rem 1rem;
    border-radius: var(--auth-radius-sm);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-auth-primary:hover,
.btn-auth-primary:focus {
    color: #fff;
    background: var(--auth-green-700);
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow-md);
}

.btn-auth-admin {
    background: var(--auth-red-600);
    border: 1px solid var(--auth-red-600);
    color: #fff;
    font-family: 'Montserrat', 'Barlow', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.7rem 1rem;
    border-radius: var(--auth-radius-sm);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-auth-admin:hover,
.btn-auth-admin:focus {
    color: #fff;
    background: var(--auth-red-700);
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow-md);
}

.auth-footnote {
    text-align: center;
    margin-top: 20px;
    color: var(--auth-slate-600);
    font-size: 0.9rem;
}

.auth-footnote a {
    color: var(--auth-red-600);
    font-weight: 600;
    text-decoration: none;
}

.auth-footnote a:hover {
    text-decoration: underline;
    color: var(--auth-red-700);
}

/* ---- Hero column (second in markup = right on desktop) ---- */

.auth-hero {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('/assets/auth-hero.jpg');
    background-size: cover;
    background-position: center;
    /* Sizes background-size: cover against the viewport instead of this
       element's own box. Sign-in/registration are already about one
       viewport tall, so this looks the same there, but a long page like
       the Privacy Notice stretches this grid column far taller than the
       source image - without this, cover would zoom in hard to still
       span that height, cropping most of the image away. Falls back to
       the default (scroll) attachment on browsers/devices that don't
       support fixed backgrounds (notably older mobile Safari), which is
       harmless here since the mobile layout below already uses a short,
       fixed-height banner unaffected by this problem either way. */
    background-attachment: fixed;
}

.auth-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--auth-green-950) 12%, rgba(0, 38, 23, 0.72) 55%, rgba(0, 38, 23, 0.28) 100%);
}

.auth-hero.is-admin::after {
    background: linear-gradient(to top, #3d0f16 12%, rgba(61, 15, 22, 0.75) 55%, rgba(61, 15, 22, 0.3) 100%);
}

.auth-hero-content {
    position: relative;
    z-index: 1;
    padding: 40px;
    color: var(--auth-mist-50);
}

.auth-hero-rule-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.auth-hero-rule {
    width: 40px;
    height: 4px;
    background: var(--auth-red-600);
    display: inline-block;
    flex: 0 0 auto;
}

.auth-hero-tagline {
    margin: 0;
    max-width: 420px;
    font-size: 1.0625rem;
    color: var(--auth-mist-50);
}

@media (max-width: 767.98px) {
    .auth-card {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: 220px;
        order: 2;
    }

    .auth-form-panel {
        padding: 40px 24px;
        order: 1;
    }
}

/* ---- Passwordless sign-in: passkey button + "sign in another way" disclosure ---- */

.auth-passkey-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--auth-slate-300);
    color: var(--auth-ink-900);
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    border-radius: var(--auth-radius-sm);
    box-shadow: var(--auth-shadow-xs);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-passkey-btn:hover {
    background: var(--auth-mist-50);
    box-shadow: var(--auth-shadow-sm);
}

/* WCAG 2.4.7 (Focus Visible): a real, high-contrast outline distinct from
   the hover state - the hover-only treatment this used to share with
   :focus relied on a box-shadow well under 3:1 contrast, which isn't a
   visible focus indicator. Matches .auth-alt-signin > summary:focus-visible
   below. */
.auth-passkey-btn:focus-visible {
    outline: 2px solid var(--auth-green-700);
    outline-offset: 2px;
}

.auth-passkey-btn:disabled {
    opacity: 0.7;
}

.auth-passkey-status {
    min-height: 1.2em;
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: var(--auth-slate-600);
}

.auth-passkey-status.text-danger {
    color: var(--auth-red-600);
}

/* The passwordless panel (magic-link form + passkey button) and the
   password fallback share one slot: opening the <details> below swaps one
   for the other instead of stacking both, so "Sign in another way" reads
   as a real alternative rather than an accordion appended under the form. */
.auth-form-panel-inner:has(.auth-alt-signin[open]) #passwordlessPanel {
    display: none;
}

.auth-alt-signin {
    margin-top: 16px;
}

.auth-alt-signin > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #fff;
    border: 1px solid var(--auth-slate-300);
    border-radius: var(--auth-radius-sm);
    padding: 0.65rem 1rem;
    box-shadow: var(--auth-shadow-xs);
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--auth-ink-900);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-alt-signin > summary:hover {
    background: var(--auth-mist-50);
    box-shadow: var(--auth-shadow-sm);
}

.auth-alt-signin > summary::-webkit-details-marker {
    display: none;
}

/* One control, two faces: the closed state reads "Sign in another way",
   the open state reads "Use a sign-in link instead" - swapped by the
   [open] attribute alone, so going back never needs a second control or
   any JS. */
.auth-alt-signin-state {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-alt-signin-state-open {
    display: none;
}

.auth-alt-signin[open] > summary .auth-alt-signin-state-closed {
    display: none;
}

.auth-alt-signin[open] > summary .auth-alt-signin-state-open {
    display: flex;
}

.auth-alt-signin > summary:focus-visible {
    outline: 2px solid var(--auth-green-700);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- "Your passkeys" management list ---- */

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

.auth-passkey-list > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--auth-slate-200);
}

.auth-passkey-list > li:last-child {
    border-bottom: none;
}

.auth-passkey-meta {
    font-size: 0.8125rem;
    color: var(--auth-slate-600);
}

@media (max-width: 400px) {
    .auth-form-panel {
        padding: 28px 20px;
    }

    .auth-hero-content {
        padding: 28px;
    }
}

/* ---- In-page navigation between auth pages (sign in <-> Privacy Notice
   <-> Terms and Conditions), driven by assets/js/auth-policy-panel.js.
   Every link this targets is a real href to a real page first - the script
   only intercepts the click to swap .auth-form-panel-inner/.auth-hero-content
   in place instead of a full page load, so nothing here is required for the
   page to work with JS disabled or on a fetch() failure. */
.auth-form-panel-inner,
.auth-hero-content {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.auth-panel-leaving .auth-form-panel-inner,
.auth-panel-leaving .auth-hero-content {
    opacity: 0;
    transform: translateY(6px);
}

@media (prefers-reduced-motion: reduce) {
    .auth-form-panel-inner,
    .auth-hero-content {
        transition: none;
    }
}

/* A Privacy Notice/Terms page carries more copy than a form, so its panel
   is allowed a bit more width than the 440px sign-in/registration forms. */
.auth-form-panel-inner.is-wide {
    max-width: 560px;
}

.auth-policy-content h2 {
    font-family: 'Montserrat', 'Barlow', sans-serif;
    font-size: 1.0625rem;
    font-weight: 800;
    color: var(--auth-ink-900);
    margin: 28px 0 10px;
}

.auth-policy-content h2:first-child {
    margin-top: 0;
}

.auth-policy-content p,
.auth-policy-content li {
    color: var(--auth-ink-700);
    font-size: 0.9rem;
    line-height: 1.65;
}

.auth-policy-content p {
    margin-bottom: 0.85rem;
}

.auth-policy-content ul {
    padding-left: 1.1rem;
    margin-bottom: 1rem;
}

.auth-policy-updated {
    color: var(--auth-slate-600);
    font-size: 0.8125rem;
    margin-bottom: 24px;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 20px;
    cursor: pointer;
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--auth-red-600);
}

.auth-back-link:hover {
    color: var(--auth-red-700);
    text-decoration: underline;
}

.auth-back-link:focus-visible {
    outline: 2px solid var(--auth-green-700);
    outline-offset: 2px;
    border-radius: 4px;
}
