<script>
document.querySelectorAll('.counter').forEach(counter => {
  const update = () => {
    const target = +counter.getAttribute('data-target');
    const current = +counter.innerText;
    const increment = Math.ceil(target / 80);

    if (current < target) {
      counter.innerText = current + increment;
      setTimeout(update, 30);
    } else {
      counter.innerText = target.toLocaleString();
    }
  };
  update();
});
</script>

<script>
function toggleSidebar(){
  document.getElementById('admin-sidebar').classList.toggle('collapsed');
  document.getElementById('admin-main').classList.toggle('collapsed');
}
</script>

<div class="modal fade" id="loginModal" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content rounded-4">
      <div class="modal-header border-0">
        <h5 class="modal-title fw-bold">Secure Login</h5>
        <button class="btn-close" data-bs-dismiss="modal"></button>
      </div>

      <form method="post" action="login.php">
        <div class="modal-body">
          <div class="mb-3">
            <label>Email address</label>
            <input type="email" name="email" class="form-control" required>
          </div>
          <div class="mb-3">
            <label>Password</label>
            <input type="password" name="password" class="form-control" required>
          </div>
          <div class="text-muted small">
            OTP verification required after login.
          </div>
        </div>

        <div class="modal-footer border-0">
          <button class="btn btn-primary w-100">
            <i class="bi bi-lock"></i> Login Securely
          </button>
        </div>
      </form>
    </div>
  </div>
</div>

