/*
 * Bromley Borough sign-in modal — Figma 548:26758 (desktop), 548:27009 (tablet),
 * 548:27230 (mobile). Tokens come from tokens.css; nothing brand-specific is
 * hard-coded here. See ADR-0007.
 */

/* Overlay + dialog ------------------------------------------------------ */

.bb-auth {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ds-sp-4);
}

.bb-auth[hidden] {
    display: none;
}

.bb-auth__overlay {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.3);
    cursor: pointer;
    animation: bb-auth-fade 200ms ease-out;
}

.bb-auth__card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--ds-color-surface);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lift);
    padding: var(--ds-sp-6) var(--ds-sp-6) var(--ds-sp-5);
    animation: bb-auth-pop 200ms ease-out;
}

.bb-auth__close {
    position: absolute;
    top: var(--ds-sp-4);
    right: var(--ds-sp-4);
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--ds-color-text-muted);
    cursor: pointer;
    border-radius: var(--ds-radius-sm);
    padding: 0;
}

.bb-auth__close:hover,
.bb-auth__close:focus-visible {
    color: var(--ds-color-text);
    background: var(--ds-color-border-soft);
    outline: 0;
}

/* Title ---------------------------------------------------------------- */

.bb-auth__title {
    font-family: var(--ds-font-display);
    font-size: 1.75rem;          /* ~28px — per Figma */
    line-height: var(--ds-lh-tight);
    font-weight: 400;
    margin: 0 0 var(--ds-sp-5);
    color: var(--ds-color-text);
    padding-right: var(--ds-sp-6); /* keep clear of close button */
}

.bb-auth__title-em {
    font-style: italic;
    color: var(--ds-color-link);
    margin-left: 0.25ch;
}

/* Form ----------------------------------------------------------------- */

.bb-auth__form {
    display: flex;
    flex-direction: column;
    gap: var(--ds-sp-4);
}

.bb-auth__field {
    display: flex;
    flex-direction: column;
    gap: var(--ds-sp-2);
}

.bb-auth__label {
    font-family: var(--ds-font-body);
    font-size: var(--ds-fs-body);
    font-weight: 600;
    color: var(--ds-color-text);
}

.bb-auth__req {
    color: var(--ds-color-link);
    margin-left: 2px;
}

.bb-auth__input {
    font-family: var(--ds-font-body);
    font-size: var(--ds-fs-body);
    line-height: var(--ds-lh-body);
    color: var(--ds-color-text);
    background: var(--ds-color-surface);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-sm);
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.bb-auth__input::placeholder {
    color: var(--ds-color-text-soft);
}

.bb-auth__input:focus {
    border-color: var(--ds-color-primary-600);
    box-shadow: 0 0 0 3px var(--ds-color-primary-50);
    outline: 0;
}

/* Password field with eye toggle */

.bb-auth__pwd {
    position: relative;
}

.bb-auth__input--pwd {
    padding-right: 38px;
}

.bb-auth__pwd-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--ds-color-text-soft);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    border-radius: var(--ds-radius-sm);
}

.bb-auth__pwd-toggle:hover,
.bb-auth__pwd-toggle:focus-visible {
    color: var(--ds-color-text);
    background: var(--ds-color-border-soft);
    outline: 0;
}

/* Recover Password — sits right under the password input, right-aligned */

.bb-auth__recover {
    align-self: flex-end;
    margin-top: var(--ds-sp-1);
    font-family: var(--ds-font-body);
    font-size: var(--ds-fs-body-s);
    color: var(--ds-color-link);
    text-decoration: none;
}

.bb-auth__recover:hover {
    text-decoration: underline;
}

/* Error alert ----------------------------------------------------------- */

.bb-auth__alert {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    border-radius: var(--ds-radius-sm);
    padding: var(--ds-sp-2) var(--ds-sp-3);
    font-size: var(--ds-fs-body);
    line-height: var(--ds-lh-body);
}

.bb-auth__alert[hidden] {
    display: none;
}

/* Submit button.
 * p.30 (feedback 2026-06-17): client asked for full-width modal buttons —
 * this overrides the original narrow + left-aligned Figma treatment (ADR-0007 Q5). */

.bb-auth__submit {
    align-self: stretch;
    width: 100%;
    position: relative;
    background: var(--ds-color-primary-600);
    color: var(--ds-color-gray-0);
    border: 0;
    border-radius: var(--ds-radius-pill);
    font-family: var(--ds-font-body);
    font-size: var(--ds-fs-body);
    font-weight: 500;
    padding: 10px 36px;
    cursor: pointer;
    margin-top: var(--ds-sp-1);
    transition: background-color 120ms ease, transform 120ms ease;
    min-width: 110px;
    min-height: 40px;
}

.bb-auth__submit:hover {
    background: color-mix(in oklab, var(--ds-color-primary-600) 90%, black);
}

.bb-auth__submit:focus-visible {
    outline: 2px solid var(--ds-color-primary-200);
    outline-offset: 2px;
}

.bb-auth__submit[disabled] {
    cursor: progress;
    opacity: 0.85;
}

.bb-auth__submit-spinner {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bb-auth__submit-spinner[hidden] {
    display: none;
}

/* Divider -------------------------------------------------------------- */

.bb-auth__divider {
    display: flex;
    align-items: center;
    gap: var(--ds-sp-3);
    margin: var(--ds-sp-5) 0 var(--ds-sp-4);
    color: var(--ds-color-text-soft);
    font-size: var(--ds-fs-body-s);
}

.bb-auth__divider::before,
.bb-auth__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ds-color-border);
}

/*
 * Social buttons — Figma 548:26790 / 652:7613 / 652:7624 (2026-05-16).
 * Pill, gray bg, no border, Roboto Medium per Google's "Sign in with Google" branding
 * policy. Buttons hug their content and centre inside the column; not full-width.
 * Closes the Google-branding compliance risk flagged in CONTEXT.md (purple-on-white +
 * missing G mark was the prior implementation).
 */

.bb-auth__social {
    /* p.30: full-width social buttons (was a centred max-content column). */
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.bb-auth__social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: var(--ds-color-gray-100);
    color: #1f1f1f;
    border: none;
    border-radius: 99px;
    font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 120ms ease;
}

.bb-auth__social-btn:hover {
    background: var(--ds-color-gray-200);
}

.bb-auth__social-btn:focus-visible {
    outline: 2px solid var(--ds-color-primary-200);
    outline-offset: 2px;
}

.bb-auth__social-btn[disabled] {
    cursor: progress;
    opacity: 0.7;
}

.bb-auth__social-btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    object-fit: contain;
}

/* Sign-up sub-row — added to fill the design's missing affordance, ADR-0007 */

.bb-auth__signup {
    margin: var(--ds-sp-4) 0 0;
    font-size: var(--ds-fs-body-s);
    color: var(--ds-color-text-muted);
    text-align: center;
}

.bb-auth__signup a {
    color: var(--ds-color-link);
    font-weight: 500;
    margin-left: 4px;
}

/* Body scroll lock when modal is open */

body.bb-no-scroll {
    overflow: hidden;
}

/* Animations */

@keyframes bb-auth-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes bb-auth-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .bb-auth__overlay,
    .bb-auth__card {
        animation: none;
    }
}

/* Mobile tweaks --------------------------------------------------------- */

@media (max-width: 480px) {
    .bb-auth {
        padding: var(--ds-sp-3);
        align-items: flex-start;
        padding-top: 10vh;
    }

    .bb-auth__card {
        padding: var(--ds-sp-5);
    }

    .bb-auth__title {
        font-size: 1.5rem;
    }
}
