:root {
    /* Light mode colors (default) — aligned with the app design system (brand #1d64f2, zinc) */
    --mainBackgroundColor: #f4f4f5;
    --secondaryBackgroundColor: #1d64f2;
    --borderSecondaryColor: #e4e4e7;
    --fontColor: #18181b;
    --secondFontColor: #71717a;
    --boxShadowColor: rgba(0, 0, 0, 0.06);
    --boxShadow: 0 1px 2px var(--boxShadowColor);
    --cardBackgroundColor: #ffffff;
    --iconColor: #18181b;
    --secondLayerBackgroundColor: #ffffff;
    --sideNavbarWidth: 300px;
    --sideNavbarBorderColor: #CECECE;
    --mainFontFamily: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --inputBackgroundColor: #ffffff;
    --inputBorderColor: #d4d4d8;
    --linkColor: #1d64f2;
    --buttonHoverColor: #1a5ad4;
}

/* Dark mode colors */
[data-theme="dark"] {
    --mainBackgroundColor: #0b1120;
    --secondaryBackgroundColor: #1d64f2;
    --borderSecondaryColor: #1c2740;
    --fontColor: #e8edf6;
    --secondFontColor: #8595ad;
    --boxShadowColor: rgba(0, 0, 0, 0.4);
    --boxShadow: 0 1px 2px var(--boxShadowColor);
    --cardBackgroundColor: #131c2e;
    --iconColor: #e8edf6;
    --secondLayerBackgroundColor: #131c2e;
    --sideNavbarBorderColor: #1c2740;
    --inputBackgroundColor: #0b1120;
    --inputBorderColor: #1c2740;
    --linkColor: #4a84f5;
    --buttonHoverColor: #1a5ad4;
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --mainBackgroundColor: #0b1120;
        --secondaryBackgroundColor: #1d64f2;
        --borderSecondaryColor: #1c2740;
        --fontColor: #e8edf6;
        --secondFontColor: #8595ad;
        --boxShadowColor: rgba(0, 0, 0, 0.4);
        --boxShadow: 0 1px 2px var(--boxShadowColor);
        --cardBackgroundColor: #131c2e;
        --iconColor: #e8edf6;
        --secondLayerBackgroundColor: #131c2e;
        --sideNavbarBorderColor: #1c2740;
        --inputBackgroundColor: #0b1120;
        --inputBorderColor: #1c2740;
        --linkColor: #4a84f5;
        --buttonHoverColor: #1a5ad4;
    }
}

* {
    font-family: var(--mainFontFamily);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input:-webkit-autofill,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-webkit-autofill:hover {
    font-size: 14px;
    transition: background-color 5000s ease-in-out 0s;
    box-shadow: inset 0 0 0 1000px var(--inputBackgroundColor);
    -webkit-text-fill-color: var(--fontColor);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--mainBackgroundColor);
    font-family: var(--mainFontFamily);
    font-feature-settings: 'cv11','ss01','ss03','cv02';
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    width: 100%;
    color: var(--fontColor);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1 {
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.01em;
    margin: 0 0 8px 0;
    color: var(--fontColor);
}

p {
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    margin: 8px 0 20px;
    color: var(--fontColor);
}

span {
    font-size: 14px;
    color: var(--secondFontColor);
}

a {
    color: var(--fontColor);
    font-size: 14px;
    text-decoration: none;
    margin: 15px 0;
}

.container {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    width: 100%;
    margin: 0;
    position: relative;
    z-index: 1; /* Ensure container appears above animated background */
}

/* Every page puts exactly one card (.sign-in-container, .register-container,
   .login-reset-container, ...) in here, optionally followed by the
   "Try another way" form. Stacking them in a centered column keeps the card
   centered and gives that form its own line without it having to be
   viewport-wide to earn one (see .try-another-way below). */
.form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: left;
    width: 100%;
    margin: auto;
    transition: all .6s ease-in-out;
    padding: 32px 16px;
    position: relative;
    z-index: 2; /* Ensure form appears above animated background */
}

.panel {
    width: 100%;
    background: var(--secondaryBackgroundColor);
    margin: 0 20px;
    height: 100%;
    justify-content: center;
    text-align: left;
    border-radius: 20px;
    background-origin: padding-box;
    z-index: 1;
}

form {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

label {
    font-size: 14px;
    display: block;
    text-align: left;
    color: var(--fontColor);
    font-weight: normal;
}

.social-container a {
    border: 1px solid var(--borderSecondaryColor);
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin: 0 5px;
    height: 40px;
    width: 40px;
}

.form-container input {
    border-radius: 8px;
    background: var(--inputBackgroundColor);
    border: 1px var(--inputBorderColor) solid;
    padding: 0 12px;
    margin: 0;
    width: 100%;
    background-repeat: no-repeat;
    height: 40px;
    font-size: 14px;
    color: var(--fontColor);
    /* Autofill paints text via -webkit-text-fill-color, which leaves the caret
       on the browser default (dark, invisible in dark mode). Set it explicitly. */
    caret-color: var(--fontColor);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.form-container input:focus {
    outline: none;
    border-color: var(--secondaryBackgroundColor);
    /* First shadow masks Chrome's light autofill background. It lives on the
       plain :focus rule (not :-webkit-autofill:focus) because Chrome drops the
       autofill pseudo-class while you edit a field, so a scoped rule stops
       matching and the light background flashes back. On non-autofilled inputs
       it paints the same color, so it's a no-op. Second shadow is the focus ring. */
    box-shadow: inset 0 0 0 1000px var(--inputBackgroundColor),
                0 0 0 3px rgba(29, 100, 242, 0.15);
}

.login-button {
    border-radius: 8px;
    border: none;
    background: var(--secondaryBackgroundColor);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    height: 40px;
    padding: 0 16px;
    cursor: pointer;
    transition: transform 80ms ease-in, background-color 0.3s ease;
}
.login-button:hover {
    background-color: var(--buttonHoverColor);
}
.login-button:disabled {
    opacity: 0.6; /* Makes the button 60% opaque */
    cursor: not-allowed; /* Changes cursor to not-allowed symbol */
}
.register-button, .signup-with-email-button {
    border-radius: 8px;
    border: none;
    background: var(--secondaryBackgroundColor);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    height: 40px;
    padding: 0 16px;
    cursor: pointer;
    transition: transform 80ms ease-in, background-color 0.3s ease;
    margin-top: 20px;
    width: 100%;
}
.register-button:hover, .signup-with-email-button:hover {
    background-color: var(--buttonHoverColor);
}
.register-button:disabled {
    opacity: 0.6; /* Makes the button 60% opaque */
    cursor: not-allowed; /* Changes cursor to not-allowed symbol */
}

.idp-button {
    border-radius: 5px;
    background: var(--cardBackgroundColor);
    color: var(--fontColor);
    font-size: 14px;
    font-weight: 500;
    padding: 0 20px;
    letter-spacing: 0;
    transition: transform 80ms ease-in, background-color 0.3s ease, border-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border: 1px solid var(--borderSecondaryColor);
    height: 40px;
    margin-bottom: 10px;
}

.idp-button:hover {
    cursor: pointer;
    background-color: var(--inputBackgroundColor);
    border-color: var(--secondFontColor);
    opacity: 0.9;
}

.idp-button > svg {
    padding-right: 0.25rem;
    margin-right: 8px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.idp-button > span {
    color: var(--fontColor);
    font-size: 14px;
    font-weight: 500;
}

.idp-button:disabled {
    background-color: #f0f1f0;
    color: #a9a9a9;
    cursor: not-allowed;
}

.idp-button:disabled > svg {
    filter: grayscale(1);
}

button:active {
    transform: scale(.95);
}

/* Keyboard users need to see where they are (WCAG 2.4.7 A). This used to be a
   blanket `outline: none` on every button, which left the two controls that
   are buttons now - "Try another way" and the password reveal toggle - with no
   focus affordance at all. :focus-visible keeps the ring off a mouse click. */
button:focus-visible,
.password-toggle:focus-visible {
    outline: 2px solid var(--secondaryBackgroundColor);
    outline-offset: 2px;
}

.sign-in-container {
    width: 440px;
    z-index: 2;
    padding: 28px 32px;
    height: fit-content;
    background-color: var(--cardBackgroundColor);
    border-radius: 12px;
    box-shadow: var(--boxShadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.register-container {
    width: 440px;
    z-index: 2;
    background-color: var(--cardBackgroundColor);
    padding: 28px 32px;
    height: fit-content;
    border-radius: 12px;
    box-shadow: var(--boxShadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.forgot-password-container {
    width: 100%;
    z-index: 2;
    background-color: var(--cardBackgroundColor);
    padding: 0 20px 40px 20px;
    height: fit-content;
    border-radius: 12px;
    box-shadow: var(--boxShadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.input-form {
    margin-top: 15px;
    flex-grow: 1; /* Allow the input form to grow vertically */
}

.forgot-password {
    font-size: 11px;
    font-weight: 600;
    color: var(--linkColor);
    text-align: right;
    margin-top: 0px; /* Adjust the margin for spacing */
}

.option {
    margin: 10px 0;
    text-align: center;
    flex: 0.2 0 auto;
    font-size: 13px;
    color: #7d8597;
}

.idp-button {
    border-radius: 8px;
    background: var(--cardBackgroundColor);
    color: var(--fontColor);
    font-size: 14px;
    font-weight: 500;
    padding: 0 20px;
    letter-spacing: 0;
    transition: transform 80ms ease-in;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border: 1px solid var(--borderSecondaryColor);
}

.idp-button:hover {
    cursor: pointer;
    background-color: var(--inputBackgroundColor);
}

.idp-button > svg {
    padding-right: 0.25rem;
    margin-right: 8px;
}

.idp-button:disabled {
    background-color: #f0f1f0; /* Replace with the desired background color */
    color: #a9a9a9; /* Replace with the desired text color */
}

.idp-button:disabled > svg {
    filter: grayscale(1);
}

.logo {
    display: block;
    width: 44px;
    height: 44px;
    margin: 0 auto 16px auto;
}

.img-center {
    margin-left: auto;
    margin-right: auto;
}

.img-left {
    margin-left: auto;
    margin-right: auto;
}

.signup {
    margin: 10px 0;
    text-align: center;
    font-size: 16px;
    color: #7d8597;
}

/* The "Try another way" <form> (template.ftl renders it as a sibling of the
   card, so the FORM itself is the flex child) sits below the card because
   .form-container stacks its children in a column. It used to get there by
   being `width: 100%` in a wrapping row, which forced the line break but also
   made the form - and the full-width <a> inside it - span the whole viewport:
   a 1248px click target on a 1280px screen, reading as an oversized strip
   rather than a button. Sizing it to the card instead needs no line-break
   trick, and its horizontal padding matches the card's so the button lines up
   with the card's own buttons. 440px is the width every card class in this
   theme uses (.sign-in-container, .register-container, .login-reset-container,
   .login-update-container). */
.try-another-way {
    width: 440px;
    max-width: 100%;
    padding: 0 32px;
    margin: 0 0 20px;
}

/* .login-button's height, radius and weight with .idp-button's outlined
   treatment, all from theme variables, so this reads as one of the page's
   secondary buttons in both color schemes instead of a bare text link. The
   control is a real <button type="submit"> (it used to be an anchor with an
   onclick handler); the styling is unchanged, but a button brings its own
   font and background defaults, so those are set here too. */
.try-another-way > button {
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--borderSecondaryColor);
    border-radius: 8px;
    background: var(--cardBackgroundColor);
    color: var(--fontColor);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.try-another-way > button:hover {
    background-color: var(--inputBackgroundColor);
    border-color: var(--secondFontColor);
}

/* template.ftl's "Restart login" link, sized and padded like .try-another-way
   so it lines up under the card. A plain <a> in this theme is body-colored with
   no underline, which would read as text, so it takes the link color that
   .forgot-password and .signup use. */
.restart-login {
    width: 440px;
    max-width: 100%;
    padding: 0 32px;
    margin: 0 0 20px;
    text-align: center;
}

.restart-login > a {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--linkColor);
}

/* In-sentence links on login-page-expired.ftl: underlined as well as colored,
   since they sit inside running text (WCAG 1.4.1). */
.instruction a {
    margin: 0;
    font-weight: 600;
    color: var(--linkColor);
    text-decoration: underline;
}

/* The language selector (template.ftl), below the card and sized to it like
   .try-another-way. */
.locale-selector {
    width: 440px;
    max-width: 100%;
    padding: 0 32px;
    margin: 0 0 20px;
}

.locale-selector > ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.locale-selector a {
    font-size: 13px;
    color: var(--linkColor);
}

.locale-selector a[aria-current="true"] {
    color: var(--fontColor);
    font-weight: 600;
    text-decoration: none;
}

.signup > span {
    margin-right: 5px;
    text-align: center;
    font-size: 13px;
    color: var(--fontColor);
}

.signup > a {
    margin-right: 5px;
    text-align: center;
    font-size: 13px;
    color: var(--linkColor);
    font-weight: 600;
}

/* A <button>, not a <div>, so keyboard users can reach it and assistive tech
   reads its pressed state (WCAG 4.1.2 A, 2.1.1 A). Everything below the
   position is undoing the button defaults so it looks exactly as it did. */
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
    line-height: 0;
    color: inherit;
}

/* The theme's global button press effect replaces transform, which would drop
   this one out of its vertical centering, so it keeps both. */
.password-toggle:active {
    transform: translateY(-50%) scale(.95);
}

.password-toggle > svg {
    display: block;
    margin: auto;
    fill: #7d8597;
}

.password-toggle svg {
    fill: #7d8597;
}

.password-toggle-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.password-toggle-line {
    position: absolute;
    left: -8px; /* Adjust the position as needed */
    top: 2px; /* Adjust the position as needed */
    height: 24px; /* Adjust the height as needed */
    width: 1px; /* Adjust the width as needed for a thinner line */
    background-color: var(--borderSecondaryColor); /* Adjust the color as needed */
}

.password-toggle > svg {
    display: block;
    margin: auto;
    fill: #7d8597;
}

.double-data {
    display: flex;
    justify-content: space-between;
}

.double-data .input-group {
    width: calc(50% - 7.5px);
}

.double-data .input-group label {
    display: block;
    text-align: left;
}

.double-data .input-group input {
    width: 100%;
}

.send-forgot-password-button {
    border-radius: 5px;
    border: none;
    background: var(--secondaryBackgroundColor);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 12px 45px;
    letter-spacing: 1px;
    margin: 20px 0;
    transition: transform 80ms ease-in, background-color 0.3s ease;
    cursor: pointer;
}


.send-forgot-password-button:hover {
    background-color: var(--buttonHoverColor);
}

.password-reset-text {
    text-align: center;
}

.side-container {
    display: none;
}

.login-reset-container {
    height: fit-content;
    background-color: var(--cardBackgroundColor);
    width: 440px;
    padding: 28px 32px;
    border-radius: 12px;
    box-shadow: var(--boxShadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.login-update-container {
    height: fit-content;
    background-color: var(--cardBackgroundColor);
    width: 440px;
    padding: 28px 32px;
    border-radius: 12px;
    box-shadow: var(--boxShadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.data {
    margin-top: 5px;
}

.panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    overflow: hidden;
}

.panel span {
    color: white;
    font-size: 20px;
    font-weight: bold;
    display: block;
    margin-top: 20px;
}

.side-container {
    display: none;
}

@media (max-width: 950px) {
    .panel {
        margin: 0 5px;
    }
    
    .form-container {
        width: 100%;
        padding: 0 10px;
    }
    
    .sign-in-container {
        width: 100%;
        max-width: 440px;
        padding: 28px 24px;
        margin-top: 50px;
        text-align: center;
        background-color: var(--cardBackgroundColor);
        border-radius: 12px;
        box-shadow: var(--boxShadow);
        margin-bottom: 20px;
    }
    
    .register-container {
        width: 100%;
        max-width: 440px;
        padding: 28px 24px;
        margin-top: 50px;
        text-align: center;
        background-color: var(--cardBackgroundColor);
        border-radius: 12px;
        box-shadow: var(--boxShadow);
        margin-bottom: 20px;
    }

    /* Follows the card's narrower padding here, so the button keeps lining up
       with the card's own buttons. */
    .try-another-way,
    .restart-login {
        padding: 0 24px;
    }

    .side-container {
        display: none;
    }

    html {
        background-color: var(--mainBackgroundColor);
    }

    .login-update-container {
        width: 100%;
        max-width: 440px;
        padding: 28px 24px;
        margin-bottom: 20px;
    }
    
    .login-reset-container {
        width: 100%;
        max-width: 440px;
        padding: 28px 24px;
        margin-bottom: 20px;
    }
}

html, body {
    min-height: 100%;
    width: 100%;
}

.pf-c-form-control[aria-invalid="true"] {
    border-bottom-color: #c9190b;
}

.pf-m-error {
    color: #c9190b;
}

.tos {
    margin-top: 20px;
    text-align: center;
}

.tos span {
    font-size: 12px;
}

.tos a {
    color: var(--linkColor);
    text-decoration: none;
    font-size: 12px;
}

.tos a:hover {
    text-decoration: underline;
    font-size: 12px;
}


.pf-c-form-control::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
    color: #CECECE !important; /* Adding !important to ensure override */
    opacity: 1; /* For Firefox */
}

.pf-c-form-control:-ms-input-placeholder { /* Internet Explorer 10-11 */
    color: #CECECE !important;
}

.pf-c-form-control::-ms-input-placeholder { /* Microsoft Edge */
    color: #CECECE !important;
}

#kc-reset-password-form span {
    color: #CECECE;
}

.or-section {
    display: flex;
    align-items: center;
}

.around-or-idp {
    border-bottom: 1px solid var(--borderSecondaryColor);
    flex: 1 0 auto;
    height: 0.5em;
    margin: 0;
}

.initial-view {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#signup-form {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.input-form {
    margin-top: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data {
    margin-top: 0;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--secondaryBackgroundColor);
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    margin-bottom: 15px;
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

.back-button:hover {
    opacity: 0.8;
}

.back-button svg {
    stroke: var(--secondaryBackgroundColor);
}

.idp-button > img {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    flex-shrink: 0;
}

.idp-button:disabled > img {
    opacity: 0.5;
}

.g-recaptcha {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
}

#kc-form-buttons {
    position: relative;
}

.register-button {
    position: relative;
    z-index: 1;
}

/* Add the floating terms footer */
.terms-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--mainBackgroundColor);
    padding: 10px 0;
    text-align: center;
    box-shadow: 0 -2px 5px var(--boxShadowColor);
    z-index: 100;
    transition: background-color 0.3s ease;
}

.terms-footer span {
    font-size: 12px;
    color: var(--secondFontColor);
}

.terms-footer a {
    color: var(--secondaryBackgroundColor);
    text-decoration: underline;
}

/* Logo handling for dark mode */
.logo-light {
    display: block;
}

.logo-dark {
    display: none;
}

[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

/* Auto dark mode logo switching */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-light {
        display: none;
    }
    
    :root:not([data-theme="light"]) .logo-dark {
        display: block;
    }
}

/* Dark mode toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--cardBackgroundColor);
    border: 1px solid var(--borderSecondaryColor);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--boxShadow);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--fontColor);
}

/* Update input placeholder colors */
.pf-c-form-control::placeholder {
    color: var(--secondFontColor) !important;
    opacity: 0.7;
}

/* Update error colors for dark mode */
[data-theme="dark"] .pf-c-form-control[aria-invalid="true"] {
    border-color: #f44336;
    background-color: rgba(244, 67, 54, 0.1);
}

[data-theme="dark"] .pf-m-error,
[data-theme="dark"] .kcInputErrorMessageClass,
[data-theme="dark"] #input-error-username,
[data-theme="dark"] #input-error-password,
[data-theme="dark"] #input-error-email,
[data-theme="dark"] #input-error-firstName,
[data-theme="dark"] #input-error-lastName {
    color: #ff9999;
    font-size: 12px;
}

/* Also update for auto dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pf-c-form-control[aria-invalid="true"] {
        border-color: #f44336;
        background-color: rgba(244, 67, 54, 0.1);
    }
    
    :root:not([data-theme="light"]) .pf-m-error,
    :root:not([data-theme="light"]) .kcInputErrorMessageClass,
    :root:not([data-theme="light"]) #input-error-username,
    :root:not([data-theme="light"]) #input-error-password,
    :root:not([data-theme="light"]) #input-error-email,
    :root:not([data-theme="light"]) #input-error-firstName,
    :root:not([data-theme="light"]) #input-error-lastName {
        color: #ff9999;
        font-size: 12px;
    }
}

/* Update disabled button states */
[data-theme="dark"] .login-button:disabled,
[data-theme="dark"] .register-button:disabled,
[data-theme="dark"] .idp-button:disabled {
    opacity: 0.5;
    background-color: var(--cardBackgroundColor);
}

/* Add subtle border to buttons in dark mode for better visibility */
[data-theme="dark"] .login-button,
[data-theme="dark"] .register-button,
[data-theme="dark"] .signup-with-email-button,
[data-theme="dark"] .send-forgot-password-button {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    background-color: var(--secondaryBackgroundColor) !important;
}

[data-theme="dark"] .login-button:hover,
[data-theme="dark"] .register-button:hover,
[data-theme="dark"] .signup-with-email-button:hover,
[data-theme="dark"] .send-forgot-password-button:hover {
    background-color: var(--buttonHoverColor) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* .login-button-secondary (e.g. the consent screen's Cancel) is composed
   with .login-button for shared sizing, so the !important block above wins
   in dark mode and silently repaints it the same primary blue as Authorize.
   Re-assert the secondary look, matching .idp-button's dark treatment. */
[data-theme="dark"] .login-button-secondary {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .login-button-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: none !important;
}

/* Dark mode IDP button styles */
[data-theme="dark"] .idp-button {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: var(--fontColor) !important;
}

[data-theme="dark"] .idp-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

[data-theme="dark"] .idp-button > span {
    color: var(--fontColor) !important;
}

[data-theme="dark"] .idp-button > svg path,
[data-theme="dark"] .idp-button > img {
    filter: brightness(0.9);
}

/* Auto dark mode IDP button styles */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .idp-button {
        background-color: rgba(255, 255, 255, 0.05) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
        color: var(--fontColor) !important;
    }

    :root:not([data-theme="light"]) .idp-button:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
    }

    :root:not([data-theme="light"]) .idp-button > span {
        color: var(--fontColor) !important;
    }

    :root:not([data-theme="light"]) .idp-button > svg path,
    :root:not([data-theme="light"]) .idp-button > img {
        filter: brightness(0.9);
    }
}

/* Update password toggle icon color */
.password-toggle svg {
    fill: var(--secondFontColor);
}

/* Update divider line color */
.around-or-idp {
    border-bottom-color: var(--borderSecondaryColor);
}

/* Option text color */
.option {
    color: var(--secondFontColor);
}

/* Update password reset text color */
#kc-reset-password-form span {
    color: var(--secondFontColor);
}

/* Alert message styles */
.alert-error, .pf-m-danger {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.alert-warning, .pf-m-warning {
    background-color: #fef6e7;
    border: 1px solid #f0ab00;
    color: #795600;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.alert-success, .pf-m-success {
    background-color: #e7f5e7;
    border: 1px solid #92d192;
    color: #1e4f1e;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.alert-info, .pf-m-info {
    background-color: #e7f3ff;
    border: 1px solid #73bcf7;
    color: #004080;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

/* Auto dark mode button styles */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .login-button,
    :root:not([data-theme="light"]) .register-button,
    :root:not([data-theme="light"]) .signup-with-email-button,
    :root:not([data-theme="light"]) .send-forgot-password-button {
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
        background-color: var(--secondaryBackgroundColor) !important;
    }

    :root:not([data-theme="light"]) .login-button:hover,
    :root:not([data-theme="light"]) .register-button:hover,
    :root:not([data-theme="light"]) .signup-with-email-button:hover,
    :root:not([data-theme="light"]) .send-forgot-password-button:hover {
        background-color: var(--buttonHoverColor) !important;
        border-color: rgba(255, 255, 255, 0.4) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    }

    /* Same re-assertion as the explicit [data-theme="dark"] block above, for
       a system-dark browser with no explicit toggle stamp on :root. */
    :root:not([data-theme="light"]) .login-button-secondary {
        background-color: rgba(255, 255, 255, 0.05) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
        box-shadow: none !important;
    }

    :root:not([data-theme="light"]) .login-button-secondary:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
        box-shadow: none !important;
    }
}

/* Dark mode alert styles */
[data-theme="dark"] .alert-error,
[data-theme="dark"] .pf-m-danger {
    background-color: rgba(248, 113, 113, 0.12);
    border-color: #5a2a2a;
    color: #fca5a5;
}

[data-theme="dark"] .alert-warning,
[data-theme="dark"] .pf-m-warning {
    background-color: rgba(245, 158, 11, 0.12);
    border-color: #5a4229;
    color: #fcd34d;
}

[data-theme="dark"] .alert-success,
[data-theme="dark"] .pf-m-success {
    background-color: rgba(16, 185, 129, 0.12);
    border-color: #2a5a2a;
    color: #6ee7b7;
}

[data-theme="dark"] .alert-info,
[data-theme="dark"] .pf-m-info {
    background-color: rgba(29, 100, 242, 0.12);
    border-color: #29425a;
    color: #93b4fc;
}

/* The Security Key registration confirmation starts hidden and is revealed by
   webauthnRegisterConfirmation.js. The inherited PatternFly kcAlertClass sets
   its own `display`, which would beat the browser's default styling of the
   `hidden` attribute, so state it here. */
#webauthn-register-confirmation[hidden] {
    display: none !important;
}

/* The alert message text sits in a child <span>, which the global `span` rule
   colors with --secondFontColor (a muted grey, near-invisible on the dark alert
   background). Inherit the alert's own color instead, in both light and dark. */
.alert-error span,
.alert-warning span,
.alert-success span,
.alert-info span,
.pf-m-danger span,
.pf-m-warning span,
.pf-m-success span,
.pf-m-info span {
    color: inherit;
}

/* ===== Submit / navigation loading feedback =====
   On submit (or social/SSO navigation) the button swaps its label for a
   spinner so the user knows the request is in flight. Driven by the
   .is-loading class added in js/submitFeedback.js. */
@keyframes kc-spin {
    to { transform: rotate(360deg); }
}

.login-button.is-loading,
.register-button.is-loading,
.send-forgot-password-button.is-loading,
.idp-button.is-loading {
    position: relative;
    color: transparent !important; /* hide the label; spinner takes its place */
    /* pointer-events (not :disabled) blocks a re-click — a disabled control is
       dropped from the POST, which would break buttons whose name/value matter
       (e.g. accept/cancel on the oauth-grant page). */
    pointer-events: none;
}

/* idp buttons hold an icon + span; hide them while the spinner shows */
.idp-button.is-loading > * {
    visibility: hidden;
}

.login-button.is-loading::after,
.register-button.is-loading::after,
.send-forgot-password-button.is-loading::after,
.idp-button.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    animation: kc-spin 0.6s linear infinite;
}

/* idp buttons sit on a light surface — use a dark spinner */
.idp-button.is-loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--fontColor);
}

/* Respect reduced-motion: drop the spin, keep the label visible but dimmed */
@media (prefers-reduced-motion: reduce) {
    .login-button.is-loading,
    .register-button.is-loading,
    .send-forgot-password-button.is-loading {
        color: #fff !important;
    }
    .idp-button.is-loading {
        color: var(--fontColor) !important;
    }
    .idp-button.is-loading > * {
        visibility: visible;
    }
    .login-button.is-loading,
    .register-button.is-loading,
    .send-forgot-password-button.is-loading,
    .idp-button.is-loading {
        opacity: 0.7;
        cursor: progress;
    }
    .login-button.is-loading::after,
    .register-button.is-loading::after,
    .send-forgot-password-button.is-loading::after,
    .idp-button.is-loading::after {
        display: none;
    }
}
/* -----------------------------------------------------------------------------
   OAuth consent screen
   Uses the existing tokens only, so light and dark both follow the theme
   without a second palette to keep in step.
   -------------------------------------------------------------------------- */

/* The form is the flex child of .form-container, which centers it but never
   sized it, so on a desktop viewport it stretched the full panel and every line
   of copy ran edge to edge. The card treatment matches the sign-in and register
   cards; those only defined it under the 950px breakpoint, so consent had no
   card at any width. */
.consent {
    text-align: left;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 28px 24px;
    box-sizing: border-box;
    background-color: var(--cardBackgroundColor);
    border-radius: 12px;
    box-shadow: var(--boxShadow);
}

.consent-title {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.35;
    margin: 18px 0 6px;
    color: var(--fontColor);
}

.consent-identity {
    text-align: center;
    font-size: 14px;
    color: var(--secondFontColor);
    margin: 0 0 20px;
}

.consent-identity strong {
    color: var(--fontColor);
    font-weight: 600;
}

/* The capability grant. This is the hero: it is the only part of the screen
   describing what the application can actually do, so it carries the weight
   the scope names used to take. */
.consent-grant {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--secondaryBackgroundColor) 28%, var(--borderSecondaryColor));
    border-radius: 12px;
    background: color-mix(in srgb, var(--secondaryBackgroundColor) 6%, var(--secondLayerBackgroundColor));
    margin-bottom: 14px;
}

.consent-grant-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--secondaryBackgroundColor);
    color: #ffffff;
}

.consent-grant-icon svg {
    width: 21px;
    height: 21px;
}

.consent-grant-title {
    margin: 0 0 5px;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--fontColor);
}

.consent-grant-body {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--fontColor);
    opacity: 0.82;
}

/* The OIDC claims, deliberately quiet. They are part of the grant and have to
   be shown, but nothing acts on them, and as a checklist they competed with
   the access above for attention. */
.consent-secondary {
    margin: 0 0 16px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--secondFontColor);
}

.consent-note,
.consent-legal {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--secondFontColor);
    margin: 0 0 16px;
}

.consent-legal a {
    color: var(--linkColor);
}

.login-button-secondary {
    margin-top: 10px;
    background: var(--cardBackgroundColor);
    color: var(--fontColor);
    border: 1px solid var(--inputBorderColor);
}

.login-button-secondary:hover {
    background: var(--mainBackgroundColor);
}

.consent-warning {
    margin: 16px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    text-align: center;
    color: var(--secondFontColor);
}

/* logoutOtherSessions checkbox (password-commons.ftl): never styled before
   since no active template rendered it, so the native checkbox and its
   label text overlapped. */
.checkbox {
    margin: 12px 0;
    font-size: 13px;
    color: var(--fontColor);
}

.checkbox label {
    /* Inherited patternfly-v3 bundle sets padding-left:20px here for its own
       absolute-positioned-checkbox layout, which this rule doesn't use. */
    padding-left: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox input[type="checkbox"] {
    /* .form-container input sizes every <input> to width:100%/height:40px, and
       Bootstrap's .checkbox input[type="checkbox"] rule (from the inherited
       patternfly-v3 bundle) absolutely-positions it with a -20px offset meant
       for Bootstrap's own padding-left layout. Neither convention applies
       here, so both are overridden explicitly rather than relied on to lose
       the cascade. */
    position: static;
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

/* Authenticator/credential chooser list: select-authenticator.ftl's passkey-
   vs-password choice, and the registered-passkey list webauthn-authenticate.ftl
   shows when there's more than one credential to pick from. Modeled on
   .idp-button's card-row look, since both are "pick one of several options"
   affordances, extended to a two-line heading+description body. */
.auth-option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--borderSecondaryColor);
    background: var(--cardBackgroundColor);
    color: var(--fontColor);
    font-family: inherit;
    text-align: left;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Only the select-authenticator.ftl rows are clickable buttons; the
   webauthn-authenticate.ftl credential list is informational, so it stays
   un-hovered rather than implying it's interactive. */
button.auth-option-item {
    cursor: pointer;
}

button.auth-option-item:hover {
    background-color: var(--inputBackgroundColor);
    border-color: var(--secondFontColor);
}

.auth-option-icon {
    flex-shrink: 0;
    display: flex;
    color: var(--secondaryBackgroundColor);
}

.auth-option-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-option-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--fontColor);
}

.auth-option-description {
    font-size: 12px;
    color: var(--secondFontColor);
}

.auth-option-arrow {
    flex-shrink: 0;
    color: var(--secondFontColor);
}
