/* ═══════════════════════════════════════════════════════════
   AUTH — Login & Register
   Full-screen scenic background + centered white card
   Tokens: stitch-design.css :root (--bs-* vars)
═══════════════════════════════════════════════════════════ */

/* ── Page shell: full-screen bg image with overlay ── */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh; /* use dynamic viewport on mobile to avoid address-bar gaps */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 16px 32px; /* top padding leaves room for back-link */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    box-sizing: border-box;
    gap: 16px;
}

/* Dark overlay sits between bg-image and content */
.auth-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 14, 0.52);
    z-index: 0;
}

/* ── Back link (top-left corner of viewport at desktop) ── */
.auth-back {
    position: fixed;
    top: 20px;
    left: 24px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.2s, gap 0.2s;
}

.auth-back:hover {
    color: #ffffff;
    gap: 8px;
}

.auth-back i {
    font-size: 11px;
}

/* ── Centered card ── */
.auth-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 20px;
    padding: 36px 40px 32px;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    box-shadow:
        0 24px 64px rgba(10, 20, 14, 0.30),
        0 2px 8px rgba(10, 20, 14, 0.12);
    display: flex;
    flex-direction: column;
}

/* ══════════════════════════════════════════════
   MOBILE  (< 640px)
   Flat full-screen white layout — no floating card
   ══════════════════════════════════════════════ */
@media (max-width: 639px) {

    /* Strip bg-image and overlay on mobile */
    .auth-page {
        background-image: none !important;
        background-color: #fbf9f8;
        padding: 0;
        gap: 0;
        justify-content: flex-start;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .auth-page::before {
        display: none;
    }

    /* Card fills the full viewport, flush edges, no overflow */
    .auth-card {
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
        padding: 20px 20px 28px;
        background: #ffffff;
        flex: 1;
        overflow-x: hidden;
    }

    /* Back link becomes in-flow, sits at top of card */
    .auth-back {
        position: static;
        color: var(--bs-primary, #17452F);
        margin-bottom: 20px;
        font-size: 13px;
        align-self: flex-start;
    }

    .auth-back:hover {
        color: var(--bs-primary-dark, #002e1b);
        gap: 8px;
    }

    /* Brand: smaller top margin on mobile */
    .auth-brand {
        margin-bottom: 14px;
    }

    /* Divider: tighter on mobile */
    .auth-divider {
        margin-bottom: 14px;
    }

    /* Heading: compact */
    .auth-heading {
        margin-bottom: 18px;
    }

    .auth-title {
        font-size: 22px;
    }

    /* Form: tighter row gaps */
    .auth-form {
        gap: 12px;
    }

    /* Inputs must not exceed card width */
    .auth-input-wrap {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .auth-input-wrap input {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Button full-width, no overflow */
    .auth-btn {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 13px;
        margin-top: 4px;
    }

    /* Switch link: tighter top margin */
    .auth-switch {
        margin-top: 14px;
    }

    /* Quote: hidden on mobile — saves vertical space */
    .auth-quote {
        display: none;
    }
}

/* ── Brand block (top center of card) ── */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    margin-bottom: 20px;
}

.auth-brand-logo {
    display: block;
    width: min(12rem, 75vw);
    height: auto;
}

.auth-brand-prominent .auth-brand-logo {
    width: min(18rem, 85vw);
    transform: translateY(2rem);
}

/* ── Heading block ── */
.auth-heading {
    text-align: center;
    margin-bottom: 24px;
}

.auth-title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--bs-on-surface, #1b1c1c);
    margin: 0 0 4px;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.auth-subtitle {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--bs-charcoal-muted, #5a625c);
    margin: 0;
    line-height: 1.55;
}

/* ── Divider ── */
.auth-divider {
    height: 1px;
    background: var(--bs-outline, #E3E1DA);
    margin: 0 0 20px;
}

/* ── Alerts ── */
.auth-alert {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-family: var(--font-sans);
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.auth-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ── Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.auth-field label {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    color: var(--bs-on-surface, #1b1c1c);
    letter-spacing: 0.03em;
}

/* Input wrapper */
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.auth-input-wrap .auth-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-charcoal-muted, #5a625c);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

.auth-input-wrap input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border: 1.5px solid #8B897F;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--bs-on-surface, #1b1c1c);
    background: #f8f7f4;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
    outline: none;
}

.auth-input-wrap input:focus {
    border-color: var(--bs-primary, #17452F);
    box-shadow: 0 0 0 3px rgba(23, 69, 47, 0.12);
    background: #ffffff;
}

/* Password fields: room for the eye toggle */
.auth-input-wrap input[type="password"],
.auth-input-wrap input[type="text"].auth-pw-visible {
    padding-right: 40px;
}

/* Eye toggle button */
.auth-pw-toggle {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--bs-charcoal-muted, #5a625c);
    font-size: 13px;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 1;
    line-height: 1;
}

.auth-pw-toggle:hover {
    color: var(--bs-primary, #17452F);
}

/* Validation message */
.auth-error {
    font-size: 12px;
    color: #b91c1c;
    font-family: var(--font-sans);
    line-height: 1.4;
}

/* ── Remember me row ── */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: -2px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--bs-charcoal-muted, #5a625c);
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--bs-primary, #17452F);
    cursor: pointer;
    flex-shrink: 0;
}

.auth-forgot-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--bs-primary, #17452F);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.auth-forgot-link:hover {
    text-decoration: underline;
}

.auth-forgot-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Submit button ── */
.auth-btn {
    width: 100%;
    padding: 13px;
    border-radius: 9999px;
    background: var(--bs-primary, #17452F);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    margin-top: 6px;
}

.auth-btn:hover {
    background: var(--bs-primary-dark, #002e1b);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(23, 69, 47, 0.25);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ── Switch link (login ↔ register) ── */
.auth-switch {
    text-align: center;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--bs-charcoal-muted, #5a625c);
    margin-top: 18px;
    margin-bottom: 0;
}

.auth-switch a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--bs-primary, #17452F);
    font-weight: 700;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-page :focus-visible {
    outline-color: var(--bs-primary, #17452F);
}

/* ── Quote footer (below card) ── */
.auth-quote {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-top: 20px;
    padding: 0 8px;
}

.auth-quote p {
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.6;
    margin: 0;
}
