/* FF Auth hosted login theme — pixel-port of Phoenix's OAuthPage
 * (src/client/app/pages/OAuthPage/styles.jsx on the
 * feature/DDEV-6692-create-an-oauth-login-page-for-mm-developers
 * branch). Keeps visual consistency with the existing FF.com
 * one-off login pages so users coming from any FF property see
 * the same auth experience.
 *
 * Color palette is Phoenix's as-is (incl. the #1a73e8 accent that
 * looks Google-blue-ish — Eric called this out as a placeholder
 * but we adopt it for now; design team can override later by
 * dropping a different stylesheet in this theme dir).
 *
 * Roboto self-hosted from this theme's resources/fonts/. No CDN
 * dependency — cuts a network call off the login critical path
 * and avoids privacy headaches (Google Fonts CDN sees every login
 * page load otherwise).
 */

/* --- Self-hosted Roboto ------------------------------------------ */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/Roboto-Light.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Roboto-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/Roboto-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/Roboto-Bold.woff2') format('woff2');
}

/* --- Design tokens ----------------------------------------------
 *
 * Ported from the Figma design system (file FYQGuzKvru7TK84Hm1L2ui,
 * "Section 3 — 优化版 v2"), read via get_variable_defs. These are the
 * shadcn-shaped variables the design is built on. Every colour and
 * radius below references one instead of repeating a literal, so a
 * palette change is a single-block edit rather than a sweep.
 *
 * This replaces the Phoenix palette described in the file header,
 * including the #1a73e8 "Google-blue-ish" accent that header always
 * flagged as a placeholder. Prefixed --ff-* so nothing collides with
 * the PatternFly v3/v4 custom properties the parent theme still
 * loads via stylesCommon.
 */

:root {
    /* Surfaces. The page sits on --ff-background, the card one step
       lighter on --ff-card, and inputs one step lighter again on
       --ff-surface. Three tones, each 1 step apart, is what gives
       the design its depth without any borders doing the work. */
    --ff-background: #eaeaea;
    --ff-card: #fafafa;
    --ff-surface: #ffffff;

    /* Text. --ff-foreground is also the primary button ground —
       one near-black used for both, per the design. */
    --ff-foreground: #0f1317;
    --ff-muted-foreground: #646569;

    --ff-primary: #0f1317;
    --ff-primary-foreground: #fafafa;
    --ff-secondary: #f4f4f4;

    /* Figma ships this as #0f131738 — the foreground at 22% alpha.
       Written as rgba() so it composites over whichever surface it
       lands on rather than assuming white underneath. */
    --ff-border: rgba(15, 19, 23, 0.22);

    --ff-success: #16a34a;
    --ff-danger: #c0392b;

    /* Figma --muted / --info-subtle. The account row's ground and its
       avatar tint; --muted sits a shade below --secondary so the row
       reads as inset information rather than as a button. */
    --ff-muted: #f2f2f2;
    --ff-info-subtle: #dbeafe;

    /* Figma: --radius 8, with calc(+4) and calc(-6) derivatives. */
    --ff-radius: 8px;
    --ff-radius-lg: 12px;
    --ff-radius-sm: 2px;

    --ff-space-1: 4px;
    --ff-space-2: 8px;
    --ff-space-3: 12px;
    --ff-space-4: 16px;
    --ff-space-6: 24px;
    --ff-space-8: 32px;

    /* Focus ring. The design marks focus with a soft halo rather
       than a colour change, so the ring is the same near-black at
       low alpha and reads identically on every surface. */
    --ff-ring: 0 0 0 3px rgba(15, 19, 23, 0.12);
    --ff-ring-danger: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

/* --- Reset of Keycloak's default styles -------------------------- */

/* Keycloak's parent theme ships its own #kc-* sized layout. We
 * replace it wholesale with the Phoenix card layout below. Cancel
 * the parent's container so our wrapper is the only thing on
 * screen. */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    color: var(--ff-foreground);
    background-color: var(--ff-background);
    -webkit-font-smoothing: antialiased;
}

.login-pf-page,
.login-pf body {
    background: none !important;
}

#kc-header,
#kc-header-wrapper,
.login-pf-page-header {
    display: none;
}

/* --- Page wrapper (port of PageWrapper from styles.jsx) ---------- */

.ff-page-wrapper {
    min-height: 100vh;
    display: flex;
    /* Column, not row: the design puts the language switcher +
       "Secured by FFID" note BELOW the card, on the page ground
       rather than inside a bordered card footer. The card and that
       footer row are siblings stacked here. */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ff-space-4);
    background-color: var(--ff-background);
    padding: var(--ff-space-6);
    box-sizing: border-box;
}

/* --- Card (Card + CardAccent + CardBody + CardFooter) ------------ */

.ff-card {
    background-color: var(--ff-card);
    border-radius: var(--ff-radius-lg);
    width: 100%;
    /* Card width matches the FFID SSO frontend at
       dev-web.ffau.to/us/account/oauth/login (Eric's reference
       2026-07-15). Text shrunk separately below; the *box* stays
       the size it was. */
    max-width: 420px;
    /* Softer + tighter than the old 0 4px 24px/.12 drop. The design
       leans on the surface-tone step (background -> card) for
       separation and uses the shadow only to lift the edge. */
    box-shadow: 0 1px 2px rgba(15, 19, 23, 0.04),
                0 8px 24px rgba(15, 19, 23, 0.06);
    border: 1px solid rgba(15, 19, 23, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* .ff-card-accent (the 6px #1a73e8 bar across the top of the card)
   is gone — the design has no accent rule, and the colour was the
   placeholder blue. The empty <div> was dropped from template.ftl
   in the same change; this comment is the tombstone so the class
   isn't reintroduced by anyone diffing against an older card. */

.ff-card-body {
    /* Containing block for .ff-card-topbar, which the design pins to
       the card's top-right corner. */
    position: relative;
    padding: var(--ff-space-8);
    display: flex;
    flex-direction: column;
    gap: var(--ff-space-4);
}

/* Contextual links ("New to FF? Create account", "Back to Sign In").
   The design renders them as a centred line at the bottom of the
   card with no rule above.

   The element is a SIBLING of .ff-card-body, not a child, so it sits
   outside that element's padding and has to carry its own — an
   earlier pass dropped the old `padding: 16px 40px 24px` and left
   only a top margin, which put the links hard against the card's
   bottom edge. Horizontal padding matches .ff-card-body so the line
   is centred on the same content column; the bottom padding is the
   card's own breathing room. No top padding: the body's own
   padding-bottom already separates it from the content above. */
.ff-card-footer {
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--ff-space-1);
    padding: 0 var(--ff-space-8) var(--ff-space-8);
}

/* The non-link half of that line ("New to FF?"). */
.ff-footer-note-inline {
    font-size: 14px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
}

/* The row below the card: language switcher + "Secured by FFID".
   Sits on the page ground, outside the card, per the design. The
   switcher itself is not built yet (it needs the 6 locale files
   translated first) so today this row carries only the note. */
.ff-page-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ff-space-2);
    width: 100%;
    max-width: 420px;
}

/* Website filing line (China partition only; the ff-cn theme supplies the
   values). A second row under the note, so the footer wraps. */
.ff-page-footer {
    flex-wrap: wrap;
}

.ff-footer-filing {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ff-space-2);
    width: 100%;
    font-size: 12px;
    line-height: 18px;
    color: var(--ff-muted-foreground);
}

.ff-footer-filing a {
    color: inherit;
    text-decoration: none;
}

.ff-footer-filing a:hover,
.ff-footer-filing a:focus {
    text-decoration: underline;
}

/* --- Logo + title ------------------------------------------------ */

.ff-logo {
    color: var(--ff-foreground);
    height: 44px;
    width: auto;
    /* Left-aligned to match prod. align-self: flex-start overrides
       the parent's default `align-items: stretch` (which would make
       the img try to fill horizontally) and pins it to the left
       edge of the card body's content area. */
    display: block;
    align-self: flex-start;
    margin-bottom: 8px;
}

/* Figma type token "UI/h3": Roboto Regular 24/32. The old 18px/700
   came from the Phoenix card; the design's heading is larger and
   NOT bold — the size carries the hierarchy, not the weight. */
.ff-card-title {
    font-size: 24px;
    line-height: 32px;
    font-weight: 400;
    color: var(--ff-foreground);
    /* Left-aligned to match prod. Phoenix's CardTitle styled
       component has no text-align (defaults to left). The logo
       is centered above; the title sits left under it. */
    margin: 0;
}

/* Sub-heading under the card title — "Continue to <client>" in the
   design. Figma type token "UI/muted": Roboto Regular 14/20 in
   --muted-foreground. No template renders it yet; the class lands
   here with the rest of the header so the page work that adds it
   doesn't have to touch this file again. */
.ff-card-subtitle {
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    color: var(--ff-muted-foreground);
    margin: 0;
}

/* Label baseline — also used by checkboxes / rememberMe, which
   don't have the input-then-label structure the field rows use.
   The design's labels are darker and slightly heavier than the old
   Phoenix grey: they read as headings for their field, not hints. */
.ff-field-label {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--ff-foreground);
}

/* The design uses a static label ABOVE the input, not the Material
   floating label this theme shipped with.
 *
 * The markup keeps its input-then-label DOM order — every .ftl in
 * this theme writes the input first because the old pattern needed
 * the `input ~ label` sibling selector, and .ff-field is already a
 * flex column. So `order: -1` pulls the label visually above the
 * input and the conversion costs zero template edits across the
 * ~30 pages that share this primitive.
 *
 * (`.ff-field-label--static` on the birthdate row did the same
 * thing by hand before this; it now just matches the default.) */
.ff-field > .ff-field-label {
    order: -1;
    margin-bottom: var(--ff-space-1);
    pointer-events: auto;
}

/* Required-field asterisk. Stays alongside the label text both at
   rest and when floating. Color inherited so it scales with the
   label's color transitions. */
.ff-field-required {
    margin-left: 1px;
}

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

/* Phoenix used @ff/ui's EmailField + PasswordField with built-in
 * label-above-input layout. Replicate the layout server-side with
 * a wrapping <div class="ff-field-wrapper">. */
.ff-field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ff-field {
    display: flex;
    flex-direction: column;
    /* position: relative is retained for the affix slot (the
       show/hide eye the design puts inside the password input) —
       that lands with the page work, but absolutely-positioned
       children need the containing block to already be here. */
    position: relative;
}

.ff-field input[type="text"],
.ff-field input[type="email"],
.ff-field input[type="password"],
.ff-field input[type="tel"],
.ff-field input[type="date"] {
    width: 100%;
    box-sizing: border-box;
    /* Boxed field, replacing the underline-only Material style this
       theme inherited from Phoenix. The design's input is a white
       rectangle on the card's off-white ground, 1px border all round
       at the shared radius. Height lands at ~44px, matching the
       primary button so a field and a button stack evenly. */
    padding: var(--ff-space-3);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    font-size: 14px;
    line-height: 20px;
    font-family: inherit;
    color: var(--ff-foreground);
    background-color: var(--ff-surface);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* Suppress Chrome / Edge / Safari autofill styling. On fields that
   Chrome autofills from its saved-profile cache (username, first
   name, last name, phone, etc.), the browser applies:
     - light-blue tinted background (rgb(232, 240, 254))
     - internal box-shadow that reads as a border box
   Those overlays fight our underline-only style and make autofilled
   fields look like boxed inputs. Suppress by inset-shadowing a
   transparent color (kills the tint) and pinning text color.
   The transition trick delays Chrome's re-tint attempt effectively
   forever, so the suppression sticks across state changes (hover,
   focus, blur).
   Note: only fires on the -webkit-autofill pseudo-class; non-
   autofilled fields keep their normal styling. */
.ff-field input:-webkit-autofill,
.ff-field input:-webkit-autofill:hover,
.ff-field input:-webkit-autofill:focus,
.ff-field input:-webkit-autofill:active {
    /* Paint the field's own surface rather than `transparent` — the
       input is a white box on an off-white card now, so a
       transparent inset would let the card tone show through and an
       autofilled field would read a shade darker than its
       neighbours. */
    -webkit-box-shadow: 0 0 0 1000px var(--ff-surface) inset !important;
    -webkit-text-fill-color: var(--ff-foreground) !important;
    background-color: var(--ff-surface) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Belt-and-suspenders: if the input somehow inherits a
   .form-control class from PatternFly (parent theme's
   stylesCommon still loads PatternFly v3 + v4), force our
   underline-only look. Higher specificity than the .form-control
   rule from PatternFly (0,1,2 vs their 0,1,0) so this wins by
   normal cascade — the !important is only for background-color
   which fights browser autofill AND PatternFly's white bg. */
.ff-field input.form-control,
.ff-field input {
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    background-color: var(--ff-surface) !important;
    box-shadow: none;
}

/* --- Birthdate three-dropdown picker ---
 * Used on register.ftl (the Create Account form) + collect-birthdate.ftl
 * (post-auth required-action page) when a client is in
 * `ff-auth.birthdate-required-clients`. Three <select>s for month / day
 * / year, laid out side-by-side, all using the same underline-only
 * style as the text inputs. Chosen over <input type="date"> because the
 * native picker popup can't be CSS-themed + varies wildly across
 * browsers; for a one-shot birthdate the user knows by heart, three
 * dropdowns are faster than any calendar widget.
 */

/* .ff-field-dob is the wrapper; .ff-field-label--static is a
   non-floating label (sits above the row at all times — the
   floating-label pattern doesn't make sense for select widgets). */
/* Now that every label is static + order:-1 by default, this rule
   only needs to opt out of the flex reorder — the birthdate label
   is already first in the DOM, so leaving order at -1 would be a
   no-op but relying on that is fragile. */
.ff-field-dob .ff-field-label--static {
    position: static;
    order: 0;
    margin-bottom: var(--ff-space-1);
    pointer-events: auto;
}

/* The three selects in a row. Gap of 8px feels tight enough to read
   as one composite field, loose enough that the underlines don't
   smush together. flex-1 with min-width:0 keeps each select sharing
   the row width evenly + lets them shrink on narrow screens (mobile
   keeps them inline rather than wrapping — they fit even at 320px
   viewport because the options' display widths are small). */
.ff-field-dob-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.ff-field-dob-row .ff-select {
    flex: 1 1 0;
    min-width: 0;
}

/* Underline-only style mirroring the text input rule above. Padding-
   right leaves room for the dropdown arrow we draw ourselves below. */
.ff-field .ff-select,
.ff-field-dob-row .ff-select {
    width: 100%;
    box-sizing: border-box;
    /* Boxed to match the text inputs. Right padding still reserves
       room for the chevron we draw below. */
    padding: var(--ff-space-3) 28px var(--ff-space-3) var(--ff-space-3);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    font-size: 14px;
    line-height: 20px;
    font-family: inherit;
    color: var(--ff-foreground);
    background-color: var(--ff-surface);
    -webkit-appearance: none;
    appearance: none;

    /* Custom dropdown arrow drawn as an SVG data-URI background. Native
       <select> chevrons are inconsistent across browsers (Chrome's grey
       arrow vs Safari's pill button); painting our own keeps the look
       identical everywhere. The arrow color matches the text. */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%230f1317' stroke-width='1.5'><path d='M2.5 4.5l3.5 3.5 3.5-3.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;

    transition: border-color 150ms ease, box-shadow 150ms ease;
    cursor: pointer;
}

.ff-field-dob-row .ff-select:hover:not(:focus):not([aria-invalid="true"]) {
    border-color: var(--ff-muted-foreground);
}

.ff-field-dob-row .ff-select:focus {
    outline: none;
    border-color: var(--ff-foreground);
    box-shadow: var(--ff-ring);
}

.ff-field-dob-row .ff-select[aria-invalid="true"] {
    border-color: var(--ff-danger);
}

.ff-field-dob-row .ff-select[aria-invalid="true"]:focus {
    box-shadow: var(--ff-ring-danger);
}

/* When a select still has its placeholder option selected (value=""),
   render the text in the same grey as the input placeholders. Helps
   "Month / Day / Year" placeholder text read as hint rather than data.
   :has() lets us target the select based on its selected option's
   value; widely supported in modern browsers. */
.ff-field-dob-row .ff-select:has(option[value=""]:checked) {
    color: var(--ff-muted-foreground);
}

.ff-field input::placeholder {
    color: var(--ff-muted-foreground);
    opacity: 1;
}

.ff-field input:hover:not(:focus):not([aria-invalid="true"]) {
    border-color: var(--ff-muted-foreground);
}

/* Focus is a halo, not a thicker edge — box-shadow so nothing in
   the layout shifts when it appears. */
.ff-field input:focus {
    outline: none;
    border-color: var(--ff-foreground);
    box-shadow: var(--ff-ring);
}

.ff-field input[aria-invalid="true"] {
    border-color: var(--ff-danger);
}

.ff-field input[aria-invalid="true"]:focus {
    box-shadow: var(--ff-ring-danger);
}

/* Per-field error message — Keycloak surfaces validation errors
 * via messagesPerField. Render below the input. */
.ff-field-error {
    color: var(--ff-danger);
    font-size: 13px;
    margin-top: var(--ff-space-2);
    line-height: 1.4;
}

/* Per-field hint header (e.g., "Password must be at least:" before
 * the bulleted policy list). Same neutral color as the hint list. */
.ff-field-hint-header {
    margin: var(--ff-space-2) 0 var(--ff-space-1);
    font-size: 13px;
    line-height: 1.5;
    color: var(--ff-muted-foreground);
}

/* Per-field hint list (e.g., password policy bullets). Default style
 * = grey bullet at rest. When validation.js adds .satisfied, swaps
 * to a green checkmark for live feedback as the user types. */
.ff-field-hint {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    line-height: 22px;
    color: var(--ff-muted-foreground);
}

.ff-field-hint li {
    position: relative;
    padding-left: 24px;
    transition: color 150ms ease;
}

/* Unmet rule: a hollow ring (the design's radio_button_unchecked).
 * Met rule: a filled green check. The design notes call this out
 * explicitly — the state has to be carried by the GLYPH, not by
 * colour alone, or the checklist fails WCAG 1.4.1. Both symbols
 * occupy the same box so the rule text never shifts. */
.ff-field-hint li::before {
    content: "○";
    position: absolute;
    left: 4px;
    top: 0;
    color: var(--ff-muted-foreground);
    transition: color 150ms ease;
}

.ff-field-hint li.satisfied {
    color: var(--ff-success);
}

.ff-field-hint li.satisfied::before {
    content: "✓";
    color: var(--ff-success);
    font-weight: 600;
}

/* --- Terms-acceptance block (Phoenix-style <Agreement>) --------- */

.ff-agreement {
    /* More breathing room above the agreement — gives the password
       rules + confirm field room before the legal text starts. */
    margin-top: 12px;
}

.ff-agreement-row {
    display: flex;
    align-items: flex-start;
    gap: var(--ff-space-3);
    font-size: 14px;
    line-height: 20px;
    color: var(--ff-foreground);
    cursor: pointer;
    /* <label> default + Keycloak's parent label rule would render
       this bold. Force normal weight to match prod's terms text. */
    font-weight: 400;
}

.ff-agreement-row input[type="checkbox"] {
    /* 18px box inside a 24px row. The design notes call for a 24x24
     * hit target (WCAG 2.5.8) — the whole <label> is clickable, so
     * the row already satisfies it; the margin keeps the box
     * optically centred on the first line of legal text. */
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: var(--ff-primary);
    cursor: pointer;
}

.ff-agreement-text {
    flex: 1;
}

.ff-agreement-text a {
    /* Neutral underlined links, not a brand colour — the underline
       carries the affordance. */
    color: var(--ff-foreground);
    text-decoration: underline;
}

.ff-agreement-text a:hover {
    text-decoration: none;
}

/* --- Buttons ----------------------------------------------------- */

.ff-button {
    width: 100%;
    box-sizing: border-box;
    /* 44px tall, matching the fields and the social buttons so a
       stacked column of controls reads as one rhythm. */
    min-height: 44px;
    padding: var(--ff-space-3) var(--ff-space-4);
    border: 1px solid var(--ff-primary);
    border-radius: var(--ff-radius);
    background-color: var(--ff-primary);
    color: var(--ff-primary-foreground);
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    font-family: inherit;
    cursor: pointer;
    margin-top: var(--ff-space-2);
    transition: background-color 120ms ease-in-out, color 120ms ease-in-out,
                box-shadow 120ms ease-in-out;
}

.ff-button:hover {
    background-color: #272b2f;
}

.ff-button:active {
    background-color: #000000;
}

.ff-button:focus-visible {
    outline: none;
    box-shadow: var(--ff-ring);
}

.ff-button:disabled {
    background-color: var(--ff-muted-foreground);
    border-color: var(--ff-muted-foreground);
    cursor: not-allowed;
}

/* .ff-button-outline was Phoenix's variant="outlineDark" — a white
 * button with a dark rule. In the new design the primary CTA is a
 * SOLID near-black button, and this class is what all 28 templates
 * in this theme put on their primary CTA. So rather than editing 28
 * files to drop the class, the variant is redefined here to inherit
 * the solid primary: one place to change, no page churn, and every
 * page picks up the new CTA at once.
 *
 * It is deliberately an empty-ish override rather than a deletion —
 * deleting it would leave 28 dangling class names that read like a
 * missing stylesheet to the next person. When the page-level work
 * sweeps the templates, drop the class there and delete this block.
 *
 * A genuine secondary button (light grey ground) is .ff-button-
 * secondary below; the social buttons already use that treatment. */
.ff-button-outline {
    background-color: var(--ff-primary);
    color: var(--ff-primary-foreground);
    border-color: var(--ff-primary);
}

/* Real secondary variant — light grey ground, dark text, same
   geometry. This is the treatment the design gives the social
   buttons and any non-primary action. */
.ff-button-secondary {
    background-color: var(--ff-secondary);
    color: var(--ff-foreground);
    border-color: var(--ff-border);
}

.ff-button-secondary:hover {
    background-color: #ececec;
}

/* The "or" rule between the form and the social buttons. No page
   renders it yet — it arrives with the page-level work — but it
   belongs with the rest of the shared primitives. */
.ff-divider {
    display: flex;
    align-items: center;
    gap: var(--ff-space-3);
    font-size: 14px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
}

.ff-divider::before,
.ff-divider::after {
    content: "";
    flex: 1 1 0;
    height: 1px;
    background-color: var(--ff-border);
}

.ff-button-outline:hover {
    background-color: #272b2f;
    color: var(--ff-primary-foreground);
}

/* Destructive variant — used on delete-account confirmation. Red
   ground signals "this is the irreversible option" so a distracted
   click doesn't land here by mistake. Same padding + typography as
   the primary button so the two options line up visually. */
.ff-button-destructive {
    background-color: #c53030;
    border-color: #c53030;
    color: #ffffff;
    margin-top: var(--ff-space-3);
}

.ff-button-destructive:hover {
    background-color: #9b2c2c;
    border-color: #9b2c2c;
}

.ff-button-destructive:active {
    background-color: #742a2a;
    border-color: #742a2a;
}

.ff-link {
    color: var(--ff-foreground);
    text-decoration: underline;
    font-size: 14px;
}
.ff-link:hover {
    text-decoration: underline;
}

/* Container that hosts a secondary action link BELOW the primary
   form button (e.g. "Sign in as a different account" on the
   password step). Centered, with breathing room above the button
   so the primary CTA still dominates visually. */
.ff-form-secondary-action {
    margin-top: var(--ff-space-4);
    text-align: center;
}

/* Descriptive paragraph under a card title (used on the IDP-link
   confirm, IDP-link-email, and select-authenticator pages). Same
   font stack + weight as the standard body copy, muted color so
   the eye stays on the primary form action. */
.ff-blurb {
    color: var(--ff-muted-foreground);
    font-size: 14px;
    line-height: 22px;
    margin: 0 0 var(--ff-space-4);
    font-family: inherit;
}

/* Bulleted-list variant of .ff-blurb — same font + color, indented
   for readability. Used on delete-account-confirm for the
   consequences list (logs out immediately, erases data, ...). */
.ff-list {
    color: var(--ff-muted-foreground);
    font-size: 14px;
    line-height: 22px;
    margin: 0 0 var(--ff-space-4);
    padding-left: var(--ff-space-6);
    font-family: inherit;
}

.ff-list li {
    margin-bottom: 6px;
}

/* --- Authenticator picker (select-authenticator.ftl) -------------
   Full-width card-style buttons stacked vertically, each showing a
   name + optional help text. Reads as a list rather than a row of
   small buttons. */
.ff-authenticator-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ff-authenticator-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;

    width: 100%;
    padding: var(--ff-space-3) var(--ff-space-4);
    background-color: var(--ff-surface);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.ff-authenticator-option:hover,
.ff-authenticator-option:focus-visible {
    background-color: var(--ff-secondary);
    border-color: var(--ff-foreground);
    outline: none;
}

.ff-authenticator-option-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ff-foreground);
}

.ff-authenticator-option-help {
    font-size: 13px;
    color: var(--ff-muted-foreground);
}

/* --- Switch link (used on the "use another account" path) ------- */

.ff-switch-link {
    font-size: 14px;
    color: var(--ff-foreground);
    cursor: pointer;
    text-align: center;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    text-decoration: underline;
}

.ff-switch-link:hover {
    text-decoration: underline;
}

/* --- Footer ------------------------------------------------------ */

.ff-footer-links {
    display: flex;
    /* Gap between distinct links (e.g. "Forgot Password?" +
       "Create Account" on the login page). The register footer
       collapses its "Already have an account? Sign in" into one
       anchor so the gap doesn't apply there. */
    gap: var(--ff-space-4);
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
}

.ff-footer-link {
    font-size: 14px;
    color: var(--ff-foreground);
    text-decoration: underline;
}

.ff-footer-link:hover {
    color: var(--ff-foreground);
    text-decoration: underline;
}

/* "Secured by FFID". Sits on the page ground below the card now,
   so it needs to read against --ff-background rather than white —
   the old #aaaaaa was too faint out there. */
.ff-footer-note {
    font-size: 13px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
}

/* --- Global error banner (Keycloak's `message.summary`) ---------- */

/* Keycloak renders a `message` block at the top of the form when
 * the realm sends a global error/info/success. Style it consistent
 * with the per-field error palette. */
/* Alert block. The design draws this as a soft-tinted rounded box
 * with a leading icon; the icon is supplied by ::before here so no
 * template has to change to get it.
 *
 * Note this banner carries only what Keycloak actually puts in
 * `message.summary`. The design mock shows a remaining-attempts
 * count ("2 attempts left") — that is sample copy, not something
 * Keycloak exposes to a template, and surfacing it would confirm
 * an account exists to whoever is guessing. Decided 2026-09-10:
 * the alert gets the design's look, not its sample numbers. */
.ff-message {
    display: flex;
    align-items: flex-start;
    gap: var(--ff-space-3);
    padding: var(--ff-space-3) var(--ff-space-4);
    border-radius: var(--ff-radius);
    font-size: 14px;
    line-height: 20px;
}

.ff-message::before {
    flex-shrink: 0;
    font-size: 15px;
    line-height: 20px;
}

.ff-message-error {
    background-color: #fdecea;
    border: 1px solid #f3c7c1;
    color: #842029;
}

.ff-message-error::before {
    content: "⚠";
}

.ff-message-warning {
    background-color: #fff8eb;
    border: 1px solid #f6ce8a;
    color: #874a00;
}

.ff-message-warning::before {
    content: "⚠";
}

.ff-message-info,
.ff-message-success {
    background-color: #eef6ee;
    border: 1px solid #bcdcc2;
    color: #1a5c2a;
}

.ff-message-info::before,
.ff-message-success::before {
    content: "✓";
}

/* ---------------------------------------------------------------------------
 * Sign in with Apple button.
 *
 * Apple's Sign in with Apple Brand Guidelines prescribe a specific
 * button design: a contained pill/rectangle, brand-controlled
 * background + text colors, and the Apple silhouette beside the
 * label. Apple offers black/white/outline color schemes; we use the
 * white-with-outline variant — white ground, dark border + label,
 * black Apple silhouette — so the button stacks cleanly next to the
 * Sign in with Google button (also white ground) without one social
 * provider visually dominating the other.
 *
 * Width matches our other full-width buttons so the layout's column
 * grid stays consistent. Border-radius is small (2px) to align with
 * the rest of the FF buttons rather than the rounded-pill style Apple
 * shows in their docs — Apple's guidelines explicitly allow any
 * radius; staying consistent with our existing buttons reads cleaner
 * here than mimicking Apple's stock asset exactly.
 * ------------------------------------------------------------------------- */

.ff-button-apple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 16px;

    background-color: var(--ff-secondary);
    color: var(--ff-foreground);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);

    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 500;
    font-size: 15px;
    line-height: 1;
    letter-spacing: -0.01em;

    text-decoration: none;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.ff-button-apple:hover,
.ff-button-apple:focus-visible {
    background-color: #ececec;
    color: var(--ff-foreground);
    outline: none;
}

.ff-button-apple:focus-visible {
    box-shadow: var(--ff-ring);
}

.ff-button-apple-icon {
    width: 16px;
    height: 16px;
    /* Optical alignment: Apple's silhouette is slightly bottom-heavy.
       A small upward nudge keeps the visual centerline aligned with
       the text baseline. */
    margin-top: -2px;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
 * Sign in with Google button.
 *
 * White ground, dark text, Google G silhouette. Google's Identity
 * branding guidelines also publish a "dark theme" + "neutral theme"
 * variant; this is the light/white variant, which reads cleanest on
 * our white FF card. Following the same width + height + radius
 * conventions as ff-button-apple so the two stack consistently when
 * both providers are enabled.
 * ------------------------------------------------------------------------- */

.ff-button-google {
    /* Google's Sign in with Google branding guidelines (web variant):
       Roboto Medium 14/20, 12px horizontal padding to the G + label,
       4-color G logo on white. The G asset itself lives at
       resources/img/google-g.svg (downloaded from Google's branding
       page; not embedded inline because we don't redistribute their
       asset bytes). */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 12px;

    background-color: var(--ff-secondary);
    color: var(--ff-foreground);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);

    font-family: "Roboto", -apple-system, BlinkMacSystemFont,
        "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.005em;

    text-decoration: none;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.ff-button-google:hover,
.ff-button-google:focus-visible {
    background-color: #ececec;
    color: var(--ff-foreground);
    outline: none;
}

.ff-button-google:focus-visible {
    box-shadow: var(--ff-ring);
}

.ff-button-google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* --- TOTP enrollment page (login-config-totp.ftl) ---
 * Step-by-step list with QR code centered, manual-entry alt, then
 * the verify-code + device-name form. Inherits the standard
 * .ff-field underline-only input style; just adds spacing + the
 * monospace secret block.
 * ------------------------------------------------------------------------- */

.ff-totp-steps {
    margin: 0 0 var(--ff-space-4);
    padding-left: var(--ff-space-6);
    font-size: 14px;
    color: var(--ff-muted-foreground);
    line-height: 1.5;
}

.ff-totp-steps li + li {
    margin-top: 12px;
}

.ff-totp-steps p {
    margin: 0;
}

/* Manual-entry secret: monospace, selectable, soft background tint
   so it reads as "code value" rather than prose. */
.ff-totp-secret code {
    display: inline-block;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 14px;
    background: var(--ff-secondary);
    padding: var(--ff-space-1) var(--ff-space-2);
    border-radius: var(--ff-radius-sm);
    user-select: all;
    word-break: break-all;
}

/* --- SMS OTP setup form ------------------------------------------
   Two-row layout: country dropdown on top, phone input below. We
   don't use the .ff-field floating-label pattern here because that
   pattern assumes a text input with placeholder=" " and absolute-
   positioned label; the <select> always has a non-empty value, so
   the label would just float-stuck and overlap the dropdown. Plain
   static labels above each control read more naturally for a form
   that mixes input types anyway. */

.ff-sms-entry {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ff-sms-entry-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ff-sms-entry-label {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--ff-foreground);
}

/* Both controls use the same boxed style as the login + register
   inputs (see .ff-field input rules above). */
.ff-sms-entry select,
.ff-sms-entry input[type="tel"] {
    width: 100%;
    box-sizing: border-box;
    padding: var(--ff-space-3);
    font-size: 14px;
    line-height: 20px;
    color: var(--ff-foreground);
    background: var(--ff-surface);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

/* Native dropdown chevron — replaced with a clean SVG arrow so the
   select looks intentional rather than browser-default. */
.ff-sms-entry select {
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%230f1317' stroke-width='1.5'%3E%3Cpath d='M2.5 4.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.ff-sms-entry select:hover:not(:focus),
.ff-sms-entry input[type="tel"]:hover:not(:focus):not([aria-invalid="true"]) {
    border-color: var(--ff-muted-foreground);
}

.ff-sms-entry select:focus,
.ff-sms-entry input[type="tel"]:focus {
    border-color: var(--ff-foreground);
    box-shadow: var(--ff-ring);
}

.ff-sms-entry input[type="tel"][aria-invalid="true"] {
    border-color: var(--ff-danger);
    box-shadow: var(--ff-ring-danger);
}

/* --- Select-credential / "Try another way" cards ------------------
   Base Keycloak template (theme/base/login/select-authenticator.ftl)
   renders each option as a <button class="pf-l-split"> with icon,
   body-stack (heading + desc), spacer, arrow. Our theme overrides
   `styles=` so the parent theme's login.css doesn't load — without
   these rules the button keeps the browser default text-align:center
   and the heading floats in the middle of the card with the icon way
   off to the left. */

button[name="authenticationExecution"].select-auth-box-parent {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--ff-space-3) var(--ff-space-4);
    margin: 0 0 var(--ff-space-2) 0;
    background: var(--ff-surface);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

button[name="authenticationExecution"].select-auth-box-parent:hover,
button[name="authenticationExecution"].select-auth-box-parent:focus-visible {
    border-color: var(--ff-foreground);
    background: var(--ff-secondary);
    outline: none;
}

button[name="authenticationExecution"] .select-auth-box-icon {
    flex: 0 0 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 var(--ff-space-3) 0 0;
    color: var(--ff-muted-foreground);
    font-size: 18px;
}

button[name="authenticationExecution"] .pf-l-split__item.pf-l-stack {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

button[name="authenticationExecution"] .select-auth-box-headline {
    font-size: 14px;
    font-weight: 500;
    color: var(--ff-foreground);
    text-align: left;
    margin: 0;
}

button[name="authenticationExecution"] .select-auth-box-desc {
    font-size: 13px;
    color: var(--ff-muted-foreground);
    text-align: left;
    margin: 0;
}

button[name="authenticationExecution"] .pf-l-split__item.pf-m-fill {
    flex: 0 0 0;
}

button[name="authenticationExecution"] .select-auth-box-arrow {
    flex: 0 0 16px;
    color: var(--ff-muted-foreground);
    margin-left: var(--ff-space-2);
}
button[name="authenticationExecution"] .select-auth-box-arrow::before {
    content: "›";
    font-size: 22px;
    line-height: 1;
}
button[name="authenticationExecution"] .select-auth-box-arrow i {
    display: none;
}


/* ===================================================================
 * Page-composition pieces added with the register redesign.
 * =================================================================== */

/* "Already have an account? Sign in" — top-right of the card, above
   the logo. Absolute so it doesn't consume a row in the card body's
   flex column and push the logo down. */
.ff-card-topbar {
    position: absolute;
    top: var(--ff-space-4);
    right: var(--ff-space-8);
    display: flex;
    align-items: baseline;
    gap: var(--ff-space-1);
    font-size: 13px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
}

.ff-card-topbar .ff-link {
    font-size: 13px;
}

/* Stack of social-provider buttons. The buttons themselves already
   carry their own geometry (.ff-button-google / -apple); this just
   owns the spacing between them. */
.ff-social-group {
    display: flex;
    flex-direction: column;
    gap: var(--ff-space-2);
}

/* Two fields sharing a row — first name + last name on register.
   Collapses to one column on narrow screens, where two 44px-tall
   inputs side by side leave no room for either label. */
.ff-field-row {
    display: flex;
    gap: var(--ff-space-3);
}

.ff-field-row > .ff-field {
    flex: 1 1 0;
    min-width: 0;
}

@media (max-width: 400px) {
    .ff-field-row {
        flex-direction: column;
    }
}

/* --- Input affix slot (show/hide password) ----------------------
 *
 * The control sits INSIDE the field box rather than beside it, so
 * the input keeps its own border, focus ring and invalid state and
 * the icon rides along with them. .ff-input-affix is the positioning
 * context; the input reserves right padding so typed text never runs
 * under the button.
 */

.ff-input-affix {
    position: relative;
    display: flex;
}

.ff-input-affix > input {
    /* 44px: the button's hit target plus the field's own padding. */
    padding-right: 44px !important;
}

.ff-affix-button {
    position: absolute;
    top: 0;
    right: 0;
    /* Full-height, 44px-wide target — meets WCAG 2.5.8 without
       growing the field. */
    height: 100%;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0 var(--ff-radius) var(--ff-radius) 0;
}

/* The icon is a background image rather than inline markup so the
   templates stay free of SVG, and so the swap is a pure attribute
   selector on aria-pressed — the same attribute that carries the
   state to assistive tech. One source of truth for both. */
.ff-affix-button::before {
    content: "";
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23646569' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M1.8 12S5.4 5.8 12 5.8 22.2 12 22.2 12 18.6 18.2 12 18.2 1.8 12 1.8 12Z'/><circle cx='12' cy='12' r='3.2'/></svg>");
}

.ff-affix-button[aria-pressed="true"]::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f1317' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M1.8 12S5.4 5.8 12 5.8 22.2 12 22.2 12 18.6 18.2 12 18.2 1.8 12 1.8 12Z'/><circle cx='12' cy='12' r='3.2'/><path d='M3.5 3.5l17 17'/></svg>");
}

.ff-affix-button:hover::before {
    opacity: 0.75;
}

.ff-affix-button:focus-visible {
    outline: none;
    box-shadow: var(--ff-ring);
}

/* --- Explanatory notes ------------------------------------------
 * .ff-field-note  — sits under one field ("You can sign in with your
 *                   username or your email."), wired to the input
 *                   via aria-describedby.
 * .ff-form-note   — sits under the submit button and describes what
 *                   pressing it leads to.
 */

.ff-field-note {
    font-size: 13px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
    margin-top: var(--ff-space-1);
}

.ff-form-note {
    font-size: 13px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
    margin: var(--ff-space-3) 0 0;
    text-align: center;
}

/* template.ftl always emits the .ff-card-footer element; which links
   land inside it is decided per pageType, and for register the answer
   is "none" (the link moved to .ff-card-topbar). Collapse the empty
   shell rather than making the macro conditional — otherwise the card
   carries a dead 8px row under its last real element.

   :has() is already relied on elsewhere in this file (the birthdate
   select's placeholder colour), so the support floor is unchanged. */
.ff-card-footer:not(:has(a)) {
    display: none;
}

/* The topbar is absolute, so it can't push the logo down if its text
   grows — a longer translation of "Already have an account? Sign in"
   would wrap to two lines and land on top of the logo. Two guards:
   let it wrap right-aligned, and reserve the clearance on the card
   body itself, only on pages that actually have a topbar. */
.ff-card-topbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    text-align: right;
    max-width: calc(100% - (2 * var(--ff-space-8)));
}

.ff-card-body:has(.ff-card-topbar) {
    padding-top: 56px;
}

/* --- Label row with a trailing action ---------------------------
 *
 * "Forgot password?" sits at the right end of the password field's
 * label row. Wrapping the label means the `.ff-field > .ff-field-label`
 * reorder no longer applies to it, so the ROW carries order: -1
 * instead and the label keeps only its typography.
 */
.ff-field > .ff-field-labelrow {
    order: -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--ff-space-3);
    margin-bottom: var(--ff-space-1);
}

.ff-field-label-action {
    font-size: 13px;
    white-space: nowrap;
}

/* Edge (and any Trident-derived engine) draws its OWN password-reveal
   eye inside the input via ::-ms-reveal. With our affix button also
   present the field shows two eyes, one of which ignores the
   aria-pressed state everything else is wired to. Suppress the native
   one — ours is the only control, and it is the one that is labelled,
   keyboard-reachable and consistent across browsers.

   ::-ms-clear goes too: it is the same class of injected control on
   text inputs and would sit under the affix button. */
.ff-field input[type="password"]::-ms-reveal,
.ff-field input[type="password"]::-ms-clear,
.ff-field input[type="text"]::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

/* --- Account row -------------------------------------------------
 * "You are signing in as <identifier>", with a way out. Rendered by
 * the accountRow macro in account-row.ftl on the credential steps.
 */

.ff-account-row {
    display: flex;
    align-items: center;
    gap: var(--ff-space-3);
    padding: var(--ff-space-2) var(--ff-space-3);
    background-color: var(--ff-muted);
    border-radius: var(--ff-radius);
}

.ff-account-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background-color: var(--ff-info-subtle);
    color: var(--ff-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

/* The identifier is the one thing on this row that can be arbitrarily
   long, so it takes the leftover width and truncates. min-width: 0 is
   what actually lets a flex child shrink below its content size —
   without it the row would just overflow the card. The full value
   stays reachable via the title attribute. */
.ff-account-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    line-height: 20px;
    color: var(--ff-foreground);
}

.ff-account-change {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--ff-muted-foreground);
    text-decoration: none;
}

.ff-account-change:hover {
    color: var(--ff-foreground);
    text-decoration: underline;
}
