@import url("input-field.css");

/* Import Roboto from Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");

body,
html {
  font-family: "Roboto", Arial, sans-serif;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Full page container */
.login-pf-page {
  display: flex;
  flex-direction: row;
  height: 100vh;
}

/* Left side: login form */
.login-pf-header::before {
  content: url("../img/Logo.svg");
}

.login-pf-header {
  position: relative;
  h1 {
    background-color: #f4f3f1;
  }
}

.card-pf {
  flex: 0 0 40%;
  background-color: #f4f3f1;
  padding: 24px 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
}

/* to prevent having to restructure entire file 
 should definitely be overhauled when time is available */
@media (min-width: 1024px) {
  .login-pf-page {
    min-height: 100vh;
    overflow: hidden;
  }

  .card-pf {
    min-height: 0;
    max-height: 100vh;
  }
}

#kc-page-title {
  margin-top: 32px; /* Logo to headline */
  margin-bottom: 40px; /* Headline to username input */
}

/* Input fields */
input {
  width: 80%;
  padding: 12px 12px;
  margin-bottom: 0px;
  border-radius: 8px;
  border: 2px solid #a4a4a4;
  font-size: 14px;
  background: transparent;
}

input,
.pf-c-form-control,
.pf-c-button {
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-group:has(input#username) {
  display: flex;
  flex-direction: column;

  label {
    order: 2;
  }

  input {
    order: 3;
  }

  span {
    order: 1;
  }
}

.form-group:has(input#password) {
  margin-bottom: 0;
}

.form-group:has(input#password-confirm) {
  margin-top: 24px;
}

.form-group:has([id^="input-error"]) input,
.form-group:has([id^="input-error"]) label.pf-c-form__label-text::before,
#kc-form-login:has([id^="input-error"]) input#password,
#kc-form-login:has([id^="input-error"]) input#email {
  border: 2px solid #fd4852;
}

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

#kc-reset-password-form .form-group {
  margin-bottom: 40px;
}

/* Error input style */
input:invalid,
.kc-input-error {
  border-color: #ff4d4f;
  background-image: url("${url.resourcesPath}/img/error-icon.png");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px 20px;
}

/* Login button */
.pf-m-primary {
  height: 56px;
  padding: 16px 24px 16px 24px;
  font-size: 16px;
  background: #111111;
  color: #fdfdfd;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  align-items: center;
  justify-content: center;
}

.pf-m-primary:hover {
  background-color: #333333 !important;
}

#kc-error-message p:has(#backToApplication) {
  margin-top: 32px;
}

.login-pf-page::after {
  flex: 0.7;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  content: "";
  flex-grow: 1;
  background: url("../img/BORA_SignatureKitchen2025_A1_Totale_Küche_DE_RGB.png")
    center/cover no-repeat;
}

.login-pf-page-header {
  display: none;
}

.login-pf-settings {
  display: flex;
  flex-direction: column-reverse;
  margin-bottom: 40px;

  a {
    display: block;
    text-decoration: none;
    color: #242424;
    font-weight: 700;
    margin-top: 8px;
    margin-bottom: 40px;
    width: fit-content;
  }
}

.pf-m-error {
  display: flex;
  align-items: center;
  justify-content: left;
  gap: 12px;
  background: #f5e6e5;
  color: #242424;
  border: 2px solid #fd4852;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 400;
  line-height: 150%; /* 21px */
  letter-spacing: 0.42px;
  box-sizing: border-box;
  text-align: center;
}

#kc-register-form .pf-m-error,
#kc-reset-password-form .pf-m-error {
  margin-top: 20px;
}

#kc-register-form:has(#username) .pf-m-error {
  margin-bottom: 0;
}

#kc-reset-password-form .pf-m-error {
  margin-bottom: 0;
}

/* Restrict checkbox input to custom box area */

/* .checkbox input[type="checkbox"],
.pf-c-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.pf-c-check input[type="checkbox"] {
  width: 100%;
  height: 24px;
  top: 0;
  margin-top: -2px;
  z-index: 2;
  align-self: anchor-center;
} */

label.pf-c-form__label-text a {
  z-index: 10;
}

/* .pf-c-check label {
  display: none;
} */

/* .checkbox label,
.form-group:has(.pf-c-check) .pf-c-form__label-text {
  position: relative;
  padding-left: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
} */

/* .checkbox label::after,
.form-group:has(.pf-c-check) .pf-c-form__label-text::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 40px;
  height: 40px;
  background: #b0a89e;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  z-index: 1;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
} */

/* .form-group:has(#input-error-dataprotection) #dataprotection-yes,
.form-group:has(#input-error-termsofuse) #termsofuse-yes {
  transform: translateY(-154%);
} */

/* .checkbox label:hover::after,
.form-group:has(.pf-c-check) .pf-c-form__label-text:hover::after,
.form-group:has(.pf-c-check input[type="checkbox"]:hover)
  .pf-c-form__label-text::after {
  left: 12px;
  opacity: 0.15;
} */

/* Custom checkbox box */
/* .checkbox label::before,
.form-group:has(.pf-c-check) .pf-c-form__label-text::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; 
  height: 22px; 
  border: 1px solid #242424;
  border-radius: 4px;
  background: transparent;
  z-index: 2;
} */

/* .checkbox label:has(input[type="checkbox"]:checked)::before,
.form-group:has(.pf-c-check input:checked) label.pf-c-form__label-text::before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzI0MjQyNCIgZD0iTTE0LjExNiAzLjA3NGMuMzIxLjMyMS4zMjcuODQ5LjAxNCAxLjE3OGwtNy45MzUgOC4zMzNhLjgwMi44MDIgMCAwIDEtMS4yMDEtLjA0M2wtMy40NC00LjE2N2EuODUuODUgMCAwIDEgLjA5NC0xLjE3NC44LjggMCAwIDEgMS4xNDUuMDk3bDIuODY0IDMuNDY3IDcuMzEtNy42NzdhLjguOCAwIDAgMSAxLjE1LS4wMTQiLz48L3N2Zz4=");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  background-color: transparent;
} */

input[type="radio"] {
  width: auto;
}

#kc-passwd-update-form .checkbox {
  margin-bottom: 40px;
}

.col-xs-12:has(label.pf-c-form__label-text) {
  display: flex;
}

#kc-content-wrapper {
  display: flex;
  flex-direction: column;

  #kc-form {
    order: 1;
  }

  #kc-info {
    order: 2;
  }

  #kc-social-providers {
    order: 3;
  }
}

.login-pf-page .login-pf-signup a:hover,
.login-pf-page .login-pf-signup a:focus,
#kc-reset-password-form #kc-form-options:hover a,
#kc-reset-password-form #kc-form-options:focus a,
#kc-info-message a:hover,
#kc-info-message a:focus {
  background: rgba(176, 169, 142, 0.24) !important;
  color: #242424 !important;
  border: 2px solid #242424 !important;
}

.login-pf-page .login-pf-signup a,
#kc-reset-password-form #kc-form-options a,
#kc-register-form #kc-form-options a,
#kc-info-message a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px; /* space between icon and text */
  padding: 16px 24px 16px 24px;
  background: #f3f4f6;
  border-radius: 8px;
  color: #242424;
  border: 2px solid #242424;
  margin-top: 12px;
  cursor: pointer;
  text-decoration: none;
  width: auto;
}

#kc-register-form .form-group:has(#kc-form-options) {
  display: flex;
  flex-direction: column-reverse;
  margin-top: 40px;
}

.pf-c-input-group {
  position: relative;
}

#kc-register-form button,
#kc-passwd-update-form button,
#kc-form-login button {
  position: absolute;
  background: url("../img/icon_eye.svg") no-repeat center;
  width: 24px;
  height: 24px;
  border: none;
  top: 50%;
  right: 0;
  transform: translate(-50%, -50%);
}

.kc-social-links,
.kc-social-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kc-social-links {
  display: flex;
  flex-direction: column; /* Stack buttons vertically */
  gap: 12px; /* Space between buttons */
  align-items: stretch;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
}

.kc-social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: #f3f4f6;
  border-radius: 8px;
  color: #242424;
  border: 2px solid #242424;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s;
}

.kc-social-links a:hover,
.kc-social-links a:focus {
  background: rgba(176, 169, 142, 0.24);
  color: #111111;
  border-color: #242424;
}

.kc-social-provider-name {
  position: relative;
  padding-left: 28px;
}

.kc-social-provider-name::before {
  content: "";
  display: inline-block;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) translateX(-5px);
  width: 24px;
  height: 24px;
}

#social-google .kc-social-provider-name::before {
  background: url("../img/google.png") no-repeat center/contain;
}

#social-microsoft .kc-social-provider-name::before {
  background: url("../img/MS.png") no-repeat center/contain;
}

#social-facebook .kc-social-provider-name::before {
  background: url("../img/FB.png") no-repeat center/contain;
}

#social-apple .kc-social-provider-name::before {
  background: url("../img/apple.svg") no-repeat center/contain;
}

#kc-locale-dropdown {
  width: 60%;
  border: 2px solid #a4a4a4;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  padding: 0;
  position: absolute;
  top: 0;
  right: 0;
}

#kc-locale-dropdown button {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 16px;
  padding-top: 2px;
  color: #242424;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  position: relative;
}

#kc-locale-dropdown button::after {
  content: "▼";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #a4a4a4;
  pointer-events: none;
}

.pf-c-dropdown__menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  background: #fff;
  border: 2px solid #a4a4a4;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: 10;
  margin: 0;
  padding: 8px 0;
  overflow: hidden;
}

.menu-button-links[aria-expanded="true"] .pf-c-dropdown__menu,
#kc-current-locale-link[aria-expanded="true"] + .pf-c-dropdown__menu {
  display: block;
}

#kc-locale-dropdown.focus {
  border-radius: 8px 8px 0 0;
}

.pf-c-dropdown__menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  color: #242424;
  text-decoration: none;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.pf-c-dropdown__menu-item:hover,
.pf-c-dropdown__menu-item:focus {
  background: rgba(176, 169, 142, 0.24);
  color: #111111;
}

#kc-locale-dropdown ul,
#kc-locale-dropdown li {
  list-style: none;
  padding: 0;
  margin-left: -2px;
}

.subtitle {
  display: none;
}

/* Mobile responsiveness */
@media (max-width: 1023px) {
  .login-pf-page {
    flex-direction: column;
    height: auto;
    width: auto;
    align-items: center; /* Center the form horizontally */
    justify-content: flex-start;
    background-color: #f4f3f1;
  }

  .login-pf-page::before {
    width: 100vw;
    height: 30vh;
    min-height: 120px;
    margin-bottom: 28px; /*reduced margin due to styles below causing too much space*/
    max-width: 100vw;
    overflow: hidden;
    z-index: 0;

    content: "";
    flex-grow: 1;
    background: url("../img/BORA_SignatureKitchen2025_A1_Totale_Küche_DE_RGB.png")
      center/cover no-repeat;
  }

  .card-pf {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0; /* We'll use margins for spacing */
    padding: 0 32px 64px;
    width: -webkit-fill-available;
  }

  .login-pf-page::after {
    display: none;
  }

  #kc-page-title {
    margin-top: 12px; /* Logo to headline */
    margin-bottom: 32px; /* Headline to username input */
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group:has(input#password-confirm) {
    margin-top: 16px;
  }

  .form-group:has(label[for="newsletter"]) {
    margin-top: 32px;
    margin-bottom: 24px;
  }

  .form-group:has(label[for="data_protection"]),
  .form-group:has(label[for="terms_of_use"]) {
    margin-bottom: 24px;
  }

  .login-pf-settings {
    display: flex;
    flex-direction: column-reverse;
    margin-bottom: 0;

    a {
      display: block;
      text-decoration: none;
      color: #242424;
      font-weight: 700;
      margin-top: 8px;
      margin-bottom: 32px;
      width: fit-content;
    }
  }

  /* .form-group:has(#input-error-dataprotection) #dataprotection-yes,
  .form-group:has(#input-error-termsofuse) #termsofuse-yes {
    transform: translateY(-144%);
  } */

  .checkbox label::before,
  .form-group:has(.pf-c-check) .pf-c-form__label-text::before {
    width: 18px;
    height: 18px;
  }

  .checkbox label::after,
  .form-group:has(.pf-c-check) .pf-c-form__label-text::after {
    width: 32px;
    height: 32px;
  }

  .checkbox label::after {
    display: none !important;
  }

  .custom-checkbox .circle {
    display: none;
  }

  .checkbox label,
  .form-group:has(.pf-c-check) .pf-c-form__label-text {
    font-size: 12px;
  }

  .checkbox,
  #kc-passwd-update-form .checkbox {
    margin-bottom: 32px;
  }

  .checkbox label::after {
    display: none;
  }

  .custom-error-box {
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 12px;
    background: #f5e6e5;
    color: #242424;
    border: 2px solid #fd4852;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 32px;
    font-size: 12px;
    font-weight: 400;
    line-height: 150%; /* 21px */
    letter-spacing: 0.36px;
    box-sizing: border-box;
    text-align: center;
  }

  #kc-registration {
    margin-top: 8px;
  }

  .pf-m-error {
    margin-bottom: 12px;
  }

  #kc-register-form .pf-m-error,
  #kc-reset-password-form .pf-m-error {
    margin-top: 12px;
  }
}

@media (min-width: 1280px) {
  .card-pf {
    flex: 0 0 32%;
  }
}

@media (min-width: 1360px) {
  .card-pf {
    flex: 0 0 30%;
  }
}
