import { getTranslations } from 'next-intl/server'
import { Truck, Timer, ShieldCheck, BadgePercent } from 'lucide-react'

const ITEMS = [
  { key: 'freeDelivery', icon: Truck },
  { key: 'fastDelivery', icon: Timer },
  { key: 'freshQuality', icon: ShieldCheck },
  { key: 'weeklyOffers', icon: BadgePercent },
] as const

// The four store promises (FeaturesSection copy, messages/*.json) as a
// compact strip — "Modern" homepage and "Modern" footer.
export default async function TrustStrip({ tone = 'card' }: { tone?: 'card' | 'plain' }) {
  const t = await getTranslations('FeaturesSection')

  return (
    <div
      className={`grid grid-cols-2 lg:grid-cols-4 gap-px overflow-hidden rounded-2xl ${
        tone === 'card' ? 'bg-gray-100 border border-gray-100 shadow-sm' : 'bg-transparent'
      }`}
    >
      {ITEMS.map(({ key, icon: Icon }) => (
        <div key={key} className={`flex items-center gap-3 sm:gap-4 p-4 sm:p-5 ${tone === 'card' ? 'bg-white' : ''}`}>
          <span className="flex h-11 w-11 sm:h-12 sm:w-12 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
            <Icon size={22} strokeWidth={1.8} />
          </span>
          <div className="min-w-0">
            <p className="font-bold text-dark text-sm sm:text-base leading-tight">{t(`${key}.title`)}</p>
            <p className="text-xs sm:text-sm text-gray-custom truncate">{t(`${key}.desc`)}</p>
          </div>
        </div>
      ))}
    </div>
  )
}
