/* Move2Cloud sign-in pages. Loaded after Keycloak's own stylesheet, which it only restyles:
   the markup of the pages is Keycloak's, untouched, so upgrades keep working.
   A product theme overrides the variables below in its brand.css. */

@font-face {
  font-family: "Poppins";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  --m2c-font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --m2c-accent: #0d41e1;
  --m2c-accent-hover: #0a34b8;
  --m2c-page: #f5f7fb;
  --m2c-page-image: none;
  --m2c-surface: #ffffff;
  --m2c-text: #182641;
  --m2c-text-secondary: #55647b;
  --m2c-border: #dfe6f2;
  --m2c-control-border: #cfd9e8;
  --m2c-card-radius: 24px;
  --m2c-control-radius: 9px;
  --m2c-card-shadow: 0 16px 44px -28px rgba(24, 55, 104, 0.28);
  --m2c-logo: url("../img/logo-move2cloud-blue.svg");
  /* The product named under the logo; empty for none. */
  --m2c-product: "";

  /* Keycloak's own components read these. */
  --pf-v5-global--FontFamily--text: var(--m2c-font);
  --pf-v5-global--FontFamily--heading: var(--m2c-font);
  --pf-v5-global--primary-color--100: var(--m2c-accent);
  --pf-v5-global--primary-color--200: var(--m2c-accent-hover);
  --pf-v5-global--link--Color: var(--m2c-accent);
  --pf-v5-global--link--Color--hover: var(--m2c-accent-hover);
  --pf-v5-global--active-color--100: var(--m2c-accent);
  --pf-v5-global--Color--100: var(--m2c-text);
}

html,
body#keycloak-bg {
  min-height: 100vh;
  margin: 0;
  font-family: var(--m2c-font);
  color: var(--m2c-text);
  background: var(--m2c-page-image), var(--m2c-page);
  background-attachment: fixed;
}

/* The page: one card, centred. */
.pf-v5-c-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: none;
}

/* The card holds the logo and the form, as on the products' own sign-in pages. */
.pf-v5-c-login__container {
  display: block;
  width: 100%;
  position: relative;
  max-width: 420px;
  min-height: 0;
  padding: 36px 32px 28px;
  background: var(--m2c-surface);
  border: 1px solid var(--m2c-border);
  border-radius: var(--m2c-card-radius);
  box-shadow: var(--m2c-card-shadow);
}

.pf-v5-c-login__header {
  padding: 0;
  margin: 0 0 24px;
}

/* The realm's name is replaced by the logo; it stays in the page for screen readers. */
#kc-header-wrapper {
  display: block;
  min-height: 40px;
  padding: 0;
  font-size: 0;
  line-height: 0;
  text-align: left;
  text-transform: none;
  color: transparent;
  background: var(--m2c-logo) left top / auto 40px no-repeat;
}
/* The product's name under the logo, for the themes that set one. */
#kc-header-wrapper::after {
  content: var(--m2c-product);
  display: none;
  padding-top: 54px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--m2c-text-secondary);
}

.pf-v5-c-login__main {
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.pf-v5-c-login__main-header,
.pf-v5-c-login__main-body,
.pf-v5-c-login__main-footer {
  padding-left: 0;
  padding-right: 0;
}
.pf-v5-c-login__main-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 0;
  padding-bottom: 20px;
  border: 0;
}
.pf-v5-c-login__main-body {
  padding-top: 0;
  padding-bottom: 8px;
}

#kc-page-title,
.pf-v5-c-title {
  font-family: var(--m2c-font);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--m2c-text);
}

/* Fields */
.pf-v5-c-form {
  gap: 16px;
}
.pf-v5-c-form__label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--m2c-text);
}
.pf-v5-c-form-control {
  --pf-v5-c-form-control--BorderRadius: var(--m2c-control-radius);
  border-radius: var(--m2c-control-radius);
}
.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after {
  border-radius: var(--m2c-control-radius);
  border-color: var(--m2c-control-border);
}
.pf-v5-c-form-control {
  /* Light fields on the white card, even when the device asks for a dark appearance. */
  --pf-v5-c-form-control--BackgroundColor: #fff;
  background-color: #fff;
  color-scheme: light;
}
.pf-v5-c-form-control > input,
.pf-v5-c-form-control > select {
  background-color: #fff;
  font-family: var(--m2c-font);
  font-size: 14px;
  color: var(--m2c-text);
  padding-top: 11px;
  padding-bottom: 11px;
  border-radius: var(--m2c-control-radius);
}
.pf-v5-c-form-control:focus-within::after {
  border-color: var(--m2c-accent);
}
.pf-v5-c-input-group {
  gap: 8px;
}
.pf-v5-c-input-group .pf-v5-c-button.pf-m-control {
  border-radius: var(--m2c-control-radius);
  color: var(--m2c-text-secondary);
}
.pf-v5-c-input-group .pf-v5-c-button.pf-m-control::after {
  border-radius: var(--m2c-control-radius);
  border-color: var(--m2c-control-border);
}

input.pf-v5-c-form-control {
  font-family: var(--m2c-font);
  font-size: 14px;
  color: var(--m2c-text);
  padding: 11px 12px;
  border: 1px solid var(--m2c-control-border);
  border-radius: var(--m2c-control-radius);
}
input.pf-v5-c-form-control:focus {
  outline: 2px solid var(--m2c-accent);
  outline-offset: -1px;
}

/* Buttons */
.pf-v5-c-button {
  font-family: var(--m2c-font);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--m2c-control-radius);
}
.pf-v5-c-button::after {
  border-radius: var(--m2c-control-radius);
}
.pf-v5-c-button.pf-m-primary {
  --pf-v5-c-button--m-primary--BackgroundColor: var(--m2c-accent);
  --pf-v5-c-button--m-primary--hover--BackgroundColor: var(--m2c-accent-hover);
  --pf-v5-c-button--m-primary--focus--BackgroundColor: var(--m2c-accent-hover);
  --pf-v5-c-button--m-primary--active--BackgroundColor: var(--m2c-accent-hover);
  padding-top: 11px;
  padding-bottom: 11px;
}
.pf-v5-c-button.pf-m-link,
a {
  color: var(--m2c-accent);
}

/* Links under the form: "no account yet", "back to sign-in". */
.pf-v5-c-login__main-footer {
  padding-top: 8px;
  padding-bottom: 0;
}
.pf-v5-c-login__main-footer-band {
  padding: 16px 0 0;
  margin-top: 8px;
  background: none;
  border-top: 1px solid var(--m2c-border);
  font-size: 13px;
  color: var(--m2c-text-secondary);
  text-align: center;
}
.pf-v5-c-helper-text__item-text,
#kc-registration,
#kc-info-wrapper {
  font-size: 13px;
  color: var(--m2c-text-secondary);
}

/* Language choice: small, in the corner of the card, level with the logo. */
.pf-v5-c-login__main-header-utilities {
  position: absolute;
  top: 40px;
  right: 32px;
  width: auto;
}
/* Narrow enough to leave the product's name its line beside the logo. */
.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control,
#login-select-toggle {
  width: 104px;
  min-width: 0;
}
.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control > select {
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 12px;
}
/* The languages as flags (js/locale-flags.js), the current one framed. */
.m2c-locale-flags {
  display: flex;
  gap: 6px;
}
.m2c-locale-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  opacity: 0.75;
  transition: opacity 0.15s, border-color 0.15s, background-color 0.15s;
}
.m2c-locale-flag svg {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.m2c-locale-flag:hover,
.m2c-locale-flag:focus-visible {
  opacity: 1;
  background-color: rgba(15, 23, 42, 0.04);
}
.m2c-locale-flag[aria-current="true"] {
  opacity: 1;
  border-color: var(--m2c-border, #e2e8f0);
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* Messages */
.pf-v5-c-alert {
  border-radius: var(--m2c-control-radius);
  box-shadow: none;
}

@media (max-width: 480px) {
  .pf-v5-c-login__container {
    padding: 28px 20px 22px;
    border-radius: 18px;
  }
  .pf-v5-c-login__main-header-utilities {
    top: 32px;
    right: 20px;
  }
  #kc-header-wrapper {
    background-size: auto 34px;
  }
}

/* ── Two-factor setup and first password: short enough to fit on a screen ──
   The apps are named in the first step: their list goes. The code is smaller, the steps closer.
   "Sign out from other devices" means nothing to someone who has just been given an account. */
#kc-totp-supported-apps { display: none; }
#kc-totp-settings { margin-bottom: 12px; }
#kc-totp-settings > li { margin-bottom: 6px; }
#kc-totp-secret-qr-code { display: block; width: 148px; height: 148px; margin: 8px auto 0; }
#kc-totp-settings #mode-manual, #kc-totp-settings #mode-barcode { display: inline-block; margin-top: 4px; font-size: 14px; }
#kc-totp-settings-form .pf-v5-c-form__group { margin-bottom: 12px; }
#kc-form-options:has(#logout-sessions) { display: none; }

/* The product's logo and name, a link to its front page (js/home-link.js): the header as it was. */
a.m2c-home-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}
a.m2c-home-link:focus-visible {
  outline: 2px solid var(--m2c-accent, #2563eb);
  outline-offset: 4px;
}

/* "Forgot Password?" has sent its e-mail (login.ftl): the words, then the way back, apart. */
#kc-email-sent { display: grid; gap: 24px; }
#kc-email-sent p { margin: 0; }

/* Signing out (Keycloak's logout-confirm.ftl): the question, the button, then the way back, apart. */
#kc-logout-confirm .instruction { margin: 0 0 20px; }
#kc-logout-confirm #kc-info-message p { margin: 16px 0 0; }
