<?php

header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
header('Expires: 0');
?>

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Login - ITSM</title>

  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">

  <style>
    body {
      background-color: #f8f9fa;
    }

    .login-container {
      min-height: 100vh;
    }

    .login-card {
      width: 100%;
      width: 600px;
      border: none;
      box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15);
    }
  </style>
</head>

<body>

  <div class="container">
    <div class="row justify-content-center align-items-center login-container">
      <div class="col-auto">

        <div class="card login-card">
          <div class="card-body p-4">

            <div class="text-center mb-4">
              <img
                src="<?= asset('/images/brand/logo-bsi-tosca.PNG') ?>"
                alt="Logo"
                width="200">

              <h5 class="fw-bold">ITSM Portal</h5>
              <p class="text-muted mb-0">
                Sign in to your account
              </p>
            </div>

            <?php if (isset($_SESSION['error'])): ?>
              <div class="alert alert-danger alert-dismissible fade show" role="alert">
                <?= $_SESSION['error'] ?>
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
              </div>
              <?php unset($_SESSION['error']); ?>
            <?php endif; ?>

            <form method="POST" action="<?= url('LOGIN') ?>">

              <div class="mb-3">
                <label class="form-label">Username / Email</label>
                <input
                  type="text"
                  name="usernameOrEmail"
                  class="form-control"
                  placeholder="Masukkan username or email"
                  required>
              </div>

              <div class="mb-3">
                <label class="form-label">Password</label>
                <input
                  type="password"
                  name="password"
                  class="form-control"
                  placeholder="Masukkan password"
                  required>
              </div>

              <button
                type="submit"
                class="btn btn-primary w-100">
                Login
              </button>

            </form>

          </div>
        </div>

      </div>
    </div>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

</body>

</html>