'use client';

import { Skeleton } from '@/components/ui/skeleton';

/**
 * Skeleton Loading للصفحة الرئيسية - استراتيجية تحميل احترافية (10/10 UX)
 * يظهر أثناء تحميل المكونات ثم يُستبدل بالمحتوى الحقيقي.
 */
const HomePageSkeleton = () => {
  return (
    <div className='overflow-x-hidden bg-white'>
      {/* Hero Skeleton */}
      <section className='relative w-full bg-[#092346] lg:h-[90vh] h-[80vh] flex items-center justify-center'>
        <div className='w-full max-w-4xl px-4 flex flex-col items-center gap-4'>
          <Skeleton className='h-10 sm:h-12 w-3/4 max-w-xl bg-white/10' />
          <Skeleton className='h-6 w-full max-w-2xl bg-white/10' />
          <Skeleton className='h-12 w-64 rounded-lg bg-white/10' />
          <Skeleton className='h-10 w-48 rounded-lg bg-white/10' />
        </div>
      </section>

      {/* Services Section Skeleton */}
      <section className='relative w-full py-16 px-4'>
        <div className='max-w-7xl mx-auto'>
          <Skeleton className='h-10 w-48 mx-auto mb-4 rounded-xl' />
          <Skeleton className='h-8 w-3/4 max-w-2xl mx-auto mb-12' />
          <div className='grid lg:grid-cols-3 md:grid-cols-2 grid-cols-1 gap-8'>
            {[1, 2, 3].map((i) => (
              <div key={i} className='rounded-xl border border-gray-200 overflow-hidden'>
                <Skeleton className='h-2 w-full' />
                <div className='p-6'>
                  <Skeleton className='h-72 w-full rounded-lg mb-4' />
                  <Skeleton className='h-7 w-2/3 mb-2' />
                  <Skeleton className='h-4 w-full mb-2' />
                  <Skeleton className='h-4 w-4/5 mb-6' />
                  <Skeleton className='h-10 w-40 mx-auto rounded-md' />
                </div>
              </div>
            ))}
          </div>
        </div>
      </section>

      {/* Payment Section Skeleton */}
      <section className='container mx-auto px-4 py-8'>
        <Skeleton className='h-10 w-72 mx-auto mb-8' />
        <div className='max-w-6xl mx-auto flex flex-col sm:flex-row items-center justify-center gap-6 bg-white py-10 px-6 rounded-2xl border border-gray-100'>
          <Skeleton className='h-40 w-40 sm:h-60 sm:w-60 rounded-xl' />
          <Skeleton className='h-8 w-64' />
        </div>
      </section>

      {/* Server Location Skeleton */}
      <section className='container mx-auto px-4 py-8'>
        <Skeleton className='h-10 w-56 mx-auto mb-12' />
        <Skeleton className='h-64 w-full max-w-4xl mx-auto rounded-xl mb-8' />
        <div className='grid lg:grid-cols-4 md:grid-cols-2 grid-cols-1 gap-6'>
          {[1, 2, 3, 4].map((i) => (
            <Skeleton key={i} className='h-32 rounded-lg' />
          ))}
        </div>
      </section>

      {/* DataCenter Services Skeleton */}
      <section className='py-12 px-4'>
        <Skeleton className='h-12 w-64 mx-auto mb-8' />
        <div className='flex justify-center gap-2 mb-8'>
          {[1, 2, 3, 4].map((i) => (
            <Skeleton key={i} className='h-10 w-24 rounded-lg' />
          ))}
        </div>
        <Skeleton className='h-80 w-full max-w-6xl mx-auto rounded-xl' />
      </section>

      {/* Dashboard Features Skeleton */}
      <section className='px-4 sm:px-6 md:px-16 lg:px-32 mt-12'>
        <div className='container mx-auto'>
          <div className='grid gap-12 lg:grid-cols-2 items-center'>
            <div className='space-y-4'>
              <Skeleton className='h-4 w-32' />
              <Skeleton className='h-9 w-3/4' />
              <Skeleton className='h-4 w-full' />
              <Skeleton className='h-4 w-full' />
              <div className='space-y-3 pt-4'>
                {[1, 2, 3].map((i) => (
                  <Skeleton key={i} className='h-14 w-full rounded-lg' />
                ))}
              </div>
            </div>
            <Skeleton className='h-80 w-full rounded-xl' />
          </div>
        </div>
      </section>

      {/* Partners Section Skeleton */}
      <section className='py-16 px-4 bg-gray-50'>
        <Skeleton className='h-10 w-48 mx-auto mb-4' />
        <Skeleton className='h-5 w-3/4 max-w-2xl mx-auto mb-12' />
        <div className='max-w-7xl mx-auto grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-12'>
          {[1, 2, 3].map((i) => (
            <Skeleton key={i} className='h-64 rounded-xl' />
          ))}
        </div>
        <div className='flex flex-wrap justify-center gap-4'>
          {[1, 2, 3, 4, 5].map((i) => (
            <Skeleton key={i} className='h-28 w-[200px] rounded-lg' />
          ))}
        </div>
      </section>

      {/* Customer Opinions Skeleton */}
      <section className='py-12 sm:py-16 lg:py-24 px-4 bg-[#F9FAFB]'>
        <Skeleton className='h-12 w-56 mx-auto mb-12' />
        <div className='max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-12 gap-8'>
          <div className='lg:col-span-4 space-y-4'>
            {[1, 2, 3, 4].map((i) => (
              <Skeleton key={i} className='h-24 rounded-xl' />
            ))}
          </div>
          <div className='lg:col-span-8'>
            <Skeleton className='h-96 w-full rounded-3xl' />
          </div>
        </div>
      </section>
    </div>
  );
};

export default HomePageSkeleton;
