'use client';

interface HotelCardSkeletonProps {
  viewMode?: 'list' | 'grid';
}

export default function HotelCardSkeleton({ viewMode = 'list' }: HotelCardSkeletonProps) {
  if (viewMode === 'grid') {
    // Grid view - vertical card layout
    return (
      <div className="cols-listing mb-3">
        <div className="card listing-card rounded-3 w-100 shadow-sm p-0">
          {/* Image Skeleton */}
          <div className="position-relative rounded-top-3 overflow-hidden" style={{ height: '200px', backgroundColor: '#e9ecef' }}>
            <div className="placeholder-glow w-100 h-100">
              <span className="placeholder w-100 h-100" style={{ backgroundColor: '#dee2e6' }}></span>
            </div>
          </div>

          {/* Content Skeleton */}
          <div className="p-3">
            {/* Badges Skeleton */}
            <div className="d-flex gap-2 mb-2">
              <div className="placeholder-glow">
                <span className="placeholder rounded-pill" style={{ width: '90px', height: '20px', backgroundColor: '#dee2e6' }}></span>
              </div>
              <div className="placeholder-glow">
                <span className="placeholder rounded-pill" style={{ width: '75px', height: '20px', backgroundColor: '#dee2e6' }}></span>
              </div>
            </div>

            {/* Title Skeleton */}
            <div className="placeholder-glow mb-2">
              <span className="placeholder" style={{ width: '75%', height: '20px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Stars Skeleton */}
            <div className="placeholder-glow mb-2">
              <span className="placeholder" style={{ width: '110px', height: '14px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Location Skeleton */}
            <div className="placeholder-glow mb-2">
              <span className="placeholder" style={{ width: '60%', height: '14px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Amenities Skeleton */}
            <div className="d-flex gap-2 mb-2 flex-wrap">
              {[1, 2, 3].map((i) => (
                <div key={i} className="placeholder-glow">
                  <span className="placeholder rounded-pill" style={{ width: '65px', height: '24px', backgroundColor: '#dee2e6' }}></span>
                </div>
              ))}
              <div className="placeholder-glow">
                <span className="placeholder rounded-pill" style={{ width: '35px', height: '24px', backgroundColor: '#dee2e6' }}></span>
              </div>
            </div>

            {/* Book Now Pay Later Skeleton */}
            <div className="placeholder-glow mb-3">
              <span className="placeholder" style={{ width: '150px', height: '14px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Price Section Skeleton */}
            <div className="text-center pt-2 border-top">
              {/* Price Skeleton */}
              <div className="placeholder-glow mb-1">
                <span className="placeholder" style={{ width: '60px', height: '32px', backgroundColor: '#dee2e6' }}></span>
              </div>

              {/* Taxes Skeleton */}
              <div className="placeholder-glow mb-2">
                <span className="placeholder" style={{ width: '140px', height: '12px', backgroundColor: '#dee2e6' }}></span>
              </div>

              {/* CTA Button Skeleton */}
              <div className="placeholder-glow">
                <span className="placeholder rounded-2" style={{ width: '100%', height: '36px', backgroundColor: '#dee2e6' }}></span>
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }

  // List view - horizontal card layout
  return (
    <div className="cols-listing mb-3">
      <div className="card listing-card rounded-start-3 w-100 shadow-sm p-0">
        <div className="row listing-row g-0 h-100">
          {/* Image Skeleton */}
          <div className="listing-col-h col-xxl-3 col-xl-3 col-lg-3 col-md-3 col-sm-12 col-12 h-100 p-2 p-md-3 pe-2 pe-md-0">
            <div className="h-imgs-carousel position-relative rounded-3 overflow-hidden" style={{ height: '200px', backgroundColor: '#e9ecef' }}>
              <div className="placeholder-glow w-100 h-100">
                <span className="placeholder w-100 h-100" style={{ backgroundColor: '#dee2e6' }}></span>
              </div>
            </div>
          </div>

          {/* Content Skeleton */}
          <div className="listing-col-h col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12 h-100 booking-content-details p-2 p-md-3">
            {/* Badges Skeleton */}
            <div className="d-flex gap-2 mb-2">
              <div className="placeholder-glow">
                <span className="placeholder rounded-pill" style={{ width: '90px', height: '20px', backgroundColor: '#dee2e6' }}></span>
              </div>
              <div className="placeholder-glow">
                <span className="placeholder rounded-pill" style={{ width: '75px', height: '20px', backgroundColor: '#dee2e6' }}></span>
              </div>
            </div>

            {/* Title Skeleton */}
            <div className="placeholder-glow mb-2">
              <span className="placeholder" style={{ width: '65%', height: '22px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Stars Skeleton */}
            <div className="placeholder-glow mb-2">
              <span className="placeholder" style={{ width: '110px', height: '14px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Location Skeleton */}
            <div className="placeholder-glow mb-2">
              <span className="placeholder" style={{ width: '55%', height: '14px', backgroundColor: '#dee2e6' }}></span>
            </div>

            {/* Amenities Skeleton */}
            <div className="d-flex gap-2 mb-2 flex-wrap">
              {[1, 2, 3].map((i) => (
                <div key={i} className="placeholder-glow">
                  <span className="placeholder rounded-pill" style={{ width: '70px', height: '26px', backgroundColor: '#dee2e6' }}></span>
                </div>
              ))}
              <div className="placeholder-glow">
                <span className="placeholder rounded-pill" style={{ width: '40px', height: '26px', backgroundColor: '#dee2e6' }}></span>
              </div>
            </div>

            {/* Book Now Pay Later Skeleton */}
            <div className="placeholder-glow mt-2">
              <span className="placeholder" style={{ width: '160px', height: '14px', backgroundColor: '#dee2e6' }}></span>
            </div>
          </div>

          {/* Price Section Skeleton */}
          <div className="listing-col-h col-xxl-3 col-xl-3 col-lg-3 col-md-3 col-sm-12 col-12 h-100 p-2 p-md-3 ps-2 ps-md-0 border-start">
            <div className="d-flex flex-column justify-content-between align-items-end h-100">
              {/* Rating Badge Skeleton */}
              <div className="placeholder-glow mb-2">
                <span className="placeholder rounded-2" style={{ width: '85px', height: '28px', backgroundColor: '#dee2e6' }}></span>
              </div>

              {/* Price Content */}
              <div className="text-end w-100">
                {/* Limited Offer Badge Skeleton */}
                <div className="placeholder-glow mb-2 d-flex justify-content-end">
                  <span className="placeholder rounded-pill" style={{ width: '120px', height: '22px', backgroundColor: '#dee2e6' }}></span>
                </div>

                {/* Price Skeleton */}
                <div className="placeholder-glow mb-1">
                  <span className="placeholder" style={{ width: '70px', height: '36px', backgroundColor: '#dee2e6' }}></span>
                </div>

                {/* Taxes Skeleton */}
                <div className="placeholder-glow mb-3">
                  <span className="placeholder" style={{ width: '150px', height: '12px', backgroundColor: '#dee2e6' }}></span>
                </div>

                {/* CTA Button Skeleton */}
                <div className="placeholder-glow">
                  <span className="placeholder rounded-2" style={{ width: '90%', height: '38px', backgroundColor: '#dee2e6' }}></span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}
