/* =============================================================
   Habla — Auth & Error pages (Liquid Glass)
   Premium glassmorphism shell, brand-consistent (#2b7cff).
   Used by: login, 2FA verify, 2FA create, error 400/404/500.
   ============================================================= */
:root {
  --brand: #2b7cff;
  --brand-ink: #1e61d4;
  --brand-deep: #1a4fb0;
  --ink: #0b1c2d;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #ef4444;
  --ok: #16a34a;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-brd: rgba(255, 255, 255, 0.65);
  --shadow: 0 30px 70px -24px rgba(16, 42, 89, 0.45), 0 8px 24px -12px rgba(16, 42, 89, 0.25);
  --r-card: 24px;
  --r-field: 13px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Poppins', system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: #eaf1ff;
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(43, 124, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(43, 124, 255, 0.14), transparent 60%),
    url('/static/takata.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 5%;
  z-index: 10;
  position: relative;
}

/* ── Glass card ─────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  backdrop-filter: blur(22px) saturate(165%);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  animation: auth-rise 0.6s var(--ease) both;
}
.auth-card--wide { max-width: 460px; }

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(26px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* stagger inner blocks */
.auth-card > * { animation: auth-rise 0.55s var(--ease) both; }
.auth-card > *:nth-child(1) { animation-delay: 0.05s; }
.auth-card > *:nth-child(2) { animation-delay: 0.10s; }
.auth-card > *:nth-child(3) { animation-delay: 0.15s; }
.auth-card > *:nth-child(4) { animation-delay: 0.20s; }
.auth-card > *:nth-child(5) { animation-delay: 0.25s; }
.auth-card > *:nth-child(6) { animation-delay: 0.30s; }

/* ── Brand row ──────────────────────────────────────────────── */
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  text-decoration: none;
}
.auth-brand img { width: 38px; height: 38px; border-radius: 10px; }
.auth-brand span { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); }

.auth-title {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 27px;
  line-height: 1.18;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.auth-sub { font-size: 14.5px; line-height: 1.55; color: var(--muted); margin: 0 0 24px; }

/* ── Badge (portal label) ───────────────────────────────────── */
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--brand-deep);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  margin-bottom: 16px;
}
.auth-badge i { font-size: 12px; }
/* Distintivo del portal de administración (color propio). */
.auth-badge--admin {
  color: #6d28d9;
  background: #f3effe;
  border-color: #ddd0fb;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.auth-alert,
.error-message-api {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  padding: 11px 13px;
  border-radius: 11px;
  margin: 0 0 18px;
  border: 1px solid transparent;
}
.auth-alert i { margin-top: 1px; }
.auth-alert--error,
.error-message-api { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.auth-alert--info { background: #eff6ff; color: var(--brand-deep); border-color: #bfdbfe; }
.auth-alert--success { background: #ecfdf5; color: #15803d; border-color: #bbf7d0; }

/* ── Fields ─────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-field { position: relative; display: flex; flex-direction: column; gap: 6px; }
.auth-field > label {
  font-size: 12.5px; font-weight: 600; color: #334155; letter-spacing: 0.01em;
}
.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-wrap > .auth-ico {
  position: absolute; left: 14px; color: #94a3b8; font-size: 15px; pointer-events: none;
  transition: color 0.18s ease;
}
.auth-input {
  width: 100%;
  height: 50px;
  padding: 0 16px 0 42px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.auth-input::placeholder { color: #9aa6b6; }
.auth-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(43, 124, 255, 0.14);
}
.auth-input-wrap:focus-within > .auth-ico { color: var(--brand); }

/* password / generic trailing toggle */
.auth-toggle {
  position: absolute; right: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: #94a3b8; cursor: pointer;
  border-radius: 9px; transition: color 0.18s ease, background 0.18s ease;
}
.auth-toggle:hover { color: var(--brand); background: rgba(43, 124, 255, 0.08); }

/* 2FA code input */
.auth-code {
  text-align: center;
  font-family: "Poppins", monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.5em;
  padding-left: 16px;
  text-indent: 0.5em;
}

/* ── Buttons ────────────────────────────────────────────────── */
.auth-btn {
  position: relative;
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--r-field);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s var(--ease), box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}
.auth-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-ink) 100%);
  box-shadow: 0 12px 24px -10px rgba(43, 124, 255, 0.7);
}
.auth-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 30px -10px rgba(43, 124, 255, 0.75); }
.auth-btn--primary:active { transform: translateY(0) scale(0.98); }
.auth-btn--google {
  margin-top: 4px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
}
.auth-btn--google:hover { border-color: #cbd5e1; background: #f8fafc; transform: translateY(-1px); }
.auth-btn[disabled] { opacity: 0.72; cursor: progress; transform: none; }

.auth-btn-row { margin-top: 6px; }

/* spinner inside buttons */
.auth-spinner {
  width: 19px; height: 19px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ── Links ──────────────────────────────────────────────────── */
.auth-links {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-align: center;
}
.auth-links a, .auth-link {
  color: var(--brand-ink); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 0.15s ease;
}
.auth-links a:hover, .auth-link:hover { color: var(--brand-deep); text-decoration: underline; }
.auth-muted { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: #94a3b8; font-size: 12.5px; margin: 20px 0 16px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── Right-side visual ──────────────────────────────────────── */
.auth-visual {
  position: absolute;
  bottom: 0; right: 0;
  height: 100vh; height: 100dvh;
  width: auto; max-width: 55vw;
  object-fit: contain;
  object-position: right bottom;
  mix-blend-mode: multiply;
  filter: contrast(1.08) brightness(1.04);
  pointer-events: none;
  z-index: 1;
  animation: auth-float 7s ease-in-out infinite;
}
.auth-visual--mascot {
  top: 50%; bottom: auto; right: 11%;
  height: 56vh;
  transform: translateY(-50%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 52%, rgba(0,0,0,.4) 82%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, #000 52%, rgba(0,0,0,.4) 82%, transparent 100%);
  animation: auth-float-mascot 7s ease-in-out infinite;
}
@keyframes auth-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes auth-float-mascot { 0%,100% { transform: translateY(-50%); } 50% { transform: translateY(calc(-50% - 12px)); } }

/* ── Error pages ────────────────────────────────────────────── */
.auth-errcode {
  font-family: "Poppins", sans-serif;
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  margin: 0 0 6px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.auth-errcode--soft { background: linear-gradient(135deg, #94a3b8 0%, #475569 100%); -webkit-background-clip: text; background-clip: text; }
.auth-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--brand-ink); background: rgba(43, 124, 255, 0.1);
  border: 1px solid rgba(43, 124, 255, 0.2); border-radius: 999px;
  padding: 5px 12px; margin-bottom: 16px;
}

/* ── 2FA create (QR / steps) ────────────────────────────────── */
.mfa-steps { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mfa-step { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: #334155; }
.mfa-step .n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
}
.qr-box {
  margin: 4px auto 20px;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  min-height: 232px;
}
#qr {
  width: 216px; height: 216px;
  border-radius: 14px; border: 1px solid var(--line);
  background: #fff; padding: 8px;
  display: none; opacity: 0; transition: opacity 0.4s ease;
}
.qr-loader {
  width: 46px; height: 46px;
  border: 4px solid #dbe6fb; border-top-color: var(--brand);
  border-radius: 50%; animation: auth-spin 1s linear infinite;
}
.mfa-note {
  display: flex; align-items: flex-start; gap: 9px;
  background: #ecfdf5; border: 1px solid #bbf7d0; color: #15803d;
  font-size: 13px; line-height: 1.45; padding: 12px 14px; border-radius: 12px; margin-bottom: 18px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 920px) {
  .auth-page { justify-content: center; overflow: auto; }
  .auth-shell { padding: 28px 18px; display: flex; justify-content: center; }
  .auth-card { max-width: 440px; }
  .auth-visual, .auth-visual--mascot { display: none; }
}
@media (max-width: 420px) {
  .auth-card { padding: 30px 22px; border-radius: 20px; }
  .auth-title { font-size: 24px; }
  .auth-errcode { font-size: 60px; }
}

/* ── Accessibility ──────────────────────────────────────────── */
.auth-input:focus-visible,
.auth-btn:focus-visible,
.auth-toggle:focus-visible,
.auth-links a:focus-visible {
  outline: 3px solid rgba(43, 124, 255, 0.45);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-card > *, .auth-visual, .auth-visual--mascot { animation: none !important; }
  .auth-btn, .auth-input { transition: none !important; }
}
