:root {
  --felt-50:  #EEF4F0;
  --felt-100: #D4E3DA;
  --felt-200: #A7C5B2;
  --felt-300: #77A48A;
  --felt-400: #4C8566;
  --felt-500: #2B6B49;
  --felt-600: #1F553A;
  --felt-700: #17432E;
  --felt-800: #0F3121;
  --felt-900: #0A2418;

  --gold-100: #F7E9C3;
  --gold-500: #C9A24B;
  --gold-700: #8F6F22;

  --graphite-50:  #F5F6F7;
  --graphite-100: #E5E7EA;
  --graphite-200: #C8CCD2;
  --graphite-300: #9AA1AB;
  --graphite-500: #454C56;
  --graphite-700: #1E2229;

  --chalk:     #FBFAF7;
  --chalk-50:  #FFFFFF;
  --chalk-200: #F3F1EC;

  --ink:       #0F1410;
  --ink-muted: #4B5550;
  --ink-dim:   #7C867F;

  --accent-red: #B3311F;

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans:  Inter, -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-3: 0 16px 32px rgba(0,0,0,0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

.mota-body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--chalk);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   Two-column shell
   ========================================================================= */
.mota-shell {
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .mota-shell {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   Left sidebar — felt-green brand panel
   ========================================================================= */
.mota-side {
  background:
    linear-gradient(180deg, var(--felt-500) 0%, var(--felt-700) 100%);
  color: var(--chalk-50);
  padding: 48px 48px 40px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.mota-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.04), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(201,162,75,0.06), transparent 50%);
  pointer-events: none;
}

.mota-side > * { position: relative; z-index: 1; }

.mota-side__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 48px;
}

.mota-side__mark {
  width: 44px;
  height: 44px;
  display: block;
}

.mota-side__wordmark {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold-500);
  text-transform: uppercase;
}

.mota-side__tagline {
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--chalk-50);
  margin: 0 0 28px;
  max-width: 360px;
}

.mota-side__bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mota-side__bullets li {
  position: relative;
  padding-left: 24px;
  font-size: 15px;
  color: rgba(255,255,255,0.88);
  line-height: 1.5;
}

.mota-side__bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 12px;
  height: 2px;
  background: var(--gold-500);
}

.mota-side__footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.72);
}

.mota-side__back {
  color: var(--chalk-50);
  text-decoration: none;
  font-weight: 500;
  transition: color 120ms ease;
}

.mota-side__back:hover { color: var(--gold-500); }
.mota-side__back-arrow { display: inline-block; margin-right: 4px; }

@media (max-width: 900px) {
  .mota-side {
    padding: 32px 24px 28px;
  }
  .mota-side__brand { margin-bottom: 24px; }
  .mota-side__tagline { font-size: 22px; margin-bottom: 20px; }
  .mota-side__bullets { gap: 10px; }
  .mota-side__footer { margin-top: 28px; padding-top: 18px; }
}

/* =========================================================================
   Right column — form area
   ========================================================================= */
.mota-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--chalk);
}

.mota-card {
  width: 100%;
  max-width: 420px;
}

.mota-card__header {
  margin-bottom: 28px;
}

.mota-card__title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0;
}

.mota-locale {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.mota-locale select {
  font: inherit;
  font-size: 13px;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--graphite-200);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
}

/* =========================================================================
   Alerts (errors, warnings, success)
   ========================================================================= */
.mota-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 20px;
}

.mota-alert__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.mota-alert--error    { background: #FBE9E7; color: #7A1D0E; border: 1px solid #F7D7D2; }
.mota-alert--error    .mota-alert__icon { background: var(--accent-red); color: white; }
.mota-alert--warning  { background: var(--gold-100); color: var(--gold-700); border: 1px solid #ECD79B; }
.mota-alert--success  { background: var(--felt-50); color: var(--felt-700); border: 1px solid var(--felt-100); }
.mota-alert--success  .mota-alert__icon { background: var(--felt-500); color: white; }
.mota-alert--info     { background: var(--graphite-50); color: var(--graphite-700); border: 1px solid var(--graphite-100); }

.mota-required {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.mota-required__star { color: var(--accent-red); }

/* Returning-user retirement banner — shown above the form on every
   page that uses this layout. Subtle (not alarming) but visible. */
.mota-returning-notice {
  background: var(--gold-100);
  border: 1px solid #ECD79B;
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gold-700);
  margin-bottom: 18px;
}
.mota-returning-notice strong {
  color: var(--ink);
  font-weight: 600;
}
.mota-returning-notice em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}

/* =========================================================================
   Form — override PatternFly + legacy Keycloak class names so the form
   built by inherited login.ftl / register.ftl / etc. takes our styling.
   We target both PF v4 selectors (`.pf-c-...`) and Keycloak's older
   simpler selectors (`.form-control`, `.form-group`) to stay
   forward-compatible across KC 22..26.
   ========================================================================= */
.mota-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#kc-form,
#kc-form-wrapper,
#kc-content,
#kc-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Field group / row */
.pf-c-form__group,
.form-group,
.kc-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

/* Labels */
label,
.pf-c-form__label,
.control-label,
.pf-c-form__label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
.pf-c-form-control,
.form-control {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--chalk-50);
  border: 1px solid var(--graphite-200);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
.pf-c-form-control:focus,
.form-control:focus {
  outline: none;
  border-color: var(--felt-500);
  box-shadow: 0 0 0 3px rgba(43, 107, 73, 0.15);
}

input[aria-invalid="true"],
input.error,
.pf-c-form-control.pf-m-error {
  border-color: var(--accent-red);
}
input[aria-invalid="true"]:focus,
input.error:focus,
.pf-c-form-control.pf-m-error:focus {
  box-shadow: 0 0 0 3px rgba(179, 49, 31, 0.15);
}

/* Inline field error message */
.pf-c-form__helper-text.pf-m-error,
#input-error,
.input-error,
.kc-feedback-text {
  font-size: 12px;
  color: var(--accent-red);
  margin-top: 2px;
}

/* Password show/hide toggle (KC v2) */
.pf-c-input-group {
  display: flex;
  width: 100%;
}
.pf-c-input-group .pf-c-form-control { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pf-c-input-group button {
  background: var(--chalk-50);
  border: 1px solid var(--graphite-200);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0 12px;
  cursor: pointer;
  color: var(--ink-muted);
}
.pf-c-input-group button:hover { color: var(--felt-500); }

/* Buttons — primary submit */
button[type="submit"],
input[type="submit"],
.pf-c-button.pf-m-primary,
.btn-primary,
#kc-login,
#kc-register,
#kc-submit {
  background: var(--felt-500);
  color: var(--chalk-50);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  width: 100%;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
  letter-spacing: 0.01em;
}

button[type="submit"]:hover,
input[type="submit"]:hover,
.pf-c-button.pf-m-primary:hover,
.btn-primary:hover,
#kc-login:hover,
#kc-register:hover,
#kc-submit:hover {
  background: var(--felt-600);
}

button[type="submit"]:active,
.pf-c-button.pf-m-primary:active {
  transform: translateY(1px);
}

button:disabled,
.pf-c-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Secondary / link buttons */
.pf-c-button.pf-m-link,
.btn-link,
a.kc-feedback-link {
  background: transparent;
  color: var(--felt-500);
  font: inherit;
  font-weight: 500;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.pf-c-button.pf-m-link:hover,
.btn-link:hover,
a.kc-feedback-link:hover {
  color: var(--felt-700);
  text-decoration: underline;
}

/* Forgot password / "Try another way" link row */
#kc-form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 8px;
}

#kc-form-options a {
  color: var(--felt-500);
  text-decoration: none;
}
#kc-form-options a:hover { text-decoration: underline; }

#kc-form-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
}

/* Checkboxes */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--graphite-300);
  border-radius: 3px;
  background: var(--chalk-50);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin: 0;
}
input[type="checkbox"]:checked {
  background: var(--felt-500);
  border-color: var(--felt-500);
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 107, 73, 0.15);
}

/* Form button row (login + register together) */
#kc-form-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* =========================================================================
   Social providers (Discord, Google)
   ========================================================================= */
#kc-social-providers,
.kc-social-providers {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--graphite-100);
  position: relative;
}

#kc-social-providers > h2,
.kc-social-providers h2,
#kc-social-providers > h4 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
  margin: 0 0 14px;
}

#kc-social-providers ul,
.kc-social-providers ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#kc-social-providers a,
.kc-social-providers a,
.zocial,
.pf-c-button.kc-social-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--graphite-200);
  background: var(--chalk-50);
  color: var(--ink);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

#kc-social-providers a:hover,
.kc-social-providers a:hover,
.zocial:hover {
  border-color: var(--felt-500);
  background: var(--felt-50);
}

/* =========================================================================
   Provider-specific buttons — official brand guidelines.

   Google: light-variant button per
     https://developers.google.com/identity/branding-guidelines
   - Background: #FFFFFF, border: 1px solid #DADCE0
   - Text: Roboto Medium, color #1F1F1F
   - Hover background tint: #F8F9FA (Google's "google-grey-50")
   - The 4-color G mark stays untouched (no recoloring per guidelines).

   Discord: per https://discord.com/branding
   - Brand color "Blurple": #5865F2 (background)
   - Hover: #4752C4
   - White Clyde mark + white text.
   ========================================================================= */

#kc-social-providers a.kc-social-google,
.kc-social-providers a.kc-social-google {
  background: #FFFFFF;
  color: #1F1F1F;
  border: 1px solid #DADCE0;
  font-family: "Roboto", "Roboto Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: 0.25px;
}

#kc-social-providers a.kc-social-google:hover,
.kc-social-providers a.kc-social-google:hover {
  background: #F8F9FA;
  border-color: #DADCE0;
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.30), 0 1px 3px 1px rgba(60,64,67,0.15);
}

#kc-social-providers a.kc-social-google:active,
.kc-social-providers a.kc-social-google:active {
  background: #F1F3F4;
  border-color: #DADCE0;
}

#kc-social-providers a.kc-social-google:focus,
.kc-social-providers a.kc-social-google:focus {
  outline: none;
  border-color: #4285F4;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
}

#kc-social-providers a.kc-social-discord,
.kc-social-providers a.kc-social-discord {
  background: #5865F2;
  color: #FFFFFF;
  border: 1px solid transparent;
  font-weight: 500;
}

#kc-social-providers a.kc-social-discord svg,
.kc-social-providers a.kc-social-discord svg {
  fill: #FFFFFF;
}

#kc-social-providers a.kc-social-discord:hover,
.kc-social-providers a.kc-social-discord:hover {
  background: #4752C4;
  border-color: transparent;
  box-shadow: 0 2px 4px rgba(88, 101, 242, 0.25);
}

#kc-social-providers a.kc-social-discord:active,
.kc-social-providers a.kc-social-discord:active {
  background: #3C45A5;
  border-color: transparent;
}

#kc-social-providers a.kc-social-discord:focus,
.kc-social-providers a.kc-social-discord:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.35);
}

/* =========================================================================
   Info section ("New here? Register" / "Back to log in")
   ========================================================================= */
.mota-info,
#kc-info {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--graphite-100);
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
}

.mota-info a,
#kc-info a {
  color: var(--felt-500);
  font-weight: 500;
  text-decoration: none;
}
.mota-info a:hover,
#kc-info a:hover { text-decoration: underline; }

.mota-tryanother {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
}
.mota-tryanother a {
  color: var(--felt-500);
  text-decoration: none;
}
.mota-tryanother a:hover { text-decoration: underline; }

/* =========================================================================
   Hide stock Keycloak chrome that fights with our layout
   ========================================================================= */
.login-pf,
.login-pf-page,
.login-pf-page-header,
#kc-header,
#kc-header-wrapper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#kc-header-wrapper,
.login-pf-brand { display: none !important; }
