/*
 * What is particular to the Keycloak login theme. The look itself comes from the shared
 * fonts.css, tokens.css and components.css (generated from libs/design-tokens, KUNPORT-2523),
 * the same files the registration pages and the onboarding use.
 */

/* ------------------------------------------------------------- frame */

html,
body {
  margin: 0;
  padding: 0;
}

.kc-card__header {
  display: flex;
  flex-direction: column;
}

.kc-card__header .mr-lead:empty {
  display: none;
}

.kc-required-hint {
  margin-top: var(--mr-space-2);
}

.kc-username {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mr-space-2) var(--mr-space-3);
  margin-bottom: var(--mr-space-4);
  padding: var(--mr-space-2) var(--mr-space-4);
  border-radius: var(--mr-radius-pill);
  background: var(--mr-surface-deep);
  font-size: 14px;
  line-height: 21px;
  color: var(--mr-text);
}

.kc-alert-text {
  flex: 1;
}

.kc-social-icons {
  display: flex;
  gap: var(--mr-space-3);
}

/* The social icons are white glyphs; darken them for the light footer. */
.kc-social-icons img {
  display: block;
  width: 20px;
  height: 20px;
  filter: brightness(0) opacity(0.55);
}

.kc-disclaimer {
  flex-basis: 100%;
  margin: 0;
}

/* -------------------------------------------------------- login page */

.kc-login {
  display: flex;
  flex-direction: column;
  gap: var(--mr-space-5);
}

.kc-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--mr-space-3);
}

.kc-forgot-password {
  font-size: 14px;
  line-height: 21px;
}

.kc-register {
  text-align: center;
}

.kc-divider {
  display: flex;
  align-items: center;
  gap: var(--mr-space-3);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mr-text-muted);
}

.kc-divider::before,
.kc-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--mr-border-subtle);
}

.kc-social-links {
  display: flex;
  flex-direction: column;
  gap: var(--mr-space-3);
}

.kc-webshop {
  padding: var(--mr-space-4) var(--mr-space-5);
  border-radius: var(--mr-radius-md);
  background: var(--mr-surface-deep);
  display: flex;
  flex-direction: column;
  gap: var(--mr-space-1);
}

.kc-webshop__title {
  margin: 0;
  font-size: 14px;
  line-height: 21px;
  font-weight: 600;
  color: var(--mr-text);
}

/* ------------------------------------- base templates, forms, password */

/* Keycloak's base pages (e.g. the profile step, ADR-0068) still emit a few wrappers. */
.kc-form-options,
.kc-form-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--mr-space-3);
  font-size: 14px;
}

.kc-form-options a,
.kc-info a,
.instruction a {
  color: var(--mr-link);
  font-weight: 500;
  text-decoration: none;
}

.kc-form-options a:hover,
.kc-info a:hover,
.instruction a:hover {
  text-decoration: underline;
}

.kc-info {
  font-size: 14px;
  line-height: 21px;
  color: var(--mr-text-secondary);
}

.instruction {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: var(--mr-text-secondary);
}

.mr-card form {
  display: flex;
  flex-direction: column;
  gap: var(--mr-space-5);
}

.mr-card #kc-select-try-another-way-form {
  gap: 0;
  font-size: 14px;
}

/* update-password: the input with its visibility toggle. */
.password-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrapper .mr-input {
  padding-right: 48px;
}

.password-visibility-icon {
  position: absolute;
  right: var(--mr-space-4);
  width: 18px;
  height: 18px;
  color: var(--mr-text-muted);
  cursor: pointer;
}

.password-visibility-icon:hover {
  color: var(--mr-text);
}

.password-policy-box {
  padding: var(--mr-space-4) var(--mr-space-5);
  border-radius: var(--mr-radius-md);
  background: var(--mr-surface-deep);
}

.password-policy-title {
  margin: 0 0 var(--mr-space-2);
  font-size: 14px;
  line-height: 21px;
  font-weight: 600;
  color: var(--mr-text);
}

.password-policy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--mr-space-1);
}

.password-policy-item {
  display: flex;
  align-items: center;
  gap: var(--mr-space-2);
  font-size: 14px;
  line-height: 21px;
  color: var(--mr-text-secondary);
}

.password-policy-item .policy-icon {
  color: var(--mr-text-muted);
}

.password-policy-item.satisfied,
.password-policy-item.satisfied .policy-icon {
  color: var(--mr-success-fg);
}

.password-policy-item.unsatisfied,
.password-policy-item.unsatisfied .policy-icon {
  color: var(--mr-danger);
}

/* The user-profile form of the base theme groups fields in divs of its own. */
#kc-update-profile-form > div,
#kc-idp-review-profile-form > div {
  display: flex;
  flex-direction: column;
  gap: var(--mr-space-2);
}

/* ------------------------------------------------------ terms, info */

#kc-terms-text {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--mr-space-4) var(--mr-space-5);
  border: 1px solid var(--mr-border-subtle);
  border-radius: var(--mr-radius-md);
  font-size: 14px;
  line-height: 21px;
  color: var(--mr-text-secondary);
}

#kc-terms-text h1,
#kc-terms-text h2 {
  font-size: 16px;
  line-height: 24px;
  color: var(--mr-text);
}

#kc-terms-text ul {
  padding-inline-start: var(--mr-space-6);
  list-style-type: disc;
}

.terms-heading {
  font-weight: 600;
  color: var(--mr-text);
}

.kc-status-icon {
  margin-bottom: calc(var(--mr-space-1) * -1);
}

@media (max-width: 640px) {
  #kc-terms-text {
    max-height: 50vh;
  }
}
