/*
 * WMS login theme. Structure and spacing only: every colour, radius and font comes from the tenant's theme
 * tokens (custom properties). The values below are the neutral defaults the web app also falls back to; brand.js
 * replaces them from the public bootstrap endpoint. Patternfly's own CSS is still loaded (icons, utility
 * classes), so selectors are prefixed with "body.wms" to win without !important.
 */
:root {
  --color-background: #f7f8fa;
  --color-foreground: #12141a;
  --color-surface: #ffffff;
  --color-primary: #0b6e4f;
  --color-primary-foreground: #ffffff;
  --color-accent: #c45d26;
  --color-muted: #e8ebf0;
  --color-border: #d5dae3;
  --color-danger: #b42318;
  --color-success: #1b7f4e;
  --color-warning: #a15c00;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-sans: "IBM Plex Sans", "Noto Sans", system-ui, sans-serif;
  --font-display: "IBM Plex Sans", "Noto Sans", system-ui, sans-serif;
  --base-size: 16px;
  --text-secondary: color-mix(in srgb, var(--color-foreground) 68%, var(--color-surface));
}

html.wms-html,
html.wms-html body.wms {
  height: auto;
  min-height: 100%;
  margin: 0;
  background: var(--color-background);
  background-image: none;
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: var(--base-size);
  line-height: 1.5;
}

body.wms * {
  box-sizing: border-box;
}

body.wms .wms-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 24px 16px;
}

body.wms .wms-card {
  width: 100%;
  max-width: 440px;
  padding: 32px 32px 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
}

@media (max-width: 480px) {
  body.wms .wms-page {
    align-items: start;
    padding: 0;
  }
  body.wms .wms-card {
    min-height: 100vh;
    min-height: 100dvh;
    max-width: none;
    padding: 24px 20px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---- top bar: brand and language ---- */
body.wms .wms-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 24px;
}

body.wms .wms-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body.wms .wms-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

body.wms .wms-mark-image {
  background: transparent;
}

body.wms .wms-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Simple box mark drawn with borders so it follows the primary colour without an image. */
body.wms .wms-mark:not(.wms-mark-image)::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid currentcolor;
  border-radius: 4px;
  transform: rotate(45deg) scale(0.75);
}

body.wms .wms-brand-name {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  visibility: hidden;
}

html.wms-ready body.wms .wms-brand-name {
  visibility: visible;
}

/* ---- language switcher ---- */
body.wms .wms-locale {
  position: relative;
  flex: none;
}

body.wms #kc-current-locale-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-foreground);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
}

body.wms #kc-current-locale-link::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentcolor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}

body.wms .wms-locale-list {
  position: absolute;
  z-index: 10;
  inset-block-start: calc(100% + 4px);
  inset-inline-end: 0;
  display: none;
  min-width: 160px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 14%);
  list-style: none;
}

body.wms .wms-locale [aria-expanded="true"] + .wms-locale-list,
body.wms .wms-locale-list:focus-within {
  display: block;
}

body.wms .wms-locale-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
  text-decoration: none;
}

body.wms .wms-locale-item:hover,
body.wms .wms-locale-item:focus-visible {
  background: var(--color-muted);
}

/* ---- header ---- */
body.wms .wms-header h1,
body.wms #kc-page-title {
  margin: 0 0 20px;
  color: var(--color-foreground);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

body.wms .wms-required {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

body.wms .required {
  color: var(--color-danger);
}

body.wms #kc-username {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--color-muted);
}

body.wms #kc-attempted-username {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

body.wms .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---- forms ---- */
body.wms #kc-content-wrapper,
body.wms #kc-form,
body.wms #kc-form-wrapper {
  width: 100%;
  margin: 0;
  padding: 0;
}

body.wms form,
body.wms .form-horizontal {
  margin: 0;
}

body.wms .form-group,
body.wms .pf-c-form__group {
  display: block;
  margin: 0 0 16px;
  padding: 0;
}

body.wms .form-horizontal .form-group {
  margin-inline: 0;
}

body.wms .pf-c-form__label,
body.wms label {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  color: var(--color-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: start;
}

body.wms input.pf-c-form-control,
body.wms .pf-c-form-control,
body.wms select,
body.wms textarea,
body.wms input[type="text"],
body.wms input[type="password"],
body.wms input[type="email"],
body.wms input[type="tel"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: none;
  color: var(--color-foreground);
  font: inherit;
  line-height: 1.4;
}

body.wms .pf-c-form-control:focus,
body.wms input:focus-visible,
body.wms select:focus-visible {
  border-color: var(--color-primary);
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

body.wms input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

body.wms .pf-c-input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
}

body.wms .pf-c-input-group .pf-c-form-control {
  flex: 1;
  min-width: 0;
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

body.wms .pf-c-input-group > button {
  display: inline-grid;
  width: 48px;
  flex: none;
  place-items: center;
  margin: 0;
  border: 1px solid var(--color-border);
  border-inline-start: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  border-start-end-radius: var(--radius-md);
  border-end-end-radius: var(--radius-md);
  background: var(--color-muted);
  color: var(--color-foreground);
  cursor: pointer;
}

body.wms .pf-c-form__helper-text,
body.wms .pf-c-form__helper-text.pf-m-error,
body.wms .kc-feedback-text {
  display: block;
  margin-top: 6px;
  color: var(--color-danger);
  font-size: 0.875rem;
}

body.wms input[type="checkbox"],
body.wms input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0 8px 0 0;
  accent-color: var(--color-primary);
  vertical-align: middle;
}

body.wms .checkbox label,
body.wms .pf-c-check__label {
  display: inline-flex;
  align-items: center;
  font-weight: 400;
}

body.wms .login-pf-settings,
body.wms #kc-form-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 16px;
}

body.wms #kc-form-options {
  margin: 0;
}

/* ---- buttons ---- */
body.wms .pf-c-button,
body.wms input[type="submit"],
body.wms button.btn-default,
body.wms a.pf-c-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-foreground);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

body.wms .pf-c-button.pf-m-primary,
body.wms input[type="submit"].pf-m-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

body.wms .pf-c-button.pf-m-primary:hover,
body.wms input[type="submit"].pf-m-primary:hover {
  background: color-mix(in srgb, var(--color-primary) 88%, black);
}

body.wms .pf-c-button.pf-m-block,
body.wms input[type="submit"].pf-m-block {
  display: flex;
  width: 100%;
}

body.wms .pf-c-button:focus-visible,
body.wms a:focus-visible,
body.wms button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

body.wms .pf-c-button:disabled,
body.wms input[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

#kc-form-buttons {
  margin-top: 8px;
}

/* ---- links ---- */
body.wms a {
  border-bottom: 0;
  background-image: none;
  box-shadow: none;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.wms a:hover {
  color: color-mix(in srgb, var(--color-primary) 80%, black);
}

body.wms #kc-info,
body.wms #kc-registration {
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

body.wms #try-another-way,
body.wms #reset-login {
  font-size: 0.875rem;
}

body.wms #reset-login {
  margin-inline-start: auto;
}

/* ---- alerts ---- */
body.wms .pf-c-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-inline-start: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-muted);
  color: var(--color-foreground);
  font-size: 0.9375rem;
}

body.wms .pf-c-alert.pf-m-danger {
  border-inline-start-color: var(--color-danger);
  color: var(--color-danger);
}

body.wms .pf-c-alert.pf-m-success {
  border-inline-start-color: var(--color-success);
}

body.wms .pf-c-alert.pf-m-warning {
  border-inline-start-color: var(--color-warning);
}

body.wms .pf-c-alert__icon {
  flex: none;
  padding-top: 1px;
}

body.wms .pf-c-alert__title {
  margin: 0;
  font-weight: 500;
}

/* ---- authenticator picker, OTP, social ---- */
body.wms .select-auth-box-parent,
body.wms .pf-c-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
}

body.wms .select-auth-box-parent:hover,
body.wms .pf-c-tile:hover {
  border-color: var(--color-primary);
}

body.wms #kc-social-providers hr {
  border: 0;
  border-top: 1px solid var(--color-border);
}

body.wms #kc-social-providers h2 {
  margin: 12px 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

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

body.wms .kc-social-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-foreground);
  text-decoration: none;
}

body.wms code,
body.wms .kc-recovery-codes-list {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ---- motion ---- */
@media (prefers-reduced-motion: no-preference) {
  body.wms .wms-card {
    animation: wms-in 160ms ease-out;
  }
}

@keyframes wms-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@media (forced-colors: active) {
  body.wms .wms-card,
  body.wms .pf-c-form-control,
  body.wms .pf-c-button {
    border: 1px solid CanvasText;
  }
}

@media (scripting: none) {
  body.wms .wms-brand-name {
    visibility: visible;
  }
}
