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-200/50 hover:from-banquise-blue-800/15 hover:to-banquise-blue-800/8 active:scale-95',
    className
  );

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

  return (
    <div 
      className={cardClasses} 
      onClick={handleClick}
      style={{
        background: 'linear-gradient(to bottom right, rgba(31, 80, 120, 0.1), rgba(31, 80, 120, 0.05))',
        backdropFilter: 'blur(16px)',
        borderRadius: '1rem',
        border: '1px solid rgba(160, 236, 249, 0.3)',
        transition: 'all 0.3s ease'
      }}
    >
      {/* Icon */}
      <div 
        className="mb-6 sm:mb-8 w-20 h-20 sm:w-24 sm:h-24 rounded-2xl flex items-center justify-center text-3xl sm:text-4xl shadow-lg group-hover:scale-110 transition-transform duration-300 mx-auto"
        style={{
          background: 'linear-gradient(to bottom right, var(--banquise-blue-600), var(--banquise-blue-400))'
        }}
      >
                <Image
                  src={service.image as any}
                  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}
                />
      </div>
      
      {/* Service name */}
      <h3 
        className="text-xl sm:text-2xl font-bold mb-4 sm:mb-6 font-heading text-center group-hover:text-banquise-blue-200 transition-colors duration-300"
        style={{ color: 'var(--banquise-blue-900)' }}
      >
        {service.name}
      </h3>
      
      {/* Short description */}
      <p 
        className="leading-relaxed text-center text-sm sm:text-base"
        style={{ color: 'var(--banquise-slate-700)' }}
      >
        {service.description.split('.')[0]}.
      </p>
      
      
      {/* Hover effect */}
      <div 
        className="absolute inset-0 rounded-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"
        style={{
          background: 'linear-gradient(to bottom right, rgba(160, 236, 249, 0.1), rgba(52, 166, 252, 0.05))'
        }}
      ></div>
    </div>
  );
};
