<div class="page-container animate-fade-in">
  <div class="page-header">
    <h1>Candidates</h1>
    <p class="page-subtitle">View all candidates and their quiz history</p>
  </div>

  @if (loading()) {
    <div class="loading-center"><div class="spinner spinner-lg"></div><p>Loading candidates...</p></div>
  } @else if (candidates().length === 0) {
    <div class="empty-state">
      <span class="material-symbols-rounded">people</span>
      <h3>No candidates found</h3>
      <p>No candidates have registered yet.</p>
    </div>
  } @else {
    <div class="candidates-grid stagger-children">
      @for (user of candidates(); track user._id) {
        <a [routerLink]="['/hr/candidates', user._id, 'history']" class="card card-hover candidate-card">
          <div class="candidate-avatar">{{ user.name?.charAt(0)?.toUpperCase() || '?' }}</div>
          <div class="candidate-info">
            <h4>{{ user.name }}</h4>
            <p>{{ user.email }}</p>
            <span class="candidate-meta">
              @if (user.group) { <span class="badge badge-primary">{{ user.group }}</span> }
              Joined {{ user.createdAt | date:'mediumDate' }}
            </span>
          </div>
          <span class="material-symbols-rounded arrow-icon">chevron_right</span>
        </a>
      }
    </div>
  }
</div>
