/* Organization login theme: dark mode only */
:root {
  --org-bg-url: url("../img/bg-default.png");
  --org-logo-url: url("../img/logo-default.png");
  --org-primary: #5f6368;
  --org-accent: #7a7f85;
  --login-surface: rgba(38, 41, 45, 0.7);
  --login-control: rgba(255, 255, 255, 0.08);
  --login-control-focus: rgba(255, 255, 255, 0.14);
  --login-control-border: rgba(255, 255, 255, 0.18);
}

html.login-pf {
  color-scheme: dark;
}

/* Page shell */
html.login-pf body {
  align-items: center !important;
  background: var(--org-bg-url) center / cover fixed no-repeat !important;
  color: #f5f6fa !important;
  display: flex !important;
  font-family: "Inter", "Segoe UI", sans-serif !important;
  justify-content: center !important;
  margin: 0 !important;
  min-height: 100vh !important;
}

html.login-pf body::before {
  background: var(--org-bg-url) center / cover fixed no-repeat !important;
  content: "";
  filter: blur(13px);
  inset: 0;
  position: fixed;
  transform: scale(1.05);
  z-index: 0;
}

.pf-v5-c-login__container {
  align-items: center !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  grid-template-areas: none !important;
  grid-template-columns: none !important;
  justify-content: center !important;
  margin: 0 auto !important;
  max-width: 100% !important;
  padding: 0 !important;
  position: relative !important;
  width: 100% !important;
  z-index: 1;
}

.pf-v5-c-login__header,
.pf-v5-c-login__footer,
#kc-header-wrapper,
#kc-registration-container {
  display: none !important;
}

/* Login panel and organization header */
.pf-v5-c-login__main {
  align-items: center !important;
  backdrop-filter: blur(14px) !important;
  background-color: var(--login-surface) !important;
  border-radius: 15px !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 0 auto !important;
  max-width: calc(100vw - 2rem) !important;
  min-width: 0 !important;
  position: relative !important;
  width: min(500px, calc(100vw - 2rem)) !important;
  z-index: 1;
}

.pf-v5-c-login__main-header {
  display: block !important;
  padding: 3rem 5.5rem 1rem !important;
}

.kc-header-container {
  margin-bottom: 2rem !important;
  text-align: center !important;
}

#kc-org-logo {
  background: var(--org-logo-url) center / contain no-repeat !important;
  height: 80px !important;
  margin: 0 auto 1rem !important;
  width: 260px !important;
}

#kc-org-logo span {
  display: none !important;
}

#kc-org-title,
#kc-page-title {
  color: #fff !important;
}

#kc-org-title {
  font-size: 1.6rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.4) !important;
}

#kc-page-title {
  font-size: 1.5rem !important;
}

/* Shared form controls */
.pf-v5-c-form-control,
.pf-c-form-control {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  --pf-v5-c-form-control--after--BorderBottomColor: transparent !important;
  --pf-v5-c-form-control--after--BorderBottomWidth: 0 !important;
}

.pf-v5-c-form-control::before {
  border-style: none !important;
}

.pf-v5-c-login__main-header-utilities,
.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control,
#login-select-toggle {
  width: 100% !important;
}

.pf-v5-c-login__main-header-utilities {
  margin: 0 auto !important;
}

#login-select-toggle,
.kc-form-card input[type="email"],
.kc-form-card input[type="password"],
.kc-form-card input[type="text"] {
  background: var(--login-control) !important;
  border: 1px solid var(--login-control-border) !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
  color: #fff !important;
  font-size: 16px !important;
  transition: background 0.25s ease, border-color 0.25s ease !important;
}

.kc-form-card input[type="email"],
.kc-form-card input[type="password"],
.kc-form-card input[type="text"] {
  margin-bottom: 0 !important;
  padding: 0.75rem 1rem !important;
  width: 100% !important;
}

#login-select-toggle {
  appearance: none !important;
  color-scheme: light;
  height: 49.6px !important;
  padding: 0.75rem 2.75rem 0.75rem 1rem !important;
}

/* Keep the native options readable while leaving the popup browser-rendered. */
#login-select-toggle option {
  background: Canvas !important;
  color: CanvasText !important;
}

#login-select-toggle:focus,
.kc-form-card input:focus {
  background: var(--login-control-focus) !important;
  border-color: var(--org-accent) !important;
  outline: none !important;
}

.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control__utilities {
  align-items: center;
  display: flex;
  height: 100%;
}

/* Form layout and actions */
.kc-form-card {
  border-radius: 18px !important;
  box-sizing: border-box !important;
  max-width: 420px !important;
  padding: 2.5rem !important;
  width: 100% !important;
}

.kc-form-card .pf-v5-c-form__group {
  margin-bottom: 1rem !important;
}

.kc-form-card button,
.kc-form-card input[type="submit"],
button#kc-login {
  background-color: var(--org-primary) !important;
  border: 0 !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
  color: #fff !important;
  cursor: pointer !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  margin-top: 0.5rem !important;
  padding: 0.85rem !important;
  transition: background-color 0.3s ease, transform 0.1s ease !important;
  width: 100% !important;
}

.kc-form-card button:hover,
.kc-form-card input[type="submit"]:hover,
button#kc-login:hover {
  background-color: var(--org-accent) !important;
  transform: translateY(-1px) !important;
}

/* The password step renders the selected account outside login-password.ftl. */
.pf-v5-c-input-group:has(#kc-attempted-username) {
  align-items: stretch !important;
  display: flex !important;
  gap: 0.5rem !important;
  margin: 0 auto !important;
  max-width: 340px !important;
  width: calc(100% - 5rem) !important;
}

.pf-v5-c-form:has(#kc-attempted-username) {
  row-gap: 0.5rem !important;
}

.pf-v5-c-form:has(#kc-attempted-username) #kc-form.kc-form-card {
  padding-top: 1rem !important;
}

.pf-v5-c-form__group:has(#kc-attempted-username) > .pf-v5-c-form__label {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 340px !important;
  width: calc(100% - 5rem) !important;
}

.pf-v5-c-input-group:has(#kc-attempted-username) > * + * {
  border-inline-start: 0 !important;
}

#input-error-container-username:not(:has(*)) {
  display: none !important;
}

.pf-v5-c-form-control:has(#kc-attempted-username) {
  background: var(--login-control) !important;
  border: 1px solid var(--login-control-border) !important;
  border-radius: 10px !important;
  display: block !important;
  width: 100% !important;
}

#kc-attempted-username {
  color: #fff !important;
  font-size: 16px !important;
  height: 49px !important;
  padding: 0.75rem 1rem !important;
  width: 100% !important;
}

#kc-attempted-username[readonly] {
  color: #a8a8a8 !important;
}

#reset-login {
  align-items: center !important;
  background: var(--login-control) !important;
  border: 1px solid var(--login-control-border) !important;
  border-radius: 10px !important;
  color: #fff !important;
  display: flex !important;
  height: 49px !important;
  justify-content: center !important;
  padding: 0 !important;
  width: 49px !important;
}

#reset-login::after {
  border: 0 !important;
}

#reset-login:hover {
  background: var(--login-control-focus) !important;
  border-color: var(--org-accent) !important;
}

#reset-login .kc-tooltip-text {
  display: none !important;
}

/* PatternFly reduces the form-card gutter below 768px. Keep the locale control
   in the same 340px lane as the inputs throughout that intermediate range. */
@media (min-width: 651px) and (max-width: 767.98px) {
  .pf-v5-c-login__main-header {
    padding-left: 4.5rem !important;
    padding-right: 4.5rem !important;
  }

  .pf-v5-c-input-group:has(#kc-attempted-username) {
    margin-left: 40px !important;
    margin-right: auto !important;
  }

  .pf-v5-c-form__group:has(#kc-attempted-username) > .pf-v5-c-form__label {
    margin-left: 40px !important;
    margin-right: auto !important;
  }

  .pf-v5-c-login__main-header-utilities {
    margin-left: 0 !important;
    width: calc(100% - 1rem) !important;
  }
}

/* Mobile: keep every control in one wide, shared lane. */
@media (max-width: 650px) {
  html.login-pf body {
    align-items: flex-start !important;
    background-attachment: scroll !important;
    overflow-x: hidden !important;
    padding: 1rem 0 !important;
  }

  .pf-v5-c-login__main-header {
    padding: 2rem 1rem 1rem !important;
  }

  .pf-v5-c-login__main-body {
    padding: 0 1rem 2rem !important;
  }

  .kc-form-card {
    margin: 0 !important;
    max-width: none !important;
    padding: 1.5rem 0 2rem !important;
  }

  .pf-v5-c-input-group:has(#kc-attempted-username) {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .pf-v5-c-form__group:has(#kc-attempted-username) > .pf-v5-c-form__label {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  #kc-org-logo {
    height: 70px !important;
    margin-bottom: 1.5rem !important;
    width: 200px !important;
  }
}
