/* Auth pages (login / two-factor).
   Scoped strictly to .container-auth and .auth-* so it cannot affect any
   other page that shares layout.hbs or layout-popup.hbs.
   Loaded after modern.css so the overrides below win. */

.container-auth {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 8px;
}

.auth-card {
    background: var(--wd-surface);
    border: 1px solid var(--wd-border);
    border-radius: var(--wd-radius);
    box-shadow: var(--wd-shadow);
    padding: 34px 32px 30px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    text-align: center;
}

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

.auth-title {
    font-family: var(--wd-font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--wd-text);
    margin: 4px 0 0;
}

.auth-subtitle {
    margin: 0;
    color: var(--wd-muted);
    font-size: 14px;
    line-height: 1.6;
}

.auth-card .form-group:last-of-type {
    margin-bottom: 18px;
}

.auth-card label {
    font-weight: 500;
}

.auth-card .checkbox {
    margin-top: 0;
    font-weight: 400;
}

.auth-btn {
    width: 100%;
    padding: 11px 16px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--wd-radius-sm);
    background: var(--wd-accent);
    border-color: var(--wd-accent);
    color: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-btn:hover,
.auth-btn:focus {
    background: var(--wd-accent-strong);
    border-color: var(--wd-accent-strong);
    color: #fff;
}

.auth-btn[disabled],
.auth-btn[disabled]:hover {
    background: var(--wd-accent);
    border-color: var(--wd-accent);
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--wd-border);
    text-align: center;
    font-size: 13px;
    color: var(--wd-muted);
}

.auth-footer a {
    color: var(--wd-accent);
}

@media (max-width: 480px) {
    .container-auth {
        padding-top: 0;
    }

    .auth-card {
        padding: 26px 20px 24px;
        border-radius: var(--wd-radius-sm);
    }
}

/* Login feedback. On the auth pages there is no navbar, so the default fixed
   overlay (modern.css: top 80px) would float awkwardly in empty space. Render
   the alert inline instead, centered directly above the card. The 10s auto-hide
   timer in partials/scripts.hbs still applies, so it behaves like a toast. */
.auth-flash {
    position: static;
    margin-bottom: 14px;
}

/* ===== Balanced auth layout: card + footer as one centered column =====
   body is `display:flex; flex-direction:column; min-height:100vh` (modern.css),
   and .footer carries `margin-top:auto`, which pins it to the bottom of the
   viewport and leaves a big gap under the card. On the auth pages we regroup:
   center the card+footer block vertically and turn the footer into a subtle
   centered line right under the card.

   `body:has(.auth-card)` targets exactly login.hbs and 2fa.hbs. Verified: the
   2FA *settings* page (views/account/security/2fa.hbs) does NOT use .auth-card,
   so it keeps the normal footer. Without :has() support (Firefox <121) the page
   simply falls back to the current layout — graceful degradation, nothing breaks. */

body:has(.auth-card) {
    justify-content: safe center; /* avoids top-clipping on short viewports */
    justify-content: center;
}

/* Lift the footer off the viewport bottom and drop the bar/divider look */
body:has(.auth-card) .footer {
    margin-top: 14px;
    height: auto;
    background: transparent;
    border-top: none;
}

body:has(.auth-card) .footer .container {
    max-width: 440px; /* same column width as the card */
    padding: 0 20px;
}

body:has(.auth-card) .footer .text-muted {
    margin: 0;
    text-align: center;
    font-size: 13px;
}

/* An empty flash wrapper must not offset the vertical centering */
body:has(.auth-card) .flash-messages:not(:has(.alert)) {
    display: none;
}

/* Unify the 2FA card width with the login card (400px).
   Login: .container-auth 440 − 2×20 padding = 400px card.
   2FA:   .form-popup drives the width; 400 + 2×15 padding = 430px. */
body:has(.auth-card) .form-popup {
    max-width: 430px;
}
