/* ===== THEME-PROOF LOGIN (works the same in light or dark) ===== */
:root {
  --org-bg-url: url("../img/bg-default.png");
  --org-logo-url: url("../img/logo-default.png");
  --org-primary: #3E0ACC;
  --org-accent: #5C33FF;
  --org-glass: rgba(255,255,255,0.12);
}

/* Never inherit PF/browser color-scheme differences */
:is(html[data-pf-theme], html).login-pf {
  color-scheme: dark !important; /* lock rendering to a single scheme */
}

/* Global layout */
:is(html[data-pf-theme], html) body.login-pf {
  margin: 0 !important;
  min-height: 100vh !important;
  background: var(--org-bg-url) no-repeat center center fixed !important;
  background-size: cover !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: "Inter", "Segoe UI", sans-serif !important;
  color: #f5f6fa !important;
}

/* Background blur layer */
:is(html[data-pf-theme], html).login-pf::before,
:is(html[data-pf-theme], html).login-pf body::before {
  content: "" !important;
  position: fixed !important;
  inset: 0 !important;
  background-image: var(--org-bg-url) !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  background-position: center center !important;
  background-attachment: fixed !important;
  filter: blur(13px) !important;
  transform: scale(1.05) !important;
  z-index: 0 !important;
}

/* PF container normalization */
:is(html[data-pf-theme], html) .pf-v5-c-login__container {
  position: relative !important;
  z-index: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  grid-template-areas: none !important;
  grid-template-columns: none !important;
  padding: 0 !important;
  margin: 0 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 0 !important;
}

/* Remove PF header/footer visuals */
:is(html[data-pf-theme], html) .pf-v5-c-login__header,
:is(html[data-pf-theme], html) .pf-v5-c-login__footer {
  display: none !important;
}

/* Main login “card” */
:is(html[data-pf-theme], html) .pf-v5-c-login__main {
  position: relative !important;
  z-index: 1 !important;
  margin: 0 auto !important;
  justify-content: center !important;
  align-items: center !important;
  width: 500px !important;
  border-radius: 15px !important;
  backdrop-filter: blur(14px) !important;
  background-color: rgba(38, 41, 45, 0.70) !important; /* fixed color */
}

/* Header / logo */
:is(html[data-pf-theme], html) .kc-header-container {
  text-align: center !important;
  margin-bottom: 2rem !important;
}

:is(html[data-pf-theme], html) #kc-org-logo {
  background-image: var(--org-logo-url) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  height: 80px !important;
  width: 260px !important;
  margin: 0 auto 1rem !important;
}
:is(html[data-pf-theme], html) #kc-org-logo span { display: none !important; }

:is(html[data-pf-theme], html) #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;
  color: #fff !important;
}

/* Hide the realm title below logo consistently */
:is(html[data-pf-theme], html) #kc-header-wrapper {
  display: none !important;
}

/* Form card wrapper */
:is(html[data-pf-theme], html) .kc-form-card {
  border-radius: 18px !important;
  width: 100% !important;
  max-width: 420px !important;
  padding: 2.5rem !important;
}

/* Neutralize PF input wrapper (both class variants) */
:is(html[data-pf-theme], html) .pf-v5-c-form-control,
:is(html[data-pf-theme], html) .pf-c-form-control {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  --pf-v5-c-form-control--after--BorderBottomWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderBottomColor: transparent !important;
}

.pf-v5-c-form-control:before {
    border-style: none !important;
}

/* Inputs */
:is(html[data-pf-theme], html) .kc-form-card input[type="text"],
:is(html[data-pf-theme], html) .kc-form-card input[type="password"],
:is(html[data-pf-theme], html) .kc-form-card input[type="email"] {
  width: 100% !important;
  padding: 0.75rem 1rem !important;
  margin-bottom: 0 !important; /* spacing handled by group */
  border: 1px solid rgba(255,255,255,0.18) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.08) !important;
  color: #fff !important;
  font-size: 1rem !important;
  transition: border-color .25s ease, background .25s ease !important;
}
:is(html[data-pf-theme], html) .kc-form-card input:focus {
  outline: none !important;
  border-color: var(--org-accent) !important;
  background: rgba(255,255,255,0.14) !important;
}

/* Group spacing (instead of per-input margins) */
:is(html[data-pf-theme], html) .kc-form-card .pf-v5-c-form__group {
  margin-bottom: 1rem !important;
}

/* Buttons */
:is(html[data-pf-theme], html) .kc-form-card button,
:is(html[data-pf-theme], html) .kc-form-card input[type="submit"],
:is(html[data-pf-theme], html) button#kc-login {
  width: 100% !important;
  padding: 0.85rem !important;
  margin-top: 0.5rem !important;
  border: none !important;
  border-radius: 10px !important;
  background-color: var(--org-primary) !important;
  color: #fff !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background-color 0.3s ease, transform 0.1s ease !important;
}
:is(html[data-pf-theme], html) .kc-form-card button:hover,
:is(html[data-pf-theme], html) .kc-form-card input[type="submit"]:hover,
:is(html[data-pf-theme], html) button#kc-login:hover {
  background-color: var(--org-accent) !important;
  transform: translateY(-1px) !important;
}

/* Hide PF control-style extra button if present */
:is(html[data-pf-theme], html) button.pf-v5-c-button.pf-m-control {
  display: none !important;
}

/* Footer/registration area (hidden) */
:is(html[data-pf-theme], html) #kc-registration-container {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  :is(html[data-pf-theme], html) .kc-form-card {
    margin: 0 1rem !important;
    padding: 2rem 1.5rem !important;
  }
  :is(html[data-pf-theme], html) #kc-org-logo {
    width: 200px !important;
    height: 70px !important;
  }
}
