@import url("https://fonts.googleapis.com/css2?family=Funnel+Display:wght@300..800&display=swap");

* {
  box-sizing: border-box;
  font-family:
    "Funnel Display",
    system-ui,
    -apple-system,
    sans-serif;
  padding: 0;
  margin: 0;
}

.login-pf {
  background: #fafafa !important;
  height: initial;
}
.card-pf {
  background: transparent;
  border-top: none;
  box-shadow: none;
  margin: 0;
  padding: 0 !important;
}
.login-pf-page .login-pf-signup {
  display: none;
}

body {
  margin: 0;
  background: #fafafa !important;
  background-image: none;
}
.login-pf body {
  background: none !important;
}
/* Hide Keycloak default header */
#kc-header,
#kc-header-wrapper,
.kc-header,
.login-pf-page-header,
header[role="banner"],
div#kc-header.login-pf-page-header {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Remove padding from Keycloak page wrapper */
.login-pf-page {
  padding: 0 !important;
  margin: 0 !important;
  background: #fafafa !important;
}

.container-login {
  display: flex;
  height: 100dvh;
}

.login-pf-page .login-pf-header {
  display: none;
}

.login-pf-page .card-pf {
  padding: 0 !important;
}

/* Ensure Keycloak wrapper doesn't add extra spacing */
#kc-container,
#kc-content,
.kc-content {
  padding: 0 !important;
  margin: 0 !important;
  /* height: 100vh !important; */
}

#kc-container-wrapper {
  padding: 0 !important;
  margin: 0 !important;
}

/* LEFT */
.left {
  width: 35%;
  padding: 30px 40px;
  text-align: center;
  display: flex;
  justify-content: center;
  height: calc(100dvh - 20px);
  overflow-y: auto;
}
.left-block-content {
  width: 100%;
  margin: auto 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.brand img {
  width: 140px;
  margin: 0 auto;
}

.brand-text {
  margin-bottom: 30px;
}

.brand-text h1 {
  color: #313131;
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 14px;
  white-space: nowrap;
}

.brand-text .sub {
  font-size: 16px;
  color: #99a2b0;
}

.brand-text .sub a {
  color: #313131;
  text-decoration: underline;
}

.oauth {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 25px;
}

.oauth button,
.oauth .oauth-button {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  border-radius: 8px;
  gap: 13px;
  border: none;
  cursor: pointer;
  transition: 0.3s;
  text-decoration: none;
  background: #f1f1f1;
  flex: 1 1 0;
  min-width: 120px;
  max-width: 150px;
}

/* Dynamic sizing based on number of buttons */
.oauth .oauth-button:first-child:nth-last-child(1) {
  /* 1 button */
  flex: 0 0 150px;
  max-width: 150px;
}

.oauth .oauth-button:first-child:nth-last-child(2),
.oauth .oauth-button:first-child:nth-last-child(2) ~ .oauth-button {
  /* 2 buttons */
  flex: 0 0 calc((100% - 12px) / 2);
  max-width: 180px;
}

.oauth .oauth-button:first-child:nth-last-child(3),
.oauth .oauth-button:first-child:nth-last-child(3) ~ .oauth-button {
  /* 3 buttons */
  flex: 0 0 calc((100% - 24px) / 3);
  max-width: 150px;
}

.oauth button:hover,
.oauth .oauth-button:hover {
  transform: scale(1.08);
  transition: 0.3s;
}

.oauth button img,
.oauth .oauth-button img {
  width: 20px;
}

.or-divider {
  text-align: center;
  margin-bottom: 24px;
  color: #aaa;
  font-size: 13px;
  position: relative;
}

.or-divider::before {
  content: "";
  height: 1px;
  width: 100%;
  background: #cbcbcb;
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
}

/* Login error notification (incorrect email/password) */
.login-error-notification {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.4;
  text-align: left;
}

.login-error-notification-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.login-error-notification-info {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #1e1b4b;
}

/*
 * The fourth type Keycloak emits. Without it a warning inherits the base rule,
 * which is the error styling -- an advisory message shown in alarm red.
 * template.ftl suppresses warnings during app-initiated actions but not
 * otherwise, so they do reach this page.
 */
.login-error-notification-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* App-level error (e.g. registration validation failure) */
.app-error-notification {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Registration password requirements */
.password-requirements {
  font-size: 13px;
  color: #6b7280;
  margin-top: 6px;
  margin-bottom: 4px;
}

.password-validation-feedback {
  font-size: 13px;
  margin-top: 4px;
  min-height: 1.2em;
}

.password-validation-feedback.password-validation-error {
  color: #b91c1c;
}

/* Email validation feedback */
.email-validation-feedback {
  font-size: 13px;
  margin-top: 4px;
  min-height: 1.2em;
}

.email-validation-feedback.email-validation-error {
  color: #b91c1c;
}

/* TOTP configure page */
.totp-steps {
  text-align: left;
  margin-bottom: 24px;
  padding: 0;
  list-style: none;
}

.totp-step {
  margin-bottom: 16px;
}

.totp-step-title {
  font-size: 14px;
  font-weight: 600;
  color: #313131;
  margin-bottom: 6px;
}

.totp-app-list {
  margin: 0 0 8px 0;
  padding-left: 20px;
  font-size: 14px;
  color: #6b7280;
}

.totp-secret-wrap {
  margin: 8px 0;
  word-break: break-all;
}

.totp-secret {
  display: inline-block;
  padding: 10px 14px;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  font-size: 14px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.05em;
}

.totp-qr {
  display: block;
  max-width: 200px;
  height: auto;
  margin: 12px 0;
  border-radius: 8px;
  border: 1px solid #e4e4e7;
}

.totp-link {
  font-size: 14px;
  color: #141a42;
  text-decoration: underline;
}

.totp-link:hover {
  text-decoration: none;
}

.totp-policy-list {
  margin: 8px 0 0 0;
  padding-left: 20px;
  font-size: 14px;
  color: #6b7280;
}

/* Login OTP verification page - credential selector */
.otp-credential-list {
  margin-bottom: 16px;
}

.otp-credential-label {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 500;
}

.otp-credential-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.otp-credential-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}

.otp-credential-option:hover {
  border-color: #313131;
  background: #fafafa;
}

.otp-credential-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #141a42;
}

.otp-credential-option input[type="radio"]:checked + .otp-credential-name {
  font-weight: 600;
}

.otp-credential-name {
  flex: 1;
}

.or-divider span {
  width: 40px;
  background: #fafafa;
  display: inline-block;
  position: relative;
  z-index: 9;
}

form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ip-block {
  text-align: left;
}

.ip-block label {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 500;
  display: block;
}

.ip-block label i {
  color: red;
}

/* Password field with show/hide toggle */
.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  padding-right: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.password-toggle-btn:hover {
  color: #313131;
}

.password-toggle-btn:focus {
  outline: 2px solid #313131;
  outline-offset: 2px;
}

.password-toggle-btn svg {
  display: block;
}

.ip-block input,
.ip-block .input {
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  width: 100%;
  font-size: 16px;
}

.ip-block .password-input-wrap input {
  padding-right: 44px;
}

.ip-block input:focus,
.ip-block .input:focus {
  border: 1px solid #313131;
  outline: #313131;
}

.ip-block input[aria-invalid="true"],
.ip-block .input[aria-invalid="true"] {
  border-color: #d32f2f;
}

#input-error,
.input-error {
  color: #d32f2f;
  font-size: 14px;
  margin-top: 8px;
  display: block;
  text-align: left;
}

/* Logout other sessions checkbox - avoid overlap with label text */
.logout-sessions-block {
  /* margin-top: 16px; */
}
/* Wrapper div from Keycloak macro - make it flex so checkbox and label sit side by side */
.logout-sessions-block > div {
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.logout-sessions-block label,
.logout-sessions-block .kc-label,
.logout-sessions-block [class*="checkbox"] {
  display: flex !important;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
  cursor: pointer;
}
/* Override .ip-block input so checkbox doesn't stretch to 100% and overlap text */
.logout-sessions-block input[type="checkbox"] {
  width: 18px !important;
  min-width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  margin: 0 !important;
  /* margin-right: 14px !important; */
  padding: 0 !important;
  flex-shrink: 0;
  box-sizing: border-box;
}
/* When label wraps checkbox, ensure label content has gap */
/* .logout-sessions-block label input[type="checkbox"] {
  margin-right: 14px !important;
} */

.primary {
  margin-top: 16px;
  height: 48px;
  border-radius: 10px;
  border: none;
  background: #141a42;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  font-size: 16px;
}

.terms {
  font-size: 14px;
  color: #99a2b0;
  margin-top: 20px;
}

.terms a {
  color: #99a2b0;
}

/* Keycloak specific styles */
.checkbox input[type="checkbox"] {
  position: relative;
  margin-left: 0px;
}
.checkbox {
  text-align: left;
  margin: 12px 0;
}

.checkbox label {
  font-size: 14px;
  color: #313131;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
}

.checkbox input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
}

#kc-form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  font-size: 14px;
}

#kc-form-options a {
  color: #313131;
  text-decoration: underline;
}

/* RIGHT */
.right {
  width: 65%;
  /* width: 786px; */
  margin: 20px;
  padding: 30px 40px;
  position: relative;
  /* background: linear-gradient(331.6deg, #84B0FB 7.6%, #F8FAFC 83.79%); */
  overflow: hidden;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero h2 {
  font-size: 48px;
  font-weight: bold;
  margin: 0 0 15px;
  color: #121d2f;
}

.hero p {
  color: #535ea4 !important;
  font-size: 18px;
  margin-bottom: 40px;
}

.chat-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 20px;
  width: 100%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  backdrop-filter: blur(5.1px);
  -webkit-backdrop-filter: blur(5.1px);
  border: 2px solid rgba(255, 255, 255, 0.28);
}

.chat-scroller {
  height: 250px;
}

.chat-card .user-message {
  text-align: right;
}

.chat {
  display: inline-block;
  max-width: 55%;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.left-chat {
  background: #fff;
  display: inline-flex;
  gap: 22px;
  /* From https://css.glass */
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(12.2px);
  -webkit-backdrop-filter: blur(12.2px);
  border: 1px solid rgba(255, 255, 255, 0.69);
}

.chat-logo {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background: #000;
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.right-chat {
  background: #f3f4f3;
  margin-left: auto;
  text-align: right;
  display: inline-flex;
}

.chat-input {
  margin-top: 20px;
  background: #fff;
  border-radius: 2px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: #aaa;
  /* From https://css.glass */
  background: rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 1);
}

.chat-input input {
  font-size: 14px;
  width: 100%;
  padding: 6px;
  border: none;
  background-color: transparent;
  outline: none;
}

.send {
  background: #141a46;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

#reset-message {
  margin-top: 20px;
}
#show-reset-form {
    color: gray;
    display: block;
    text-align: right;
    margin: 10px 0;
}
.back-to-login {
    color: #1A1A1A;
    font-weight: 500;
    font-size: 14px;
}

/* @media (min-width: 1400px) {
  .left {
    width: 25%
  }
  .right {
    width: 75%
  }
} */

@media (max-width: 1280px) {
  .left {
    min-width: 35%;
    padding: 30px 40px;
  }
}
@media (max-width: 1024px) {
  .container-login {
    height: initial;
  }
  .right {
    display: none;
  }
  .left {
    min-width: 60%;
    margin: 0 auto;
    padding-top: 40px;
    height: initial;
  }
}
@media (max-height: 720px) {
  .container-login {
    height: initial;
  }
  .left {
    height: initial;
  }
}

@media (max-width: 640px) {
  .container-login {
    height: initial;
  }

  .left {
    width: 100%;
    padding: 40px 30px;
    display: block;
  }
  .right {
    display: none;
  }

  .brand-text h1 {
    font-size: 24px;
  }

  .hero h2 {
    font-size: 32px;
    line-height: 1.2;
  }

  .chat-card {
    width: 100%;
  }

  .oauth button,
  .oauth .oauth-button {
    width: calc((100% - 12px) / 2);
    min-width: 100px;
    max-width: none;
  }

  /* Single button on mobile */
  .oauth:has(.oauth-button:only-child) .oauth-button {
    width: 100%;
    max-width: 100%;
  }
}

/* Hide Keycloak default PatternFly alerts on branded pages */
.alert,
.pf-c-alert,
#kc-content-wrapper > .alert,
.login-pf-page .alert {
  display: none !important;
}

/* Verify email / info status card */
.status-card {
  display: flex;
  gap: 14px;
  text-align: left;
  padding: 18px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  line-height: 1.45;
}

.status-card-info {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e1b4b;
}

.status-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141a42;
  color: #fff;
}

.status-card-body {
  min-width: 0;
}

.status-card-lead {
  font-size: 15px;
  font-weight: 600;
  color: #131313;
  margin: 0 0 8px;
}

.status-card-text {
  font-size: 14px;
  color: #4b5563;
  margin: 0;
  word-break: break-word;
}

.verify-hint {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 4px;
  text-align: left;
}

.verify-back {
  margin-top: 18px;
}

.verify-back a {
  color: #131313;
  text-decoration: underline;
}

a.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

.status-card-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.status-card-error .status-card-icon {
  background: #b91c1c;
}

/* Second action next to .primary (e.g. "review profile" on account linking) */
.secondary {
  height: 48px;
  border-radius: 10px;
  border: 1px solid #141a42;
  background: #fff;
  color: #141a42;
  font-weight: 500;
  cursor: pointer;
  font-size: 16px;
}

/* A form submit that should read as a text link (e.g. cancel an app-initiated action) */
.link-button {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: #131313;
  text-decoration: underline;
  cursor: pointer;
}

/* Organization picker */
.org-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.org-option {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #d9dde5;
  background: #fff;
  color: #131313;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.org-option:hover,
.org-option:focus-visible {
  border-color: #141a42;
  background: #f5f6fa;
  outline: none;
}
