/* ============================================================
   PREDISE — pantallas de autenticacion
   ------------------------------------------------------------
   Depende de predise-theme.css (tokens). Cero hex aca dentro:
   si necesitas un color nuevo, agregalo al :root del tema.

   Cubre: login, recuperar contrasena, sesion finalizada.
   No depende de Bootstrap ni de styles.css.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; padding: 0; }

body.auth-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-size: .85rem;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

/* ==================== ESCENARIO ==================== */
.auth {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

/* Blobs de marca en CSS: reemplazan a Wallpaper_Login.png para que
   el fondo siga al tema en vez de estar quemado en un PNG. */
.blob { position: absolute; border-radius: 50%; pointer-events: none; }
.blob--tr {
  width: min(46vw, 620px); aspect-ratio: 1;
  top: min(-19vw, -250px); right: min(-13vw, -170px);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
}
.blob--tr-dot {
  width: min(8vw, 104px); aspect-ratio: 1;
  top: min(4vw, 54px); right: min(6vw, 80px);
  background: var(--surface);
}
.blob--bl {
  width: min(40vw, 540px); aspect-ratio: 1;
  bottom: min(-17vw, -230px); left: min(-14vw, -190px);
  background: linear-gradient(135deg, var(--brand-hover) 0%, var(--brand) 100%);
}
.blob--bl-dot {
  width: min(7vw, 92px); aspect-ratio: 1;
  bottom: min(9vw, 120px); left: min(7vw, 96px);
  background: var(--surface);
}
.blob--l {
  width: min(22vw, 290px); aspect-ratio: 1;
  top: 38%; left: min(-13vw, -170px);
  background: var(--brand); opacity: .9;
}

/* ==================== TARJETA ==================== */
.auth-card {
  position: relative; z-index: 1;
  width: min(430px, 100%);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.auth-card__accent {
  height: 4px;
  background: linear-gradient(90deg, var(--brand-deep), var(--brand), var(--brand-lift));
}
.auth-card__body { padding: 30px 30px 26px; }
.auth-card__foot {
  padding: 14px 30px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: .7rem; font-weight: 600; color: var(--muted); text-align: center;
}

/* ==================== LOGO ==================== */
.auth-logo { display: flex; justify-content: center; }
.auth-logo img { width: 152px; max-width: 100%; height: auto; display: block; }

/* ==================== ENCABEZADO ==================== */
.auth-head { text-align: center; margin: 20px 0 24px; }
.auth-head__title {
  margin: 0;
  font-family: var(--ff-title);
  font-weight: var(--fw-title);
  font-size: 1.22rem;
  color: var(--brand-deep);          /* 7.23:1 — reemplaza el gris de 3.75:1 */
}
.auth-head__desc {
  margin: 5px 0 0;
  font-size: .79rem; font-weight: 500; color: var(--muted);
}

/* ==================== CAMPOS ==================== */
.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 6px;
  font-family: var(--ff-title); font-weight: 800; font-size: .68rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.field label.required::after { content: " *"; color: var(--danger); }

.control { position: relative; display: flex; align-items: center; }
.control__icon {
  position: absolute; left: 11px;
  display: grid; place-items: center;
  color: var(--muted); pointer-events: none;
  transition: color .2s;
}
.control:focus-within .control__icon { color: var(--brand-text); }

.auth input[type="text"],
.auth input[type="email"],
.auth input[type="password"],
.auth input[type="tel"] {
  width: 100%;
  border: 1.5px solid var(--border-strong);   /* 3.02:1 — WCAG 1.4.11 */
  border-radius: var(--r-field);
  padding: 10px 12px 10px 36px;
  font-family: var(--ff-body); font-weight: 600; font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.auth input::placeholder { color: var(--muted); font-weight: 500; opacity: 1; }
.auth input:hover:not(:disabled) { border-color: var(--brand); }
.auth input:focus {
  /* --brand-lift daria 1.75:1: insuficiente para WCAG 1.4.11 */
  border-color: var(--brand-text);
  box-shadow: var(--ring);
}
.auth input:disabled {
  background: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
.auth input[aria-invalid="true"] { border-color: var(--danger); }
.has-reveal input { padding-right: 42px; }

.field__hint { margin: 6px 0 0; font-size: .72rem; font-weight: 600; color: var(--muted); }
.field__error {
  margin: 6px 0 0; display: flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; color: var(--danger-fg);
}

/* Mostrar / ocultar contrasena */
.reveal {
  position: absolute; right: 8px;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border: none; background: none; border-radius: 8px;
  color: var(--muted); cursor: pointer;
  transition: color .2s, background .2s;
}
.reveal:hover { color: var(--brand-text); background: var(--surface-2); }
.reveal:focus-visible { outline: none; box-shadow: var(--ring); }

/* ==================== BOTONES ==================== */
.btn-auth {
  width: 100%; border: none;
  border-radius: var(--r-field); padding: 11px 22px;
  font-family: var(--ff-title); font-weight: 800; font-size: .82rem;
  cursor: pointer; transition: all .22s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn-auth--primary {
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
  color: var(--on-brand-deep);                /* blanco sobre deep = 7.23:1 */
  box-shadow: var(--shadow-brand-1);
}
.btn-auth--primary:hover {
  transform: translateY(-1px); box-shadow: var(--shadow-brand-2);
  color: var(--on-brand-deep);
}
.btn-auth--primary:active { transform: translateY(0); background: var(--brand-deep); }
.btn-auth--ghost {
  background: var(--surface); color: var(--muted);
  border: 1.5px solid var(--border); box-shadow: none;
}
.btn-auth--ghost:hover { border-color: var(--brand); color: var(--brand-text); }
.btn-auth:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-auth:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
/* Cargando: mas legible que un disabled comun, y el cursor lo delata.
   Va despues de :disabled a proposito, misma especificidad, gana el orden. */
.btn-auth[aria-busy="true"] { opacity: .9; cursor: progress; transform: none; }

.spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: var(--surface);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== ENLACES ==================== */
.auth a.link {
  color: var(--brand-text);        /* no --brand: daria 2.96:1 */
  text-decoration: none; font-weight: 700; font-size: .78rem;
  border-radius: 6px; transition: color .2s;
}
.auth a.link:hover { color: var(--brand-deep); text-decoration: underline; }
.auth a.link:focus-visible { outline: none; box-shadow: var(--ring); }
.linkrow { display: flex; justify-content: center; margin: -4px 0 20px; }
.back {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 12px;
  font-family: var(--ff-title); font-weight: 800; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em;
}

/* ==================== AVISOS ==================== */
.notice {
  display: flex; gap: 9px; padding: 11px 13px; margin-bottom: 20px;
  background: var(--info-bg);
  border: 1px solid var(--info-bd);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-field);
  font-size: .75rem; font-weight: 600; color: var(--info-fg);
}
.notice svg { flex-shrink: 0; margin-top: 1px; }
.notice--danger {
  background: var(--danger-bg); border-color: var(--danger-bd);
  border-left-color: var(--danger); color: var(--danger-fg);
}
.notice--ok {
  background: var(--ok-bg); border-color: var(--ok-bd);
  border-left-color: var(--ok); color: var(--ok-fg);
}

/* ==================== ESTADO / CONFIRMACION ==================== */
.state { text-align: center; padding: 4px 0 2px; }
.state__icon {
  width: 56px; height: 56px; border-radius: 50%;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  background: var(--info-bg); border: 1px solid var(--info-bd);
  color: var(--info-fg);
}
.state__icon--ok {
  background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg);
}
.state__icon--error {
  background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger-fg);
}

/* ==================== REQUISITOS DE CONTRASENA ====================
   Django entrega password_validators_help_text_html() como un <ul> ya
   armado, asi que se le da estilo en vez de reconstruirlo a mano. */
.reglas {
  margin: -6px 0 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-field);
}
.reglas__t {
  margin: 0 0 7px;
  font-family: var(--ff-title); font-weight: 800; font-size: .66rem;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.reglas ul { margin: 0; padding: 0; list-style: none; }
.reglas li {
  position: relative;
  padding-left: 17px; margin-bottom: 4px;
  font-size: .74rem; font-weight: 600; line-height: 1.45; color: var(--muted);
}
.reglas li:last-child { margin-bottom: 0; }
.reglas li::before {
  content: ""; position: absolute; left: 3px; top: .52em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand-lift);
}
.state__title {
  margin: 0 0 6px;
  font-family: var(--ff-title); font-weight: 800; font-size: 1.05rem;
  color: var(--brand-deep);
}
.state__desc { margin: 0 0 18px; font-size: .79rem; color: var(--muted); }

/* ==================== RESPONSIVE — 1280 / 900 / 640 ==================== */
@media (max-width: 900px) {
  .auth-card__body { padding: 26px 22px 22px; }
  .auth-card__foot { padding: 13px 22px; }
  .blob--l { display: none; }
}
@media (max-width: 640px) {
  .auth { padding: 22px 14px; }
  .auth-card { width: 100%; border-radius: 12px; }
  .auth-card__body { padding: 22px 18px 18px; }
  .auth-logo img { width: 130px; }
  .auth-head { margin: 18px 0 20px; }
  .blob--tr, .blob--bl { opacity: .85; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .btn-auth--primary:hover { transform: none; }
}
