


import React from 'react';
import { SECTION_IDS, ACCELERATOR_INVESTMENT_CONTENT } from '../constants'; 
import { InvestmentProject } from '../types'; 
import Button from './Button'; 
import { CurrencyDollarIcon, PresentationChartLineIcon, UsersIcon, LightBulbIcon } from '@heroicons/react/24/outline';

interface InvestmentCardProps {
  project: InvestmentProject; 
}

const InvestmentCard: React.FC<InvestmentCardProps> = ({ project }) => (
  <div className="bg-white rounded-xl transition-all duration-300 ease-in-out flex flex-col overflow-hidden">
    <div className="relative w-full aspect-[16/9] overflow-hidden">
      <img src={project.imageUrl} alt={project.name} className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" loading="lazy" />
    </div>
    <div className="p-5 flex flex-col flex-grow">
      <h3 className="font-quicksand text-2xl font-semibold text-slate-800 mb-1">{project.name}</h3>
      <p className="font-inter text-sm text-slate-600 mb-3">{project.industry}</p>
      
      <div className="mb-3">
        <h4 className="font-inter text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1">{ACCELERATOR_INVESTMENT_CONTENT.problemLabel}</h4>
        <div className="font-inter text-sm text-slate-600 line-clamp-2" dangerouslySetInnerHTML={{ __html: project.problem }}></div>
      </div>
      <div className="mb-4">
        <h4 className="font-inter text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1">{ACCELERATOR_INVESTMENT_CONTENT.solutionLabel}</h4>
        <div className="font-inter text-sm text-slate-600 line-clamp-2" dangerouslySetInnerHTML={{ __html: project.solution }}></div>
      </div>
      
      <div className="grid grid-cols-2 gap-x-4 gap-y-2 text-sm mb-4 font-inter text-slate-700">
        <div className="flex items-center">
          <UsersIcon className="w-4 h-4 mr-1.5 text-slate-500"/> {ACCELERATOR_INVESTMENT_CONTENT.teamLabel} {project.teamSize} чел.
        </div>
        <div className="flex items-center">
          <CurrencyDollarIcon className="w-4 h-4 mr-1.5 text-slate-500"/> {ACCELERATOR_INVESTMENT_CONTENT.fundingLabel} {project.fundingSought}
        </div>
      </div>

      {project.contactEmail ? (
        <Button
          variant="primary"
          size="sm"
          onClick={() => window.location.href = `mailto:${project.contactEmail}?subject=Инвестиции в ${project.name}`}
          leftIcon={<PresentationChartLineIcon />}
          className="mt-auto"
        >
          {ACCELERATOR_INVESTMENT_CONTENT.contactProjectButtonText}
        </Button>
      ) : (
        <Button
          variant="secondary"
          size="sm"
          disabled
          className="mt-auto"
        >
          {ACCELERATOR_INVESTMENT_CONTENT.requestContactButtonText}
        </Button>
      )}
    </div>
  </div>
);

interface AcceleratorInvestmentSectionProps {
  investmentProjects: InvestmentProject[];
}

const AcceleratorInvestmentSection: React.FC<AcceleratorInvestmentSectionProps> = ({ investmentProjects }) => {
  return (
    <section 
      id={SECTION_IDS.acceleratorInvestmentPage} 
      className="py-16 md:py-24 bg-white min-h-screen"
    >
      <div className="container mx-auto px-4 sm:px-6 lg:px-8">
        <header className="mb-12 md:mb-16">
          <h1 className="font-quicksand text-4xl sm:text-5xl md:text-6xl font-bold text-slate-900">
            {ACCELERATOR_INVESTMENT_CONTENT.title}
          </h1>
          <p className="mt-4 text-lg md:text-xl text-slate-700 max-w-3xl">
            {ACCELERATOR_INVESTMENT_CONTENT.subtitle}
          </p>
        </header>
        
        {investmentProjects && investmentProjects.length > 0 ? (
          <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8">
            {investmentProjects.map((project: InvestmentProject) => (
              <InvestmentCard key={project.id} project={project} />
            ))}
          </div>
        ) : (
          <div className="text-center py-10 bg-white p-6 rounded-xl">
            <CurrencyDollarIcon className="w-16 h-16 mx-auto text-slate-300 mb-4" />
            <h2 className="text-2xl font-quicksand font-semibold text-slate-700 mb-3">{ACCELERATOR_INVESTMENT_CONTENT.emptyStateTitle}</h2>
            <p className="text-slate-600 font-inter">
              {ACCELERATOR_INVESTMENT_CONTENT.emptyStateMessage}
            </p>
          </div>
        )}

         <div className="mt-16 text-center bg-white p-8 md:p-12 rounded-xl">
            <LightBulbIcon className="w-12 h-12 mx-auto text-slate-500 mb-4" />
            <h2 className="text-3xl font-quicksand font-semibold text-slate-800 mb-6">
                {ACCELERATOR_INVESTMENT_CONTENT.investorCtaTitle}
            </h2>
            <p className="font-inter text-lg text-slate-600 mb-8 max-w-xl mx-auto">
                {ACCELERATOR_INVESTMENT_CONTENT.investorCtaSubtitle}
            </p>
            <div className="flex flex-col sm:flex-row flex-wrap justify-center items-center gap-4 sm:gap-6">
              {ACCELERATOR_INVESTMENT_CONTENT.contactMethods.map((method) => (
                <a 
                  key={method.id}
                  href={method.href}
                  target="_blank" 
                  rel="noopener noreferrer"
                  className={`group inline-flex items-center justify-center px-6 py-3 text-base font-medium text-slate-800 ${method.bgColor} ${method.hoverBgColor} rounded-full focus:outline-none focus:ring-2 ${method.ringColor} focus:ring-offset-2 transition-all duration-150 ease-in-out font-quicksand w-full sm:w-auto sm:min-w-[180px]`}
                  aria-label={method.ariaLabel}
                >
                  <method.icon className="w-5 h-5" />
                  <span className="ml-2.5">{method.name}</span>
                </a>
              ))}
            </div>
        </div>
      </div>
    </section>
  );
};

export default AcceleratorInvestmentSection;
