'use client';

interface GrandPrizeProps {
  prizeAmount?: string;
  drawDate?: Date;
}

export default function GrandPrize({
  prizeAmount = "360€",
  drawDate,
}: GrandPrizeProps) {
  const formatDate = (date: Date) => {
    return date.toLocaleDateString('fr-FR', {
      day: 'numeric',
      month: 'long',
      year: 'numeric',
    });
  };

  return (
    <div className="bg-gradient-to-br from-secondary-50 via-secondary-100 to-secondary-200 rounded-3xl shadow-2xl p-10 md:p-12 border-3 border-secondary-400 mt-10 hover:shadow-3xl transition-all duration-300">
      <div className="flex flex-col items-center text-center">
        {/* Icône trophée */}
        <div className="bg-gradient-to-br from-secondary-400 to-secondary-500 rounded-full p-6 mb-6 shadow-xl">
          <svg className="w-16 h-16 text-white" fill="currentColor" viewBox="0 0 20 20">
            <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
          </svg>
        </div>

        {/* Titre */}
        <h2 className="text-3xl md:text-4xl font-bold text-gray-900 mb-6">
          Grand Prix à gagner !
        </h2>

        {/* Prix principal */}
        <div className="bg-white/80 backdrop-blur-sm rounded-2xl px-8 py-6 mb-6 shadow-lg">
          <h3 className="text-2xl md:text-3xl font-bold text-primary-500 mb-2">
            1 an de thé offert
          </h3>
          <p className="text-xl text-secondary-600 font-semibold">
            d'une valeur de {prizeAmount}
          </p>
        </div>

        {/* Description */}
        <p className="text-lg md:text-xl text-gray-700 mb-8 max-w-2xl leading-relaxed">
          Le grand prix du tirage final : une année complète de thé premium
        </p>

        {/* Informations du tirage */}
        <div className="grid md:grid-cols-2 gap-4 w-full max-w-xl">
          {drawDate && (
            <div className="bg-white/70 backdrop-blur-sm rounded-2xl p-5 flex items-center gap-4 shadow-md">
              <div className="bg-primary-100 rounded-full p-3">
                <svg className="w-6 h-6 text-primary-500" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
                  <path fillRule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clipRule="evenodd" />
                </svg>
              </div>
              <div className="text-left">
                <h4 className="text-sm text-gray-500 font-medium">Tirage au sort</h4>
                <p className="text-lg font-bold text-gray-700"><time dateTime={drawDate.toISOString().split('T')[0]}>{formatDate(drawDate)}</time></p>
              </div>
            </div>
          )}

          <div className="bg-white/70 backdrop-blur-sm rounded-2xl p-5 flex items-center gap-4 shadow-md">
            <div className="bg-primary-100 rounded-full p-3">
              <svg className="w-6 h-6 text-primary-500" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
                <path fillRule="evenodd" d="M6.267 3.455a3.066 3.066 0 001.745-.723 3.066 3.066 0 013.976 0 3.066 3.066 0 001.745.723 3.066 3.066 0 012.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 010 3.976 3.066 3.066 0 00-.723 1.745 3.066 3.066 0 01-2.812 2.812 3.066 3.066 0 00-1.745.723 3.066 3.066 0 01-3.976 0 3.066 3.066 0 00-1.745-.723 3.066 3.066 0 01-2.812-2.812 3.066 3.066 0 00-.723-1.745 3.066 3.066 0 010-3.976 3.066 3.066 0 00.723-1.745 3.066 3.066 0 012.812-2.812zm7.44 5.252a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clipRule="evenodd" />
              </svg>
            </div>
            <div className="text-left">
              <h4 className="text-sm text-gray-500 font-medium">Certification</h4>
              <p className="text-lg font-bold text-gray-700">Contrôle d'huissier</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}
