'use client';

import { useState } from "react";
import { MoveLeft, MoveRight } from "lucide-react";
import Image from "next/image";
import { Button } from "@/components/ui/button";

const testimonials = [
  {
    quote:
      "Dottinat made buying our first products an absolute breeze! Their team was incredibly attentive and guided us through every step. We couldn’t be happier with our product.",
    author: "Sarah & Michael Stone",
    role: "Retail Shopper",
  },
  {
    quote:
      "The quality of medical supplies exceeded our expectations. Dottinat's procurement team understands hospital needs perfectly.",
    author: "Dr. James Wilson",
    role: "Hospital Administrator",
  },
  {
    quote:
      "As a distributor, we appreciate Dottinat's reliable logistics and consistent product availability. A truly professional partner.",
    author: "Lisa Rodriguez",
    role: "Regional Distributor",
  },
  {
    quote:
      "Their agricultural products opened new markets for our business. The quality is exceptional and delivery always on time.",
    author: "Thomas Chen",
    role: "Export Manager",
  },
];

const Testimonials = () => {
  const [currentIndex, setCurrentIndex] = useState(0);

  const nextSlide = () => {
    setCurrentIndex((prevIndex) =>
      prevIndex === testimonials.length - 1 ? 0 : prevIndex + 1
    );
  };

  const prevSlide = () => {
    setCurrentIndex((prevIndex) =>
      prevIndex === 0 ? testimonials.length - 1 : prevIndex - 1
    );
  };

  return (
    <div className="relative w-full px-6 md:px-20 py-16 overflow-hidden bg-white">

  {/* Decorative Background Images - Responsive */}
  <Image
    src="/upper.png"
    alt="upper background shape"
    width={320}
    height={320}
    className="absolute top-0 right-0 opacity-100 pointer-events-none select-none 
              w-35 h-35 md:w-75 md:h-75" // Smaller on mobile, larger on desktop
  />
  <Image
    src="/lower.png"
    alt="lower background shape"
    width={280}
    height={280}
    className="absolute bottom-0 left-0 opacity-100 pointer-events-none select-none 
              w-35 h-35 md:w-75 md:h-75" // Smaller on mobile, larger on desktop
  />

  {/* Heading & Subheading */}
  <div className="flex flex-col items-start gap-4 mb-10 max-w-4xl relative z-10">
    <Button
      variant="outline"
      className="flex items-center gap-2 rounded-full border border-teal-500 text-teal-700 hover:bg-teal-50 mb-4 font-bold"
    >
      <div className="w-2 h-2 rounded-full bg-[#0B6F6F]"></div>
      Testimonials
    </Button>

    <h2 className="text-4xl md:text-6xl font-semibold text-teal-800">
      What People Are Saying
    </h2>
    <p className="text-gray-500 text-lg font-medium max-w-2xl">
      Real feedback from clients who've experienced our services.
    </p>
  </div>


      {/* Centered Testimonial Card */}
      <div className="flex justify-center">
      <div className="max-w-3xl w-full flex flex-col items-center text-center">

          {/* Quote */}
          <p className="text-2xl md:text-3xl text-black italic leading-relaxed mb-8">
            “{testimonials[currentIndex].quote}”
          </p>

          {/* Author and Role */}
          <div className="mb-6">
            <p className="text-lg font-semibold text-black">{testimonials[currentIndex].author}</p>
            <p className="text-sm text-gray-500">{testimonials[currentIndex].role}</p>
          </div>

         {/* Pagination Controls */}
<div className="flex items-center gap-4 mt-4">
  {/* Prev Button */}
  <button
    onClick={prevSlide}
    className="p-2 rounded-full border border-gray-300 hover:bg-gray-100 transition"
    aria-label="Previous testimonial"
  >
    <MoveLeft className="h-5 w-5 text-gray-600" />
  </button>

  {/* Next Button */}
  <button
    onClick={nextSlide}
    className="p-2 rounded-full border border-gray-300 hover:bg-gray-100 transition"
    aria-label="Next testimonial"
  >
    <MoveRight className="h-5 w-5 text-gray-600" />
  </button>
</div>

        </div>
      </div>
    </div>
  );
};

export default Testimonials;
