/* =========================================================================
   Hawk IVO login theme (id hawkintech)

   This file carries the whole design of the login pages. It has the same
   name as the stylesheet of the stock Keycloak theme (css/login.css), so
   Keycloak resolves that name to this file and the stock one never loads:
   nothing here layers on top of it, and nothing here may rely on it. What
   the browser loads besides this file is the common PatternFly of the
   parent theme (form controls, dropdown, alerts) and Bootstrap 3 that
   comes with PatternFly 3 - both are neutralised below where they would
   decide the layout.

   Palette from the getaiplan corporate design (Corporatedesign.Model.js).
   ========================================================================= */

/* Open Sans = corporate UI font, self-hosted (no external request to Google -
   keeps the login page GDPR-clean). Variable woff2 covers weights 300-800. */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/open-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/open-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --hawk-primary: #001953;          /* corporate primary / navy */
  --hawk-primary-hover: #00103a;
  --hawk-accent: #2440e0;           /* brighter blue from the hawk gradient */
  --hawk-accent-soft: rgba(36, 64, 224, 0.12);
  --hawk-text: #0d1b3e;
  --hawk-muted: #5a6b8c;
  --hawk-line: #dce3f2;
  --hawk-field-bg: #f7f9fe;
  --hawk-danger: #b3261e;
  --hawk-success: #1e7f4f;
  --hawk-warning: #9a6200;
  --hawk-card-bg: #ffffff;
  --hawk-radius: 20px;
  --hawk-radius-sm: 10px;
  --hawk-font: 'Open Sans', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --hawk-shadow: 0 24px 64px rgba(0, 8, 35, 0.45), 0 2px 8px rgba(0, 8, 35, 0.25);
  color-scheme: light;
}

/* =========================================================================
   Page and background
   ========================================================================= */

/* PatternFly puts a photo behind ".login-pf"; the page brings its own. */
.login-pf,
html.login-pf {
  background: none;
  height: 100%;
}

.login-pf body,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--hawk-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--hawk-text);
  background-color: #04123c;
  background-image:
    radial-gradient(60rem 40rem at 12% -10%, rgba(59, 108, 255, 0.55) 0%, rgba(59, 108, 255, 0) 60%),
    radial-gradient(48rem 38rem at 92% 8%, rgba(0, 199, 255, 0.28) 0%, rgba(0, 199, 255, 0) 62%),
    radial-gradient(52rem 46rem at 78% 108%, rgba(84, 46, 214, 0.42) 0%, rgba(84, 46, 214, 0) 58%),
    linear-gradient(160deg, #123ac4 0%, #06196e 48%, #04102f 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

/* The page is one centred column: brand, card, and nothing that floats. */
.login-pf-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 16px 56px;
  box-sizing: border-box;
}

/* Bootstrap 3 grid classes sit on nearly every wrapper of the stock
   templates and would float them into columns. The card is one column. */
.login-pf-page [class*="col-xs-"],
.login-pf-page [class*="col-sm-"],
.login-pf-page [class*="col-md-"],
.login-pf-page [class*="col-lg-"] {
  float: none;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.login-pf-page .form-horizontal .form-group {
  margin-left: 0;
  margin-right: 0;
}

/* =========================================================================
   Brand above the card
   ========================================================================= */

#kc-header {
  text-align: center;
  padding: 0 0 20px;
  width: 100%;
}

#kc-header-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* The mark and wordmark of Hawk IVO Keystone: these pages serve the persons of every product, so they carry the
   identity provider's brand and not one product's. The wordmark SVG brings its own margin around the letters. */
#kc-header-wrapper::before {
  content: "";
  display: block;
  width: 72px;
  height: 72px;
  background: url("../img/hawk-ivo-keystone-icon.svg") no-repeat center center;
  background-size: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 8, 35, 0.55));
}

#kc-header-wrapper .hawk-wordmark {
  display: block;
  width: 190px;
  max-width: 70vw;
  height: auto;
}

/* =========================================================================
   Card
   ========================================================================= */

.login-pf-page .card-pf {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 34px 34px 38px;
  box-sizing: border-box;
  text-align: left;
  background: var(--hawk-card-bg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-top: none;
  border-radius: var(--hawk-radius);
  box-shadow: var(--hawk-shadow);
}

.login-pf-header {
  position: relative;
  margin: 0 0 22px;
}

h1#kc-page-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--hawk-primary);
  letter-spacing: -0.01em;
}

/* The person a form already knows, with the link back to the start. */
#kc-username {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--hawk-muted);
}

#kc-username label {
  margin: 0;
  font-weight: 600;
  color: var(--hawk-text);
}

#kc-username a {
  line-height: 0;
}

.kc-login-tooltip .kc-tooltip-text {
  display: none;
}

/* =========================================================================
   Language switcher, pinned to the top right of the window
   ========================================================================= */

#kc-locale {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  text-align: right;
}

#kc-locale-dropdown {
  position: relative;
  display: inline-block;
}

#kc-locale-dropdown button#kc-current-locale-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-family: var(--hawk-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#kc-locale-dropdown button#kc-current-locale-link:hover,
#kc-locale-dropdown button#kc-current-locale-link[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
}

/* A drawn chevron: the glyph U+2304 sits on the baseline of the font and hung
   below the label. Raised by a third of its size, the rotated square centers
   optically on the text. */
button#kc-current-locale-link::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

/* Opened by the menu script, which sets display:block on the list. */
#kc-locale ul {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 13rem;
  max-height: 17rem;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--hawk-line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 8, 35, 0.35);
  text-align: left;
}

#kc-locale ul li {
  margin: 0;
}

#kc-locale-dropdown a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--hawk-text);
  font-size: 14px;
  text-decoration: none;
}

#kc-locale-dropdown a:hover,
#kc-locale-dropdown a:focus {
  background: var(--hawk-accent-soft);
  color: var(--hawk-primary);
}

/* =========================================================================
   Messages
   ========================================================================= */

.pf-c-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--hawk-line);
  border-left: 4px solid var(--hawk-muted);
  border-radius: var(--hawk-radius-sm);
  background: var(--hawk-field-bg);
}

.pf-c-alert .pf-c-alert__icon {
  line-height: 1.4;
}

.pf-c-alert .pf-c-alert__title {
  font-size: 14px;
  line-height: 1.45;
  color: var(--hawk-text);
}

.pf-c-alert.pf-m-danger {
  border-left-color: var(--hawk-danger);
  background: #fdf3f2;
}

.pf-c-alert.pf-m-danger .pf-c-alert__icon {
  color: var(--hawk-danger);
}

.pf-c-alert.pf-m-success {
  border-left-color: var(--hawk-success);
  background: #f1faf5;
}

.pf-c-alert.pf-m-success .pf-c-alert__icon {
  color: var(--hawk-success);
}

.pf-c-alert.pf-m-warning {
  border-left-color: var(--hawk-warning);
  background: #fdf7ec;
}

.pf-c-alert.pf-m-warning .pf-c-alert__icon {
  color: var(--hawk-warning);
}

.pf-c-alert.pf-m-info {
  border-left-color: var(--hawk-accent);
  background: #f2f5ff;
}

.pf-c-alert.pf-m-info .pf-c-alert__icon {
  color: var(--hawk-accent);
}

/* =========================================================================
   Form
   ========================================================================= */

#kc-content,
#kc-content-wrapper {
  width: 100%;
}

.login-pf-page .form-group {
  margin: 0 0 18px;
}

.login-pf-page label,
.pf-c-form__label,
.pf-c-form__label-text {
  display: block;
  margin: 0 0 6px;
  font-family: var(--hawk-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--hawk-text);
}

.login-pf-page p,
p.instruction,
#kc-second-factor-description,
#kc-email-otp-description {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--hawk-muted);
}

.login-pf-page .pf-c-form-control,
#kc-content input[type="text"],
#kc-content input[type="password"],
#kc-content input[type="email"],
#kc-content input[type="tel"],
#kc-content textarea,
#kc-content select {
  box-sizing: border-box;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--hawk-line);
  border-radius: var(--hawk-radius-sm);
  background: var(--hawk-field-bg);
  font-family: var(--hawk-font);
  font-size: 15px;
  color: var(--hawk-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

#kc-content textarea.pf-c-form-control {
  height: auto;
  padding: 12px 14px;
}

.login-pf-page .pf-c-form-control:hover {
  border-color: #c3cee6;
}

.login-pf-page .pf-c-form-control:focus,
#kc-content input:focus,
#kc-content textarea:focus,
#kc-content select:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--hawk-accent);
  box-shadow: 0 0 0 3px var(--hawk-accent-soft);
}

/* The field a message points at. The selector carries an id because the rule
   for the fields above does too, through its second selector. */
#kc-content .pf-c-form-control[aria-invalid="true"],
#kc-content input[aria-invalid="true"] {
  border-color: var(--hawk-danger);
  background: #fdf6f5;
}

#kc-content .pf-c-form-control[aria-invalid="true"]:focus,
#kc-content input[aria-invalid="true"]:focus {
  border-color: var(--hawk-danger);
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.14);
}

.pf-c-form__helper-text.pf-m-error,
#input-error,
#input-error-email-code,
.login-pf-page .kc-feedback-text {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--hawk-danger);
}

/* Password field with the button that reveals it. The field selector carries
   the id of the field rule above, which otherwise keeps the field's own right
   border and rounded corners next to the button. */
.login-pf-page .pf-c-input-group {
  display: flex;
  align-items: stretch;
}

#kc-content .pf-c-input-group > .pf-c-form-control {
  flex: 1 1 auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.login-pf-page .pf-c-input-group > .pf-c-button.pf-m-control {
  flex: 0 0 auto;
  width: 46px;
  padding: 0;
  border: 1px solid var(--hawk-line);
  border-left: none;
  border-top-right-radius: var(--hawk-radius-sm);
  border-bottom-right-radius: var(--hawk-radius-sm);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: var(--hawk-field-bg);
  color: var(--hawk-muted);
  cursor: pointer;
}

/* PatternFly draws the border of a control button on its own, darker at the
   bottom; the button's border above is the one that matches the field. */
.login-pf-page .pf-c-input-group > .pf-c-button.pf-m-control::after {
  display: none;
}

.login-pf-page .pf-c-input-group > .pf-c-button.pf-m-control:hover {
  color: var(--hawk-primary);
  background: #eef2fb;
}

/* Field and button read as one control, also while the field has the focus. */
.login-pf-page .pf-c-input-group:focus-within > .pf-c-button.pf-m-control {
  border-color: var(--hawk-accent);
  background: #ffffff;
}

/* Remember me and the forgotten password, on one line. */
.login-pf-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 22px;
}

.login-pf-settings #kc-form-options,
.login-pf-settings .pf-c-form__group {
  width: auto;
  margin: 0;
}

/* Bootstrap pulls the box out of the text flow with a negative margin; here
   the box and its text are one row. */
#kc-form-options .checkbox {
  margin: 0;
}

#kc-form-options .checkbox label {
  padding-left: 0;
}

#kc-form-options .checkbox input[type="checkbox"] {
  position: static;
  margin-left: 0;
}

#kc-form-options .checkbox label,
.pf-c-check__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--hawk-muted);
}

#kc-form-options input[type="checkbox"],
.pf-c-check__input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--hawk-accent);
}

/* =========================================================================
   Buttons
   ========================================================================= */

.login-pf-page .pf-c-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--hawk-radius-sm);
  font-family: var(--hawk-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.login-pf-page .pf-c-button.pf-m-block,
.login-pf-page #kc-form-buttons .pf-c-button {
  width: 100%;
}

.login-pf-page .pf-c-button.pf-m-primary,
.login-pf-page input[type="submit"].pf-m-primary {
  background: linear-gradient(135deg, var(--hawk-accent) 0%, var(--hawk-primary) 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 35, 140, 0.35);
}

.login-pf-page .pf-c-button.pf-m-primary:hover {
  box-shadow: 0 14px 30px rgba(15, 35, 140, 0.42);
  transform: translateY(-1px);
}

.login-pf-page .pf-c-button.pf-m-primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(15, 35, 140, 0.32);
}

.login-pf-page .pf-c-button.btn-default {
  background: #ffffff;
  border-color: var(--hawk-line);
  color: var(--hawk-primary);
}

.login-pf-page .pf-c-button.btn-default:hover {
  background: var(--hawk-field-bg);
  border-color: #c3cee6;
}

.login-pf-page .pf-c-button:disabled,
.login-pf-page .pf-c-button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Several buttons below each other keep their distance. */
#kc-form-buttons .pf-c-button + .pf-c-button {
  margin-top: 10px;
}

#kc-form-buttons {
  margin: 0;
}

/* =========================================================================
   Links, footer of the card
   ========================================================================= */

.login-pf-page a {
  color: var(--hawk-accent);
  font-weight: 600;
  text-decoration: none;
}

.login-pf-page a:hover,
.login-pf-page a:focus {
  color: var(--hawk-primary);
  text-decoration: underline;
}

#kc-info,
#kc-registration-container,
#kc-select-try-another-way-form {
  margin: 22px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--hawk-line);
  text-align: center;
  font-size: 14px;
  color: var(--hawk-muted);
}

#kc-info-wrapper {
  background: none;
  border: none;
  padding: 0;
}

#kc-select-try-another-way-form .form-group {
  margin: 0;
}

/* =========================================================================
   Choosing an authenticator, and the second factor of the getaiplan realm
   ========================================================================= */

.select-auth-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.select-auth-box-parent {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--hawk-line);
  border-radius: 14px;
  background: var(--hawk-field-bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.select-auth-box-parent:hover {
  border-color: var(--hawk-accent);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 35, 140, 0.12);
}

.select-auth-box-icon {
  color: var(--hawk-accent);
}

.select-auth-box-headline {
  font-size: 15px;
  font-weight: 600;
  color: var(--hawk-primary);
}

.select-auth-box-desc {
  font-size: 13px;
  color: var(--hawk-muted);
}

.select-auth-box-arrow {
  margin-left: auto;
  color: var(--hawk-muted);
}

/* The chooser of the second factor ships plain radio buttons. */
#kc-second-factor-form .pf-c-form__group > div > div {
  margin-bottom: 10px;
}

#kc-second-factor-form input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0 10px 0 0;
  accent-color: var(--hawk-accent);
  vertical-align: middle;
}

#kc-second-factor-form input[type="radio"] + label {
  display: inline;
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  color: var(--hawk-text);
  cursor: pointer;
  vertical-align: middle;
}

/* A one-time code is read back digit by digit. */
#emailCode,
input[name="otp"],
input[name="totp"] {
  letter-spacing: 0.35em;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* Tiles of the one-time-password chooser. */
.pf-c-tile {
  border-radius: 14px;
  border: 1px solid var(--hawk-line);
}

/* Recovery codes. */
.kc-recovery-codes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 0;
  margin: 0 0 16px;
  list-style: none;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

/* =========================================================================
   Social and identity providers
   ========================================================================= */

.kc-social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--hawk-line);
  list-style: none;
}

.kc-social-links li {
  margin: 0;
}

.login-pf-page .kc-social-item {
  width: 100%;
  background: #ffffff;
  border-color: var(--hawk-line);
  color: var(--hawk-primary);
}

.login-pf-page .kc-social-item:hover {
  background: var(--hawk-field-bg);
  border-color: #c3cee6;
}

/* =========================================================================
   Narrow windows
   ========================================================================= */

@media (max-width: 575px) {
  .login-pf-page {
    padding: 72px 12px 40px;
  }

  .login-pf-page .card-pf {
    padding: 26px 20px 28px;
    border-radius: 16px;
  }

  #kc-header-wrapper::before {
    width: 60px;
    height: 60px;
  }

  #kc-header-wrapper .hawk-wordmark {
    width: 160px;
  }

  h1#kc-page-title {
    font-size: 20px;
  }

  #kc-locale ul {
    min-width: 11rem;
    max-height: 60vh;
  }
}

@media (max-height: 640px) {
  .login-pf-page {
    justify-content: flex-start;
  }
}

/* =========================================================================
   Accessibility
   ========================================================================= */

.login-pf-page :focus-visible {
  outline: 2px solid var(--hawk-accent);
  outline-offset: 2px;
}

#kc-locale :focus-visible {
  outline-color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .login-pf-page * {
    transition: none;
    animation: none;
  }

  .login-pf-page .pf-c-button:hover {
    transform: none;
  }
}
