<?php // admin/login.php ?>
<?php
$title   = 'Login';
$expired = ($_GET['expired'] ?? '') === '1';
?>
<div style="min-height:100vh;background:#09090b;display:flex;align-items:center;justify-content:center;padding:20px;">
  <div style="width:100%;max-width:360px;">
    <?php if($expired): ?>
    <div style="background:rgba(251,191,36,.15);border:1px solid rgba(251,191,36,.3);color:#fbbf24;
                padding:11px 14px;border-radius:10px;margin-bottom:16px;font-size:13px;text-align:center;">
      ⏱ Sessão expirada após 30 minutos de inactividade.
    </div>
    <?php endif; ?>
    <div style="text-align:center;margin-bottom:28px;">
      <div style="font-size:40px;margin-bottom:8px;">📸</div>
      <h1 style="font-size:22px;font-weight:700;color:#fff;">Painel Admin</h1>
      <p style="font-size:14px;color:#71717a;margin-top:4px;"><?= h(config('app.name')) ?></p>
    </div>
    <?php if($m=flash('error')): ?>
    <div style="background:#fff1f2;border:1px solid #fecdd3;color:#be123c;padding:10px 14px;border-radius:8px;margin-bottom:14px;font-size:14px;text-align:center;"><?= h($m) ?></div>
    <?php endif; ?>
    <form method="post" action="<?= base_url('admin/login') ?>"
          style="background:#18181b;border:1px solid rgba(255,255,255,0.08);border-radius:16px;padding:24px;display:flex;flex-direction:column;gap:14px;">
      <?= csrf_field() ?>
      <div>
        <label class="label" style="color:#a1a1aa;">Utilizador</label>
        <input type="text" name="user" required autofocus autocomplete="username"
               style="width:100%;background:#09090b;border:1px solid rgba(255,255,255,0.15);border-radius:8px;padding:10px 12px;font-size:15px;color:#fafafa;outline:none;"
               onfocus="this.style.borderColor='rgba(255,255,255,0.4)'"
               onblur="this.style.borderColor='rgba(255,255,255,0.15)'">
      </div>
      <div>
        <label class="label" style="color:#a1a1aa;">Password</label>
        <input type="password" name="pass" required autocomplete="current-password"
               style="width:100%;background:#09090b;border:1px solid rgba(255,255,255,0.15);border-radius:8px;padding:10px 12px;font-size:15px;color:#fafafa;outline:none;"
               onfocus="this.style.borderColor='rgba(255,255,255,0.4)'"
               onblur="this.style.borderColor='rgba(255,255,255,0.15)'">
      </div>
      <button type="submit" class="btn btn-white" style="width:100%;padding:12px;font-size:15px;border-radius:10px;margin-top:4px;">Entrar</button>
    </form>
  </div>
</div>
