/* ── Solo Ledger login theme (from Team Ledger) ──────────────────────────────────────────────────
   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=Familjen+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/* The app's two themes (apps/web/app/globals.css), chosen by data-theme on
   <html> (js/theme.js): by day near-white paper on the sage page; at night the
   green desk with lamplit cream paper. Without JavaScript the page is light.
   Variable names are Team Ledger's so the rules below carry over unchanged. */
:root {
  color-scheme: light;
  --page-bg: #F2F3EE;
  --page-text: #1B2420;
  --page-muted: #5A6560;
  --surface: #FCFCFA;
  --input-bg: #ECEEE8;
  --on-accent: #FFFFFF;
  --text: #1B2420;
  --heading: #1B2420;
  --muted: #5A6560;       /* 5.9:1 on the card (WCAG 2.2 AA) */
  --hairline: #DADED3;
  --border: #DADED3;
  --accent: #216A4C;
  --accent-hover: #1A5A40;
  --link: #216A4C;
  --focus: #2F7FB8;
  --red-text: #8E3325;
  --red-soft-bg: #F9E9E5;
  --red-soft-border: #EBC4BB;
  --amber: #8A5A10;
  --amber-soft-bg: #FBF3E1;
  --green-soft-bg: #E3EEE7;
  --green-soft-border: #CBE3D2;
  --font-sans: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  --font-size-micro: 0.68rem;
  --font-size-xs: 0.72rem;
  --font-size-sm: 0.8rem;
  --font-size-body: 0.88rem;
  --font-size-base: 0.95rem;
  --font-size-heading: 1rem;
  --font-size-page-title: 1.6rem;
  --radius-input: 11px;
  --radius-button: 11px;
  --radius-card: 16px;
  --shadow-card: 0 18px 40px -22px rgba(15, 46, 36, .35);
}
/* At night black, lit in green from above, as the product page (app/(public)/landing.css): the
   door into the app, not its desk. The card stays paper, dimmed a shade, as in the app. */
html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0A0B0A;
  --page-text: #F2EEE3;
  --page-muted: #C3C7B8;
  --surface: #EFEADD;
  --input-bg: #E5DFCF;
  --on-accent: #EFEADD;
  --text: #3B3A32;
  --heading: #0F2E24;
  --muted: #5A584A;
  --hairline: #C4BEAD;
  --border: #C4BEAD;
  --accent: #0F2E24;
  --accent-hover: #1B4636;
  --link: #246340;
  --focus: #2B4EC9;
  --red-text: #9A3B36;
  --red-soft-bg: #EDD6D0;
  --amber-soft-bg: #ECDCBC;
  --green-soft-bg: #D6E3D3;
  --shadow-card: 0 10px 28px -14px rgba(0, 0, 0, .55);
}
/* The card itself is light paper in both themes: native fields and the eye stay light. */
.login-pf-page .card-pf { color-scheme: light; }
html[data-theme="dark"] .login-pf-page {
  background:
    radial-gradient(110% 55% at 50% -8%, rgba(63, 162, 104, .26), transparent 62%),
    radial-gradient(80% 40% at 100% 60%, rgba(63, 162, 104, .08), transparent 70%),
    var(--page-bg);
  min-height: 100vh;
}

/* ── 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;
  /* The app's gutters: on a phone the card keeps 16px from each edge, as every screen of the app does. */
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}
/* 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;
}

/* ── The brand above the card ───────────────────────────────────────────────
   The app's mark and name, as in its sidebar; a link back to the product page. */
.pcp-brand,
.login-pf-page a.pcp-brand {
  width: min(100%, 460px);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--page-text);
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.login-pf-page a.pcp-brand:hover { color: var(--page-text); text-decoration: none; }
.pcp-brand svg { width: 32px; height: 32px; border-radius: 8px; flex: 0 0 auto; }
html[data-theme="dark"] .pcp-brand svg { box-shadow: 0 0 0 1px rgba(242, 238, 227, .14); }

/* ── 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;
}
@media (max-width: 480px) {
  .login-pf-page .card-pf { padding: 24px 20px 26px; }
}

/* ── Card title / eyebrow ────────────────────────────────────────────────────*/
#kc-content-wrapper {
  margin-top: 0;
}
#kc-page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--font-size-page-title);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--heading);
  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(--focus);
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  box-shadow: none;
}
.login-pf-page .form-group {
  margin-bottom: 18px;
}

/* Password reveal button — inside the field: one region, one outline, the
   eye at its end (PatternFly draws the control's own borders with ::after). */
.login-pf-page .pf-c-input-group,
.login-pf-page .pf-v5-c-input-group {
  align-items: stretch;
  /* PatternFly paints the group white; it showed at the field's rounded corners on a dark card. */
  background: transparent;
}
.login-pf-page .pf-c-input-group > input,
.login-pf-page .pf-v5-c-input-group > input {
  border-right: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.login-pf-page .kc-login-tooltip,
.login-pf-page button.pf-c-button.pf-m-control {
  color: var(--muted);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
  padding: 0 14px;
}
.login-pf-page button.pf-c-button.pf-m-control::after {
  border: none;
}
/* Focused, the field and its eye are outlined as one. */
.login-pf-page .pf-c-input-group:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-radius: var(--radius-input);
}
.login-pf-page .pf-c-input-group > input:focus {
  outline: none;
}
.login-pf-page .pf-c-input-group:focus-within > input,
.login-pf-page .pf-c-input-group:focus-within > button.pf-c-button.pf-m-control {
  border-color: var(--focus);
}

/* ── 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 .pf-c-button.pf-m-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 .pf-c-button.pf-m-primary:hover,
.login-pf-page .pf-c-button.pf-m-primary:focus,
.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(--link);
  text-decoration: none;
  font-weight: 600;
}
.login-pf-page a:hover {
  color: var(--link);
  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;
}

/* ── The way to the other page (sign in ⇄ register), at the card's foot ──────*/
#kc-info {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px dashed var(--hairline);
}
#kc-info-wrapper {
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--font-size-body);
  text-align: center;
}

/* 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;
}

/* Keyboard focus anywhere else on the page: the same ring. */
.login-pf-page a:focus-visible,
.login-pf-page button:focus-visible,
.pcp-brand:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
html[data-theme="dark"] .pcp-brand:focus-visible { outline-color: #9DB4F2; }

/* Registration and password reset: the page's one action first, the way back
   under it, quiet (Keycloak draws the link above the button). */
.login-pf-page .form-group:has(> #kc-form-options + #kc-form-buttons) {
  display: flex;
  flex-direction: column-reverse;
  gap: 14px;
}
.login-pf-page .form-group:has(> #kc-form-options + #kc-form-buttons) #kc-form-buttons { margin-top: 4px; }
.login-pf-page .form-group:has(> #kc-form-options + #kc-form-buttons) #kc-form-options { margin: 0; text-align: center; }
.login-pf-page .form-group:has(> #kc-form-options + #kc-form-buttons) #kc-form-options a { color: var(--muted); font-weight: 500; }
