'use client'

import { motion } from 'framer-motion'
import { Language, PitchTeamMember } from '@/lib/types'
import { t } from '@/lib/i18n'
import { User } from 'lucide-react'
import GradientText from '../ui/GradientText'
import FadeInView from '../ui/FadeInView'

interface TeamSlideProps {
  lang: Language
  team: PitchTeamMember[]
}

export default function TeamSlide({ lang, team }: TeamSlideProps) {
  const i = t(lang)

  return (
    <div>
      <FadeInView className="text-center mb-12">
        <h2 className="text-4xl md:text-5xl font-bold mb-3">
          <GradientText>{i.team.title}</GradientText>
        </h2>
        <p className="text-lg text-white/50 max-w-2xl mx-auto">{i.team.subtitle}</p>
      </FadeInView>

      <div className="grid md:grid-cols-2 gap-8 max-w-4xl mx-auto">
        {team.map((member, idx) => (
          <motion.div
            key={member.id}
            initial={{ opacity: 0, x: idx === 0 ? -40 : 40 }}
            animate={{ opacity: 1, x: 0 }}
            transition={{ delay: 0.3 + idx * 0.2, duration: 0.6 }}
            className="bg-white/[0.08] backdrop-blur-xl border border-white/10 rounded-3xl p-8"
          >
            <div className="flex items-start gap-5">
              {/* Avatar */}
              <div className="w-20 h-20 rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600
                flex items-center justify-center shrink-0 shadow-lg">
                <User className="w-10 h-10 text-white" />
              </div>

              <div className="flex-1">
                <h3 className="text-xl font-bold text-white mb-1">{member.name}</h3>
                <p className="text-indigo-400 text-sm font-medium mb-3">
                  {lang === 'de' ? member.role_de : member.role_en}
                </p>
                <p className="text-sm text-white/50 leading-relaxed mb-4">
                  {lang === 'de' ? member.bio_de : member.bio_en}
                </p>

                {/* Equity */}
                <div className="flex items-center gap-2 mb-3">
                  <span className="text-xs text-white/40">{i.team.equity}:</span>
                  <span className="text-sm font-bold text-white">{member.equity_pct}%</span>
                </div>

                {/* Expertise Tags */}
                <div className="flex flex-wrap gap-1.5">
                  {(member.expertise || []).map((skill, sidx) => (
                    <span
                      key={sidx}
                      className="text-xs px-2.5 py-1 rounded-full bg-indigo-500/10 text-indigo-300 border border-indigo-500/20"
                    >
                      {skill}
                    </span>
                  ))}
                </div>
              </div>
            </div>
          </motion.div>
        ))}
      </div>
    </div>
  )
}
