@if (server()) {
  <div class="max-w-2xl space-y-3">
    @if (bannedUsers().length === 0) {
      <p class="text-sm text-muted-foreground text-center py-8">{{ 'settings.bans.empty' | translate }}</p>
    } @else {
      @for (ban of bannedUsers(); track ban.oderId) {
        <div class="flex items-center gap-3 p-3 bg-secondary/50 rounded-lg">
          <div class="w-8 h-8 rounded-full bg-destructive/20 flex items-center justify-center text-destructive font-semibold text-sm">
            {{ ban.displayName?.charAt(0)?.toUpperCase() || '?' }}
          </div>
          <div class="flex-1 min-w-0">
            <p class="text-sm font-medium text-foreground truncate">
              {{ ban.displayName || ('settings.bans.unknownUser' | translate) }}
            </p>
            @if (ban.reason) {
              <p class="text-xs text-muted-foreground truncate">{{ 'settings.bans.reason' | translate: { reason: ban.reason } }}</p>
            }
            @if (ban.expiresAt) {
              <p class="text-xs text-muted-foreground">{{ 'settings.bans.expires' | translate: { date: formatExpiry(ban.expiresAt) } }}</p>
            } @else {
              <p class="text-xs text-destructive">{{ 'settings.bans.permanent' | translate }}</p>
            }
          </div>
          @if (isAdmin()) {
            <button
              type="button"
              (click)="unbanUser(ban)"
              class="grid h-8 w-8 place-items-center rounded-lg text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
            >
              <ng-icon
                name="lucideX"
                class="w-4 h-4"
              />
            </button>
          }
        </div>
      }
    }
  </div>
} @else {
  <div class="flex items-center justify-center h-40 text-muted-foreground text-sm">{{ 'settings.bans.selectServer' | translate }}</div>
}
