/*
 * VPRO login screen layout for the Keycloak 26 keycloak.v2 login theme.
 * Shared brand tokens and controls live in base.css.
 */
.pf-v5-c-login__container {
  /* these custom properties override layout stuff on larger screens, because we don't want that */
  --pf-v5-c-login__container--xl--GridTemplateColumns: 1fr;
  --pf-v5-c-login__container--PaddingLeft:0;
  --pf-v5-c-login__container--PaddingRight: 0;

  max-width: var(--vpro-panel-width);
  margin-inline: 2rem;
  background: var(--vpro-surface);
  grid-template-areas:
    "header"
    "main";
}

/* Hides the header because it only says 'vpro-publiek*/
.pf-v5-c-login__header {
  display: none;
}

/* the main div containing all content */
.pf-v5-c-login__main {
  display: flex;
  flex-direction: column;
  box-shadow:none;
  margin-block-end: 0;
}

.pf-v5-c-login__main-header {
  order: 2; /* make it come after the .vpro-login-intro (that lives in the footer) and gets order: 1 */
  padding-block: var(--vpro-panel-gutter-block) 0;
  padding-inline: var(--vpro-panel-gutter-inline);
  border-top: 0;
  background: var(--vpro-surface);

  #kc-page-title {
    margin-block-end: 0.5rem;
  }
}

.pf-v5-c-login__main:has(.vpro-login-intro) .pf-v5-c-login__main-header {
  padding-top: 0;
}

/* The intro is emitted by the supported footer hook, then visually ordered above the built-in page title. */
.pf-v5-c-login__main:has(.vpro-login-intro) #kc-page-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.pf-v5-c-login__main-body {
  order: 3;
  padding: 1rem var(--vpro-panel-gutter-inline);
  background: var(--vpro-surface);
}


.pf-v5-c-login__main-footer {
  background: var(--vpro-surface);
}

.pf-v5-c-button.pf-m-primary {
  min-height: var(--vpro-button-height);
  padding-block: 10px;
  font-weight: 500;
}

/* The section that says 'Geen account? Registreren)*/
#kc-info {
  padding: 22px 0 24px;
  text-align: left;

  a {
    text-decoration: underline;
  }
}


/* --- RESET PASSSWORD PAGE */
body[data-page-id="login-login-reset-password"] {
 .pf-v5-c-login__main-body {
    display: flex;
    flex-direction: column;
  }

  #kc-reset-password-form {
    order: 2; 
  }

  #kc-info {
    order: 1; /* in the source order the info comes after the form, we want it before */
    padding: 0;
    margin-block-end: .5rem;
  }
}


/* Override default Keycloak password toggle styles to match VPRO theme. */
.pf-v5-c-login__main > .pf-v5-c-login__main-footer:last-child,
.vpro-login-footer-content {
  display: contents;
}

.vpro-login-intro {
  order: 1;
  padding: var(--vpro-panel-gutter-block) var(--vpro-panel-gutter-inline);
  background: var(--vpro-surface);
}

.vpro-login-intro-title {
  margin: 0 0 12px;
  color: var(--vpro-heading);
  font-family: var(--vpro-font-heading);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.vpro-login-intro-text {
  max-width: 42rem;
  margin: 0;
  color: var(--vpro-text);
  font-family: var(--vpro-font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
}

.vpro-login-footer {
  order: 4;
  display: flex;
  justify-content: flex-end;
  padding: 8px var(--vpro-panel-gutter-inline) 28px;
  background: var(--vpro-surface);
}

.vpro-login-footer-logo {
  display: block;
  width: 126px;
  max-width: 40%;
  height: auto;
}


/* --- REGISTREREN PAGINA --- */

/* the 'verplichte velden' message a little less in your face */
[data-page-id="login-register"] {
  .subtitle {
    text-align: right;
    font-size: 15px;
    .pf-v5-c-form__label-required {
      color: var(--pf-v5-global--danger-color--100);
    }
  }
}

.pf-v5-c-login__main-footer-band {
  border-top: none;
}

#kc-register-form {
  display: flex;
  flex-flow: row wrap;
  gap: 1.5rem 1rem;

  > * {
    order: 1;
    flex: 1 1 100%;
  }

  > #kc-form-buttons {
    order: 3;
  }

  > .pf-v5-c-form__group.pf-v5-c-login__main-footer-band {
    order: 2;
    white-space: nowrap;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: solid 1px black;
    text-align: center;
  }

  /* Somehow these buttons won't automagically flex the way we want, so we help them a little with this arbitrary media query */
  @media (min-width: 653px) {
    > #kc-form-buttons {
      flex-basis: var(--vpro-buttongroup-primary-button-width);
    }

    > .pf-v5-c-form__group.pf-v5-c-login__main-footer-band {
      flex-basis: var(--vpro-buttongroup-secondary-button-width);
    } 
  }
}

.terms-title {
  /* the termsTitle key does not except HTML, so we added the titel to the termsText with a <h1> and this className*/
  font-size: 18px;
  margin-bottom: 0.5rem;
}


/* --- WACHTWOORD VERGETEN PAGINA --- */

/* BUTTON-GROUP alignment */
.pf-v5-c-form__actions {  
  &.pf-v5-u-flex-wrap {
    flex-wrap: nowrap !important; /*override strongified */

    .pf-v5-c-button {
      &.pf-m-primary {
        order: 2;
      } 

      &.pf-m-secondary {
        order: 1;
        flex-basis: var(--vpro-buttongroup-secondary-button-width);
        border: solid 1px currentColor;
        display: flex;
        align-items: center;
        justify-content: center;

        &:after {
          content: none;
        }
      }
    }
  }
}

/* --- AUTHENTICATOR PAGINA --- */

/* BUTTON-GROUP alignment */
.pf-v5-c-form__actions {
  display: flex;
  flex-flow: row wrap;
  gap: 1rem;
  margin: 0;
  
  > * {
    flex: 1 0 100%;
  }

  .pf-v5-c-button {
    order: 1;
    flex-basis: var(--vpro-buttongroup-secondary-button-width);
    border: solid 1px black;
    margin: 0;

    &.pf-m-primary {
      order: 2;
      flex-basis: var(--vpro-buttongroup-primary-button-width);
 
      &:after {
        content: none;
      }
    }
  }
}

#kc-totp-settings {
  > li {
    margin-bottom: 1rem;
  }
}

#kc-totp-supported-apps {
  display: none; /* we don't want to show the list of supported apps, because any authenticator app is supposed to work. */
}

/* the png containing the QR code, nicer to have that on our lightgrey background */
#kc-totp-secret-qr-code {
  mix-blend-mode: multiply;
}

/* the code to fill out manually, if qr code scanning fails */
#kc-totp-secret-key {
    border: solid 1px black;
    display: block;
    padding: 1rem .5rem;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 24px;
    margin-block: 1rem;
    background: white;
    user-select: all;
}

/* the list with optional additional properties*/
ul:has(#kc-totp-type) {
  list-style: circle;
  list-style-position: inside;

  >li {
    margin-block: 0 .1rem;

    &::marker {
      margin-inline-end: 0.5rem;
    }
  }
}
