/* ============================================================
   Sign-in screen.

   Palette and shape language are lifted straight from the booking
   screens so a staff member meets the same visual system before they
   log in as they do after. Tokens are scoped to .auth-page rather than
   :root — this stylesheet loads next to the shared theme (style.css)
   and has no business redefining anything globally.

   Built mobile-first: the phone layout is the base rule set, and the
   only breakpoint promotes it to a centred card on wider screens.
   ============================================================ */
.auth-page {
    --auth-deep: #00312e;      /* darkest teal — page base, shadows   */
    --auth-primary: #005450;   /* deep teal — icons, strong labels    */
    --auth-accent: #00a99d;    /* bright teal — focus, gradient end   */
    --auth-ink: #0f2a28;       /* headings and input text             */
    --auth-muted: #6b7c7b;     /* labels, secondary copy              */
    --auth-faint: #9aa6a5;     /* footnotes                           */
    --auth-line: #eef1f1;      /* borders                             */
    --auth-tint: rgba(0, 84, 80, 0.06); /* filled input affordance    */
}

body.auth-body {
    margin: 0;
    /* Matches the top of the page gradient so rubber-band overscroll on
       iOS reveals more teal instead of a white band. */
    background: #00312e;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.auth-page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* dvh tracks the collapsing browser chrome on mobile; the vh above
       stays as the fallback for browsers without it. */
    min-height: 100dvh;
    background: linear-gradient(165deg, #00312e 0%, #005450 45%, #00a99d 118%);
}

/* Soft off-canvas glow — the same accent teal the vehicle thumbnails use,
   just diffused. Purely decorative. */
.auth-glow {
    position: absolute;
    top: -14%;
    right: -28%;
    width: min(88vw, 430px);
    height: min(88vw, 430px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 169, 157, 0.55) 0%, rgba(0, 169, 157, 0) 70%);
    pointer-events: none;
}

/* ---------- Brand block ---------- */
/* Takes all the height the sheet does not, so the brand sits optically
   centred in the teal on a tall phone while the sheet stays anchored to the
   bottom edge — within thumb reach rather than floating mid-screen. */
.auth-brand {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* safe-area keeps the logo clear of the notch / status bar */
    padding: calc(2.5rem + env(safe-area-inset-top)) 1.5rem 1.9rem;
}

/* The logo is a wide blue wordmark, so it cannot sit directly on teal and
   stay legible. A white plate gives it the contrast it needs and echoes the
   rounded surfaces used throughout the booking cards. */
.auth-logo-plate {
    display: inline-block;
    background: #fff;
    border-radius: 16px;
    padding: 0.85rem 1.35rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 10px 26px rgba(0, 49, 46, 0.32);
}
.auth-logo-plate img {
    display: block;
    width: 168px;
    height: auto;
}

.auth-app-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.25rem;
}
.auth-app-tagline {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
}

/* ---------- Sheet ---------- */
/* On phones the form is a sheet rising from the bottom edge, the same shape
   the booking wizard uses. It has no drag handle on purpose: the booking
   sheets can be dismissed, this one cannot, and a handle would promise a
   gesture that does nothing. */
.auth-sheet {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    background: #fff;
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -10px 34px rgba(0, 49, 46, 0.32);
    padding: 1.85rem 1.35rem calc(1.75rem + env(safe-area-inset-bottom));
}
.auth-sheet-inner {
    max-width: 420px;
    margin: 0 auto;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--auth-ink);
    margin: 0 0 0.3rem;
}
.auth-subtitle {
    font-size: 0.82rem;
    color: var(--auth-muted);
    margin: 0 0 1.5rem;
}

/* ---------- Alerts ---------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1.15rem;
    font-size: 0.82rem;
    line-height: 1.45;
}
.auth-alert i {
    font-size: 1.1rem;
    line-height: 1.3;
}
.auth-alert p {
    margin: 0;
}
.auth-alert-error {
    background: rgba(226, 72, 61, 0.1);
    color: #c62f27;
}
/* Darker than the #00a651 used for the success icon on the booking wizard —
   that tone is fine for a 2.4rem glyph but too light for small body text on
   a tinted background. */
.auth-alert-success {
    background: rgba(0, 206, 104, 0.12);
    color: #046b3f;
}

/* ---------- Fields ---------- */
.auth-field {
    margin-bottom: 1.1rem;
}
.auth-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--auth-muted);
    margin-bottom: 0.4rem;
}
.auth-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-input-group:focus-within {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(0, 169, 157, 0.15);
}
.auth-input-icon {
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-tint);
    color: var(--auth-primary);
    font-size: 1.15rem;
}
.auth-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 54px;
    border: 0;
    background: transparent;
    padding: 0 0.9rem;
    color: var(--auth-ink);
    /* Must stay at 16px: anything smaller makes iOS Safari zoom the page in
       on focus, which knocks the layout sideways mid-sign-in. */
    font-size: 1rem;
}
.auth-input:focus {
    outline: none;
}
.auth-input::placeholder {
    color: #b3bebd;
}
/* Chrome paints autofilled inputs pale yellow, which breaks the group. */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: #0f2a28;
}

/* 48px square, so it clears the minimum touch target on its own. */
.auth-reveal {
    flex: 0 0 48px;
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
}
.auth-reveal:hover,
.auth-reveal[aria-pressed="true"] {
    color: var(--auth-primary);
}
.auth-reveal:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: -4px;
}

/* ---------- Submit ---------- */
.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    height: 54px;
    margin-top: 1.6rem;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #00a99d, #005450);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(0, 84, 80, 0.32);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}
.auth-submit:hover {
    background: linear-gradient(135deg, #005450, #00312e);
    transform: translateY(-1px);
}
.auth-submit:active {
    transform: translateY(0);
}
.auth-submit:disabled {
    opacity: 0.65;
    box-shadow: none;
    transform: none;
    cursor: default;
}
.auth-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: auth-spin 0.7s linear infinite;
}
.auth-submit.is-busy .auth-submit-icon {
    display: none;
}
.auth-submit.is-busy .auth-spinner {
    display: block;
}
@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

.auth-footer {
    margin: 1.6rem 0 0;
    text-align: center;
    font-size: 0.72rem;
    color: var(--auth-faint);
}

/* ---------- Short viewports (landscape phones) ---------- */
/* The brand block is the only expendable height here, so it shrinks and the
   tagline drops rather than pushing the password field off-screen. */
@media (max-width: 575.98px) and (max-height: 640px) {
    .auth-brand {
        padding: calc(1.25rem + env(safe-area-inset-top)) 1.5rem 1.15rem;
    }
    .auth-logo-plate {
        padding: 0.6rem 1.05rem;
        margin-bottom: 0.65rem;
    }
    .auth-logo-plate img {
        width: 132px;
    }
    .auth-app-name {
        font-size: 1.15rem;
    }
    .auth-app-tagline {
        display: none;
    }
    .auth-sheet {
        padding-top: 1.4rem;
    }
    .auth-subtitle {
        margin-bottom: 1.15rem;
    }
}

/* ---------- Tablet & desktop ---------- */
/* Same breakpoint the booking modals use to swap a bottom sheet for a
   centred dialog, and the same move: the sheet detaches from the bottom
   edge and becomes a floating card. */
@media (min-width: 576px) {
    .auth-page {
        align-items: center;
        justify-content: center;
        padding: 2.5rem 1.5rem;
    }
    .auth-brand {
        flex: 0 0 auto;
        padding: 0 0 1.75rem;
    }
    .auth-sheet {
        width: 100%;
        max-width: 440px;
        border-radius: 22px;
        padding: 2.1rem 2rem 1.85rem;
        box-shadow: 0 18px 48px rgba(0, 49, 46, 0.4);
    }
    .auth-glow {
        top: -20%;
        right: -10%;
        width: min(60vw, 560px);
        height: min(60vw, 560px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-input-group,
    .auth-reveal,
    .auth-submit {
        transition: none;
    }
    .auth-submit:hover {
        transform: none;
    }
    .auth-spinner {
        animation-duration: 2s;
    }
}
