/* ===========================================================================
   auth.css — shared primitives for the standalone (Layout = null) auth pages.

   C9a (account §4.10 + portalcuenta §6): the ERP login, the employee-portal
   login, and the new ForgotPassword/ResetPassword pages were each re-declaring
   the same card / input / button / checkbox / validation-summary CSS inline,
   with small drifts (e.g. Login --bg:#050D18 vs PortalCuenta #06101E). That
   duplication was the ROOT CAUSE of the regressions the analyses flagged (the
   portal login had drifted and lost the password toggle + custom checkbox).

   This file is the single source of truth for those primitives. It is a plain
   wwwroot asset so it can be linked from pages that render PRE-auth (no shared
   _Layout). Each page keeps ONLY its page-specific chrome inline:
     - the ERP Login keeps its two-column marketing pane + aurora/animation;
     - the portal login keeps its simpler single-card background.

   Tokens are reconciled here so both pages share one palette. Pages may still
   override a token locally (the ERP login sets a slightly different --bg for
   its marketing pane) — that override stays in the page, not here.
   =========================================================================== */

:root {
  /* Reconciled auth palette (single source — was duplicated/divergent per page). */
  --auth-bg: #06101E;
  --auth-line: rgba(140, 178, 224, .14);
  --auth-ink: #EAF1FA;
  --auth-ink-dim: #9FB2CC;
  /* Nudged one step lighter than the old #6F86A6 so hint text clears WCAG AA on
     the dark card (account §4.11 / portalcuenta a11y). */
  --auth-ink-faint: #8499B5;
  --auth-brand: #0072CE;
  --auth-brand-2: #4FA8F5;
  --auth-brand-pale: #CFE6FF;
  --auth-brand-warm: #ED8B00;
  --auth-err: #ff9d8a;
  --auth-ok: #5FD08A;
  --auth-r: 12px;
  --auth-r-lg: 22px;
  --auth-shadow: 0 24px 70px -20px rgba(0, 0, 0, .6);
}

/* ---------- brand mark (shared by both logins + Denegado) ---------- */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  justify-content: center;
}

.auth-brand .gem {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #FFFFFF;
  font-size: .85rem;
  background: conic-gradient(from 210deg, var(--auth-brand-2), var(--auth-brand), #004C8C, var(--auth-brand-2));
}

/* ---------- card ---------- */
.auth-card {
  position: relative;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-r-lg);
  padding: 34px;
  background: linear-gradient(180deg, rgba(12, 30, 56, .86), rgba(8, 22, 42, .86));
  backdrop-filter: blur(16px);
  box-shadow: var(--auth-shadow);
}

.auth-card h1,
.auth-card h2 {
  font-size: 1.5rem;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.auth-card .hint {
  font-size: .88rem;
  color: var(--auth-ink-faint);
  margin-bottom: 24px;
}

/* ---------- form primitives ---------- */
.auth-card label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--auth-ink-dim);
  margin: 16px 0 7px;
}

.auth-card input[type=email],
.auth-card input[type=password],
.auth-card input[type=text] {
  width: 100%;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-r);
  background: rgba(5, 13, 24, .55);
  color: var(--auth-ink);
  padding: 13px 15px;
  font: inherit;
  font-size: .96rem;
  transition: .25s;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 4px rgba(0, 114, 206, .18);
}

.auth-card input::placeholder {
  color: var(--auth-ink-faint);
}

/* ---------- password reveal toggle ---------- */
.pwd {
  position: relative;
}

.pwd input {
  padding-right: 84px;
}

.pwd .toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--auth-brand-2);
  padding: 8px;
}

.pwd .toggle:hover {
  color: var(--auth-brand-pale);
}

.pwd .toggle:focus-visible {
  outline: 2px solid var(--auth-brand-2);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Caps-lock hint shown next to the password field (account §4.8). */
.caps-hint {
  display: none;
  margin-top: 7px;
  font-size: .8rem;
  color: var(--auth-brand-warm);
  font-weight: 600;
}

.caps-hint.on {
  display: block;
}

/* ---------- styled checkbox (remember-me) ---------- */
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 6px;
  font-size: .9rem;
  color: var(--auth-ink-dim);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.check input {
  appearance: none;
  width: 19px;
  height: 19px;
  border: 1px solid var(--auth-line);
  border-radius: 6px;
  cursor: pointer;
  background: rgba(5, 13, 24, .55);
  display: grid;
  place-items: center;
  transition: .2s;
  flex: none;
}

.check input::after {
  content: "\2713";
  font-size: .7rem;
  color: #FFFFFF;
  opacity: 0;
  transform: scale(.4);
  transition: .2s;
}

.check input:checked {
  background: linear-gradient(135deg, var(--auth-brand-2), var(--auth-brand));
  border-color: transparent;
}

.check input:checked::after {
  opacity: 1;
  transform: none;
}

.check input:focus-visible {
  outline: 2px solid var(--auth-brand-2);
  outline-offset: 2px;
}

/* ---------- primary button (+ busy state, account §4.3) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .98rem;
  padding: 14px 24px;
  border: 0;
  cursor: pointer;
  transition: .25s;
  width: 100%;
  margin-top: 22px;
  background: linear-gradient(135deg, var(--auth-brand-2), var(--auth-brand));
  color: #FFFFFF;
  box-shadow: 0 8px 30px -8px rgba(0, 114, 206, .7);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px -8px rgba(0, 114, 206, .85);
}

.btn .ar {
  transition: transform .25s;
}

.btn:hover .ar {
  transform: translateX(4px);
}

.btn[aria-busy="true"],
.btn:disabled {
  opacity: .75;
  cursor: progress;
  transform: none;
}

.btn .spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: auth-spin .6s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- links ---------- */
.auth-links {
  margin-top: 22px;
  font-size: .9rem;
  display: grid;
  gap: 8px;
}

.auth-links a {
  color: var(--auth-brand-2);
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover {
  color: var(--auth-brand-pale);
}

.auth-links .dim {
  color: var(--auth-ink-faint);
  font-weight: 500;
}

.auth-links .dim:hover {
  color: var(--auth-ink-dim);
}

/* Right-aligned "forgot password" link under the password field. */
.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.forgot-row a {
  font-size: .85rem;
  font-weight: 600;
  color: var(--auth-brand-2);
  text-decoration: none;
}

.forgot-row a:hover {
  color: var(--auth-brand-pale);
}

/* A low-emphasis "wrong door" pointer to the other login. */
.auth-crossdoor {
  margin-top: 20px;
  text-align: center;
  font-size: .85rem;
  color: var(--auth-ink-faint);
}

.auth-crossdoor a {
  color: var(--auth-ink-dim);
  font-weight: 600;
  text-decoration: none;
}

.auth-crossdoor a:hover {
  color: var(--auth-brand-2);
}

/* Plain-language recovery disclosure (portal: "contact your employer"). */
.auth-recover {
  margin-top: 16px;
  font-size: .85rem;
  color: var(--auth-ink-faint);
  line-height: 1.55;
}

.auth-recover summary {
  cursor: pointer;
  color: var(--auth-brand-2);
  font-weight: 600;
  list-style: none;
}

.auth-recover summary::-webkit-details-marker {
  display: none;
}

.auth-recover[open] summary {
  margin-bottom: 8px;
}

/* ---------- validation summary / field errors ---------- */
.validation-summary ul {
  list-style: none;
}

.validation-summary li,
.field-error {
  display: block;
  color: var(--auth-err);
  font-size: .82rem;
  margin-top: 7px;
  font-weight: 500;
}

.validation-summary:not(:empty) {
  border: 1px solid rgba(255, 157, 138, .35);
  background: rgba(255, 157, 138, .08);
  border-radius: var(--auth-r);
  padding: 12px 14px;
  margin-bottom: 6px;
}

/* Tonal variants (account §4.6): warning for lockout, info for wrong-portal. */
.validation-summary.tone-warn:not(:empty) {
  border-color: rgba(237, 139, 0, .4);
  background: rgba(237, 139, 0, .08);
}

.validation-summary.tone-warn li {
  color: var(--auth-brand-warm);
}

.validation-summary.tone-info:not(:empty) {
  border-color: rgba(79, 168, 245, .4);
  background: rgba(79, 168, 245, .08);
}

.validation-summary.tone-info li {
  color: var(--auth-brand-2);
}

.validation-summary:empty,
.field-error:empty {
  display: none;
}

/* A success banner (e.g. "password updated — sign in"). */
.auth-success {
  border: 1px solid rgba(95, 208, 138, .4);
  background: rgba(95, 208, 138, .08);
  border-radius: var(--auth-r);
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--auth-ok);
  font-size: .88rem;
  font-weight: 500;
}

/* ---------- language switcher (shared; non-colour-only active state) ---------- */
.auth-lang {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: .85rem;
  color: var(--auth-ink-dim);
}

.auth-lang button {
  background: none;
  border: 0;
  color: var(--auth-ink-dim);
  cursor: pointer;
  font: inherit;
  padding: 2px 6px;
  border-radius: 6px;
}

.auth-lang button:hover {
  color: var(--auth-ink);
}

/* portalcuenta §8 / account §4.11: the active language must NOT be colour-only.
   Bold + underline + a pill border so colour-blind users can still tell. */
.auth-lang button.on {
  color: var(--auth-brand-2);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-lang button:focus-visible {
  outline: 2px solid var(--auth-brand-2);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

  .btn,
  .btn .ar,
  .btn .spinner {
    animation: none !important;
    transition: none !important;
  }
}
