/*
 * Multivista MDS Keycloak login theme — stylesheet
 * Figma: Project-launcher > MDS > Signin, node 5063:119471 (MAV-1320)
 * Page shell (background + card positioning) mirrors the sibling `multivista`
 * theme; card contents follow the MDS design tokens.
 */

/* ─────────────────────────────────────────────────────────────
   Fonts
   Brand font is Hexagon Akkurat (.otf), sourced from the Multivista
   MDS web app, which already serves it publicly as a web font. Roboto
   stays bundled as a load-time/safety fallback; stack prefers Akkurat.
   ───────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Akkurat';
  src: url('../fonts/HexagonAkkurat.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Akkurat';
  src: url('../fonts/HexagonAkkurat-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/Roboto-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/Roboto-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/Roboto-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ─────────────────────────────────────────────────────────────
   Design tokens
   ───────────────────────────────────────────────────────────── */
:root {
  --mv-primary:          #005198;
  --mv-primary-hover:    #003f78;
  --mv-primary-active:   #002f5a;
  --mv-on-primary:       #ffffff;

  --mv-surface:          #ffffff;   /* input background */
  --mv-card-bg:          #f8fafd;   /* login card background */
  --mv-page:             #f8fafd;   /* page background fallback */
  --mv-on-surface:       #121623;   /* primary text */
  --mv-muted:            #646e78;   /* subtitle / placeholder / forgot */
  --mv-secondary:        #474f5f;

  --mv-outline:          #858c99;   /* input border */
  --mv-outline-variant:  #e6eaf0;   /* dividers */

  --mv-error:            #c0392b;   /* field-error border + text */
  --mv-info:             #005198;
  --mv-info-bg:          #eef4fb;

  /* Status-banner colours (MDS spec). Light values here; dark overrides in the
     dark :root block. Referenced only by .mv-alert--*. */
  --mv-alert-warning-bg: #feecd1;   --mv-alert-warning-fg: #8e5515;
  --mv-alert-error-bg:   #fceae7;   --mv-alert-error-fg:   #bc1c1c;
  --mv-alert-success-bg: #e2fad5;   --mv-alert-success-fg: #3a6e2b;

  --mv-surface-readonly: #e6eaf0;   /* read-only field (account email) background */
  --mv-req-bg:           #f5f7fa;   /* password-requirement row background */
  --mv-req-met:          #6dbd55;   /* requirement icon once satisfied */
  --mv-btn-disabled-bg:  rgba(18, 22, 35, 0.12);
  --mv-btn-disabled-fg:  #b4bac4;

  --mv-badge-bg:         #00284c;   /* key-badge circle (dark navy in light mode) */
  --mv-badge-fg:         #ffffff;   /* key glyph */

  --mv-radius:           12px;
  --mv-h-input:          40px;
  --mv-h-btn:            48px;

  --mv-font: 'Akkurat', 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

/* ─────────────────────────────────────────────────────────────
   Reset / base
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--mv-font);
  color: var(--mv-on-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────
   Page + full-bleed background (CSS background-image, cover, centred).
   Card sits left-of-centre, vertically centred — mirrors `multivista`.
   ───────────────────────────────────────────────────────────── */
.mv-page {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  background-color: var(--mv-page);
  /* Dark gradient over the photo, heaviest on the left where the card sits,
     for card legibility and to match the Figma shell. */
  background-image:
    linear-gradient(90deg, rgba(11, 22, 38, 0.72) 0%, rgba(11, 22, 38, 0.38) 40%, rgba(11, 22, 38, 0) 70%),
    url('../img/bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 24px 24px 24px 7.5%;
}

/* ─────────────────────────────────────────────────────────────
   Card
   ───────────────────────────────────────────────────────────── */
.mv-card {
  width: 100%;
  max-width: 444px;   /* Figma card: 380px content + 32px padding each side */
  padding: 32px 32px 24px;   /* Figma: 32 top / 32 sides / 24 bottom */
  background-color: var(--mv-card-bg);
  border-radius: var(--mv-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.mv-card-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─────────────────────────────────────────────────────────────
   Logo (Hexagon Multivista SVG - same asset as the `multivista` theme)
   ───────────────────────────────────────────────────────────── */
.mv-card__logo { display: flex; align-items: center; }
.mv-card__logo img { height: 32px; width: auto; display: block; }

/* ─────────────────────────────────────────────────────────────
   Key badge (reset-landing page)
   ───────────────────────────────────────────────────────────── */
.mv-badge {
  align-self: center;   /* centred in the card; other content stays left-aligned */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: var(--mv-badge-fg);
  background: var(--mv-badge-bg);
}

/* ─────────────────────────────────────────────────────────────
   Title block
   ───────────────────────────────────────────────────────────── */
.mv-titleblock { display: flex; flex-direction: column; gap: 4px; }
.mv-card__title { font: 700 24px/32px var(--mv-font); color: var(--mv-on-surface); }
.mv-card__subtitle { font: 400 14px/20px var(--mv-font); color: var(--mv-muted); }

/* ─────────────────────────────────────────────────────────────
   Alerts (Keycloak system messages)
   ───────────────────────────────────────────────────────────── */
.mv-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 4px;
}
.mv-alert__icon { flex-shrink: 0; line-height: 0; }
.mv-alert__icon svg { display: block; width: 24px; height: 24px; }
.mv-alert__content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mv-alert__title { font: 700 16px/24px var(--mv-font); }
/* 24px line-height matches the 24px icon so the icon centres on the first line
   (icon is top-aligned via align-items:flex-start). */
.mv-alert__body  { font: 400 14px/24px var(--mv-font); }

/* Status colours come from --mv-alert-* tokens (light + dark defined in :root);
   the icon inherits the text colour via currentColor. */
.mv-alert--warning { background: var(--mv-alert-warning-bg); color: var(--mv-alert-warning-fg); }
.mv-alert--error   { background: var(--mv-alert-error-bg);   color: var(--mv-alert-error-fg); }
.mv-alert--success { background: var(--mv-alert-success-bg); color: var(--mv-alert-success-fg); }
.mv-alert--info    { background: var(--mv-info-bg); color: var(--mv-info); }

/* ─────────────────────────────────────────────────────────────
   Form + fields
   ───────────────────────────────────────────────────────────── */
.mv-form { display: flex; flex-direction: column; gap: 16px; }

/* Update-password form uses a roomier 24px rhythm between fields and before
   the button, per the Figma page-2 spec. Scoped by id so the login form
   (also .mv-form) keeps its own spacing. */
#kc-passwd-update-form { gap: 24px; }

.mv-field { display: flex; flex-direction: column; gap: 4px; }
.mv-field__label { font: 400 16px/24px var(--mv-font); color: var(--mv-on-surface); }

.mv-field__input {
  height: var(--mv-h-input);
  width: 100%;
  padding: 8px;
  border: 1px solid var(--mv-outline);
  border-radius: var(--mv-radius);
  font: 400 14px/20px var(--mv-font);
  color: var(--mv-on-surface);
  background: var(--mv-surface);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mv-field__input::placeholder { color: var(--mv-muted); }
.mv-field__input:focus {
  border-color: var(--mv-primary);
  box-shadow: 0 0 0 3px rgba(0, 81, 152, 0.18);
}
.mv-field--error .mv-field__input { border-color: var(--mv-error); }
.mv-field--error .mv-field__input:focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18); }
.mv-field__error { font: 400 12px/16px var(--mv-font); color: var(--mv-error); }

/* Read-only field (account email, shown so password managers can associate
   the saved credential). Muted fill, no focus ring. */
.mv-field__input[readonly] {
  background: var(--mv-surface-readonly);
  color: var(--mv-muted);
  cursor: default;
}
.mv-field__input[readonly]:focus { border-color: var(--mv-outline); box-shadow: none; }

/* Password show/hide */
.mv-field__password-wrap { position: relative; display: flex; align-items: center; }
.mv-field__password-wrap .mv-field__input { padding-right: 44px; }
.mv-field__eye-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--mv-muted);
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.mv-field__eye-toggle:hover { color: var(--mv-on-surface); background: var(--mv-outline-variant); }
.mv-field__eye-toggle:focus-visible { outline: 2px solid var(--mv-primary); outline-offset: 1px; }

/* ─────────────────────────────────────────────────────────────
   Password requirement row (client-side length gate). Icon is muted
   until the rule is met, then turns green (.mv-req--met, set by JS).
   ───────────────────────────────────────────────────────────── */
.mv-req {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--mv-req-bg);
  border: 1px solid var(--mv-outline-variant);
  border-radius: var(--mv-radius);
}
.mv-req__icon { color: var(--mv-muted); transition: color 0.15s ease; }
.mv-req__text { font: 400 14px/20px var(--mv-font); color: var(--mv-muted); }
.mv-req--met .mv-req__icon { color: var(--mv-req-met); }

/* ─────────────────────────────────────────────────────────────
   Forgot password link (left-aligned, below password)
   ───────────────────────────────────────────────────────────── */
.mv-form__forgot { display: flex; justify-content: flex-start; }
.mv-link--forgot {
  font: 700 12px/18px var(--mv-font);
  color: var(--mv-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 4px;
}
.mv-link--forgot:hover { color: var(--mv-on-surface); }
.mv-link--forgot:focus-visible { outline: 2px solid var(--mv-primary); outline-offset: 2px; }

/* "Back to login" text link (reset-password request page): centred in the
   form column, no underline. Uses the secondary token (#474F5F in light,
   readable grey in dark). */
.mv-link--back {
  align-self: center;
  font: 400 12px/18px var(--mv-font);
  color: var(--mv-secondary);
  text-decoration: none;
  border-radius: 4px;
}
.mv-link--back:hover { color: var(--mv-on-surface); }
.mv-link--back:focus-visible { outline: 2px solid var(--mv-primary); outline-offset: 2px; }

/* ─────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────── */
.mv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--mv-h-btn);
  padding: 0 24px;
  border: none;
  border-radius: var(--mv-radius);
  /* Akkurat ships only 400 + 700; 600 would round up to Bold. Use 400 so the
     label isn't over-weighted (Roboto fallback synthesises a mid weight). */
  font: 400 16px/24px var(--mv-font);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.mv-btn--primary { background: var(--mv-primary); color: var(--mv-on-primary); }
.mv-btn--primary:hover { background: var(--mv-primary-hover); }
.mv-btn--primary:active { background: var(--mv-primary-active); }
.mv-btn--primary:focus-visible {
  outline: 2px solid var(--mv-primary);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(0, 81, 152, 0.20);
}
.mv-btn--primary:disabled { background: var(--mv-btn-disabled-bg); color: var(--mv-btn-disabled-fg); cursor: not-allowed; }

/* Outlined secondary button (Login with SSO) */
.mv-btn--secondary {
  background: transparent;
  color: var(--mv-primary);
  border: 1px solid var(--mv-primary);
}
.mv-btn--secondary:hover { background: rgba(0, 81, 152, 0.06); }
.mv-btn--secondary:active { background: rgba(0, 81, 152, 0.12); }
.mv-btn--secondary:focus-visible { outline: 2px solid var(--mv-primary); outline-offset: 3px; }

/* Anchor styled as a button (SSO, error / info / expired pages) */
.mv-btn--link { text-decoration: none; }

/* "or" divider: centred label between two rules */
.mv-divider { display: flex; align-items: center; gap: 16px; }
.mv-divider::before,
.mv-divider::after { content: ""; flex: 1; height: 1px; background: var(--mv-outline-variant); }
.mv-divider__text { font: 400 14px/20px var(--mv-font); color: var(--mv-muted); }

/* Govcloud entry */
.mv-govcloud { font: 400 14px/20px var(--mv-font); color: var(--mv-secondary); text-align: center; }
.mv-link--govcloud {
  color: var(--mv-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 4px;
}
.mv-link--govcloud:hover { color: var(--mv-on-surface); }
.mv-link--govcloud:focus-visible { outline: 2px solid var(--mv-primary); outline-offset: 2px; }

/* ─────────────────────────────────────────────────────────────
   Icon utility
   ───────────────────────────────────────────────────────────── */
.mv-icon { display: block; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────
   Dark palette (OS dark mode). Overrides the design tokens to the
   `multivista` theme's dark values; the light palette above is untouched.
   ───────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --mv-primary:          #01adff;   /* cyan - all buttons in dark mode */
    --mv-primary-hover:    #009ae6;
    --mv-primary-active:   #0087cc;
    --mv-on-primary:       #10192e;   /* near-black button text on the cyan */

    --mv-surface:          #2a2d37;   /* input background */
    --mv-card-bg:          #1c1f2b;   /* card background */
    --mv-page:             #1c1f2b;   /* page background fallback */
    --mv-on-surface:       #ffffff;   /* primary text */
    --mv-muted:            #9ca3af;   /* subtitle / placeholder / forgot */
    --mv-secondary:        #9ca3af;

    --mv-outline:          #3f4354;   /* input border */
    --mv-outline-variant:  #3f4354;   /* dividers */

    --mv-badge-bg:         #99d6ff;   /* light-blue key-badge circle */
    --mv-badge-fg:         #10192e;   /* dark key glyph */

    --mv-error:            #fca5a5;
    --mv-info:             #93c5fd;   --mv-info-bg:    #1b2240;

    /* Status-banner dark overrides (MDS spec). */
    --mv-alert-warning-bg: #8e5515;   --mv-alert-warning-fg: #feecd1;
    --mv-alert-error-bg:   #8d0f0f;   --mv-alert-error-fg:   #fceae7;
    --mv-alert-success-bg: #255521;   --mv-alert-success-fg: #e2fad5;

    --mv-surface-readonly: #474f5f;
    --mv-req-bg:           #3b3f4e;
    --mv-req-met:          #7dd166;
    --mv-btn-disabled-bg:  rgba(245, 247, 250, 0.12);
    --mv-btn-disabled-fg:  #646e78;
  }

  /* Alert dark colours are handled by the --mv-alert-* overrides above. */

  /* Keep the dark-blue SVG logo legible on the dark card. */
  .mv-card__logo img { filter: brightness(0) invert(1); }

  .mv-card { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); }
}

/* ─────────────────────────────────────────────────────────────
   Responsive: mobile — drop the background, card fills the viewport
   (mirrors the `multivista` theme).
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mv-page {
    flex-direction: column;
    background-image: none;
    background-color: var(--mv-card-bg);
    padding: 0;
  }
  .mv-card {
    max-width: 100%;
    flex: 1;
    border-radius: 0;
    box-shadow: none;
    padding: 24px;
  }
  .mv-card-inner { max-width: 400px; margin: 0 auto; }
}
