import type { IndustryTemplate } from '../_types'

export function DetailHeader({
  detail,
  onBack,
}: {
  detail: IndustryTemplate
  onBack: () => void
}) {
  return (
    <div className="bg-white rounded-xl border border-slate-200 p-6">
      <button
        onClick={onBack}
        className="inline-flex items-center gap-1.5 text-sm text-slate-500 hover:text-emerald-600 transition-colors mb-4"
      >
        <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
          <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
        </svg>
        Zurueck zur Uebersicht
      </button>

      <div className="flex items-start gap-4">
        <div className="w-16 h-16 rounded-xl bg-gradient-to-br from-emerald-50 to-teal-50 border border-emerald-100 flex items-center justify-center text-4xl flex-shrink-0">
          {detail.icon}
        </div>
        <div className="flex-1">
          <h2 className="text-xl font-bold text-slate-900">{detail.name}</h2>
          <p className="text-slate-500 mt-1">{detail.description}</p>
        </div>
      </div>

      {detail.regulations && detail.regulations.length > 0 && (
        <div className="mt-4">
          <p className="text-xs font-medium text-slate-400 uppercase tracking-wider mb-2">
            Relevante Regulierungen
          </p>
          <div className="flex flex-wrap gap-2">
            {detail.regulations.map((reg) => (
              <span
                key={reg}
                className="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-emerald-50 text-emerald-700 border border-emerald-200"
              >
                {reg}
              </span>
            ))}
          </div>
        </div>
      )}

      <div className="grid grid-cols-3 gap-4 mt-5 pt-5 border-t border-slate-100">
        <div className="text-center">
          <p className="text-2xl font-bold text-emerald-600">
            {detail.vvt_templates?.length || 0}
          </p>
          <p className="text-xs text-slate-500 mt-0.5">VVT-Vorlagen</p>
        </div>
        <div className="text-center">
          <p className="text-2xl font-bold text-teal-600">
            {detail.tom_recommendations?.length || 0}
          </p>
          <p className="text-xs text-slate-500 mt-0.5">TOM-Empfehlungen</p>
        </div>
        <div className="text-center">
          <p className="text-2xl font-bold text-amber-600">
            {detail.risk_scenarios?.length || 0}
          </p>
          <p className="text-xs text-slate-500 mt-0.5">Risiko-Szenarien</p>
        </div>
      </div>
    </div>
  )
}
