/* Modern light login screen.
   Deliberately uses its own class names rather than Bootstrap's
   .container/.card, so the "user defined" overrides at the bottom of app.css
   (which still style register and the password pages) cannot reach in here.
   All colours come from palette.css. */

.auth {
    min-height: 100vh;
    min-height: 100dvh;   /* survives mobile browser chrome showing/hiding */
    display: grid;
    grid-template-rows: auto 1fr;
    background-color: var(--surface);
    color: var(--text);
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ---------- brand panel ---------- */

.auth__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 24px 32px;
    background: var(--brand-gradient);
    color: var(--text-on-accent);
    text-align: center;
}

.auth__brandInner {
    max-width: 420px;
}

.auth__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    font-size: 24px;
    border-radius: 16px;
    color: var(--text-on-accent);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.auth__wordmark {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.auth__tagline {
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.82);
}

/* ---------- form panel ---------- */

.auth__panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 40px;
    background-color: var(--surface);
}

.auth__form {
    width: 100%;
    max-width: 400px;
}

.auth__head {
    margin-bottom: 28px;
}

.auth__title {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.auth__sub {
    margin: 6px 0 0;
    font-size: 15px;
    color: var(--text-muted);
}

/* ---------- fields ---------- */

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.field__control {
    position: relative;
    display: flex;
    align-items: center;
}

.field__icon {
    position: absolute;
    left: 15px;
    font-size: 15px;
    color: var(--text-muted);
    pointer-events: none;
}

.field__input {
    width: 100%;
    /* 16px stops iOS Safari zooming the page on focus */
    font-size: 16px;
    line-height: 1.4;
    min-height: 52px;
    padding: 14px 16px 14px 44px;
    color: var(--text);
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.field__input--withToggle {
    padding-right: 48px;
}

.field__input::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

.field__input:focus {
    outline: none;
    background-color: var(--surface);
    border-color: var(--accent-600);
    box-shadow: 0 0 0 4px var(--accent-ring);
}

.field__input.is-invalid {
    border-color: var(--danger);
}

.field__input:focus + .field__toggle,
.field__control:focus-within .field__icon {
    color: var(--accent-700);
}

/* Chrome paints autofilled inputs pale yellow, which fights the theme. */
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
    caret-color: var(--text);
    transition: background-color 9999s ease-in-out 0s;
}

.field__toggle {
    position: absolute;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 15px;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.field__toggle:hover {
    color: var(--text);
    background-color: var(--surface-2);
}

.field__toggle:focus-visible {
    outline: 2px solid var(--accent-600);
    outline-offset: 1px;
}

.field__error {
    margin: 7px 0 0;
    font-size: 13px;
    color: var(--danger);
}

/* ---------- row: remember / forgot ---------- */

.auth__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 24px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--accent-600);
    flex-shrink: 0;
    cursor: pointer;
}

.auth__link {
    font-size: 14px;
    color: var(--accent-700);
    text-decoration: none;
}

.auth__link:hover {
    text-decoration: underline;
}

/* ---------- submit ---------- */

.auth__submit {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-on-accent);
    background-color: var(--accent-600);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-lift);
    transition: background-color 0.15s, transform 0.06s;
}

.auth__submit:hover {
    background-color: var(--accent-500);
}

.auth__submit:active {
    background-color: var(--accent-700);
    transform: translateY(1px);
}

.auth__submit:focus-visible {
    outline: 3px solid var(--accent-ring);
    outline-offset: 2px;
}

/* ---------- desktop: side-by-side ---------- */

@media (min-width: 900px) {
    .auth {
        grid-template-rows: none;
        grid-template-columns: 1.05fr 1fr;
    }

    .auth__brand {
        padding: 48px;
        text-align: left;
    }

    .auth__brandInner {
        max-width: 380px;
    }

    .auth__logo {
        width: 64px;
        height: 64px;
        font-size: 27px;
        margin-bottom: 22px;
    }

    .auth__wordmark {
        font-size: 40px;
    }

    .auth__tagline {
        margin-top: 12px;
        font-size: 17px;
    }

    .auth__panel {
        padding: 48px;
    }
}

/* ---------- short viewports (landscape phones) ---------- */

@media (max-height: 620px) and (max-width: 899px) {
    /* Collapse the brand block into a slim horizontal bar so the whole form,
       Sign in button included, still fits above the fold at 360px tall. */
    .auth__brand {
        padding: 10px 20px;
    }

    .auth__brandInner {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .auth__logo {
        width: 32px;
        height: 32px;
        font-size: 15px;
        margin-bottom: 0;
        border-radius: 10px;
    }

    .auth__wordmark {
        font-size: 19px;
    }

    /* The tagline is the first thing to go when height is tight. */
    .auth__tagline {
        display: none;
    }

    .auth__panel {
        padding: 14px 20px 16px;
    }

    .auth__head {
        margin-bottom: 12px;
    }

    .auth__title {
        font-size: 19px;
    }

    /* The brand bar already names the app, so the subtitle is redundant here
       and its removal is what buys the Sign in button its place on screen. */
    .auth__sub {
        display: none;
    }

    .field label {
        margin-bottom: 4px;
    }

    .field {
        margin-bottom: 13px;
    }

    .field__input {
        min-height: 46px;
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .auth__row {
        margin-bottom: 16px;
    }

    .auth__submit {
        min-height: 46px;
        padding: 11px 16px;
    }
}
