/* ============================================================================
   LG login theme — repaint + relayout of keycloak.v2 into the two-column
   sign-in every LG product presents (a light form column beside a navy hero).

   Two layers:
     1. CSS custom properties re-point PatternFly's leaf variables at the LG
        palette, so every inherited screen (login, reset, OTP) re-skins at once.
     2. template.ftl (this theme) restructures the page into the split layout;
        the classes it emits (.lg-*) are styled here.

   Overriding the `--dark-100`/`--dark-200` leaves is deliberate: in PatternFly
   "dark" names the color used ON a light surface, and components resolve those
   leaves directly, not the `--100` aliases.
   ============================================================================ */

:root {
  /* --- LG palette ---------------------------------------------------------- */
  --lg-navy-0: #0b2c49;
  --lg-navy-1: #092540;
  --lg-navy-2: #071d33;
  --lg-accent: #0071bc;
  --lg-accent-2: #1389ca;
  --lg-accent-hover: #075c9a;
  --lg-gold: #f6b817;
  --lg-canvas: #f4f7fa;
  --lg-surface: #ffffff;
  --lg-line: #e1e7ee;
  --lg-ink: #0b1626;
  --lg-muted: #5b6b7d;
  --lg-crit: #c73f27;
  --lg-accent-grad: linear-gradient(135deg, #0071bc 0%, #075c9a 100%);
  --lg-sidebar-bg: linear-gradient(178deg, #0b2c49 0%, #092540 60%, #071d33 100%);

  /* Deliberate simplification: the app font (Hanken Grotesk) is not bundled here to avoid
     coupling this image to the web build; system-ui is the graceful fallback.
     Ship a self-hosted woff2 + @font-face if the mismatch is ever flagged. */
  --lg-font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", helvetica, arial, sans-serif;

  /* --- PatternFly leaves -> LG palette ------------------------------------- */
  --pf-v5-global--primary-color--100: var(--lg-accent);
  --pf-v5-global--primary-color--dark-100: var(--lg-accent);
  --pf-v5-global--active-color--100: var(--lg-accent);
  --pf-v5-global--link--Color: var(--lg-accent);
  --pf-v5-global--link--Color--dark: var(--lg-accent);
  --pf-v5-global--link--Color--hover: var(--lg-accent-hover);
  --pf-v5-global--link--Color--dark--hover: var(--lg-accent-hover);

  --pf-v5-global--Color--100: var(--lg-ink);
  --pf-v5-global--Color--dark-100: var(--lg-ink);
  --pf-v5-global--Color--200: var(--lg-muted);
  --pf-v5-global--Color--dark-200: var(--lg-muted);
  --pf-v5-global--BorderColor--100: var(--lg-line);
  --pf-v5-global--BorderColor--dark-100: var(--lg-line);
  --pf-v5-global--danger-color--100: var(--lg-crit);

  --pf-v5-global--FontFamily--text: var(--lg-font);
  --pf-v5-global--FontFamily--text--vf: var(--lg-font);
  --pf-v5-global--FontFamily--heading: var(--lg-font);
  --pf-v5-global--FontFamily--heading--vf: var(--lg-font);

  --keycloak-card-top-color: var(--lg-accent);
  --keycloak-bg-logo-url: none;
}

/* ==========================================================================
   Page frame — the split layout (template.ftl emits .lg-grid).
   ========================================================================== */
html.login-pf,
.login-pf body {
  height: auto;
  min-height: 100%;
}

.login-pf body.lg-auth {
  margin: 0;
  background: var(--lg-canvas);
  font-family: var(--lg-font);
  color: var(--lg-ink);
  background-image: none;
}

.lg-grid {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .lg-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Left column: the form on a clean light surface ---------------------- */
.lg-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.lg-left-inner {
  width: 100%;
  max-width: 420px;
}

.lg-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.lg-brand-mark {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: url("../img/mark.svg") no-repeat center / cover;
  box-shadow: 0 14px 30px -14px rgb(7 29 51 / 0.6);
}

.lg-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.lg-brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--lg-ink);
}

.lg-brand-tagline {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--lg-muted);
}

.lg-secure {
  margin-top: 24px;
  text-align: center;
  font-size: 11.5px;
  color: var(--lg-muted);
}

/* The link to the product's first-access page, under the sign-in form. */
.lg-first-access {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
}

/* --- Right column: the navy brand hero (lg+ only) ------------------------ */
.lg-hero {
  position: relative;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 48px;
  color: #fff;
  background:
    radial-gradient(120% 130% at 100% 0%, rgb(19 137 202 / 0.22), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgb(246 184 23 / 0.1), transparent 55%),
    var(--lg-sidebar-bg);
}

@media (min-width: 1024px) {
  .lg-hero {
    display: flex;
  }
}

.lg-hero-lockup {
  display: flex;
  align-items: center;
}

.lg-hero-logo {
  height: 40px;
  width: auto;
}

.lg-hero-art {
  align-self: center;
  width: 100%;
  max-width: 460px;
  color: rgb(255 255 255 / 0.8);
}

.lg-hero-art svg {
  width: 100%;
  height: auto;
}

.lg-hero-copy {
  max-width: 420px;
}

.lg-hero-headline {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.lg-hero-lead {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgb(184 203 222 / 0.85);
}

/* ==========================================================================
   The card — the inherited .pf-v5-c-login__main styled as the app card.
   ========================================================================== */
.pf-v5-c-login__main {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--lg-line);
  background: var(--lg-surface);
  box-shadow:
    0 1px 2px rgb(9 38 64 / 0.06),
    0 30px 60px -28px rgb(7 29 51 / 0.55);
}

.pf-v5-c-login__main-header {
  padding: 30px 32px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.pf-v5-c-login__main-body {
  padding: 22px 32px 28px;
}

#kc-page-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--lg-ink);
}

/* ==========================================================================
   Locale selector — its own row at the top-right of the card header, so the
   full language label never overflows the card.
   ========================================================================== */
.pf-v5-c-login__main-header-utilities {
  order: -1;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control {
  width: auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  overflow: visible;
  border: 1px solid var(--lg-line);
  border-radius: 10px;
  background: var(--lg-surface);
  font-size: 12.5px;
}

.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control::before,
.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control::after {
  display: none !important;
}

.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control > select {
  width: auto;
  padding: 0;
  text-overflow: clip;
  background: transparent;
}

.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control__utilities {
  position: static;
  display: inline-flex;
  align-items: center;
  padding: 0;
}

.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control__toggle-icon {
  color: var(--lg-muted);
}

/* ==========================================================================
   Inputs — refined: a full bordered box, 44px tall, 10px radius, accent focus
   ring. Replaces PatternFly's borderless underline-only field.
   ========================================================================== */
.pf-v5-c-form__group {
  margin-top: 16px;
}

.pf-v5-c-form__group:first-child {
  margin-top: 0;
}

.pf-v5-c-form__label-text,
.pf-v5-c-form__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--lg-ink);
}

.pf-v5-c-form-control {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--lg-line);
  border-radius: 10px;
  background: var(--lg-surface);
  padding: 0 14px;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after {
  display: none !important;
}

.pf-v5-c-form-control > input,
.pf-v5-c-form-control > select {
  /* Fill the flex box above. Without this the input keeps its intrinsic
     size=20 width (~20ch), so a longer email overflows and scrolls its leading
     chars off the left edge, and field icons (autofill/password-manager) attach
     mid-box at the input's true right edge. min-width:0 lets it shrink below
     content within the flex row. */
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 0;
  font-size: 14px;
  color: var(--lg-ink);
  background: transparent;
}

.pf-v5-c-form-control > input:focus,
.pf-v5-c-form-control > select:focus {
  outline: none;
}

.pf-v5-c-form-control:focus-within {
  border-color: var(--lg-accent);
  box-shadow: 0 0 0 4px rgb(0 113 188 / 0.15);
}

/* Grouped field (password + show/hide): the group is the box; children flush. */
.pf-v5-c-input-group {
  border: 1px solid var(--lg-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--lg-surface);
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.pf-v5-c-input-group:focus-within {
  border-color: var(--lg-accent);
  box-shadow: 0 0 0 4px rgb(0 113 188 / 0.15);
}

.pf-v5-c-input-group .pf-v5-c-form-control {
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
}

.pf-v5-c-input-group .pf-v5-c-input-group__item {
  --pf-v5-c-input-group__item--BorderWidth--base: 0;
  --pf-v5-c-input-group__item--offset: 0;
  border: 0;
  margin: 0;
}

.pf-v5-c-input-group .pf-v5-c-button.pf-m-control {
  border: 0;
  background: transparent;
  color: var(--lg-muted);
  padding: 0 12px;
}

.pf-v5-c-input-group .pf-v5-c-button.pf-m-control::before,
.pf-v5-c-input-group .pf-v5-c-button.pf-m-control::after {
  display: none !important;
}

.pf-v5-c-form__helper-text a,
#kc-form-options a,
.pf-v5-c-login__main-body a:not(.pf-v5-c-button) {
  color: var(--lg-accent);
  font-size: 12.5px;
}

/* ==========================================================================
   Buttons.
   ========================================================================== */
.pf-v5-c-button.pf-m-primary {
  border-radius: 10px;
  min-height: 46px;
  background: var(--lg-accent-grad);
  box-shadow: 0 12px 24px -12px rgb(0 113 188 / 0.75);
  font-weight: 700;
  transition:
    filter 0.12s ease,
    transform 0.03s ease;
}

.pf-v5-c-button.pf-m-primary:hover {
  filter: brightness(1.06);
}

.pf-v5-c-button.pf-m-primary:active {
  transform: translateY(1px);
}

.pf-v5-c-button.pf-m-secondary {
  border-radius: 10px;
  min-height: 46px;
  border: 1px solid var(--lg-line);
  color: var(--lg-accent);
  font-weight: 600;
}

.pf-v5-c-button.pf-m-secondary:hover {
  border-color: var(--lg-accent);
  background: var(--lg-info-bg, #e9f3fb);
}

#kc-social-providers svg:not(.google) {
  filter: invert(31%) sepia(85%) saturate(1852%) hue-rotate(186deg) brightness(94%) contrast(101%);
}
