"use client";

import { useTranslations, useLocale } from 'next-intl';
import { useState, useRef, useEffect } from 'react';
import { motion, AnimatePresence, useInView } from 'framer-motion';
import { useModal } from '@/context/ModalContext';

export default function Services() {
  const t = useTranslations('services');
  const locale = useLocale();
  const sectionRef = useRef<HTMLElement>(null);
  const isInView = useInView(sectionRef, { once: false, amount: 0.1 });
  const [activeCard, setActiveCard] = useState<number | null>(null);
  const [hoveredCard, setHoveredCard] = useState<number | null>(null);
  const [isMobile, setIsMobile] = useState(false);
  const { openModal } = useModal();
  const [currentMobileSection, setCurrentMobileSection] = useState(0);
  const mobileScrollContainerRef = useRef<HTMLDivElement>(null);

  // Mobil için ekran kontrolleri
  const [activeRows, setActiveRows] = useState<Record<number, number>>({0: 0, 1: 0, 2: 0, 3: 0});
  const rowScrollRefs = useRef<Array<HTMLDivElement | null>>(Array(4).fill(null));

  // Ekran boyutunu kontrol et
  useEffect(() => {
    const checkScreenSize = () => {
      setIsMobile(window.innerWidth < 768);
    };
    
    checkScreenSize();
    window.addEventListener('resize', checkScreenSize);
    return () => window.removeEventListener('resize', checkScreenSize);
  }, []);

  // Popup'ı kapatmak için dışa tıklama
  useEffect(() => {
    if (activeCard !== null) {
      const handleClickOutside = (event: MouseEvent) => {
        const target = event.target as Element;
        if (!target.closest('.service-card') && !target.closest('.service-detail-popup')) {
          setActiveCard(null);
        }
      };
      
      document.addEventListener('mousedown', handleClickOutside);
      return () => {
        document.removeEventListener('mousedown', handleClickOutside);
      };
    }
  }, [activeCard]);

  // Mobil için otomatik kaydırma indeksini güncelle
  useEffect(() => {
    if (isMobile && mobileScrollContainerRef.current) {
      const handleScroll = () => {
        const scrollContainer = mobileScrollContainerRef.current;
        if (!scrollContainer) return;
        
        const scrollLeft = scrollContainer.scrollLeft;
        const containerWidth = scrollContainer.clientWidth;
        const maxScroll = scrollContainer.scrollWidth - containerWidth;
        
        // Bölüm sayısına göre (3 bölüm olduğunu varsayalım)
        const sectionCount = 3;
        const scrollPercentage = scrollLeft / maxScroll;
        const sectionIndex = Math.min(
          Math.floor(scrollPercentage * sectionCount),
          sectionCount - 1
        );
        
        setCurrentMobileSection(sectionIndex);
      };
      
      const scrollContainer = mobileScrollContainerRef.current;
      scrollContainer.addEventListener('scroll', handleScroll, { passive: true });
      
      return () => {
        scrollContainer.removeEventListener('scroll', handleScroll);
      };
    }
  }, [isMobile]);
  
  // Bölüme kaydır
  const scrollToSection = (sectionIndex: number) => {
    if (mobileScrollContainerRef.current) {
      const scrollContainer = mobileScrollContainerRef.current;
      const containerWidth = scrollContainer.clientWidth;
      const maxScroll = scrollContainer.scrollWidth - containerWidth;
      
      // Bölüm sayısı (3 bölüm olduğunu varsayalım)
      const sectionCount = 3;
      const targetScrollPercentage = sectionIndex / (sectionCount - 1);
      const targetScrollLeft = targetScrollPercentage * maxScroll;
      
      scrollContainer.scrollTo({
        left: targetScrollLeft,
        behavior: 'smooth'
      });
      
      setCurrentMobileSection(sectionIndex);
    }
  };
  
  // GM2'nin sağladığı avantajlar/hizmetler
  const services = [
    {
      id: 'office',
      icon: '/icons/office.svg',
      color: 'from-blue-600 to-blue-400',
      colorAlt: 'bg-blue-500',
      detailColor: 'bg-gradient-to-br from-blue-600/20 to-blue-400/5',
    },
    {
      id: 'mentorship',
      icon: '/icons/mentor.svg',
      color: 'from-indigo-600 to-indigo-400',
      colorAlt: 'bg-indigo-500',
      detailColor: 'bg-gradient-to-br from-indigo-600/20 to-indigo-400/5',
    },
    {
      id: 'investment',
      icon: '/icons/investment.svg',
      color: 'from-violet-600 to-violet-400',
      colorAlt: 'bg-violet-500',
      detailColor: 'bg-gradient-to-br from-violet-600/20 to-violet-400/5',
    },
    {
      id: 'global',
      icon: '/icons/global.svg',
      color: 'from-purple-600 to-purple-400',
      colorAlt: 'bg-purple-500',
      detailColor: 'bg-gradient-to-br from-purple-600/20 to-purple-400/5',
    },
    {
      id: 'technology',
      icon: '/icons/technology.svg',
      color: 'from-pink-600 to-pink-400',
      colorAlt: 'bg-pink-500',
      detailColor: 'bg-gradient-to-br from-pink-600/20 to-pink-400/5',
    },
    {
      id: 'education',
      icon: '/icons/education.svg',
      color: 'from-rose-600 to-rose-400',
      colorAlt: 'bg-rose-500',
      detailColor: 'bg-gradient-to-br from-rose-600/20 to-rose-400/5',
    },
    {
      id: 'marketing',
      icon: '/icons/marketing.svg',
      color: 'from-orange-600 to-orange-400',
      colorAlt: 'bg-orange-500',
      detailColor: 'bg-gradient-to-br from-orange-600/20 to-orange-400/5',
    },
    {
      id: 'consulting',
      icon: '/icons/consulting.svg',
      color: 'from-amber-600 to-amber-400',
      colorAlt: 'bg-amber-500',
      detailColor: 'bg-gradient-to-br from-amber-600/20 to-amber-400/5',
    }
  ];

  // Mobil görünümde servisleri grup halinde bölmek
  const mobileServiceGroups = [
    services.slice(0, 2),   // İlk grup: 2 kart
    services.slice(2, 4),   // İkinci grup: 2 kart
    services.slice(4, 6),   // Üçüncü grup: 2 kart
    services.slice(6, 8)    // Dördüncü grup: 2 kart
  ];

  // Animasyon varyantları
  const containerVariants = {
    hidden: { opacity: 0 },
    visible: {
      opacity: 1,
      transition: {
        staggerChildren: 0.1,
        delayChildren: 0.2
      }
    }
  };

  const cardVariants = {
    hidden: { opacity: 0, y: 50 },
    visible: {
      opacity: 1,
      y: 0,
      transition: {
        type: "spring",
        stiffness: 100,
        damping: 15
      }
    }
  };

  const detailPopupVariants = {
    hidden: {
      opacity: 0,
      scale: 0.8,
      y: 20
    },
    visible: {
      opacity: 1,
      scale: 1,
      y: 0,
      transition: {
        type: "spring",
        stiffness: 300,
        damping: 25
      }
    },
    exit: {
      opacity: 0,
      scale: 0.8,
      y: 20,
      transition: {
        duration: 0.2
      }
    }
  };

  // Mobil için yatay kaydırılabilir düzen
  const renderMobileView = () => {
    // Satır içinde kaydırma işlevini yönet
    const handleRowScroll = (rowIndex: number) => {
      const scrollContainer = rowScrollRefs.current[rowIndex];
      if (!scrollContainer) return;
      
      // Her satır içinde kaydırma pozisyonunu hesapla
      const scrollLeft = scrollContainer.scrollLeft;
      const containerWidth = scrollContainer.clientWidth;
      const maxScroll = scrollContainer.scrollWidth - containerWidth;
      
      // Aktif kartı belirle (basit olarak 0 veya 1 olacaktır, her satırda 2 kart var)
      const activeCardInRow = scrollLeft > maxScroll / 2 ? 1 : 0;
      
      // Aktif satırları güncelle
      setActiveRows(prev => ({...prev, [rowIndex]: activeCardInRow}));
    };

    // Bir satırdaki belirli karta kaydır
    const scrollToCardInRow = (rowIndex: number, cardIndex: number) => {
      const scrollContainer = rowScrollRefs.current[rowIndex];
      if (!scrollContainer) return;
      
      const cards = scrollContainer.querySelectorAll('.service-card');
      if (cards.length <= cardIndex) return;
      
      // İlgili karta kaydır (her kartın tam genişliğini ve boşluğu hesaba katarak)
      const card = cards[cardIndex] as HTMLElement;
      scrollContainer.scrollTo({
        left: card.offsetLeft - 16, // 16px sol kenar boşluğunu hesaba kat
        behavior: 'smooth'
      });
      
      setActiveRows(prev => ({...prev, [rowIndex]: cardIndex}));
    };

    return (
      <div className="relative mt-4 mb-8">
        {/* Ana dikey konteynır - satır grupları alt alta olacak */}
        <div className="space-y-8">
          {/* Her bir satır için yatay kaydırılabilir alan */}
          {mobileServiceGroups.map((group, groupIndex) => (
            <div key={`row-${groupIndex}`} className="relative px-4">
              {/* Sadece kaydırma ipucu */}
              <div className="flex justify-end mb-2 px-1">
                <div className="text-xs text-gray-400 flex items-center">
                  <svg className="w-3 h-3 mr-1" viewBox="0 0 24 24" fill="none" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 5l7 7-7 7" />
                  </svg>
                  <span>{locale === 'tr' ? 'Kaydırın' : 'Swipe'}</span>
                </div>
              </div>
              
              {/* Yatay kaydırılabilir konteynır */}
              <div 
                ref={(el) => {
                  rowScrollRefs.current[groupIndex] = el;
                }}
                className="overflow-x-auto pb-2 hide-scrollbar snap-x snap-mandatory"
                onScroll={() => handleRowScroll(groupIndex)}
                style={{ 
                  scrollbarWidth: 'none',
                  WebkitOverflowScrolling: 'touch', // iOS için düzgün kaydırma desteği
                }}
              >
                <div className="flex gap-4 min-w-max px-0.5 py-0.5">
                  {/* Her satırdaki 2 kart */}
                  {group.map((service, index) => {
                    const serviceIndex = groupIndex * 2 + index;
                    return (
                      <motion.div
                        key={service.id}
                        className="service-card rounded-xl border border-slate-700/50 overflow-hidden shadow-lg cursor-pointer relative flex-shrink-0 snap-center"
                        style={{ 
                          width: 'calc(50% - 8px)', // Container genişliğinin %50'si
                          minWidth: '220px', // Minimum 220px genişlik
                          maxWidth: 'calc(50vw - 2rem)', // En fazla ekran genişliğinin yarısı kadar
                          WebkitTapHighlightColor: 'transparent',
                          touchAction: 'manipulation'
                        }}
                        variants={cardVariants}
                        whileTap={{ scale: 0.98 }}
                        onClick={() => setActiveCard(serviceIndex)}
                      >
                        <div className="bg-slate-800/90 p-4 h-full flex flex-col">
                          {/* Üst kısım - İkon ve Başlık */}
                          <div className="flex items-center mb-2">
                            <div className={`w-9 h-9 rounded-lg bg-gradient-to-br ${service.color} p-2 flex items-center justify-center shadow-lg mr-2.5`}>
                              <img src={service.icon} alt={t(`${service.id}.title`)} className="w-full h-full" />
                            </div>
                            
                            <h3 className="text-sm font-semibold text-white line-clamp-1">
                              {t(`${service.id}.title`)}
                            </h3>
                          </div>
                          
                          {/* Kısa açıklama */}
                          <p className="text-gray-300 text-xs mb-3 line-clamp-2">
                            {t(`${service.id}.description`)}
                          </p>
                          
                          {/* Daha fazla bilgi bağlantısı */}
                          <div className="mt-auto w-full flex justify-end">
                            <span className="text-xs font-medium text-blue-300 flex items-center">
                              {t('learnMore')}
                              <svg className="w-3 h-3 ml-1" viewBox="0 0 24 24" fill="none" stroke="currentColor">
                                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
                              </svg>
                            </span>
                          </div>
                          
                          {/* Renkli accent border */}
                          <div className={`absolute top-0 left-0 w-1 h-full bg-gradient-to-b ${service.color}`}></div>
                        </div>
                      </motion.div>
                    );
                  })}
                </div>
              </div>
              
              {/* Her satır için kaydırma göstergeleri */}
              <div className="flex justify-center space-x-2 mt-2">
                {group.map((_, cardIndex) => (
                  <button
                    key={`row-${groupIndex}-indicator-${cardIndex}`}
                    className={`rounded-full transition-all duration-300 ${
                      activeRows[groupIndex] === cardIndex 
                        ? "w-6 h-1.5 bg-blue-500/80" 
                        : "w-2 h-1.5 bg-gray-400/30 hover:bg-gray-400/50"
                    }`}
                    onClick={() => scrollToCardInRow(groupIndex, cardIndex)}
                    aria-label={`Satır ${groupIndex + 1}, Kart ${cardIndex + 1}`}
                  />
                ))}
              </div>
            </div>
          ))}
        </div>
      </div>
    );
  };

  return (
    <section 
      id="services" 
      ref={sectionRef}
      className="relative py-20 bg-gradient-to-b from-slate-900 to-slate-800 overflow-hidden"
    >
      {/* Dekoratif arka plan öğeleri */}
      <div className="absolute inset-0 overflow-hidden pointer-events-none">
        <div className="absolute inset-0 bg-grid-white/[0.03]"></div>
        <div className="absolute top-0 right-0 w-3/4 h-px bg-gradient-to-l from-transparent via-blue-500/20 to-transparent"></div>
        <div className="absolute bottom-0 left-0 w-3/4 h-px bg-gradient-to-r from-transparent via-indigo-500/20 to-transparent"></div>
        <div className="absolute top-1/4 left-0 w-1/2 h-px bg-gradient-to-r from-transparent via-violet-500/20 to-transparent opacity-50"></div>
        <div className="absolute bottom-1/4 right-0 w-1/2 h-px bg-gradient-to-l from-transparent via-purple-500/20 to-transparent opacity-50"></div>
        
        {/* Gradyan arka plan bulanıklıkları */}
        <div className="absolute top-0 left-1/4 w-[500px] h-[500px] rounded-full bg-blue-500/5 blur-[120px]"></div>
        <div className="absolute bottom-0 right-1/4 w-[500px] h-[500px] rounded-full bg-indigo-500/5 blur-[120px]"></div>
      </div>
      
      <div className="container mx-auto px-4 sm:px-6 lg:px-8 relative">
        {/* Başlık ve alt başlık */}
        <motion.div
          initial={{ opacity: 0, y: -20 }}
          animate={isInView ? { opacity: 1, y: 0 } : { opacity: 0, y: -20 }}
          transition={{ duration: 0.7, delay: 0.1 }}
          className="text-center mb-16"
        >
          <h2 className="text-3xl md:text-4xl lg:text-5xl font-bold mb-6 bg-clip-text text-transparent bg-gradient-to-r from-white to-blue-200">
            {t('title')}
          </h2>
          
          <motion.div 
            className="w-24 h-1.5 bg-gradient-to-r from-blue-600 to-indigo-600 mx-auto rounded-full mb-8"
            initial={{ width: 0, opacity: 0 }}
            animate={isInView ? { width: 96, opacity: 1 } : { width: 0, opacity: 0 }}
            transition={{ duration: 0.7, delay: 0.3 }}
          />
          
          <p className="max-w-3xl mx-auto text-gray-300 text-lg">
            {t('subtitle')}
          </p>
        </motion.div>
        
        {/* Hizmet kartları */}
        {isMobile ? renderMobileView() : (
          // Masaüstü ve tablet için mevcut ızgara görünümü
          <motion.div 
            className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 md:gap-8"
            variants={containerVariants}
            initial="hidden"
            animate={isInView ? "visible" : "hidden"}
          >
            {services.map((service, index) => (
              <motion.div
                key={service.id}
                className="service-card rounded-2xl border border-slate-700/50 overflow-hidden shadow-xl cursor-pointer relative"
                variants={cardVariants}
                whileHover={{ scale: 1.03, y: -5 }}
                onMouseEnter={() => setHoveredCard(index)}
                onMouseLeave={() => setHoveredCard(null)}
                onClick={() => setActiveCard(index)}
              >
                {/* Kart içeriği - Basitleştirildi */}
                <div className="bg-slate-800/90 backdrop-blur-sm p-6 h-full flex flex-col">
                  {/* Üst kısım - İkon ve Başlık */}
                  <div className="flex items-center mb-6">
                    <div className={`w-12 h-12 rounded-xl bg-gradient-to-br ${service.color} p-2.5 flex items-center justify-center shadow-lg mr-4`}>
                      <img src={service.icon} alt={t(`${service.id}.title`)} className="w-full h-full" />
                    </div>
                    
                    <h3 className="text-xl font-semibold text-white">
                      {t(`${service.id}.title`)}
                    </h3>
                  </div>
                  
                  {/* Açıklama metni */}
                  <p className="text-gray-300 mb-auto">
                    {t(`${service.id}.description`)}
                  </p>
                  
                  {/* Daha fazla bilgi butonu */}
                  <div className="mt-6 flex justify-end">
                    <motion.button
                      className={`px-4 py-2 rounded-full bg-gradient-to-r ${service.color} text-white text-sm font-medium flex items-center space-x-1`}
                      whileHover={{ scale: 1.05 }}
                      whileTap={{ scale: 0.95 }}
                    >
                      <span>{t('learnMore')}</span>
                      <svg className="w-4 h-4 ml-1" viewBox="0 0 24 24" fill="none" stroke="currentColor">
                        <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
                      </svg>
                    </motion.button>
                  </div>
                  
                  {/* Hover efekti için arka plan */}
                  <div 
                    className={`absolute inset-0 ${service.detailColor} opacity-0 transition-opacity duration-300 ${hoveredCard === index ? 'opacity-20' : ''}`}
                  ></div>
                </div>
                
                {/* Işık efekti */}
                <div 
                  className={`absolute inset-0 rounded-2xl transition-opacity duration-300 pointer-events-none ${hoveredCard === index ? 'opacity-100' : 'opacity-0'}`}
                  style={{
                    background: `linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.12) 30%, transparent 60%)`,
                    backgroundSize: '200% 100%',
                    animation: hoveredCard === index ? 'light-sweep 1.5s infinite' : 'none'
                  }}
                ></div>
              </motion.div>
            ))}
          </motion.div>
        )}
        
        {/* Detay Popup */}
        <AnimatePresence>
          {activeCard !== null && (
            <motion.div 
              className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm"
              initial={{ opacity: 0 }}
              animate={{ opacity: 1 }}
              exit={{ opacity: 0 }}
              onClick={() => setActiveCard(null)}
            >
              <motion.div
                className="service-detail-popup relative w-full max-w-3xl bg-gradient-to-br from-slate-900/95 to-slate-800/95 rounded-2xl p-5 md:p-8 shadow-2xl border border-white/10 overflow-hidden max-h-[90vh] overflow-y-auto"
                variants={detailPopupVariants}
                initial="hidden"
                animate="visible"
                exit="exit"
                onClick={(e) => e.stopPropagation()}
              >
                {/* Kapatma düğmesi */}
                <button 
                  className="absolute top-3 right-3 text-white/60 hover:text-white p-2 z-10 bg-black/30 rounded-full" 
                  onClick={() => setActiveCard(null)}
                >
                  <svg className="w-5 h-5 md:w-6 md:h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
                  </svg>
                </button>
                
                {activeCard !== null && (
                  <>
                    {/* Başlık kısmı */}
                    <div className="flex items-center mb-6 md:mb-8">
                      <div className={`w-12 md:w-16 h-12 md:h-16 rounded-xl bg-gradient-to-br ${services[activeCard].color} p-2.5 md:p-3 flex items-center justify-center shadow-xl mr-4 md:mr-6`}>
                        <img src={services[activeCard].icon} alt={t(`${services[activeCard].id}.title`)} className="w-full h-full" />
                      </div>
                      <h2 className="text-2xl md:text-3xl font-bold text-white">{t(`${services[activeCard].id}.title`)}</h2>
                    </div>
                    
                    {/* Detaylı içerik */}
                    <div className="space-y-5 md:space-y-6">
                      <div className={`${services[activeCard].detailColor} rounded-xl p-4 md:p-6 border border-white/5`}>
                        <p className="text-base md:text-lg text-white/90 leading-relaxed">
                          {locale === 'tr' ? 
                            serviceDetails[services[activeCard].id].tr :
                            serviceDetails[services[activeCard].id].en
                          }
                        </p>
                      </div>
                      
                      {/* Özellikler listesi */}
                      <div className="grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4 mt-4 md:mt-6">
                        {serviceFeatures[services[activeCard].id].map((feature, idx) => (
                          <div key={idx} className="flex items-start space-x-3">
                            <div className={`flex-shrink-0 w-6 md:w-8 h-6 md:h-8 rounded-lg ${services[activeCard].colorAlt} flex items-center justify-center mt-0.5`}>
                              <svg className="w-3 h-3 md:w-4 md:h-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 13l4 4L19 7" />
                              </svg>
                            </div>
                            <div>
                              <p className="text-sm md:text-base text-gray-200">
                                {locale === 'tr' ? feature.tr : feature.en}
                              </p>
                            </div>
                          </div>
                        ))}
                      </div>
                    </div>
                    
                    {/* CTA Buton */}
                    <div className="flex justify-center mt-6 md:mt-8">
                      <a 
                        href="https://gm2.ifollow.com.tr/register" 
                        target="_blank" 
                        rel="noopener noreferrer"
                        className="w-full md:w-auto"
                        onClick={(e) => {
                          e.stopPropagation();
                          setActiveCard(null);
                        }}
                      >
                        <motion.button
                          className={`w-full md:w-auto px-6 md:px-8 py-3 md:py-4 rounded-full bg-gradient-to-r ${services[activeCard].color} text-white font-medium shadow-lg flex items-center justify-center space-x-2`}
                          whileHover={{ scale: 1.05, boxShadow: "0 10px 25px -5px rgba(59, 130, 246, 0.4)" }}
                          whileTap={{ scale: 0.98 }}
                        >
                          <span>{locale === 'tr' ? 'Hemen Başvur' : 'Apply Now'}</span>
                          <svg className="w-4 h-4 md:w-5 md:h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
                          </svg>
                        </motion.button>
                      </a>
                    </div>
                    
                    {/* Dekoratif elementler */}
                    <div className={`absolute -top-24 -right-24 w-80 h-80 md:w-96 md:h-96 rounded-full ${services[activeCard].detailColor} blur-3xl opacity-30 -z-10`}></div>
                    <div className={`absolute -bottom-24 -left-24 w-80 h-80 md:w-96 md:h-96 rounded-full ${services[activeCard].detailColor} blur-3xl opacity-20 -z-10`}></div>
                  </>
                )}
              </motion.div>
            </motion.div>
          )}
        </AnimatePresence>
        
        {/* Alt CTA bölümü */}
        <motion.div 
          className="mt-20 text-center"
          initial={{ opacity: 0, y: 30 }}
          animate={isInView ? { opacity: 1, y: 0 } : { opacity: 0, y: 30 }}
          transition={{ duration: 0.7, delay: 0.7 }}
        >
          <h3 className="text-2xl md:text-3xl font-semibold text-white mb-6">
            {t('cta.title')}
          </h3>
          <p className="max-w-2xl mx-auto text-gray-300 mb-8">
            {t('cta.description')}
          </p>
          
          <a 
            href="https://gm2.ifollow.com.tr/register" 
            target="_blank" 
            rel="noopener noreferrer"
            className="inline-block"
          >
            <motion.button
              className="px-8 py-4 rounded-full bg-gradient-to-r from-blue-600 to-indigo-600 text-white font-semibold shadow-lg hover:shadow-blue-500/30 transition-shadow flex items-center mx-auto"
              whileHover={{ scale: 1.05 }}
              whileTap={{ scale: 0.95 }}
            >
              <span>{t('cta.applyButton')}</span>
              <svg className="w-5 h-5 ml-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
              </svg>
            </motion.button>
          </a>
        </motion.div>
      </div>
      
      {/* Işık animasyonu için CSS */}
      <style jsx global>{`
        @keyframes light-sweep {
          0% {
            background-position: -100% 0;
          }
          100% {
            background-position: 300% 0;
          }
        }
        
        /* Yatay kaydırma çubuğunu gizleme */
        .hide-scrollbar {
          -ms-overflow-style: none;  /* IE ve Edge */
          scrollbar-width: none;  /* Firefox */
        }
        
        .hide-scrollbar::-webkit-scrollbar {
          display: none; /* Chrome, Safari ve Opera */
        }
        
        /* Snap kaydırma için destek */
        .snap-x {
          scroll-snap-type: x mandatory;
          scroll-behavior: smooth;
        }
        
        .snap-center {
          scroll-snap-align: center;
        }
        
        .snap-always {
          scroll-snap-stop: always;
        }
      `}</style>
    </section>
  );
}

// Her hizmet için detaylı açıklamalar
const serviceDetails: Record<string, { tr: string, en: string }> = {
  office: {
    tr: 'GM2 ofislerinde, modern ve yaratıcı bir ortamda çalışma imkanı sunuyoruz. Ekibinizle birlikte rahatlıkla çalışabileceğiniz, toplantılarınızı gerçekleştirebileceğiniz ve networking yapabileceğiniz bu ortak çalışma alanları, verimliliğinizi artırmak için tasarlandı.',
    en: 'We offer the opportunity to work in a modern and creative environment in GM2 offices. These co-working spaces, where you can work comfortably with your team, hold meetings, and network, are designed to increase your productivity.'
  },
  mentorship: {
    tr: 'Mentorluk programımız ile girişiminizin her aşamasında profesyonel destek alabilirsiniz. Ekosistemin önde gelen isimleri, alanında uzman dernek üyelerimiz ve üst düzey yöneticilerimiz, düzenli olarak girişimcilerimize mentorluk sağlamaktadır.',
    en: 'With our mentorship program, you can receive professional support at every stage of your venture. Leading figures in the ecosystem, our expert association members, and senior managers regularly provide mentoring to our entrepreneurs.'
  },
  investment: {
    tr: 'Girişiminize finansal destek sağlamak için MÜSİAD Üyeleri ve farklı yatırım kuruluşlarıyla işbirliği içindeyiz. Sermaye bulma, yatırımcı sunumları hazırlama, değerleme süreçleri, danışmanlık ve doğru yatırımcıyla eşleşme konularında destek veriyoruz.',
    en: 'We collaborate with MUSIAD Members and various investment institutions to provide financial support for your venture. We offer assistance in finding capital, preparing investor presentations, valuation processes, and matching with the right investors.'
  },
  global: {
    tr: 'MÜSİAD\'ın 80\'den fazla ülkedeki şubeleri ve geniş iş ağı sayesinde, girişimcilerimize global pazarlara erişim imkanı sunuyoruz. Uluslararası ticaret, ihracat süreçleri, global müşteri edinme konularında destek sağlıyoruz.',
    en: 'Through MUSIAD\'s branches in more than 80 countries and extensive business network, we offer our entrepreneurs access to global markets. We provide support on international trade, export processes, and global customer acquisition.'
  },
  technology: {
    tr: 'Yüksek değerde teknoloji perk paketimiz ile girişimcilerimize çeşitli teknoloji araçlarına erişim imkanı sunuyoruz. Bu paket bulut hizmetleri, yazılım lisansları, geliştirme araçları, analitik platformlar ve teknoloji danışmanlığı gibi hizmetleri içermektedir.',
    en: 'With our high-value technology perk package, we provide entrepreneurs access to various technology tools. This package includes cloud services, software licenses, development tools, analytics platforms, and technology consulting.'
  },
  education: {
    tr: 'Girişimcilerimizin ihtiyaç duydukları konularda eğitim programları düzenliyoruz. İş modeli geliştirme, dijital pazarlama, finans yönetimi, liderlik becerileri, teknik eğitimler ve sektöre özel konularda workshop ve seminerler sunuyoruz.',
    en: 'We organize training programs on topics our entrepreneurs need. We offer workshops and seminars on business model development, digital marketing, financial management, leadership skills, technical training, and industry-specific topics.'
  },
  marketing: {
    tr: 'Girişiminizin hedef kitlesine ulaşması için pazarlama ve reklam desteği sağlıyoruz. Marka stratejisi, içerik üretimi, sosyal medya yönetimi, dijital reklamcılık, PR çalışmaları ve pazarlama analitiği konularında uzman ekibimizle destek veriyoruz.',
    en: 'We provide marketing and advertising support to help your venture reach its target audience. We support you with our expert team in brand strategy, content production, social media management, digital advertising, PR activities, and marketing analytics.'
  },
  consulting: {
    tr: 'MÜSİAD\'ın geniş networkü ile ticaret yapma ve şirket cironuzu artırma konusunda danışmanlık hizmeti sunuyoruz. İş geliştirme stratejileri, satış süreçleri, müşteri edinme, ticari işbirlikleri ve network yönetimi konularında rehberlik sağlıyoruz.',
    en: 'We offer consulting services on trading with MUSIAD\'s extensive network and increasing your company turnover. We provide guidance on business development strategies, sales processes, customer acquisition, commercial collaborations, and network management.'
  }
};

// Her hizmet için özellikler/avantajlar
const serviceFeatures: Record<string, Array<{ tr: string, en: string }>> = {
  office: [
    { tr: 'Hızlı internet ve modern teknolojik altyapı', en: 'High-speed internet and modern technological infrastructure' },
    { tr: 'Toplantı ve konferans odaları', en: 'Meeting and conference rooms' },
    { tr: 'Ortak çalışma alanları ve networking fırsatları', en: 'Co-working spaces and networking opportunities' },
    { tr: 'Merkezi konumda erişim kolaylığı', en: 'Easy access in a central location' }
  ],
  mentorship: [
    { tr: 'Alanında uzman mentorlarla birebir görüşmeler', en: 'One-on-one meetings with expert mentors' },
    { tr: 'Düzenli mentorluk seansları ve takip sistemi', en: 'Regular mentorship sessions and follow-up system' },
    { tr: 'Sektöre özel uzmanlık ve network desteği', en: 'Industry-specific expertise and network support' },
    { tr: 'Kişiselleştirilmiş iş geliştirme stratejileri', en: 'Personalized business development strategies' }
  ],
  investment: [
    { tr: 'Yatırımcı ağına erişim imkanı', en: 'Access to investor networks' },
    { tr: 'Yatırım süreçlerinde profesyonel danışmanlık', en: 'Professional consulting in investment processes' },
    { tr: 'Girişim sermayesi ve melek yatırımcı eşleştirme', en: 'Venture capital and angel investor matching' },
    { tr: 'Yatırım hazırlık ve sunum desteği', en: 'Investment preparation and presentation support' }
  ],
  global: [
    { tr: '80+ ülkede ticari ağlara erişim', en: 'Access to business networks in 80+ countries' },
    { tr: 'Uluslararası pazar araştırma desteği', en: 'International market research support' },
    { tr: 'Global müşteri ve tedarikçi bağlantıları', en: 'Global customer and supplier connections' },
    { tr: 'İhracat stratejisi ve operasyon desteği', en: 'Export strategy and operational support' }
  ],
  technology: [
    { tr: 'Bulut hizmetleri ve sunucu kredileri', en: 'Cloud services and server credits' },
    { tr: 'Profesyonel yazılım lisansları', en: 'Professional software licenses' },
    { tr: 'Teknoloji danışmanlığı ve çözüm desteği', en: 'Technology consulting and solution support' },
    { tr: 'Analitik ve veri işleme araçları', en: 'Analytics and data processing tools' }
  ],
  education: [
    { tr: 'İş geliştirme ve yönetim eğitimleri', en: 'Business development and management training' },
    { tr: 'Teknik ve uzmanlık workshopları', en: 'Technical and specialized workshops' },
    { tr: 'Liderlik ve ekip yönetimi eğitimleri', en: 'Leadership and team management training' },
    { tr: 'Sektöre özel sertifika programları', en: 'Industry-specific certification programs' }
  ],
  marketing: [
    { tr: 'Dijital pazarlama ve sosyal medya yönetimi', en: 'Digital marketing and social media management' },
    { tr: 'Marka stratejisi ve kimlik geliştirme', en: 'Brand strategy and identity development' },
    { tr: 'İçerik üretimi ve PR çalışmaları', en: 'Content production and PR activities' },
    { tr: 'Pazarlama analitiği ve performans ölçümü', en: 'Marketing analytics and performance measurement' }
  ],
  consulting: [
    { tr: 'İş modeli geliştirme ve iyileştirme', en: 'Business model development and improvement' },
    { tr: 'Satış stratejileri ve müşteri edinme', en: 'Sales strategies and customer acquisition' },
    { tr: 'Finansal planlama ve karlılık analizi', en: 'Financial planning and profitability analysis' },
    { tr: 'Ticari işbirlikleri ve ortaklık yapılandırma', en: 'Commercial collaborations and partnership structuring' }
  ]
}; 