{{ $lang := .Page.Language.Lang }}
{{ $countries := hugo.Data.countries }}

{{ $enforced := 0 }}{{ $passed := 0 }}{{ $progress := 0 }}{{ $guidelines := 0 }}
{{ range $countries }}
  {{ if eq .status "enforced" }}{{ $enforced = add $enforced 1 }}
  {{ else if eq .status "passed" }}{{ $passed = add $passed 1 }}
  {{ else if eq .status "progress" }}{{ $progress = add $progress 1 }}
  {{ else if eq .status "guidelines" }}{{ $guidelines = add $guidelines 1 }}
  {{ end }}
{{ end }}

<style>
.ifk-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  margin: 2rem 0; text-align: center;
}
.ifk-stat {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 10px; padding: 1.25rem 0.75rem;
  border: 1px solid #e2e8f0; transition: transform 0.15s;
}
.ifk-stat:hover { transform: translateY(-2px); }
.ifk-stat-num { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.ifk-stat-label { font-size: 0.75rem; color: #64748b; margin-top: 0.25rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 480px) {
  .ifk-stats { grid-template-columns: repeat(2, 1fr); }
  .ifk-stat-num { font-size: 1.5rem; }
}
</style>

<div class="ifk-stats">
  <div class="ifk-stat">
    <div class="ifk-stat-num" style="color:#667eea">{{ $enforced }}</div>
    <div class="ifk-stat-label">{{ if eq $lang "de" }}In Kraft{{ else if eq $lang "fr" }}En vigueur{{ else }}Enforced{{ end }}</div>
  </div>
  <div class="ifk-stat">
    <div class="ifk-stat-num" style="color:#764ba2">{{ $passed }}</div>
    <div class="ifk-stat-label">{{ if eq $lang "de" }}Verabschiedet{{ else if eq $lang "fr" }}Adoptées{{ else }}Passed{{ end }}</div>
  </div>
  <div class="ifk-stat">
    <div class="ifk-stat-num" style="color:#a5b4fc">{{ $progress }}</div>
    <div class="ifk-stat-label">{{ if eq $lang "de" }}In Bearbeitung{{ else if eq $lang "fr" }}En cours{{ else }}In Progress{{ end }}</div>
  </div>
  <div class="ifk-stat">
    <div class="ifk-stat-num" style="color:#e0e7ff">{{ $guidelines }}</div>
    <div class="ifk-stat-label">{{ if eq $lang "de" }}Richtlinien{{ else if eq $lang "fr" }}Directives{{ else }}Guidelines{{ end }}</div>
  </div>
</div>
