/* ============================================================
   auth.css — Estilos compartidos para login.html y register.html
   Misma identidad visual que index.html, la landing (Sora + Inter, azul)
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primario:       #2563eb;
  --primario-hover: #1d4ed8;
  --oscuro:         #1e293b;
  --oscuro-2:       #0f172a;
  --texto:          #e2e8f0;
  --texto-suave:    #94a3b8;
  --fondo:          #0b1120;
  --borde:          #2a3648;
  --error:          #dc2626;
  --error-fondo:    #fef2f2;
  --error-borde:    #fecaca;
  --display:        'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  --cuerpo:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radio:          12px;
}

/* La tarjeta (.auth-card) y sus campos quedan siempre blancos (fondo
   hardcodeado, no variable) a pedido explícito del usuario — por eso se
   re-declaran los tokens de texto/borde acá: sin esto, el texto se
   volvería casi invisible (gris muy claro) sobre una tarjeta blanca. Solo
   el fondo de la página y la vista previa del panel al lado quedan oscuros. */
.auth-card {
  --texto:       #1e293b;
  --texto-suave: #64748b;
  --borde:       #e2e8f0;
}

/* ---- Flecha "volver" — visible en todos los tamaños de pantalla, para
   volver a la landing sin depender del navegador. ---- */
.btn-volver {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  text-decoration: none;
}
.btn-volver:hover { color: #1e293b; }
.btn-volver svg { width: 18px; height: 18px; }

/* Instalado como PWA (Android/Chrome e iOS "Agregar a inicio" reportan este
   mismo display-mode) -- el login/registro son la puerta de entrada de la
   app instalada, no debe quedar ningún camino de vuelta a la landing de
   marketing. En el navegador normal el botón y el logo siguen llevando a "/". */
@media (display-mode: standalone) {
  .btn-volver { display: none; }
  .auth-logo--texto { pointer-events: none; }
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--cuerpo);
  background: var(--fondo);
  color: var(--texto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* ---- Fondo decorativo: íconos de comida flotando ---- */
.comida-flotante {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.comida-icono {
  position: absolute;
  left: var(--x);
  bottom: -60px;
  font-size: 2rem;
  opacity: 0;
  animation: flotar-comida var(--dur) ease-in var(--delay) infinite;
  filter: blur(.3px);
}

@keyframes flotar-comida {
  0%   { transform: translateY(0) rotate(0deg);     opacity: 0; }
  8%   { opacity: .22; }
  50%  { transform: translateY(-52vh) rotate(14deg); opacity: .22; }
  92%  { opacity: .22; }
  100% { transform: translateY(-104vh) rotate(-10deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .comida-icono { animation: none; display: none; }
}

.auth-logo, .auth-card { position: relative; z-index: 1; }

/* ---- Layout con vista previa del panel al lado (solo desktop) ---- */
.auth-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1000px;
  position: relative;
  z-index: 1;
}

.auth-principal {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.auth-vista { display: none; }

@media (min-width: 900px) {
  .auth-layout {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 3.5rem;
  }
  .auth-principal { width: auto; }

  .auth-vista {
    display: block;
    max-width: 360px;
  }

  /* Panel de marca limpio en vez de una captura de pantalla -- carga al
     instante (sin imagen) y se ve más parecido a lo que usan Apple/
     Microsoft/Facebook en sus pantallas de login: logo + mensaje corto +
     motivos concretos, no un screenshot ruidoso del producto. */
  .auth-vista-marca {
    background: linear-gradient(160deg, var(--primario), var(--primario-hover));
    border-radius: 20px;
    padding: 2.75rem 2.25rem;
    box-shadow: 0 20px 60px rgba(37,99,235,0.28), 0 8px 24px rgba(37,99,235,0.16);
    color: #fff;
  }
  .auth-vista-logo { width: 44px; height: 44px; }
  .auth-vista-frase {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.25;
    margin: 1.25rem 0 1.75rem;
  }
  .auth-vista-lista {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }
  .auth-vista-lista li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.92rem;
    font-weight: 600;
    opacity: 0.94;
  }
  .auth-vista-lista svg { width: 18px; height: 18px; flex-shrink: 0; }
}

/* ---- Logo ---- */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.auth-logo img {
  height: 34px;
  width: auto;
  display: block;
}

/* Wordmark de texto — el logo con ícono queda solo para redes sociales,
   acá y en el resto del sitio se usa siempre el nombre en texto. */
.auth-logo--texto {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--texto);
  text-decoration: none;
}

/* ---- Tarjeta ---- */
.auth-card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 18px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}

.auth-titulo {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  letter-spacing: -0.5px;
  color: var(--texto);
}

.auth-subtitulo {
  font-size: 0.88rem;
  color: var(--texto-suave);
  margin-bottom: 1.75rem;
}

/* ---- Campos ---- */
.campo {
  margin-bottom: 1.1rem;
}

.campo label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--texto);
}

.campo input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--borde);
  border-radius: var(--radio);
  font-family: var(--cuerpo);
  /* 16px fijo, no 0.95rem -- por debajo de 16px Safari/iOS hace zoom
     automático al enfocar el campo, lo que rompe el layout responsive. */
  font-size: 16px;
  color: var(--texto);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.campo input:focus {
  border-color: var(--primario);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.campo input.invalido {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
}

.campo-hint {
  font-size: 0.78rem;
  color: var(--texto-suave);
  margin-top: 0.3rem;
}

.campo-error-msg {
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 0.3rem;
  display: none;
}

.campo-error-msg.visible { display: block; }

/* ---- Error general (servidor) ---- */
.auth-error {
  background: var(--error-fondo);
  border: 1px solid var(--error-borde);
  border-radius: var(--radio);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--error);
  margin-bottom: 1.1rem;
  display: none;
}

.auth-error.visible { display: block; }

/* ---- Botón principal ---- */
.btn-auth {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background: var(--primario);
  color: #fff;
  border: none;
  border-radius: var(--radio);
  font-family: var(--cuerpo);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
  margin-top: 0.5rem;
}

.btn-auth:hover {
  background: var(--primario-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.4);
}

.btn-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---- Botón secundario (ej. "Ingresar con Face ID / huella") ---- */
.btn-auth--secundario {
  background: transparent;
  color: var(--primario);
  border: 1.5px solid var(--primario);
  box-shadow: none;
}

.btn-auth--secundario:hover {
  background: rgba(37,99,235,0.08);
  box-shadow: none;
}

.oculto { display: none !important; }

/* ---- Link al otro formulario ---- */
.auth-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--texto-suave);
}

.auth-link a {
  color: var(--primario);
  font-weight: 600;
  text-decoration: none;
}

.auth-link a:hover { text-decoration: underline; }

/* ---- "¿Olvidaste tu contraseña?" / vista de recuperación ---- */
.auth-olvide {
  display: block;
  text-align: right;
  margin: -0.6rem 0 1rem;
  font-size: 0.82rem;
  color: var(--primario);
  text-decoration: none;
  font-weight: 600;
}
.auth-olvide:hover { text-decoration: underline; }

.auth-recuperar-intro {
  font-size: 0.88rem;
  color: var(--texto-suave);
  margin: 0 0 1.1rem;
  line-height: 1.5;
}

.auth-recuperar-reenviar {
  display: block;
  text-align: center;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--primario);
  text-decoration: none;
  font-weight: 600;
}
.auth-recuperar-reenviar:hover { text-decoration: underline; }

.auth-recuperar-exito {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #16a34a;
  margin: 0.5rem 0 1rem;
}

/* ---- Vista previa del slug (solo lectura — el slug lo genera el backend) ---- */
.slug-preview {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--texto-suave);
}

.slug-preview strong {
  color: var(--texto);
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (min-width: 480px) {
  .auth-card { padding: 2.25rem 2.25rem; }
}

/* ---- "Despertando el servidor" — plan gratis de Render ----
   Solo aparece si el login tarda más de lo normal (ver login.html/
   personal-login.html: setTimeout de 1.5s antes de mostrar esto). En vez
   de una pantalla en blanco que parece rota, explica qué pasa con humor. */
.despertando {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

.despertando-icono-wrap {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--oscuro-2);
  border-radius: 16px;
  animation: despertando-rebote 1.1s ease-in-out infinite;
}

.despertando-icono {
  width: 28px;
  height: 28px;
  color: var(--primario);
}

@keyframes despertando-rebote {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(0.85) rotate(-8deg); }
}

.despertando-mensaje {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--texto);
  min-height: 1.4em;
  transition: opacity .25s;
}

.despertando-barra {
  width: 100%;
  height: 6px;
  background: var(--borde);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0;
}

.despertando-barra-relleno {
  width: 35%;
  height: 100%;
  background: var(--primario);
  border-radius: 999px;
  animation: despertando-avance 1.3s ease-in-out infinite;
}

@keyframes despertando-avance {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(340%); }
}

.despertando-sub {
  font-size: 0.8rem;
  color: var(--texto-suave);
}

@media (prefers-reduced-motion: reduce) {
  .despertando-icono-wrap,
  .despertando-barra-relleno { animation: none; }
}

/* ── Registro por pasos (register.html) ──────────────────────────────────── */
.paso-progreso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.paso-punto {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--borde);
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.paso-punto.activo {
  background: var(--primario);
  transform: scale(1.25);
}

.paso-punto.completo { background: var(--primario); }

.paso-linea {
  width: 28px;
  height: 2px;
  background: var(--borde);
  flex-shrink: 0;
}

.paso-contador {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--texto-suave);
  margin-bottom: 1.4rem;
}

.paso-panel .auth-titulo,
.paso-panel .auth-subtitulo { text-align: center; }

.paso-panel .btn-auth--secundario { margin-top: 0.6rem; }

/* ── Chips de selección única (tipo de restaurante, mesas aproximadas) ───── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.55rem 0.95rem;
  min-height: 40px;
  border: 1.5px solid var(--borde);
  border-radius: 999px;
  background: #fff;
  color: var(--texto);
  font-family: var(--cuerpo);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.chip:hover { border-color: var(--primario); }

.chip.activo {
  border-color: var(--primario);
  background: var(--primario);
  color: #fff;
}

.campo-opcional {
  font-weight: 400;
  color: var(--texto-suave);
}

/* ── Aceptación de términos en el registro ──────────────────────────────── */
.campo-terminos { margin-top: -4px; }

.terminos-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .82rem;
  color: var(--texto-suave);
  line-height: 1.45;
  cursor: pointer;
}

.terminos-label input[type="checkbox"] {
  margin-top: 2px;
  width: 15px;
  height: 15px;
  flex: none;
  accent-color: var(--primario);
  cursor: pointer;
}

.terminos-label a {
  color: var(--primario);
  text-decoration: underline;
}

/* Anti-zoom de iOS/Safari (ver el comentario largo en styles.css) — piso
   por defecto sin !important, para no achicar campos que ya son grandes
   por diseño (ej. .personal-pin-input en personal-login.css, 28px). */
input, select, textarea { font-size: 16px; }
