/* =============================================
   Total Audit – Keycloak Login Theme (layout from ActaSec)
   ============================================= */

html, body {
  height: 100% !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #f0f4f8 !important;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(37, 57, 147, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(167, 217, 238, 0.18) 0%, transparent 50%),
    linear-gradient(135deg, #f0f4f8 0%, #dde4f2 50%, #eaf2f8 100%) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body,
body#keycloak-bg {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ── Page wrapper ── */
.pf-v5-c-login,
.pf-c-login {
  min-height: unset !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  align-self: stretch !important;
  justify-content: flex-start !important;
  background: transparent !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

/* ── Logo: #kc-header IS the logo element ── */
#kc-header,
.login-pf-page-header {
  display: block !important;
  align-self: center !important;
  width: 400px !important;
  height: 120px !important;
  margin: 0 auto 2rem auto !important;
  padding: 0 !important;
  position: static !important;
  top: auto !important;
  left: auto !important;
  float: none !important;
  transform: translateX(-10px) !important;
  background: transparent url("../img/logo.png") center center / contain no-repeat !important;
  background-clip: content-box !important;
  -webkit-background-clip: content-box !important;
  z-index: 2 !important;
  opacity: 0.9 !important;
  mix-blend-mode: multiply !important;
  filter: none !important;
}

/* Hide the inner text wrapper – logo is on #kc-header itself */
#kc-header-wrapper {
  display: none !important;
}

/* ── PatternFly login header (actual logo location in keycloak.v2) ── */
.pf-v5-c-login__header,
.pf-c-login__header {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  width: 100% !important;
  margin-bottom: 2.75rem !important;
  padding: 0 !important;
}

.pf-v5-c-login__header-brand,
.pf-c-login__header-brand {
  display: block !important;
  margin: 0 auto !important;
  text-align: center !important;
}

.pf-v5-c-brand,
.pf-c-brand {
  display: block !important;
  margin: 0 auto !important;
  max-height: 126px !important;
  width: auto !important;
  opacity: 0.9 !important;
  mix-blend-mode: multiply !important;
  filter: none !important;
}

/* ── Card container ──
   PatternFly's patternfly.min.css switches .pf-v5-c-login__container to
   display:grid with grid-template-areas:"main header" at >=1200px (its
   built-in split-screen login layout) — that's what was putting the logo
   beside the card instead of above it. Force single-column stacking at
   every width, and explicitly clear the grid-area assignments PatternFly
   put on the header/main children so nothing lingers if display:grid
   ever wins a property fight again. */
html body .pf-v5-c-login__container,
html body .pf-c-login__container {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  grid-template-areas: none !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  width: 624px !important;
  max-width: 92vw !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 1rem !important;
}

html body .pf-v5-c-login__header,
html body .pf-c-login__header,
html body #kc-header,
html body .pf-v5-c-login__main,
html body .pf-c-login__main,
html body .pf-v5-c-login__footer,
html body .pf-c-login__footer {
  grid-area: auto !important;
}

@media (min-width: 1200px) {
  html body .pf-v5-c-login__container,
  html body .pf-c-login__container {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* ── Card ── */
.pf-v5-c-login__main,
.pf-c-login__main {
  width: 100% !important;
  max-width: 624px !important;
  margin: 0 auto !important;
  background: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  border-radius: 16px !important;
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.06),
    0 0 1px rgba(15, 23, 42, 0.04) !important;
}

/* ── Card header ── */
.pf-v5-c-login__main-header,
.pf-c-login__main-header {
  text-align: center !important;
  padding: 1.15rem 1.2rem 0.35rem !important;
}

.pf-v5-c-login__main-header h1,
.pf-c-login__main-header h1,
#kc-page-title {
  font-size: 1.05rem !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  margin: 0 !important;
}

/* ── Card body ── */
.pf-v5-c-login__main-body,
.pf-c-login__main-body {
  padding: 1rem 1.15rem 1.15rem !important;
}

/* ── Form ── */
.pf-v5-c-form,
.pf-c-form,
#kc-form-login {
  width: 100% !important;
}

.pf-v5-c-form__group,
.pf-c-form__group {
  margin-bottom: 0.95rem !important;
}

label,
.pf-v5-c-form__label-text,
.pf-c-form__label-text {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: #475569 !important;
}

/* ── Inputs ──
   keycloak.v2 now wraps the <input> in a <span class="pf-v5-c-form-control">
   with no class on the input itself. Style the span as the visible box
   and make the input a transparent fill so they don't double-render. */
.pf-v5-c-form-control,
.pf-c-form-control {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #f8fafc !important;
  border: 1px solid #dbe4f0 !important;
  border-radius: 10px !important;
  min-height: 42px !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.pf-v5-c-form-control input,
.pf-c-form-control input,
input[type="text"],
input[type="password"],
input[type="email"] {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: none !important;
  border-radius: 10px !important;
  min-height: 42px !important;
  padding: 0.58rem 0.8rem !important;
  font-size: 0.94rem !important;
  color: #0f172a !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.pf-v5-c-form-control:focus-within,
.pf-c-form-control:focus-within {
  border-color: #253993 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(37, 57, 147, 0.12) !important;
}

/* Neutralize the browser/password-manager autofill highlight
   (this, not our own CSS, is what's painting the grey fill). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:autofill {
  -webkit-text-fill-color: #0f172a !important;
  caret-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0 1000px #f8fafc inset !important;
  box-shadow: 0 0 0 1000px #f8fafc inset !important;
  transition: background-color 9999s ease-in-out 0s !important;
}

/* ── Password group ── */
.pf-v5-c-input-group,
.pf-c-input-group,
.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after,
.pf-c-form-control::before,
.pf-c-form-control::after {
  box-shadow: none !important;
}

.pf-v5-c-input-group,
.pf-c-input-group {
  display: flex !important;
  align-items: stretch !important;
  width: 100% !important;
  border: 1px solid #dbe4f0 !important;
  border-radius: 10px !important;
  background: #f8fafc !important;
  overflow: hidden !important;
}

.pf-v5-c-input-group .pf-v5-c-form-control,
.pf-c-input-group .pf-c-form-control {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 42px !important;
}

.pf-v5-c-input-group__item,
.pf-c-input-group__item {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.pf-v5-c-button.pf-m-control,
.pf-c-button.pf-m-control {
  background: transparent !important;
  border: none !important;
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 0 0.75rem !important;
  color: #475569 !important;
  box-shadow: none !important;
}

/* ── Primary button ── */
.pf-v5-c-button.pf-m-primary,
.pf-c-button.pf-m-primary,
.btn-primary {
  width: 100% !important;
  min-height: 42px !important;
  border-radius: 10px !important;
  background: #253993 !important;
  border: 1px solid #253993 !important;
  color: #ffffff !important;
  font-size: 0.94rem !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.pf-v5-c-button.pf-m-primary:hover,
.pf-c-button.pf-m-primary:hover,
.btn-primary:hover {
  background: #1c2446 !important;
  border-color: #1c2446 !important;
}

/* ── OTP ── */
input[id*="otp"],
input[name*="otp"],
input[id*="totp"],
input[name*="totp"] {
  text-align: center !important;
  letter-spacing: 0.32em !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 0.96rem !important;
}

/* ── Links ── */
a,
#kc-content a,
.pf-v5-c-login__main-footer a,
.pf-c-login__main-footer a {
  color: #253993 !important;
}

a:hover {
  color: #1c2446 !important;
}

/* ── Errors ── */
.pf-v5-c-alert.pf-m-danger,
.pf-c-alert.pf-m-error,
.alert-error {
  background: rgba(239, 68, 68, 0.06) !important;
  border: 1px solid rgba(239, 68, 68, 0.28) !important;
  border-radius: 8px !important;
  color: #dc2626 !important;
  font-size: 0.84rem !important;
}

/* ── Footer ── */
.pf-v5-c-login__main-footer,
.pf-c-login__main-footer {
  background: transparent !important;
  color: #64748b !important;
  font-size: 0.82rem !important;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  body {
    padding: 1.5rem 0 !important;
    justify-content: flex-start !important;
  }

  #kc-header,
  .login-pf-page-header {
    width: 240px !important;
    height: 72px !important;
    margin: 0 auto 1.5rem auto !important;
    transform: translateX(-6px) !important;
  }

  .pf-v5-c-login__container,
  .pf-c-login__container {
    width: 92vw !important;
    max-width: 92vw !important;
  }

  .pf-v5-c-login__main,
  .pf-c-login__main {
    max-width: 92vw !important;
  }
}

/* ── Total Audit additions ── */
html, body, input, button, label { font-family: "Lato", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif !important; }
#kc-header, .login-pf-page-header { width: 300px !important; height: 80px !important; transform: none !important; }
.pf-v5-c-login__main-header h1, #kc-page-title { color: #1c2446 !important; font-size: 1.15rem !important; }
/* QR / authenticator setup page */
#kc-totp-secret-qr-code { display: block; margin: 0.75rem auto; border: 1px solid #e2e8f0; border-radius: 12px; padding: 8px; background: #fff; }
#kc-totp-settings li, #kc-totp-settings p { font-size: 0.86rem; color: #475569; }
