/* ==========================================================================
   auth-flat.css — pantallas de acceso con el estilo del panel
   --------------------------------------------------------------------------
   Reemplaza a auth.css (la carga views/partials/auth-head.ejs) en TODAS las
   pantallas de acceso: login/registro de clientes, login de admin, olvide
   mi contraseña, nueva contraseña, verificacion en dos pasos, aceptar
   politicas, vincular Discord y elegir panel. Mismo marcado de siempre; el
   look es el del panel (public/css/panel-flat.css): fondo casi negro, borde
   de 1px, rojo de marca y tipografia Plus Jakarta Sans.

   La tarjeta tiene dos columnas en escritorio: a la izquierda la marca / el
   texto de la pantalla y los personajes que siguen el mouse
   (partials/auth-decor.ejs + public/js/auth-crew.js); a la derecha las
   pestañas y el formulario. En <= 820px es una sola columna sin personajes.

   Variables --a-*: las sigue usando twofa.css (verificacion en dos pasos),
   asi que se definen aca con la paleta del panel.
   ========================================================================== */

:root {
  /* Paleta (igual que el panel) */
  --af-bg: #060505;
  --af-card: #0b0a0a;
  --af-input: #0e0d0d;
  --af-surface-2: #121111;
  --af-border: #1c1b1b;
  --af-border-strong: #2b2929;
  --af-text: #e4e4e7;
  --af-title: #f4f4f5;
  --af-text-2: #a1a1aa;
  --af-muted: #71717a;
  --af-accent: #ff3947;
  --af-accent-hover: #ff4e5b;
  --af-accent-ink: #ff5a66;
  --af-accent-bg: rgba(255, 57, 71, 0.11);
  --af-accent-border: rgba(255, 57, 71, 0.34);
  --af-accent-ring: rgba(255, 57, 71, 0.16);
  --af-success: #35d28a;
  --af-warning: #ffb13b;
  --af-danger: #ff4d5e;
  --af-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --af-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Compatibilidad con twofa.css / consent.css (antes venian de auth.css) */
  --a-bg: var(--af-bg);
  --a-red: var(--af-accent);
  --a-red-hi: var(--af-accent-hover);
  --a-red-soft: var(--af-accent-ink);
  --a-red-deep: #a01a26;
  --a-red-deeper: #c0283a;
  --a-node: var(--af-card);
  --a-text: var(--af-text);
  --a-muted: var(--af-text-2);
  --a-muted-2: var(--af-muted);
  --a-icon: var(--af-muted);
  --a-glass: rgba(255, 255, 255, 0.025);
  --a-glass-2: rgba(255, 255, 255, 0.045);
  --a-border: var(--af-border);
  --a-ease: var(--af-ease);
  --a-font: var(--af-font);
  --a-radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }

body.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--af-bg);
  background-image:
    radial-gradient(70% 45% at 0% 100%, rgba(255, 57, 71, 0.07) 0%, transparent 70%),
    radial-gradient(60% 40% at 100% 100%, rgba(160, 26, 38, 0.06) 0%, transparent 70%),
    linear-gradient(180deg, rgba(255, 57, 71, 0.035) 0%, transparent 220px);
  background-attachment: fixed;
  font-family: var(--af-font);
  color: var(--af-text);
  letter-spacing: -0.006em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.auth-page a { color: inherit; }
.auth-page ::selection { background: rgba(255, 57, 71, 0.4); color: #fff; }
.auth-page :focus-visible { outline: 2px solid var(--af-accent); outline-offset: 3px; }
.auth-page input:focus-visible { outline: none; }

/* Solo para lectores de pantalla (en los campos se muestran: ver .auth-field) */
.auth-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ======================== BARRA SUPERIOR ======================== */
.auth-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: min(1140px, calc(100% - 32px));
  height: 68px;
  margin: 0 auto;
}
.auth-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.auth-brand-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--af-surface-2);
  border: 1px solid var(--af-border);
  color: var(--af-accent-ink);
  overflow: hidden;
}
.auth-brand-mark svg { width: 16px; height: 16px; }
.auth-brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand-text strong { font-size: 14.5px; font-weight: 700; color: var(--af-title); letter-spacing: -0.01em; }
.auth-brand-text small { font-size: 11.5px; color: var(--af-muted); }

.auth-lang {
  display: inline-flex; gap: 2px;
  padding: 3px;
  border: 1px solid var(--af-border);
  border-radius: 10px;
  background: var(--af-card);
}
.auth-lang a {
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11.5px; font-weight: 600;
  color: var(--af-muted);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.auth-lang a:hover { color: var(--af-text); background: rgba(255, 255, 255, 0.04); }
.auth-lang a.active { color: #fff; background: var(--af-accent-bg); }

/* ======================== ESCENARIO Y TARJETA ======================== */
.auth-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 28px 16px 40px;
}
.auth-wrapper { position: relative; width: min(900px, 100%); }

/* La decoracion vieja (lineas de circuito, borde que gira) ya no se usa */
.auth-line, .auth-spark, .auth-border-glow, .auth-overlay, .auth-overlay-glass { display: none !important; }

.auth-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 368px);
  grid-template-rows: auto 1fr;
  grid-template-areas: "art tabs" "art form";
  column-gap: 56px;
  min-height: 540px;
  padding: 40px 40px 40px 36px;
  background: var(--af-card);
  border: 1px solid var(--af-border);
  border-radius: 18px;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8);
}

/* Columna izquierda: marca / texto de la pantalla */
.auth-overlay-panel { grid-area: art; align-self: start; display: none; min-width: 0; }
.auth-overlay-panel.auth-overlay-right { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 320px; }
.auth-overlay-mark {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--af-accent-bg);
  border: 1px solid var(--af-accent-border);
  color: var(--af-accent-ink);
  overflow: hidden;
}
.auth-overlay-mark svg { width: 17px; height: 17px; }
.auth-overlay-mark img { width: 100%; height: 100%; object-fit: cover; }
.auth-welcome { margin: 6px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--af-title); text-transform: none; }
.auth-welcome-sub { margin: 0; font-size: 13px; line-height: 1.6; color: var(--af-muted); }
.auth-overlay-panel .lg-foot-links { margin-top: 6px; font-size: 12px; }
/* Variante "marca" (login de clientes): logo + nombre en una fila */
.auth-overlay-panel.is-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px; row-gap: 1px;
  align-items: center;
}
.auth-overlay-panel.is-brand .auth-overlay-mark { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; background: var(--af-surface-2); border-color: var(--af-border); }
.auth-overlay-panel.is-brand .auth-welcome { margin: 0; font-size: 14.5px; }
.auth-overlay-panel.is-brand .auth-welcome-sub { font-size: 11.5px; line-height: 1.3; }
.auth-ghost-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--af-border-strong);
  color: var(--af-text);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
}

/* ======================== PESTAÑAS ======================== */
.auth-tabs {
  grid-area: tabs;
  display: flex; gap: 4px;
  margin-bottom: 30px;
  padding: 4px;
  border: 1px solid var(--af-border);
  border-radius: 12px;
  background: var(--af-input);
}
.auth-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  height: 38px;
  border-radius: 9px;
  font-size: 13px; font-weight: 700;
  color: var(--af-text-2);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tab:hover { color: var(--af-text); }
.auth-tab.active { background: var(--af-accent); color: #fff; }
.auth-tab-pill { display: none; }

/* ======================== FORMULARIOS ======================== */
.auth-forms { grid-area: form; min-width: 0; }
.auth-pane { display: block; animation: afPaneIn 0.35s var(--af-ease); }
.auth-card .auth-pane-signup { display: none; }
.auth-card.is-signup .auth-pane-login { display: none; }
.auth-card.is-signup .auth-pane-signup { display: block; }
@keyframes afPaneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auth-pane-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--af-accent-bg);
  border: 1px solid var(--af-accent-border);
  color: var(--af-accent-ink);
  font-size: 11.5px; font-weight: 600;
}
.auth-pane-badge svg { width: 13px; height: 13px; }

.auth-title { margin: 0 0 6px; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.03em; color: var(--af-title); }
.auth-sub { margin: 0 0 24px; font-size: 13.5px; line-height: 1.55; color: var(--af-muted); }

.auth-alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 77, 94, 0.08);
  border: 1px solid rgba(255, 77, 94, 0.26);
  color: #ff8a95;
  font-size: 13px; line-height: 1.45;
}
.auth-alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.auth-alert.is-success { background: rgba(53, 210, 138, 0.08); border-color: rgba(53, 210, 138, 0.26); color: #6ee7b7; }

.auth-form { display: block; }

/* Campo: la etiqueta (antes oculta) se ve arriba, como en el panel */
.auth-field { position: relative; margin: 0 0 16px; }
.auth-field > .auth-sr {
  position: static;
  display: block;
  width: auto; height: auto;
  margin: 0 0 7px; padding: 0;
  overflow: visible; clip: auto;
  white-space: normal;
  font-size: 12.5px; font-weight: 600;
  color: var(--af-text-2);
}
.auth-field > svg { display: none; } /* icono dentro del campo: no va en este estilo */
.auth-field-glow { display: none; }
.auth-field input {
  display: block;
  width: 100%; height: 46px;
  margin: 0;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--af-border);
  background: var(--af-input);
  color: var(--af-text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-field.has-toggle input { padding-right: 48px; }
.auth-field input::placeholder { color: var(--af-muted); opacity: 1; }
.auth-field input:hover:not(:focus) { border-color: var(--af-border-strong); }
.auth-field input:focus { border-color: var(--af-accent-border); box-shadow: 0 0 0 3px var(--af-accent-ring); outline: none; }
.auth-field input[aria-invalid="true"] { border-color: rgba(255, 77, 94, 0.6); }
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--af-input) inset;
  box-shadow: 0 0 0 1000px var(--af-input) inset;
  -webkit-text-fill-color: var(--af-text);
  caret-color: var(--af-text);
}
.auth-eye {
  position: absolute;
  right: 6px; bottom: 6px;
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--af-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.auth-eye:hover { color: var(--af-text); background: rgba(255, 255, 255, 0.05); }
.auth-eye[aria-pressed="true"] { color: var(--af-accent-ink); }
.auth-eye svg { width: 17px; height: 17px; }
/* El icono trae ojo y ojo tachado: se ve uno segun el estado */
.auth-eye .auth-i-eye-off { display: none; }
.auth-eye[aria-pressed="true"] .auth-i-eye { display: none; }
.auth-eye[aria-pressed="true"] .auth-i-eye-off { display: block; }

.auth-caps { margin: -8px 0 12px; font-size: 12px; color: var(--af-warning); }
.auth-forgot { margin: -6px 0 18px; text-align: right; font-size: 12.5px; }
.auth-forgot a { color: var(--af-muted); text-decoration: none; }
.auth-forgot a:hover { color: var(--af-accent-ink); }

/* Medidor de seguridad */
.auth-strength { display: flex; align-items: center; gap: 10px; margin: -6px 0 16px; }
.auth-strength-bars { display: inline-flex; gap: 4px; }
.auth-strength-bars i { display: block; width: 26px; height: 4px; border-radius: 4px; background: var(--af-border-strong); transition: background 0.2s ease; }
.auth-strength-label { font-size: 11.5px; color: var(--af-muted); }
.auth-strength[data-strength="1"] .auth-strength-bars i:nth-child(-n+1) { background: var(--af-danger); }
.auth-strength[data-strength="2"] .auth-strength-bars i:nth-child(-n+2) { background: var(--af-warning); }
.auth-strength[data-strength="3"] .auth-strength-bars i:nth-child(-n+3) { background: #a3e635; }
.auth-strength[data-strength="4"] .auth-strength-bars i { background: var(--af-success); }

/* ======================== BOTONES ======================== */
.auth-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 46px;
  margin: 0;
  border: 0; border-radius: 12px;
  background: var(--af-accent);
  color: #fff;
  font-family: inherit;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.auth-btn:hover { background: var(--af-accent-hover); }
.auth-btn:active { transform: scale(0.99); }
.auth-btn-shine { display: none; }
.auth-btn-spinner {
  display: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: afSpin 0.7s linear infinite;
}
.auth-btn.is-loading { pointer-events: none; }
.auth-btn.is-loading .auth-btn-text { display: none; }
.auth-btn.is-loading .auth-btn-spinner { display: block; }
@keyframes afSpin { to { transform: rotate(360deg); } }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; color: var(--af-muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--af-border); }
.auth-oauth { display: grid; gap: 8px; margin-top: 10px; }
.auth-oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px;
  border-radius: 12px;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, filter 0.15s ease;
}
.auth-oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.auth-oauth-btn.discord { background: #5865f2; color: #fff; }
.auth-oauth-btn.discord:hover { background: #4f5bdc; }
.auth-oauth-btn.google { background: #f4f4f5; color: #18181b; }
.auth-oauth-btn.google:hover { background: #e4e4e7; }

.auth-links { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--af-muted); }
.auth-links a { color: var(--af-accent-ink); font-weight: 600; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-note { margin: 12px 0 0; text-align: center; font-size: 12px; line-height: 1.5; color: var(--af-muted); }
.auth-page .hint { font-size: 12px; line-height: 1.5; color: var(--af-muted); }
.auth-page .field { margin-bottom: 14px; }

/* ======================== PIE ======================== */
.auth-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px;
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 26px;
  font-size: 12px;
  color: var(--af-muted);
}
.auth-foot a { color: var(--af-muted); text-decoration: none; }
.auth-foot a:hover { color: var(--af-text); }
.auth-page .lg-foot-links { display: inline-flex; flex-wrap: wrap; gap: 6px 16px; }

/* ======================== PERSONAJES ======================== */
/* Abajo a la izquierda, dentro de la tarjeta (el wrapper mide lo mismo que
   la tarjeta). Las formas son propias: torre roja, sombra, gota y pastilla. */
.auth-crew {
  position: absolute;
  left: 34px; bottom: 34px;
  z-index: 2;
  width: 320px; height: 272px;
  pointer-events: none;
  transform-origin: 0 100%;
}
.crew-char {
  position: absolute;
  bottom: 0;
  transform-origin: 50% 100%;
  transform: translateX(var(--shift, 0px)) skewX(var(--lean, 0deg));
  transition: transform 0.45s var(--af-ease);
}
.crew-body {
  position: relative;
  width: 100%; height: 100%;
  transform-origin: 50% 100%;
  animation: crewBreath 4.6s ease-in-out infinite;
}
@keyframes crewBreath { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.022); } }

.crew-a { left: 52px; width: 116px; height: 262px; z-index: 1; }
.crew-a .crew-body { background: #ff3947; border-radius: 12px 12px 0 0; animation-delay: -1.2s; }
.crew-a .crew-eyes { top: 30px; left: 38px; gap: 16px; }

.crew-b { left: 160px; width: 86px; height: 200px; z-index: 1; }
.crew-b .crew-body { background: #1e1919; border: 1px solid #2c2424; border-bottom: 0; border-radius: 10px 10px 0 0; animation-delay: -2.6s; }
.crew-b .crew-eyes { top: 24px; left: 22px; gap: 12px; }

.crew-c { left: 0; width: 164px; height: 128px; z-index: 3; }
.crew-c .crew-body { background: #ff8e97; border-radius: 82px 82px 0 0; animation-delay: -0.4s; }
.crew-c .crew-eyes { top: 48px; left: 56px; gap: 22px; }

.crew-d { left: 214px; width: 98px; height: 158px; z-index: 3; }
.crew-d .crew-body { background: #f1e4e5; border-radius: 49px 49px 0 0; animation-delay: -3.4s; }
.crew-d .crew-eyes { top: 36px; left: 28px; gap: 22px; }
.crew-mouth {
  position: absolute;
  top: 66px; left: 50%;
  width: 24px; height: 9px;
  margin-left: -12px;
  border-bottom: 2.5px solid #1a0d0e;
  border-radius: 0 0 14px 14px;
  transition: height 0.2s ease, width 0.2s ease, margin 0.2s ease;
}

.crew-eyes { position: absolute; display: flex; }
.crew-eye {
  display: grid; place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.09s ease;
}
.crew-b .crew-eye { width: 16px; height: 16px; }
.crew-pupil {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #140808;
  transform: translate(var(--px, 0px), var(--py, 0px));
  transition: transform 0.12s linear;
}
.crew-eyes.is-dots .crew-eye { width: 10px; height: 10px; background: transparent; }
.crew-eyes.is-dots .crew-pupil { width: 9px; height: 9px; background: #1a0d0e; }
/* Parpadeo y "no miro" (mientras se escribe la contraseña) */
.crew-char.is-blink .crew-eye { transform: scaleY(0.12); }
.auth-crew.is-shy .crew-mouth { width: 12px; margin-left: -6px; height: 5px; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 960px) {
  .auth-card { column-gap: 36px; padding: 34px 32px 34px 30px; }
  .auth-crew { transform: scale(0.82); left: 28px; bottom: 30px; }
}
@media (max-width: 820px) {
  .auth-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas: "tabs" "form";
    min-height: 0;
    padding: 26px 20px 24px;
    border-radius: 16px;
  }
  .auth-overlay-panel.auth-overlay-right { display: none; }
  .auth-crew { display: none; }
  .auth-wrapper { width: min(460px, 100%); }
  .auth-topbar { height: 60px; }
  .auth-brand-text small { display: none; }
  .auth-tabs { margin-bottom: 24px; }
  .auth-title { font-size: 23px; }
  .auth-field input, .auth-btn, .auth-oauth-btn { height: 48px; font-size: 16px; }
}
@media (max-width: 420px) {
  .auth-lang a { padding: 5px 7px; }
  .auth-stage { padding: 16px 12px 28px; }
}

/* ======================== MOVIMIENTO REDUCIDO ======================== */
@media (prefers-reduced-motion: reduce) {
  .crew-body { animation: none; }
  .crew-char, .crew-pupil, .crew-eye { transition: none; }
  .auth-pane { animation: none; }
}
