export function IntentScoresChart({ scores }: { scores: Record<string, number> }) {
  const entries = Object.entries(scores).sort((a, b) => b[1] - a[1])

  if (entries.length === 0) {
    return (
      <div className="text-center py-8 text-slate-400">
        Keine Intent-Scores verfuegbar
      </div>
    )
  }

  return (
    <div className="space-y-3">
      {entries.map(([intent, score]) => (
        <div key={intent}>
          <div className="flex items-center justify-between text-sm mb-1">
            <span className="text-slate-600 truncate max-w-[200px]">{intent.replace(/_/g, ' ')}</span>
            <span
              className={`font-medium ${
                score >= 4 ? 'text-emerald-600' : score >= 3 ? 'text-amber-600' : 'text-red-600'
              }`}
            >
              {score.toFixed(2)}
            </span>
          </div>
          <div className="h-2 bg-slate-100 rounded-full overflow-hidden">
            <div
              className={`h-full rounded-full transition-all ${
                score >= 4 ? 'bg-emerald-500' : score >= 3 ? 'bg-amber-500' : 'bg-red-500'
              }`}
              style={{ width: `${(score / 5) * 100}%` }}
            />
          </div>
        </div>
      ))}
    </div>
  )
}
