/* ── Team Ledger login theme ──────────────────────────────────────────────────
   Restyles the classic Keycloak login page to match the app. Tokens here are
   mirrored from apps/web/lib/tokens.ts / apps/web/app/globals.css. Loaded last
   in theme.properties so these rules override PatternFly + the base login.css.

   Login happens before we know the user's role, so we use the app's DEFAULT
   accent (green / manager), matching --accent in globals.css. */

@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Instrument+Sans:wght@400;500;600&family=Spline+Sans+Mono:wght@400;500;600&display=swap");

:root {
  --page-bg: #f2f3ee;
  --surface: #fcfcfa;
  --input-bg: #fff;
  --on-accent: #fff;
  --text: #1b2420;
  --muted: #5a6560;
  --hairline: #daded3;
  --border: #b9c0b2;
  --accent: #216a4c;
  --accent-hover: #1a573e;
  --red-text: #8e3325;
  --red-soft-bg: #f9e9e5;
  --red-soft-border: #ebc4bb;
  --amber: #a96d14;
  --amber-soft-bg: #fbf3e1;
  --green-soft-bg: #e3eee7;
  --green-soft-border: #c7dccf;
  --font-sans: "Instrument Sans", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;
  --font-size-micro: 0.68rem;
  --font-size-xs: 0.72rem;
  --font-size-sm: 0.76rem;
  --font-size-body: 0.85rem;
  --font-size-base: 0.9rem;
  --font-size-heading: 0.95rem;
  --font-size-auth-brand: 1.7rem;
  --font-size-page-title: 2rem;
  --radius-input: 7px;
  --radius-button: 8px;
  --radius-card: 10px;
  --shadow-card: 0 1px 2px rgba(27, 36, 32, 0.04), 0 8px 24px rgba(27, 36, 32, 0.05);
}

/* ── Page canvas ─────────────────────────────────────────────────────────────
   Kill PatternFly's dark hero/background image; use the warm app canvas. */
html {
  background: var(--page-bg);
}
body.login-pf,
.login-pf body {
  background: var(--page-bg);
}
.login-pf-page {
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  padding-top: 7vh;
  padding-bottom: 6vh;
}
/* PatternFly paints a full-bleed background image on this pseudo element. */
.login-pf body::before,
.login-pf-page::before {
  background: none !important;
  content: none !important;
}

/* ── Brand header (realm display name) ───────────────────────────────────────
   Rendered above the card. Presented as the app's serif wordmark. */
#kc-header {
  width: min(100%, 460px);
  margin: 0 auto 18px;
  padding: 0 4px;
}
#kc-header-wrapper {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--font-size-auth-brand);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
  text-align: left;
  padding: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* ── Card ────────────────────────────────────────────────────────────────────*/
.login-pf-page .card-pf {
  width: min(100%, 460px);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 30px 32px 32px;
}

/* ── Card title / eyebrow ────────────────────────────────────────────────────*/
#kc-content-wrapper {
  margin-top: 0;
}
#kc-page-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--font-size-page-title);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 20px;
  text-align: left;
}
/* "Sign in to your account" area / username hint above the form. */
#kc-username,
#kc-username .kc-login-tooltip {
  color: var(--muted);
}

/* ── Labels ──────────────────────────────────────────────────────────────────*/
.login-pf-page label,
.login-pf-page .control-label {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}

/* ── Inputs ──────────────────────────────────────────────────────────────────*/
.login-pf-page input[type="text"],
.login-pf-page input[type="email"],
.login-pf-page input[type="password"],
.login-pf-page input[type="number"],
.login-pf-page .form-control {
  height: auto;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-size-heading);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  box-shadow: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.login-pf-page input::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}
.login-pf-page input:focus,
.login-pf-page .form-control:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  box-shadow: none;
}
.login-pf-page .form-group {
  margin-bottom: 18px;
}

/* Password reveal button — keep it quiet, aligned to the accent. */
.login-pf-page .pf-c-input-group,
.login-pf-page .pf-v5-c-input-group {
  align-items: stretch;
}
.login-pf-page .kc-login-tooltip,
.login-pf-page button.pf-c-button.pf-m-control {
  border-color: var(--border);
  color: var(--muted);
  background: var(--surface);
}

/* ── Primary button ──────────────────────────────────────────────────────────*/
.login-pf-page #kc-form-buttons {
  margin-top: 22px;
}
.login-pf-page .btn-primary,
.login-pf-page input[type="submit"].btn-primary,
.login-pf-page #kc-login {
  width: 100%;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--on-accent);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--font-size-base);
  line-height: 1.2;
  border-radius: var(--radius-button);
  padding: 11px 16px;
  box-shadow: none;
  text-shadow: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.login-pf-page .btn-primary:hover,
.login-pf-page #kc-login:hover,
.login-pf-page .btn-primary:focus,
.login-pf-page #kc-login:focus {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

/* Secondary / default buttons (e.g. "Cancel", "Back"). */
.login-pf-page .btn-default,
.login-pf-page .btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-button);
  font-weight: 600;
  box-shadow: none;
}
.login-pf-page .btn-default:hover,
.login-pf-page .btn-secondary:hover {
  border-color: var(--text);
}

/* ── Checkbox: "Remember me" ─────────────────────────────────────────────────*/
.login-pf-page .checkbox {
  color: var(--muted);
  font-size: var(--font-size-body);
}
.login-pf-page .checkbox input[type="checkbox"] {
  accent-color: var(--accent);
}
#kc-form-options {
  margin-top: 4px;
}

/* ── Links ───────────────────────────────────────────────────────────────────*/
.login-pf-page a,
.login-pf-page #kc-registration a,
.login-pf-page #kc-info-wrapper a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.login-pf-page a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Alerts / messages ───────────────────────────────────────────────────────*/
.login-pf-page .alert,
.login-pf-page .pf-c-alert {
  border-radius: var(--radius-button);
  font-size: var(--font-size-body);
  border: 1px solid transparent;
  box-shadow: none;
}
.login-pf-page .alert-error,
.login-pf-page .pf-m-danger {
  background: var(--red-soft-bg);
  border-color: var(--red-soft-border);
  color: var(--red-text);
}
.login-pf-page .alert-warning {
  background: var(--amber-soft-bg);
  border-color: color-mix(in srgb, var(--amber) 35%, var(--amber-soft-bg));
  color: var(--amber);
}
.login-pf-page .alert-success {
  background: var(--green-soft-bg);
  border-color: var(--green-soft-border);
  color: var(--accent);
}
.login-pf-page .alert a {
  color: inherit;
  text-decoration: underline;
}

/* ── Footer / info area under the card ───────────────────────────────────────*/
#kc-info {
  width: min(100%, 460px);
  margin: 16px auto 0;
}
#kc-info-wrapper {
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--font-size-body);
  text-align: center;
}

/* Language selector, if enabled, stays subdued. */
#kc-locale ul {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-button);
}
#kc-locale a {
  color: var(--muted);
}

/* Monospace numerals utility, mirroring the app (used if codes/OTP appear). */
.login-pf-page .mono,
.login-pf-page input[name="totp"],
.login-pf-page #kc-otp-login-form input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
