@import url('./custom-font.css');
@import url('./overrides.css');

@font-face {
  font-family: "Font Awesome 6 Free";
  font-style: normal;
  font-weight: 900;
  src: url("../fonts/webfonts/fa-solid-900.woff2") format("woff2");
}

:root {
  --fen-blue: #004a98;
  --fen-blue-deep: #003a8f;
  --fen-text: #20242b;
  --fen-muted: #59616d;
  --fen-line: #cfd3da;
  --fen-login-bg: url('../img/bg1.jpg');
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}

#keycloak-bg {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0 !important;
  padding: 0 !important;
  background: #fff;
  color: var(--fen-text);
  overflow: hidden;
}

.fen-login {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.72fr);
  margin: 0 !important;
  padding: 0 !important;
  background: #fff;
  overflow: hidden;
}

.fen-login::before,
.fen-login::after {
  display: none !important;
}

.fen-login__media {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background-color: #003a8f;
  background-image:
    linear-gradient(90deg, rgba(0, 58, 143, 0.78) 0%, rgba(0, 58, 143, 0.38) 48%, rgba(0, 58, 143, 0.08) 100%),
    var(--fen-login-bg);
  background-position: center;
  background-size: cover;
}

.fen-login__media-logo {
  display: none;
  position: absolute;
  top: 30px;
  left: 32px;
  width: 142px;
  max-width: 36vw;
  height: auto;
}

.fen-login__panel {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 42px 56px 28px !important;
  margin: 0 !important;
  max-width: none !important;
  overflow-y: auto;
  grid-template-columns: none !important;
  grid-template-areas: none !important;
}

.pf-v5-c-login__main {
  width: min(100%, 390px);
  margin: 0 auto;
  align-self: center !important;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.pf-v5-c-login__main-header {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  grid-template-columns: none !important;
  grid-template-areas: none !important;
  column-gap: 0 !important;
  width: 100%;
  text-align: center;
  padding: 0 0 22px !important;
}

.fen-login__brand {
  display: block !important;
  flex: 0 0 auto;
  width: 230px !important;
  max-width: 82% !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 auto 24px !important;
  object-fit: contain;
}

.pf-v5-c-login__main-header .pf-v5-c-title {
  margin: 0;
  color: var(--fen-text);
  font-size: 25px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: 0;
}

.pf-v5-c-login__main-body {
  padding: 0;
}

.pf-v5-c-form,
#kc-form-wrapper,
#kc-form-login {
  width: 100%;
}

.pf-v5-c-form__group {
  margin-bottom: 14px;
}

.fen-field {
  position: relative;
}

.fen-field__label {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin: 0 0 -8px 15px;
  padding: 0 6px;
  background: #fff;
  color: #3f4650;
  font-size: 13px;
  line-height: 1;
  font-weight: 400;
}

.fen-field__control {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
}

.fen-field__control::before {
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 2;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: #7c828c;
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.fen-field__control--user::before {
  content: "\f007";
}

.fen-field__control--password::before {
  content: "\f023";
}

.pf-v5-c-form-control {
  width: 100%;
}

.fen-field .pf-v5-c-form-control {
  display: block;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.fen-field .pf-v5-c-form-control::before,
.fen-field .pf-v5-c-form-control::after {
  display: none !important;
  content: none !important;
}

.pf-v5-c-form-control input,
.pf-v5-c-form-control select {
  appearance: none;
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 8px 44px 8px 36px;
  border: 1px solid #aeb4bd;
  border-radius: 5px;
  background: #fff;
  color: var(--fen-text);
  font-size: 14px;
  line-height: 1.3;
  box-shadow: none;
}

.pf-v5-c-form-control input:focus,
.pf-v5-c-form-control select:focus {
  border-color: var(--fen-blue);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(0, 74, 152, 0.14);
}

.fen-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  z-index: 3;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #6d7480;
  cursor: pointer;
}

.fen-password-toggle__icon::before {
  content: "\f06e";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-size: 14px;
  font-weight: 900;
}

.fen-password-toggle.is-visible .fen-password-toggle__icon::before {
  content: "\f070";
}

.fen-login-options {
  min-height: 0;
  margin: 0;
}

.fen-login-options:empty,
.fen-login-options #kc-form-options:empty {
  display: none;
}

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

#kc-login {
  width: 100%;
  min-height: 45px;
  border: 0;
  border-radius: 999px;
  background: var(--fen-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(0, 43, 92, 0.24);
}

#kc-login:hover,
#kc-login:focus {
  background: var(--fen-blue-deep);
}

.fen-forgot-password {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
}

.fen-forgot-password a,
.pf-v5-c-login__main a {
  color: #23384f;
  text-decoration: none;
}

.fen-forgot-password a:hover,
.pf-v5-c-login__main a:hover {
  color: var(--fen-blue);
  text-decoration: underline;
}

.pf-v5-c-login__main-footer {
  padding: 18px 0 0;
}

.fen-social-divider {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0 0 20px;
}

.fen-social-divider::before,
.fen-social-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 16px);
  height: 1px;
  background: #8b919b;
}

.fen-social-divider::before {
  left: 0;
}

.fen-social-divider::after {
  right: 0;
}

.fen-social-divider span {
  width: 10px;
  height: 10px;
  border: 1px solid #8b919b;
  border-radius: 50%;
  background: #fff;
}

#kc-social-providers ul {
  width: 100%;
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}

#kc-social-providers li {
  width: 100%;
}

#kc-social-providers a {
  display: block;
  width: 100%;
}

.fen-google-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid #d8dce2;
  border-radius: 5px;
  background: #fff;
  color: #343941;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 30, 44, 0.04);
}

.fen-google-button img {
  width: 18px;
  height: 18px;
}

.fen-login__copyright {
  margin: 64px 0 0;
  color: #737985;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.pf-v5-c-alert {
  margin-bottom: 14px;
  border-radius: 5px;
}

.kc-feedback-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
}

#kc-username {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#kc-username label {
  min-width: 0;
  overflow-wrap: anywhere;
}

#kc-totp-settings,
#kc-totp-supported-apps,
#kc-totp-secret-qr-code,
#kc-totp-secret-key {
  width: 100%;
}

#kc-totp-settings {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#kc-totp-settings > li {
  padding: 14px 16px;
  border: 1px solid rgba(0, 58, 143, 0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  box-shadow: 0 8px 22px rgba(4, 34, 75, 0.08);
}

#kc-totp-settings p {
  margin: 0 0 8px;
  color: #1e2f43;
  line-height: 1.45;
}

#kc-totp-settings p:last-child {
  margin-bottom: 0;
}

#kc-totp-supported-apps,
#kc-totp-settings ul {
  margin: 0;
  padding-left: 20px;
}

#kc-totp-supported-apps li,
#kc-totp-settings ul li {
  margin-bottom: 4px;
  color: #1f2b38;
}

#kc-totp-settings-form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(0, 58, 143, 0.12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(5, 32, 67, 0.08);
}

#kc-totp-settings-form .pf-v5-c-form__group {
  margin-bottom: 12px;
}

#kc-totp-settings-form .pf-v5-c-form__label {
  margin-bottom: 4px;
}

#kc-totp-settings-form #totp,
#kc-totp-settings-form #userLabel,
#kc-otp-login-form input[name="otp"] {
  padding-left: 12px;
  min-height: 44px;
  height: 44px;
  border-radius: 10px;
  border-color: #b8c7d9;
}

#kc-totp-settings-form #totp:focus,
#kc-totp-settings-form #userLabel:focus,
#kc-otp-login-form input[name="otp"]:focus {
  border-color: #2f76c3;
  box-shadow: 0 0 0 4px rgba(47, 118, 195, 0.16);
}

#kc-totp-settings-form .pf-v5-c-form__actions,
#kc-otp-login-form .pf-v5-c-form__actions {
  margin-top: 6px;
}

#mode-manual,
#mode-barcode {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 74, 152, 0.08);
  font-size: 13px;
  font-weight: 600;
}

#kc-totp-secret-qr-code {
  display: flex;
  justify-content: center;
}

#kc-totp-secret-qr-code img,
#kc-totp-secret-qr-code canvas {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(0, 58, 143, 0.15);
  background: #fff;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(5, 30, 63, 0.12);
}

#kc-totp-secret-key {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(0, 58, 143, 0.3);
  background: rgba(0, 58, 143, 0.06);
  color: #002f73;
  font-family: "RedHatMono", "Courier New", monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

#kc-otp-login-form {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(0, 58, 143, 0.12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(5, 30, 63, 0.08);
}

.fen-login__panel:has(#kc-otp-login-form),
.fen-login__panel:has(#kc-totp-settings-form) {
  align-items: flex-start !important;
  padding-top: 24px !important;
  padding-bottom: 20px !important;
}

.pf-v5-c-login__main:has(#kc-otp-login-form),
.pf-v5-c-login__main:has(#kc-totp-settings-form) {
  align-self: flex-start !important;
  width: 100% !important;
  max-width: none !important;
}

.pf-v5-c-login__main-body:has(#kc-otp-login-form),
.pf-v5-c-login__main-body:has(#kc-totp-settings-form) {
  width: 100%;
}

#kc-otp-login-form [id^="kc-otp-credential-"] {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #c4d3e4;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

#kc-otp-login-form [id^="kc-otp-credential-"]:hover {
  border-color: #7fa3cf;
  background: #f1f7ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(18, 54, 99, 0.12);
}

#kc-otp-login-form [id^="kc-otp-credential-"].pf-m-selected,
#kc-otp-login-form [id^="kc-otp-credential-"][class*="selected"] {
  border-color: #2f76c3;
  background: linear-gradient(180deg, #eef6ff 0%, #e5f1ff 100%);
  box-shadow: 0 0 0 3px rgba(47, 118, 195, 0.2);
}

.consent-page .pf-v5-c-login__main {
  width: min(100%, 560px);
}

#kc-oauth {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#kc-oauth .instruction {
  margin: 0;
  color: rgba(0, 0, 0, 0.78);
}

#kc-oauth-scopes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#kc-oauth-scopes li {
  padding: 10px 12px;
  border: 1px solid rgba(0, 58, 143, 0.18);
  border-radius: 6px;
  background: rgba(0, 58, 143, 0.06);
}

#kc-oauth-scopes li b,
#kc-oauth-scopes li strong {
  color: #002f73;
}

@media (max-width: 900px) {
  #keycloak-bg {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: auto;
  }

  .fen-login {
    position: static !important;
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    grid-template-columns: 1fr;
  }

  .fen-login__media {
    display: none;
  }

  .fen-login__panel {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 34px 24px 24px !important;
  }

  .fen-login__brand {
    width: 196px;
    margin-bottom: 20px;
  }

  .pf-v5-c-login__main-header .pf-v5-c-title {
    font-size: 22px;
  }

  .fen-login__copyright {
    margin-top: 38px;
  }
}

@media (min-width: 768px) {
  .pf-v5-c-login__main-header {
    display: flex !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
  }
}

@media (min-width: 1600px) {
  .fen-login__media {
    background-size: cover, cover;
    background-repeat: no-repeat;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .fen-login__panel {
    align-items: flex-start !important;
    padding-top: 24px !important;
    padding-bottom: 18px !important;
  }

  .fen-login__brand {
    width: 190px !important;
    margin-bottom: 14px !important;
  }

  .pf-v5-c-login__main-header {
    padding-bottom: 14px !important;
  }

  .pf-v5-c-login__main-header .pf-v5-c-title {
    font-size: 22px;
  }

  .pf-v5-c-form__group {
    margin-bottom: 10px;
  }

  .fen-login__copyright {
    margin-top: 28px;
  }
}

@media (min-width: 901px) and (max-height: 680px) {
  .fen-login__panel {
    padding-top: 16px !important;
    padding-bottom: 14px !important;
  }

  .fen-login__brand {
    width: 160px !important;
    margin-bottom: 10px !important;
  }

  .pf-v5-c-login__main-header .pf-v5-c-title {
    font-size: 20px;
  }

  .fen-social-divider {
    margin-bottom: 12px;
  }

  .fen-login__copyright {
    margin-top: 18px;
  }
}

@media (max-width: 520px) {
  .fen-login__panel {
    min-height: 100vh;
    min-height: 100dvh;
    align-items: flex-start;
    padding: 28px 20px 20px !important;
  }

  .pf-v5-c-login__main {
    width: 100%;
  }
}
