/* Import Figtree font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&display=swap');

/* Import Font Awesome for icons */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* Import Material Icons as fallback */
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

/* Ryse Split Screen Login Layout - Universal Design */
:root {
  --primary: #00269F;
  --primary-hover: #001F7A;
  --secondary: #00D5AB;
  --border-color: #DDDDDD;
  --text-secondary: #5E5E5E;
  --background-subtle: #F7F7F7;
  --sidebar-gradient: linear-gradient(291.85deg, #00269F 2.29%, #070E24 99.99%);
  --sidebar-width: 600px;
}

/* Reset and base styles */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}

body {
  background: #FFFFFF;
  font-family: 'Figtree', sans-serif !important;
}

/* Remove any default margins/padding from root elements */
.login-pf, .login-pf-page {
  margin: 0 !important;
  padding: 0 !important;
}

/* Force Figtree font on all elements */
*,
*::before,
*::after {
  font-family: 'Figtree', sans-serif !important;
}

/* Specific overrides for common elements */
input,
button,
select,
textarea,
label,
h1, h2, h3, h4, h5, h6,
p, span, div, a,
.pf-c-form-control,
.pf-c-button,
.pf-c-form__label {
  font-family: 'Figtree', sans-serif !important;
}

/* Hide default Keycloak elements */
#kc-header,
#kc-header-wrapper,
#kc-logo-wrapper,
.login-pf-page .login-pf-brand {
  display: none !important;
}

/* Create a flex wrapper for the entire page */
.login-pf body {
  display: flex !important;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: #FFFFFF !important;
}

/* Override container to be part of flex layout */
.login-pf .container {
  display: flex !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  flex: 1;
}

/* Ensure all containers fill width */
.login-pf .container > div {
  width: 100% !important;
  max-width: none !important;
}

/* Create sidebar wrapper that will be injected */
.ryse-sidebar-wrapper {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-gradient);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  position: relative;
  /* Ensure it extends to viewport edges */
  margin-left: -1px;
  margin-top: -1px;
  margin-bottom: -1px;
  /* Add 1px to width to compensate for negative margin */
  width: calc(var(--sidebar-width) + 1px);
}

/* Sidebar content */
.ryse-sidebar {
  width: 100%;
  height: 100%;
  color: white;
  padding: 48px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Ensure all text in sidebar is white */
.ryse-sidebar * {
  color: white;
}

.ryse-sidebar-logo {
  width: 182px;
  height: 69px;
  margin-bottom: 48px;
}

.ryse-sidebar-logo img {
  width: 100%;
  height: 100%;
  filter: brightness(0) invert(1);
}

.ryse-sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ryse-sidebar-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
  color: white;
}

.ryse-sidebar-subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  margin-bottom: 48px;
}

.ryse-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ryse-features li {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  font-size: 16px;
  color: white;
}

.ryse-features li::before {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--secondary);
  color: var(--primary);
  border-radius: 50%;
  margin-right: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.ryse-sidebar-footer {
  margin-top: auto;
  padding-top: 48px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

/* Content area wrapper */
.ryse-content-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #FFFFFF;
  flex: 1;
  box-sizing: border-box;
}

/* Override Keycloak's container wrapper */
#kc-container-wrapper {
  position: static !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  background: transparent !important;
  bottom: auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
}

/* Content wrapper */
#kc-content-wrapper {
  width: 100% !important;
  max-width: none !important;
}

/* Ensure content fills available width */
#kc-content {
  width: 100% !important;
  max-width: none !important;
}

/* Form card */
.login-pf-page .card-pf {
  background: white;
  border: 1px solid #DDDDDD;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 48px;
  border-radius: 12px;
  border-top: 1px solid #DDDDDD !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  position: static !important;
}

/* Override any row/col classes that might limit width */
.login-pf-page .row,
.login-pf-page [class*="col-"] {
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Login page specific */
.login-pf-page {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  width: 100% !important;
  box-sizing: border-box;
}

/* Main container for split layout */
.ryse-main-container {
  display: flex !important;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Ensure sidebar takes fixed width and content wrapper takes remaining space */
.ryse-main-container > .ryse-sidebar-wrapper {
  flex: 0 0 calc(var(--sidebar-width) + 1px);
  width: calc(var(--sidebar-width) + 1px);
}

.ryse-main-container > .ryse-content-wrapper {
  flex: 1 1 auto;
  width: calc(100% - var(--sidebar-width));
}

/* Form styling */
#kc-form {
  width: 100%;
}

/* Ensure form groups in flex containers don't have side margins */
#kc-register-form .form-group {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Ensure inputs fill their containers */
#kc-register-form input[type="text"],
#kc-register-form input[type="email"],
#kc-register-form input[type="password"] {
  width: 100% !important;
}

/* Page title */
h1#kc-page-title {
  font-size: 30px;
  font-weight: 700;
  color: #000;
  margin-bottom: 32px;
  margin-top: 0;
  text-align: center;
}

/* Form groups */
.pf-c-form__group {
  margin-bottom: 24px;
}

/* Labels */
.pf-c-form__label,
#kc-form-login label,
#kc-register-form label,
#kc-reset-password-form label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  display: block;
}

/* Required asterisk styling when added by JavaScript */
.required-asterisk {
  color: #C9190B;
  font-weight: 600;
  margin-left: 2px;
}

/* Input fields */
#kc-form-login input[type="text"],
#kc-form-login input[type="password"],
#kc-form-login input[type="email"],
#kc-register-form input[type="text"],
#kc-register-form input[type="password"],
#kc-register-form input[type="email"],
#kc-reset-password-form input[type="text"],
#kc-reset-password-form input[type="password"],
#kc-reset-password-form input[type="email"],
.pf-c-form-control {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: border-color 0.3s ease;
  background: white;
  box-sizing: border-box;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
.pf-c-form-control:hover {
  border-color: var(--primary-hover);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
.pf-c-form-control:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 38, 159, 0.1);
}

/* Password visibility button */
.pf-c-input-group {
  position: relative;
  display: block;
}

.pf-c-button.pf-m-control {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 4px;
  width: auto;
  font-size: 16px;
  cursor: pointer;
}

.pf-c-button.pf-m-control:hover {
  background: var(--background-subtle);
  color: var(--primary);
}

/* Ensure Font Awesome icons show properly */
.pf-c-button.pf-m-control i {
  font-family: 'Font Awesome 6 Free', 'FontAwesome' !important;
  font-weight: 900;
  font-style: normal;
  display: inline-block;
}

/* Style the eye icons - Font Awesome */
.fa-eye::before {
  content: "\f06e";
}

.fa-eye-slash::before {
  content: "\f070";
}

/* PatternFly icon fallbacks */
.pficon-eye::before {
  content: "\f06e";
  font-family: 'Font Awesome 6 Free' !important;
  font-weight: 900;
}

.pficon-eye-slash::before {
  content: "\f070";
  font-family: 'Font Awesome 6 Free' !important;
  font-weight: 900;
}


/* Fix Google icon */
.fa-google::before {
  content: "G";
  font-family: 'Figtree', sans-serif;
  font-weight: 700;
  font-style: normal;
}

/* Form options */
#kc-form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  margin-top: 24px;
}

.checkbox label {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: normal;
}

#kc-form-options a {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
}

#kc-form-options a:hover {
  text-decoration: underline;
}

/* Submit buttons */
#kc-login,
#kc-register,
.pf-c-button.pf-m-primary {
  width: 100%;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  background: var(--primary) !important;
  color: white !important;
  border: none !important;
  border-radius: 12px !important;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 32px;
  display: block;
}

#kc-login:hover,
#kc-register:hover,
.pf-c-button.pf-m-primary:hover {
  background: var(--primary-hover) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 38, 159, 0.3);
}

#kc-login:active,
#kc-register:active,
.pf-c-button.pf-m-primary:active {
  transform: translateY(0);
}

/* Back button */
#kc-back {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 24px;
}

#kc-back:hover {
  text-decoration: underline;
}

/* Registration/login toggle */
#kc-registration-container,
#kc-info {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #EBEBEB;
  background: transparent !important;
}

#kc-registration,
#kc-info-wrapper {
  font-size: 14px;
  color: var(--text-secondary);
  background: transparent !important;
  padding: 0 !important;
}

#kc-registration a,
#kc-info-wrapper a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

#kc-registration a:hover,
#kc-info-wrapper a:hover {
  text-decoration: underline;
}

/* Social login styling */
#kc-social-providers {
  margin-top: 32px;
  text-align: center;
  width: 100%;
  position: static !important;
  float: none !important;
  padding: 0;
  display: block !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
}

/* Ensure social providers section doesn't have absolute positioning */
.kc-social-section {
  position: static !important;
  width: 100% !important;
  display: block !important;
}

/* Override any absolute positioning on social providers */
#kc-form #kc-social-providers,
#kc-form-wrapper #kc-social-providers,
.card-pf #kc-social-providers {
  position: static !important;
  margin-top: 32px !important;
  width: 100% !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
}

#kc-social-providers hr {
  margin: 24px 0;
  border: none;
  border-top: 1px solid #EBEBEB;
}

/* Override absolute positioning on social buttons */
#kc-social-providers .pf-c-button,
#kc-social-providers .kc-social-item,
#kc-social-providers a[id^="social-"],
a#social-google-register,
a#social-google-login {
  position: static !important;
  width: 100% !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
  margin: 0 0 12px 0 !important;
  display: flex !important;
}

#kc-social-providers h2 {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 16px;
}

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

.kc-social-links li {
  margin-bottom: 12px;
  width: 100%;
}

.kc-social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
  background: white;
  width: 100%;
  box-sizing: border-box;
}

.kc-social-links a:hover {
  border-color: var(--primary);
  background: rgba(0, 38, 159, 0.05);
}

/* Ensure social providers icon and text are properly aligned */
.kc-social-provider-logo {
  margin-right: 8px;
}

.kc-social-icon-text {
  font-weight: 500;
}

/* Error and alert messages */
.alert-error,
.pf-c-alert.pf-m-danger {
  background: #FEE;
  border: 1px solid #FCC;
  color: #C33;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
}

.alert-success,
.pf-c-alert.pf-m-success {
  background: #EFE;
  border: 1px solid #CFC;
  color: #363;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
}

.alert-warning,
.pf-c-alert.pf-m-warning {
  background: #FFE;
  border: 1px solid #FFC;
  color: #663;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
}

#input-error,
.pf-c-helper-text__item.pf-m-error {
  color: #C33;
  font-size: 12px;
  margin-top: 4px;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 100%;
    --content-width: 100%;
  }

  .login-pf .container {
    flex-direction: column;
  }

  .ryse-sidebar-wrapper {
    width: 100%;
    min-width: auto;
    height: auto;
    min-height: 200px;
  }

  .ryse-sidebar {
    padding: 24px;
  }

  .ryse-sidebar-content {
    display: none;
  }

  .ryse-sidebar-footer {
    display: none;
  }

  .ryse-content-wrapper {
    width: 100%;
    padding: 24px;
  }

  .login-pf-page .card-pf {
    padding: 32px 24px;
    border-radius: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #DDDDDD;
    border-left: none;
    border-right: none;
    border-bottom: none;
    max-width: none;
  }

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

/* Enhanced mobile responsiveness for smaller screens */
@media (max-width: 767px) {
  /* Hide sidebar completely on mobile */
  .ryse-sidebar-wrapper {
    display: none;
  }

  /* Make content wrapper full width */
  .ryse-content-wrapper {
    width: 100%;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* Main container adjustments */
  .ryse-main-container {
    flex-direction: column;
  }

  .ryse-main-container > .ryse-content-wrapper {
    width: 100%;
  }

  /* Card styling for mobile */
  .login-pf-page .card-pf {
    padding: 24px 16px;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-top: 1px solid #DDDDDD;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Container adjustments */
  .login-pf .container {
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* Logo for mobile */
  div.kc-logo-text {
    width: 140px;
    height: 53px;
    margin: 24px auto;
  }

  /* Page title */
  h1#kc-page-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
  }

  /* Form inputs - matching PM onboarding */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  .pf-c-form-control {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  /* Labels */
  .pf-c-form__label,
  label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
  }

  /* Form groups */
  .pf-c-form__group,
  .form-group {
    margin-bottom: 20px;
  }

  /* Buttons - matching PM onboarding style */
  #kc-login,
  #kc-register,
  .pf-c-button.pf-m-primary {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 500;
    margin-top: 24px;
  }

  /* Social buttons */
  #kc-social-providers {
    margin-top: 24px;
  }

  #kc-social-providers .pf-c-button,
  .kc-social-links a {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 12px;
  }

  /* Form options */
  #kc-form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin: 16px 0;
  }

  /* Registration link */
  #kc-registration-container,
  #kc-info {
    margin-top: 24px;
    padding-top: 24px;
  }

  /* Error messages */
  .alert-error,
  .pf-c-alert {
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 20px;
  }

  /* Back button */
  #kc-back {
    margin-bottom: 20px;
  }

  /* Password toggle button */
  .pf-c-button.pf-m-control {
    right: 12px;
    padding: 8px;
  }

  /* Registration form - stack side-by-side fields */
  #kc-register-form > div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0 !important;
  }

  #kc-register-form > div[style*="display: flex"] > div {
    width: 100% !important;
    margin-bottom: 20px;
  }

  #kc-register-form > div[style*="display: flex"] > div:last-child {
    margin-bottom: 0;
  }
}

/* Landscape mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .login-pf-page .card-pf {
    padding: 20px 16px;
    max-height: none;
  }

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

  .pf-c-form__group,
  .form-group {
    margin-bottom: 16px;
  }
}
