:root {
  --bg: oklch(0.97 0.006 250);
  --navy: oklch(0.19 0.035 260);
  --navy-2: oklch(0.28 0.05 255);
  --border: oklch(0.9 0.005 250);
  --text: oklch(0.24 0.02 260);
  --muted: oklch(0.55 0.02 260);
  --accent: oklch(0.55 0.16 250);
  --gold: oklch(0.75 0.11 85);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: oklch(0.45 0.16 250); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes logoPop {
  0% { transform: scale(0.7) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.05) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, oklch(0.93 0.03 250) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, oklch(0.94 0.05 85 / 0.5) 0%, transparent 45%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px -20px oklch(0.2 0.03 260 / 0.25);
  padding: 36px 34px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: cardIn 0.5s cubic-bezier(.2,.8,.3,1);
}

.auth-logo { width: 180px; height: auto; animation: logoPop 0.7s cubic-bezier(.2,.9,.3,1); }

.auth-tabs {
  width: 100%;
  display: flex;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.auth-tab.active { background: var(--navy); color: white; }

.auth-form {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: cardIn 0.35s ease-out;
}
.auth-form.active { display: flex; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.field input {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.55 0.16 250 / 0.15); }

.password-wrap { position: relative; display: flex; }
.password-wrap input { flex: 1; padding-right: 42px; }
.toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 4px;
}
.toggle-pass:hover { color: var(--text); }

.field-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.checkbox { display: flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; cursor: pointer; }
.checkbox input { accent-color: var(--accent); width: 14px; height: 14px; }
.link-muted { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.link-muted:hover { color: var(--accent); }

.btn-primary {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-radius: 10px;
  background: var(--navy);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--navy-2); }
.btn-primary:active { transform: scale(0.98); }

.divider-row {
  display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); font-weight: 600;
}
.divider-row::before, .divider-row::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.btn-google {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-google:hover { background: var(--bg); border-color: oklch(0.8 0.01 250); }

.auth-footer { font-size: 12px; color: var(--muted); letter-spacing: 0.5px; font-weight: 600; }

/* ---------------------------------------------------------------------------
   Añadidos de la integración con el backend
   -------------------------------------------------------------------------*/

/* Logo animado con Lottie. El PNG queda de respaldo si el reproductor falla.
   La caja respeta la proporcion del .json (600x260) para que no se deforme, y
   el svg va con overflow visible porque el aro del pulso crece por fuera del
   lienzo antes de desvanecerse. */
.auth-logo-wrap { display: flex; align-items: center; justify-content: center; min-height: 130px; }
.auth-lottie { width: 270px; height: 117px; }
.auth-lottie svg { display: block; overflow: visible; }

/* Avisos del servidor: errores de credenciales, solicitud enviada, etc. */
.auth-alert {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  animation: cardIn 0.3s ease-out;
}
.auth-alert-ok { background: oklch(0.93 0.09 150); color: oklch(0.4 0.13 150); }
.auth-alert-error { background: oklch(0.93 0.07 25); color: oklch(0.45 0.17 25); }

.auth-nota {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}
.auth-nota strong { color: var(--text); font-weight: 700; }

/* El botón de Google es un enlace: se alinea igual que un botón. */
a.btn-google { text-decoration: none; }
a.btn-google:hover { color: var(--text); }

/* ---------------------------------------------------------------------------
   Pantallas angostas

   La tarjeta ya nace flexible (max-width y width:100%), asi que aqui solo se
   recorta el aire: el logo, el relleno y el alto fijo del hueco del logo, que
   en un telefono se comen media pantalla y dejan el formulario abajo.
   -------------------------------------------------------------------------*/

/* 100dvh en vez de 100vh: en el navegador del telefono la barra de direcciones
   entra y sale, y con 100vh la tarjeta se descentra al hacerlo. */
@supports (height: 100dvh) {
  .auth-page { min-height: 100dvh; }
}

@media (max-width: 560px) {
  .auth-page { padding: 16px 14px; align-items: flex-start; padding-top: 28px; }

  .auth-card {
    padding: 26px 20px 22px;
    gap: 18px;
    border-radius: 18px;
  }

  /* El logo se mide con el ancho disponible y el hueco se ajusta solo. */
  .auth-logo-wrap { min-height: 0; }
  .auth-lottie { width: min(240px, 68vw); height: auto; aspect-ratio: 270 / 117; }
  .auth-logo { width: min(160px, 58vw); }

  /* 16px es el minimo que no dispara el zoom automatico de iOS al enfocar. */
  .field input { font-size: 16px; }

  /* "Recordarme" y el enlace de la contrasena se parten en dos lineas antes de
     apretarse el uno contra el otro. */
  .field-row { flex-wrap: wrap; gap: 10px; }

  /* Objetivos comodos para el dedo. */
  .auth-tab { padding: 12px 0; }
  .btn-primary { padding: 13px 0; }
  .btn-google { padding: 12px 0; }
}

