import React from 'react';
import Image from 'next/image'
import { componentStyles, mergeClasses } from '@/lib/styles/designSystem';
import type { Service } from '@/types/service';

interface ServiceCardProps {
  service: Service;
  onServiceClick: (service: Service) => void;
  className?: string;
}

export const ServiceCard: React.FC<ServiceCardProps> = ({
  service,
  onServiceClick,
  className = '',
}) => {
  const cardClasses = mergeClasses(
    'group relative p-6 sm:p-8 transition-all duration-300 cursor-pointer',
    componentStyles.card.base,
    componentStyles.card.gradient,
    'hover:-translate-y-4 hover:shadow-2xl hover:border-banquise-blue-lightest/50 hover:from-banquise-blue-dark/15 hover:to-banquise-blue-dark/8 active:scale-95',
    className
  );

  const handleClick = () => {
    onServiceClick(service);
  };

  return (
    <div className={cardClasses} onClick={handleClick}>
      {/* Icon */}
      <div className="mb-6 sm:mb-8 w-20 h-20 sm:w-24 sm:h-24 bg-gradient-to-br from-banquise-blue to-banquise-blue-light rounded-2xl flex items-center justify-center text-3xl sm:text-4xl shadow-lg group-hover:scale-110 transition-transform duration-300 mx-auto">
                {typeof service.image === 'string' ? (
                  <img
                    src={service.image}
                    alt={service.icon}
                    className="h-10 sm:h-12 lg:h-14 w-auto relative z-10 transition-transform duration-300 group-hover:scale-130 m-10"
                    style={{ filter: 'drop-shadow(0 0 12px rgba(168, 218, 255, 0.4))' }}
                  />
                ) : (
                  <Image
                    src={service.image}
                    alt={service.icon}
                    className="h-10 sm:h-12 lg:h-14 w-auto relative z-10 transition-transform duration-300 group-hover:scale-130 m-10"
                    width={56}
                    height={56}
                    unoptimized
                  />
                )}
      </div>
      
      {/* Service name */}
      <h3 className="text-xl sm:text-2xl font-bold text-banquise-gray mb-4 sm:mb-6 font-heading text-center group-hover:text-banquise-blue-lightest transition-colors duration-300">
        {service.name}
      </h3>
      
      {/* Short description */}
      <p className="text-banquise-gray/80 leading-relaxed text-center text-sm sm:text-base">
        {service.description.split('.')[0]}.
      </p>
      
      
      {/* Hover effect */}
      <div className="absolute inset-0 bg-gradient-to-br from-banquise-blue-lightest/10 to-banquise-blue/5 rounded-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"></div>
    </div>
  );
};
