<!DOCTYPE html>
<html lang="<%= lang || 'id' %>">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title><%= t('agent.login_title', 'Login Agent') %> - <%= company %></title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" rel="stylesheet">
  <style>
    body {
      background-color: #0f172a;
      color: #f8fafc;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
      padding: 16px;
    }

    .login-card {
      background: #1e293b;
      border-radius: 20px;
      padding: 28px;
      width: 100%;
      max-width: 420px;
      box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(148, 163, 184, 0.14);
    }

    .form-control {
      background: #0f172a;
      border: 1px solid #334155;
      color: white;
      padding: 12px;
      border-radius: 12px;
    }

    .form-control:focus {
      background: #0f172a;
      color: white;
      border-color: #6366f1;
      box-shadow: none;
    }

    .btn-login {
      background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
      color: white;
      border: none;
      padding: 12px;
      border-radius: 12px;
      width: 100%;
      font-weight: 700;
      margin-top: 10px;
      box-shadow: 0 14px 28px rgba(99, 102, 241, 0.22);
    }

    .brand-icon {
      font-size: 42px;
      color: #6366f1;
      margin-bottom: 10px;
    }
  </style>
</head>
<body>
  <div class="login-card text-center">
    <div class="brand-icon"><i class="bi bi-person-badge"></i></div>
    <h3 class="mb-1 fw-bold"><%= t('agent.portal_title', 'Portal Agent') %></h3>
    <p class="text-secondary mb-4 small"><%= company %></p>

    <% if (error) { %>
      <div class="alert alert-danger py-2 small rounded-3">
        <%= error %>
      </div>
    <% } %>

    <form method="POST" action="/agent/login">
      <div class="mb-3 text-start">
        <label class="form-label text-secondary small mb-1"><%= t('agent.username', 'Username') %></label>
        <input type="text" name="username" class="form-control" required placeholder="<%= t('agent.username_placeholder', 'Masukkan username') %>">
      </div>
      <div class="mb-4 text-start">
        <label class="form-label text-secondary small mb-1"><%= t('agent.password', 'Password') %></label>
        <input type="password" name="password" class="form-control" required placeholder="<%= t('agent.password_placeholder', 'Masukkan password') %>">
      </div>
      <button type="submit" class="btn btn-login"><i class="bi bi-box-arrow-in-right me-2"></i> <%= t('agent.sign_in', 'Masuk') %></button>
    </form>
  </div>
</body>
</html>
