<?php if (!function_exists('avatar_img')) { @include_once '../../helpers.php'; } ?>
<div class="grid" style="margin-top:40px;max-width:480px;margin-left:auto;margin-right:auto">
  <?php if($m = flash('error')): ?>
    <div class="alert alert-error">
      <i class="fas fa-exclamation-circle"></i>
      <div><?php echo h($m); ?></div>
    </div>
  <?php endif; ?>
  
  <?php if($m = flash('success')): ?>
    <div class="alert alert-success">
      <i class="fas fa-check-circle"></i>
      <div><?php echo h($m); ?></div>
    </div>
  <?php endif; ?>
  
  <form class="card" method="post">
<?= csrf_field() ?>

    <h2 style="margin-top:0"><i class="fas fa-sign-in-alt"></i> Acceder</h2>
    <div class="grid">
      <input name="email" placeholder="Email" type="email" required>
      <input type="password" name="password" placeholder="Contraseña" required>
      <button class="btn primary" type="submit"><i class="fas fa-key"></i> Entrar</button>
    </div>
    
    <div style="margin-top:16px;text-align:center">
      <a href="./?r=auth/forgot-password" style="color:var(--accent);font-size:0.9rem;">
        <i class="fas fa-question-circle"></i> ¿Olvidaste tu contraseña?
      </a>
    </div>
  </form>
  
  <div class="muted" style="margin-top:16px;text-align:center">
    <p>¿No tienes cuenta? <a href="./?r=register" style="color:var(--accent);">Regístrate aquí</a></p>
  </div>
</div>