/* ===========================================
   Participant Theme - Main Styles
   Keycloak v26 Migration
   =========================================== */

/* ======= Font Definitions ======= */
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

/* ======= CSS Variables ======= */
:root {
  /* Colors */
  --primary-color: #0098db;
  --primary-hover: #007bc7;
  --text-color: #212b36;
  --title-text-color: #262262;
  --button-text-color: #262262;
  --text-light: #566774;
  --border-color: #566774;
  --border-light: #dfe3e8;
  --border-error: #fecaca;
  --border-error-secondary: #f03e3e;
  --background-help: #f1faf7;
  --background-error: #ffeeee;
  --background-light: #f5f5f5;
  --background-white: #ffffff;
  --background-gradient: linear-gradient(116deg, #8ec5fc, #ddd6f3 100%);
  --background-input: light-dark(rgb(232, 240, 254), rgba(70, 90, 126, 0.4));
  --error-color: #c12000;
  --success-color: #087531;

  /* Typography */
  --font-family-primary: 'Montserrat', sans-serif;
  --font-size-base: 16px;
  --font-size-label: 12px;
  --font-size-lg-label: 14px;
  --font-size-helper: 11px;
  --line-height-base: 1.5;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;

  /* Layout */
  --content-max-width: 480px;

  /* ======= PatternFly v5 Global Variable Overrides ======= */
  --pf-v5-global--FontFamily--sans-serif: 'Montserrat', sans-serif;
  --pf-v5-global--FontFamily--text: 'Montserrat', sans-serif;
  --pf-v5-global--FontFamily--heading: 'Montserrat', sans-serif;
  --pf-v5-global--FontSize--3xl: 24px;
  --pf-v5-global--FontWeight--normal: 500;

}

/* ======= Reset & Base Styles ======= */
* {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-primary);
  font-weight: 500;
  line-height: var(--line-height-base);
  color: var(--text-color);
  background-color: var(--background-white);
  min-height: 100vh;
}

/* ======= Page Layout ======= */
#page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}


#page {
  display: flex;
  flex: 1;
  flex-direction: row;
  margin: 0;
  padding: 0;
}

/* ======= Header Styles ======= */
#header, .participant-header {
  background-color: var(--background-white);
  padding: var(--spacing-md) var(--spacing-xxl);
  border-bottom: 1px solid var(--background-light);
  position: relative;
  max-height: 70px;
}

.form-header-container .participant-header {
  padding: 0 !important;
  border: none !important;
}

.header-actions .pf-v5-c-button.pf-m-primary {
  height: 32px;
}

#header h1, .participant-header h1 {
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}


#header-row, .header-logos {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex: 1;
}

.form-header-container {
  margin-bottom: 20px;
}

.form-header-container .header-logos {
  gap: 0 !important;
}

#program-logo, .primary-logo {
  max-height: 36px;
  width: auto;
}

#invite-code-logo, #secondary-logo, .secondary-logo {
  max-height: 36px;
  width: auto;
}

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
  float: right;
  align-items: center;
}

.header-actions a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.header-actions a:hover {
  color: var(--primary-hover);
}

/* Language Switcher */
.language-switcher, #language-section {
  position: relative;
  display: inline-block;
}

.language-switcher-mobile {
  display: none !important;
}

.language-switcher select, .language-switcher-mobile select {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 4px;
  color: var(--primary-hover);
  font-size: 14px;
  cursor: pointer;
  text-align: right;
  text-decoration: underline;
  font-weight: 500;
}

/* Dropdown-style language switcher */
.dropdown-content {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
  padding-bottom: .5rem;
  padding-top: .5rem;
}

.language-switcher, .language-switcher-mobile {
  font-size: 14px;
  color: var(--primary-hover);
  padding-right: 16px;
  text-decoration: underline;
  cursor: pointer;
}

.language-switcher .dropdown-menu, .language-switcher-mobile .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: auto;
  right: 0 !important;
  z-index: 9999;
  right: auto;
}

.language-switcher .dropdown-item, .language-switcher-mobile .dropdown-item {
  font-size: 14px;
  color: var(--primary-hover);
  cursor: pointer;
  margin: 0;
  padding: 0.25rem 0.75rem;
}

.language-switcher .language-switcher-chevron,
.language-switcher-mobile .language-switcher-chevron {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: none;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ======= Primary Layout (No Sidebar) ======= */
#page.hide-sidebar {
  justify-content: center;
  align-items: center;
  background-image: var(--background-gradient);
  padding: 95px 0;
}

#page.hide-sidebar #content-container.content-area {
  flex-basis: auto;
  background-color: var(--background-white);
  padding: var(--spacing-xxl) var(--spacing-xxl) var(--spacing-xl) var(--spacing-xxl);
}

#page.hide-sidebar #content-container.content-area .content-wrapper {
  width: 30vw;
}

/* ======= Sidebar Layout - Content Column ======= */
#page.show-sidebar #content-container.content-area {
  flex-basis: 30vw;
  flex-grow: 0;
  flex-shrink: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--spacing-xl) var(--spacing-xxl);
  background-color: var(--background-white);
  order: 1; /* Display first (on left) */
  z-index: 1;
  overflow: auto;
}

/* ======= Sidebar Layout - Sidebar Area ======= */
#page.show-sidebar #sidebar-container {
  flex: 1; /* Takes remaining space */
  background-color: var(--background-light);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2; /* Display second (on right) */
  overflow: auto;
}

#sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  background-color: #f0f0f0;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  overflow: auto;
}

.content-wrapper {
  width: 100%;
  max-width: var(--content-max-width);
}

#main {
  width: 100%;
}

#content {
  width: 100%;
}

/* ======= Form Styles ======= */
.form-group, .field {
  margin-bottom: var(--spacing-lg);
}

.form-label, .label, label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: var(--spacing-sm);
}

.confirmation-code-instruction {
  margin-bottom: 64px;
}

.instruction {
  overflow-wrap: break-word;
}

.form-input, .input, input[type="text"],
input[type="email"], input[type="password"],
input[type="tel"], select, textarea {
  width: 100%;
  padding: 0.625rem;
  font-size: 1rem;
  height: 2.25em;
  font-family: var(--font-family-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
  transition: border-color 0.2s ease;
}

.form-input:focus, .input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-hover);
}

.form-input::placeholder, .input::placeholder {
  color: rgba(33, 43, 54, 0.3);
}

/* Inline labels for Checkboxes in forms */
input[type="checkbox"] {
    height: 16px;
    width: 16px;
    vertical-align: middle;
}

label[for="termsAccepted"] {
    font-size: var(--font-size-lg-label);
    display: inline;
    vertical-align: middle;
}

/* ======= Button Styles ======= */
/* Base button styles - PatternFly v5 */
.button, .btn, .pf-v5-c-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  font-family: var(--font-family-primary);
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.43;
  width: auto;
  font-stretch: normal;
  font-style: normal;
}

/* Primary buttons - Yellow theme styling */
.button.is-primary, .btn-primary,
.pf-v5-c-button.pf-m-primary {
  background-color: #fec273;
  color: var(--button-text-color);
  font-weight: bold;
}

/* Primary button hover state */
.button.is-primary:hover, .btn-primary:hover,
.pf-v5-c-button.pf-m-primary:hover {
  background-color: #fdb863;
  color: var(--button-text-color);
  text-decoration: none;
}

/* Disabled primary button state */
.button.is-primary:disabled, .btn-primary:disabled,
.pf-v5-c-button.pf-m-primary:disabled,
.pf-v5-c-button.pf-m-primary.pf-m-aria-disabled,
.pf-v5-c-button.pf-m-primary[aria-disabled="true"] {
  opacity: 0.5;
  box-shadow: none;
  cursor: not-allowed;
  background-color: #fec273;
}

/* Secondary buttons */
.button.is-secondary, .btn-secondary,
.pf-v5-c-button.pf-m-secondary {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.button.is-secondary:hover, .btn-secondary:hover,
.pf-v5-c-button.pf-m-secondary:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Block/Full-width button modifier */
.button.is-fullwidth, .btn-block,
.pf-m-block {
  width: 100%;
}

/* ======= Footer Styles ======= */
#footer {
  font-size: 12px;
}

#footer, .participant-footer {
  background-color: #f6f5f8;
  padding: var(--spacing-md) var(--spacing-xxl);
}

.footer-container {
  margin: 0;
}

/* Contact Section */
#program-contact {
  padding-bottom: 16px;
  border-bottom: solid 1px var(--border-light);
  margin: 0;
}

#contactInfo {
  font-size: 14px;
}

#contact-section {
  font-size: 14px;
}

.support-contact {
  padding-top: 16px;
}
.support-contact-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 15px;
}

.support-contact div, .support-contact-text div {
  min-height: 16px;
  line-height: 16px;
  font-size: 14px;
  padding-left: 22px;
  background-position: left center;
  background-repeat: no-repeat;
  background-size: 16px 15px;
}

.support-contact-text div{
  font-size: 1em !important;
}



.support-contact div.support-phone-number {
  background-image: url("../img/icons/icon-phone.svg");
  background-position-y: top;
}

.support-contact-text div.support-phone-number {
  background-image: url("../img/icons/icon-phone-primary-color.svg");
  background-position-y: top;
}

.support-contact div.support-email {
  background-image: url("../img/icons/icon-email.svg");
  background-position-y: top;
}

.support-contact-text div.support-email {
  background-image: url("../img/icons/icon-email-primary-color.svg");
  background-position-y: top;
}



.support-contact div.program-ttysupport {
  background-image: url("../img/icons/icon-tty.svg");
  background-position-y: top;
}

.support-contact a {
  word-break: break-word;
  color: var(--text-color);
}

/* Middle Container */
#middle-container {
  padding-top: 16px;
}

#info-row {
  /* Base mobile styles, enhanced by responsive.css */
}

#icon-row {
  /* Base mobile styles, enhanced by responsive.css */
}

#privacy-terms {
  padding-top: 16px;
}

#privacy-terms a {
  color: var(--text-color);
  text-decoration: underline;
  padding-right: 24px;
}

/* Disclaimer */
#disclaimer-container {
  padding-top: 16px;
}

/* Powered By */
.powered-by {
  padding-bottom: 8px;
}

.powered-by-image {
  max-height: 20px;
  vertical-align: middle;
}

/* Copyright */
#copyright {
  /* Uses default styles */
}

/* Social Media */
#social-contact-container {
  padding-bottom: 16px;
}

.logos {
  display: flex;
  flex-direction: row;
}

.logos span.logo {
  height: 24px;
  width: 24px;
}

.logos span.logo:not(:last-child) {
  margin-right: 24px;
}

.logos span.logo img {
  height: 24px;
  width: 24px;
}

/* App Store Icons */
#app-store-icons {
  line-height: 0.7;
  display: flex;
  flex-direction: row;
  justify-content: start;
  align-items: flex-end;
}

#app-store-icons img {
  height: 24px;
  margin-right: 8px;
}

.expand-icon {
  width: 12px;
  height: 12px;
}

/* ======= Alert/Message Styles ======= */
.alert, .pf-v5-c-alert {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  position: relative;
  border-style: solid;
  border-width: 1px 1px 1px 8px;
}

.alert-error, .pf-v5-c-alert.pf-m-danger {
  background-color: var(--background-error);
  border-color: var(--border-error);
  border-left-color: var(--border-error-secondary);
  color: #212b36;
}

.alert-success, .pf-v5-c-alert.pf-m-success {
  background-color: #f0fdf4;
  border-color: #86efac;
  color: var(--success-color);
}

.alert-warning, .pf-v5-c-alert.pf-m-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.alert-info, .pf-v5-c-alert.pf-m-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary-color);
}

/* ======= Phone number field======= */
.phone-with-country-code {
  display: flex;
  position: relative;
}

.phone-with-country-code .country-switcher.dropdown {
  display: flex;
  position: relative;
  border-radius: 5px 0 0 5px;
  border: 1px solid var(--border-color);
  border-right: 0;
  background-color: #fff;
  transition: border-color 0.2s ease;
}

.phone-with-country-code .country-switcher .dropdown-trigger:focus {
  outline: none;
}

/* Unified focus ring for country switcher + username (JS adds --focused; :focus-within is fallback). */
.phone-with-country-code:focus-within .country-switcher.dropdown:not(.is-hidden):not(.is-disabled),
.phone-with-country-code.phone-with-country-code--focused .country-switcher.dropdown:not(.is-hidden):not(.is-disabled) {
  border-top: 1px solid var(--primary-hover);
  border-bottom: 1px solid var(--primary-hover);
  border-left: 1px solid var(--primary-hover);
  border-right: 0;
}

.phone-with-country-code:focus-within span.pf-v5-c-form-control input[type="text"],
.phone-with-country-code.phone-with-country-code--focused span.pf-v5-c-form-control input[type="text"] {
  border-color: var(--primary-hover);
}

.phone-with-country-code:focus-within span.pf-v5-c-form-control input.pf-v5-c-form-control,
.phone-with-country-code.phone-with-country-code--focused span.pf-v5-c-form-control input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderTopColor: var(--primary-hover);
  --pf-v5-c-form-control--before--BorderRightColor: var(--primary-hover);
  --pf-v5-c-form-control--after--BorderBottomColor: var(--primary-hover);
  --pf-v5-c-form-control--focus--after--BorderBottomColor: var(--primary-hover);
  --pf-v5-c-form-control--hover--after--BorderBottomColor: var(--primary-hover);
}

#country-options-phone-username .dropdown-content {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
  padding: 0;
}


.phone-with-country-code .country-switcher .dropdown-trigger {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0 8px;
  cursor: pointer;
}

.phone-with-country-code .country-switcher .selected-country {
  margin: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}

.phone-with-country-code .country-switcher .selected-country .flag-dropdown {
  display: flex;
}

.phone-with-country-code .country-switcher .country-code-display {
  flex: 1;
  font-size: 16px;
  white-space: nowrap;
}

.phone-with-country-code .country-switcher .country-flag-icon {
  width: 19px;
  height: 14px;
  flex-shrink: 0;
}

.phone-with-country-code .country-switcher .expand-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.phone-with-country-code .country-switcher .dropdown-menu {
  display: none;
  position: absolute;
  left: 0;
  z-index: 9999;
  min-width: 100%;
  width: max-content;
  max-width: min(320px, 90vw);
  max-height: 280px;
  overflow-y: auto;
}

.phone-with-country-code .country-switcher .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.phone-with-country-code .country-switcher .dropdown-item .menu-flag {
  flex-shrink: 0;
}

.phone-with-country-code .country-switcher .dropdown-item .country-name {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
}

.phone-with-country-code .country-switcher .dropdown-item .country-code {
  font-size: 0.875rem;
  color: var(--text-color);
  flex-shrink: 0;
}

.phone-with-country-code .country-switcher .dropdown-item .select-tick {
  width: 10px;
  height: 10px;
  visibility: hidden;
}

.phone-with-country-code .country-switcher .dropdown-item.is-selected .select-tick {
  visibility: visible;
}

.phone-with-country-code .country-switcher.is-disabled {
  background-color: #f5f5f5;
}

.phone-with-country-code .country-switcher.is-disabled .dropdown-trigger {
  cursor: not-allowed;
  opacity: 0.6;
}

.phone-with-country-code input {
  border-radius: 0 5px 5px 0;
  border: 1px solid var(--border-color);
  border-left: 0;
  flex: 1;
}

/* No left edge on the username segment when it sits beside the country switcher (PatternFly span + input). */
.phone-with-country-code span.pf-v5-c-form-control {
  flex: 1;
  min-width: 0;
}

.phone-with-country-code span.pf-v5-c-form-control input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderLeftWidth: 0;
  --pf-v5-c-form-control--before--BorderLeftColor: transparent;
}

/* Login only: country switcher hidden until exactly 10 digits — full input border (registration always uses --phone-active). */
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active) input[type="text"] {
  border-radius: 5px;
  border-left: 1px solid var(--border-color);
}

[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active) span.pf-v5-c-form-control input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderLeftWidth: 1px;
  --pf-v5-c-form-control--before--BorderLeftColor: var(--border-color);
}

[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active) span.pf-v5-c-form-control.pf-m-error input {
  border: 1px solid var(--error-color);
  border-radius: 5px;
}

[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active) span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderLeftWidth: 1px;
  --pf-v5-c-form-control--before--BorderLeftColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderTopColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderRightColor: var(--error-color);
  --pf-v5-c-form-control--after--BorderBottomColor: var(--error-color);
}

.phone-with-country-code .country-switcher.dropdown.is-hidden {
  display: none;
}

/* Login: hide country until JS adds --phone-active (exactly 10 digits). Beats .country-switcher.dropdown { display: flex }. */
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active) .country-switcher.dropdown {
  display: none;
}

.phone-with-country-code span.pf-v5-c-form-control:focus-within {
  --pf-v5-c-form-control--after--BorderBottomWidth: 0;
}

/* ======= Link Styles ======= */
a {
  color: var(--primary-hover);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.content-area a {
  text-decoration: underline;
}

/* ======= Utility Classes ======= */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.margin-top-sm { margin-top: var(--spacing-sm); }
.margin-top-md { margin-top: var(--spacing-md); }
.margin-top-lg { margin-top: var(--spacing-lg); }
.margin-top-xl { margin-top: var(--spacing-xl); }
.margin-top-xxl { margin-top: var(--spacing-xxl); }

.margin-bottom-sm { margin-bottom: var(--spacing-sm); }
.margin-bottom-md { margin-bottom: var(--spacing-md); }
.margin-bottom-lg { margin-bottom: var(--spacing-lg); }
.margin-bottom-xl { margin-bottom: var(--spacing-xl); }
.margin-bottom-xxl { margin-bottom: var(--spacing-xxl); }

.is-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ======= Keycloak v2 Theme Overrides ======= */
/* Override default PatternFly v5 styles */
.pf-v5-c-page {
  background-color: var(--background-white);
}

/* Override PatternFly title colors and spacing */
.pf-v5-c-title {
  --pf-v5-c-title--m-3xl--FontWeight: 700;

  color: var(--title-text-color);
}

.pf-v5-c-form {
  --pf-v5-c-form__label--FontSize: var(--font-size-label);
  --pf-v5-c-form__label-text--FontWeight: 500;
  --pf-v5-c-form--GridGap: 0;

  max-width: 100%;
}

/* Fallback when labels are not under .pf-v5-c-form (PatternFly reads these on the label element). */
.pf-v5-c-form__label {
  --pf-v5-c-form__label--FontSize: var(--font-size-label);
}

.pf-v5-c-form__label-text {
  --pf-v5-c-form__label-text--FontWeight: 500;
}

.pf-v5-c-input-group:has(button[data-password-toggle]) {
  display: grid;
}

.pf-v5-c-form__group {
  margin-bottom: var(--spacing-lg);
}

/* ======= PatternFly v5 Form Control Variable Overrides ======= */
/* Override PatternFly's pseudo-element border system to match our design */
.pf-v5-c-form-control {
  /* Border colors - use our theme color for all sides */
  --pf-v5-c-form-control--before--BorderTopColor: var(--border-color);
  --pf-v5-c-form-control--before--BorderRightColor: var(--border-color);
  --pf-v5-c-form-control--before--BorderLeftColor: var(--border-color);
  --pf-v5-c-form-control--after--BorderBottomColor: var(--border-color);

  /* Border widths - consistent 1px on all sides */
  --pf-v5-c-form-control--before--BorderTopWidth: 1px;
  --pf-v5-c-form-control--before--BorderRightWidth: 1px;
  --pf-v5-c-form-control--before--BorderLeftWidth: 1px;
  --pf-v5-c-form-control--after--BorderBottomWidth: 1px;

  /* Focus/hover states - use primary-hover color for all borders */
  --pf-v5-c-form-control--focus--after--BorderBottomColor: var(--primary-hover);
  --pf-v5-c-form-control--focus--after--BorderBottomWidth: 1px;
  --pf-v5-c-form-control--hover--after--BorderBottomColor: var(--primary-hover);

  /* Error state - use error color but keep 1px width */
  --pf-v5-c-form-control--m-error--after--BorderBottomColor: var(--error-color);
  --pf-v5-c-form-control--m-error--after--BorderBottomWidth: 1px;

  /* Padding to match our design */
  --pf-v5-c-form-control--PaddingTop: 0.625rem;
  --pf-v5-c-form-control--PaddingBottom: 0.625rem;
  --pf-v5-c-form-control--PaddingLeft: 0.625rem;
  --pf-v5-c-form-control--PaddingRight: 0.625rem;

  /* Typography and colors */
  --pf-v5-c-form-control--FontSize: 1rem;
  --pf-v5-c-form-control--BackgroundColor: var(--background-white);
  --pf-v5-c-form-control--Color: var(--text-color);

  /* Font family - PatternFly doesn't have a variable for this, so set directly */
  font-family: var(--font-family-primary), sans-serif;

  /* Border radius - PatternFly uses borders on pseudo-elements, so set this directly */
  border-radius: 4px;
}

/* Styling form submit buttons*/
#kc-form-buttons, .pf-v5-c-form__actions {
  display: flex;
  justify-content: center;
}

.pf-v5-c-button.pf-m-block {
  width: auto;
}

#kc-form-buttons.pf-v5-c-button.pf-m-block, .pf-v5-c-form__actions .pf-v5-c-button.pf-m-block {
  width: auto;
}

.pf-v5-c-form__actions .pf-v5-c-button, #kc-form-buttons .pf-v5-c-button {
  min-width: 232px;
  font-size: 14px;
  padding: 0;
  height: 32px;
}

/* Fix for span wrappers - remove all borders by setting widths to 0 */
span.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderTopWidth: 0;
  --pf-v5-c-form-control--before--BorderRightWidth: 0;
  --pf-v5-c-form-control--before--BorderLeftWidth: 0;
  --pf-v5-c-form-control--before--BorderBottomWidth: 0;
  --pf-v5-c-form-control--after--BorderBottomWidth: 0;

  /* Remove padding from span wrappers */
  --pf-v5-c-form-control--PaddingTop: 0;
  --pf-v5-c-form-control--PaddingBottom: 0;
  --pf-v5-c-form-control--PaddingLeft: 0;
  --pf-v5-c-form-control--PaddingRight: 0;

  /* Ensure span doesn't use absolute positioning */
  position: static;
  width: 100%;
  display: inline-block;
}

img,
embed,
iframe,
object,
audio,
video {
  max-width: none;
}

/* Ensure inputs inside spans get proper border variables restored */
span.pf-v5-c-form-control input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderTopWidth: 1px;
  --pf-v5-c-form-control--before--BorderRightWidth: 1px;
  --pf-v5-c-form-control--before--BorderLeftWidth: 1px;
  --pf-v5-c-form-control--after--BorderBottomWidth: 1px;

  /* Restore padding for the actual input */
  --pf-v5-c-form-control--PaddingTop: 0.625rem;
  --pf-v5-c-form-control--PaddingBottom: 0.625rem;
  --pf-v5-c-form-control--PaddingLeft: 0.625rem;
  --pf-v5-c-form-control--PaddingRight: 0.625rem;
}

/**** RED OUTLINES ON ERROR STATE IS NOT WORKING ****/

/* Error state handling - when pf-m-error class is present, all borders should be red */
.pf-v5-c-form-control.pf-m-error {
  display: flex;
  position: relative;
  --pf-v5-c-form-control--before--BorderTopColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderRightColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderLeftColor: var(--error-color);
  --pf-v5-c-form-control--after--BorderBottomColor: none;
}

.pf-m-error .pf-v5-c-form-control__utilities {
  position: absolute;
  right: 0;
}

/* Ensure error state works for inputs inside error spans */
span.pf-v5-c-form-control.pf-m-error input {
  border: 1px solid var(--error-color);
}
span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderTopColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderRightColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderLeftColor: var(--error-color);
  --pf-v5-c-form-control--after--BorderBottomColor: var(--error-color);
}

/* Phone + country: keep a single shared edge (no double line between dial code and number). */
.phone-with-country-code span.pf-v5-c-form-control.pf-m-error input {
  border-top: 1px solid var(--error-color);
  border-right: 1px solid var(--error-color);
  border-bottom: 1px solid var(--error-color);
  border-left: 0;
}

.phone-with-country-code span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderLeftWidth: 0;
  --pf-v5-c-form-control--before--BorderLeftColor: transparent;
  --pf-v5-c-form-control--before--BorderTopColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderRightColor: var(--error-color);
  --pf-v5-c-form-control--after--BorderBottomColor: var(--error-color);
}

/* Error on username: highlight country switcher too (script tag between switcher and input breaks + sibling selectors). */
.phone-with-country-code--has-error .country-switcher.dropdown:not(.is-hidden):not(.is-disabled),
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error) .country-switcher.dropdown:not(.is-hidden):not(.is-disabled) {
  border-top: 1px solid var(--error-color);
  border-bottom: 1px solid var(--error-color);
  border-left: 1px solid var(--error-color);
  border-right: 0;
}

/* Error state wins over focus/active — do not switch to primary (blue) border while invalid. */
.phone-with-country-code--has-error:focus-within .country-switcher.dropdown:not(.is-hidden):not(.is-disabled),
.phone-with-country-code--has-error.phone-with-country-code--focused .country-switcher.dropdown:not(.is-hidden):not(.is-disabled),
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error):focus-within .country-switcher.dropdown:not(.is-hidden):not(.is-disabled),
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error).phone-with-country-code--focused .country-switcher.dropdown:not(.is-hidden):not(.is-disabled) {
  border-top-color: var(--error-color);
  border-bottom-color: var(--error-color);
  border-left-color: var(--error-color);
}

.phone-with-country-code--has-error:focus-within span.pf-v5-c-form-control.pf-m-error input,
.phone-with-country-code--has-error.phone-with-country-code--focused span.pf-v5-c-form-control.pf-m-error input,
.phone-with-country-code--has-error:focus-within span.pf-v5-c-form-control.pf-m-error input:focus,
.phone-with-country-code--has-error:focus-within span.pf-v5-c-form-control.pf-m-error input:active,
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error):focus-within span.pf-v5-c-form-control.pf-m-error input,
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error).phone-with-country-code--focused span.pf-v5-c-form-control.pf-m-error input {
  border-top-color: var(--error-color);
  border-right-color: var(--error-color);
  border-bottom-color: var(--error-color);
}

.phone-with-country-code--has-error:focus-within span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control,
.phone-with-country-code--has-error.phone-with-country-code--focused span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control,
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error):focus-within span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control,
.phone-with-country-code:has(span.pf-v5-c-form-control.pf-m-error).phone-with-country-code--focused span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderTopColor: var(--error-color);
  --pf-v5-c-form-control--before--BorderRightColor: var(--error-color);
  --pf-v5-c-form-control--after--BorderBottomColor: var(--error-color);
  --pf-v5-c-form-control--focus--after--BorderBottomColor: var(--error-color);
  --pf-v5-c-form-control--hover--after--BorderBottomColor: var(--error-color);
}

/* Login only: error + focus while country hidden — full red border (including left) */
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active).phone-with-country-code--has-error:focus-within span.pf-v5-c-form-control.pf-m-error input,
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active).phone-with-country-code--has-error.phone-with-country-code--focused span.pf-v5-c-form-control.pf-m-error input,
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active):has(span.pf-v5-c-form-control.pf-m-error):focus-within span.pf-v5-c-form-control.pf-m-error input {
  border: 1px solid var(--error-color);
}

[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active).phone-with-country-code--has-error:focus-within span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control,
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active).phone-with-country-code--has-error.phone-with-country-code--focused span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control,
[data-login-phone-country="true"]:not(.phone-with-country-code--phone-active):has(span.pf-v5-c-form-control.pf-m-error):focus-within span.pf-v5-c-form-control.pf-m-error input.pf-v5-c-form-control {
  --pf-v5-c-form-control--before--BorderLeftWidth: 1px;
  --pf-v5-c-form-control--before--BorderLeftColor: var(--error-color);
}

.pf-v5-c-form__helper-text {
    font-size: var(--font-size-helper);
}

.username-toggle {
    font-size: 14px;
    line-height: 1.3;
    color: var(--primary-hover);
    margin-top: 16px;
    text-decoration: underline;
}

/* ======= Hide Required Asterisk on Form Fields ======= */
.pf-v5-c-form__label-required {
    display: none !important;
}

/* Hide extra sign in link */
#kc-form-options.pf-v5-c-login__main-footer-band-item {
  display: none !important;
}


/* ======= Hide Logout Sessions Checkbox  ======= */
/* The participant theme does support Logout Sessions Checkbox on Change Password or Logout pages */
/* Modern browsers - hide the entire container div */
div.pf-v5-c-check:has(input[name="logout-sessions"]) {
    display: none !important;
}
/* Fallback for browsers without :has() support (older browsers) */
/* Hide individual elements since we can't select parent */
input[name="logout-sessions"] {
    display: none !important;
}
input[name="logout-sessions"] + .pf-v5-c-check__label {
    display: none !important;
}


/* ======= Password Toggle Button Styling ======= */
/* Make the password toggle button appear inside the input field on the right side */
/* Transparent background, icon only, primary blue color */

/* Container needs relative positioning for absolute positioning of button */
.pf-v5-c-input-group:has(button[data-password-toggle]) {
  position: relative;
}

/* Input field should stretch full width with padding for the button */
.pf-v5-c-input-group:has(button[data-password-toggle]) .pf-v5-c-input-group__item.pf-m-fill {
  flex: 1;
  width: 100%;
}

.pf-v5-c-input-group:has(button[data-password-toggle]) .pf-v5-c-form-control input[type="password"],
.pf-v5-c-input-group:has(button[data-password-toggle]) .pf-v5-c-form-control input[type="text"] {
  width: 100%;
  padding-right: 40px; /* Space for the icon button */
}

/* Position the button container absolutely on the right side */
.pf-v5-c-input-group__item:has(button[data-password-toggle]) {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

/* Style the button - transparent background, no border, blue icon */
button[data-password-toggle] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--primary-color); /* #0098db */
  min-width: auto;
  height: auto;

  /* Override PatternFly's ::after pseudo-element border (similar to form-control fix) */
  --pf-v5-c-button--m-control--after--BorderWidth: 0;
  --pf-v5-c-button--m-control--hover--after--BorderBottomWidth: 0;
  --pf-v5-c-button--m-control--active--after--BorderBottomWidth: 0;
  --pf-v5-c-button--m-control--focus--after--BorderBottomWidth: 0;
}

/* Icon styling */
button[data-password-toggle] i {
  font-size: 16px;
  color: var(--primary-color);
}

/* Hover state */
button[data-password-toggle]:hover {
  background: transparent !important;
  color: var(--primary-hover); /* #007bc7 */
}

button[data-password-toggle]:hover i {
  color: var(--primary-hover);
}

/* Focus state for accessibility */
button[data-password-toggle]:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  background: transparent !important;
}

/* Remove any padding/margin that PatternFly adds */
.pf-v5-c-input-group__item:has(button[data-password-toggle]) {
  margin: 0;
  padding: 0;
}
