:root {
  --ca-primary: #e30613;
  --ca-primary-hover: #c90511;
  --ca-navy: #0f1438;
  --ca-surface: #1a2048;
  --ca-text: #1a1414;
  --ca-muted: #737373;
  --ca-border: #ebebeb;
  --ca-error-bg: #fbe5e7;
  --ca-radius: 0.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body.ca-auth-body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ca-text);
  background: #fff;
}

#kc-header,
.pf-v5-c-login__container,
.pf-v5-c-login {
  all: unset;
}

.ca-auth-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .ca-auth-shell {
    flex-direction: row;
  }
}

.ca-auth-hero {
  position: relative;
  display: none;
  flex: 1;
  min-height: 280px;
  background-color: var(--ca-surface);
  background-image:
    linear-gradient(135deg, rgba(227, 6, 19, 0.45) 0%, rgba(15, 20, 56, 0.92) 55%),
    url("../img/auth-hero.png");
  background-size: cover;
  background-position: center;
}

@media (min-width: 1024px) {
  .ca-auth-hero {
    display: block;
    min-height: 100vh;
  }
}

.ca-auth-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2), transparent);
}

.ca-auth-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  align-items: flex-end;
  padding: 2.5rem 2.5rem 4rem;
}

.ca-auth-hero__quote {
  max-width: 28rem;
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
}

.ca-auth-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  background: #fff;
}

.ca-auth-panel__inner {
  display: flex;
  width: 100%;
  max-width: 42rem;
  flex: 1;
  flex-direction: column;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

@media (min-width: 640px) {
  .ca-auth-panel__inner {
    padding: 2.5rem 2.5rem;
  }
}

@media (min-width: 1024px) {
  .ca-auth-panel {
    max-width: 36rem;
  }

  .ca-auth-panel__inner {
    max-width: none;
    padding: 2.5rem 3rem;
  }
}

@media (min-width: 1280px) {
  .ca-auth-panel {
    max-width: 42rem;
  }

  .ca-auth-panel__inner {
    padding: 2.5rem 4rem;
  }
}

.ca-locale {
  position: relative;
  align-self: flex-end;
  margin-bottom: 1rem;
}

.ca-locale__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  background: #fff;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.ca-locale__toggle::-webkit-details-marker {
  display: none;
}

.ca-locale[open] .ca-locale__menu {
  display: block;
}

.ca-locale__menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 20;
  display: none;
  min-width: 8rem;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

html[dir="rtl"] .ca-locale__menu {
  right: auto;
  left: 0;
}

.ca-locale__item {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--ca-radius) - 2px);
  color: var(--ca-text);
  text-decoration: none;
}

.ca-locale__item:hover,
.ca-locale__item--active {
  background: #f5f5f5;
  color: var(--ca-primary);
}

.ca-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ca-primary);
}

.ca-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: pre-line;
}

.ca-subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ca-muted);
}

.ca-auth-header {
  margin-bottom: 2rem;
}

.ca-auth-page--register .ca-auth-header {
  margin-bottom: 2rem;
}

.ca-auth-page--register .ca-title {
  margin-top: 0.75rem;
}

.ca-register-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ca-register-form .ca-field {
  margin-bottom: 0;
}

.ca-register-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
}

.ca-register-actions .ca-submit {
  margin-top: 0;
}

.ca-required-note {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--ca-muted);
}

.ca-alert {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(227, 6, 19, 0.2);
  border-radius: var(--ca-radius);
  background: var(--ca-error-bg);
}

.ca-alert__icon {
  display: flex;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--ca-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.ca-alert__text {
  font-size: 0.875rem;
  font-weight: 600;
}

.ca-field {
  margin-bottom: 1.25rem;
}

.ca-field__label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ca-field__input {
  width: 100%;
  height: 44px;
  padding: 0 0.875rem;
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  background: #fff;
  font: inherit;
  color: var(--ca-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ca-field__input:focus {
  outline: none;
  border-color: var(--ca-primary);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.15);
}

.ca-field__input--error {
  border-color: var(--ca-primary);
}

.ca-field__password {
  position: relative;
  display: block;
  width: 100%;
}

.ca-field__password .ca-field__input {
  padding-right: 3rem;
}

html[dir="rtl"] .ca-field__password .ca-field__input {
  padding-right: 0.875rem;
  padding-left: 3rem;
}

.ca-field__toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0 var(--ca-radius) var(--ca-radius) 0;
  background: transparent;
  color: var(--ca-muted);
  cursor: pointer;
  padding: 0;
}

.ca-field__toggle:hover {
  color: var(--ca-text);
  background: rgba(0, 0, 0, 0.03);
}

.ca-field__toggle i {
  font-size: 0.95rem;
  line-height: 1;
  pointer-events: none;
}

html[dir="rtl"] .ca-field__toggle {
  right: auto;
  left: 0;
  border-radius: var(--ca-radius) 0 0 var(--ca-radius);
}

.ca-field__error {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--ca-primary);
}

.ca-form-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.5rem;
  margin-bottom: 1.5rem;
}

.ca-form-options__end {
  margin-left: auto;
}

html[dir="rtl"] .ca-form-options__end {
  margin-left: 0;
  margin-right: auto;
}

.ca-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.ca-checkbox input {
  accent-color: var(--ca-primary);
}

.ca-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ca-primary);
  text-decoration: none;
}

.ca-link:hover {
  text-decoration: underline;
}

.ca-submit {
  margin-top: 0.5rem;
}

.ca-btn,
#kc-login,
#kc-register {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--ca-radius);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

input#kc-login {
  padding: 0 1rem;
}

input#kc-register {
  padding: 0 1rem;
}

.ca-pw-checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ca-pw-checklist li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  color: var(--ca-muted);
}

.ca-pw-checklist li::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(115, 115, 115, 0.35);
  background: transparent;
}

.ca-pw-checklist__item--ok {
  color: #1f7a3c;
}

.ca-pw-checklist__item--ok::before {
  border-color: #1f7a3c;
  background: #1f7a3c;
  box-shadow: inset 0 0 0 2px #fff;
}

.ca-btn--primary,
#kc-login,
#kc-register {
  background: var(--ca-primary) !important;
  color: #fff !important;
}

.ca-btn--primary:hover,
#kc-login:hover,
#kc-register:hover {
  background: var(--ca-primary-hover) !important;
}

.ca-btn--outline {
  border: 1px solid var(--ca-border);
  background: #fff;
  color: var(--ca-text);
}

.ca-signup-hint {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ca-muted);
}

.ca-signup-hint a {
  font-weight: 600;
  color: var(--ca-primary);
  text-decoration: none;
}

.ca-signup-hint a:hover {
  text-decoration: underline;
}

.ca-signup-hint--center {
  text-align: center;
}

.ca-social {
  margin-top: 1.5rem;
}

.ca-social ul {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ca-username-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  background: #fafafa;
  font-size: 0.875rem;
}

.ca-username-row a {
  color: var(--ca-primary);
  font-weight: 600;
  text-decoration: none;
}

#try-another-way {
  display: inline-block;
  margin-top: 1rem;
  color: var(--ca-primary);
  font-weight: 600;
  text-decoration: none;
}

/* Hide leftover PatternFly login chrome only — do not reset buttons/inputs we style ourselves */
.pf-v5-c-login,
.pf-v5-c-login__container,
.pf-v5-c-login__main,
.pf-v5-c-alert,
.pf-v5-c-title {
  all: unset;
}
