'use client';

import { X, Thermometer, FileText, Heart } from 'lucide-react';
import Image from 'next/image';

export default function PatientModal({ patient, onClose }) {
  if (!patient) return null;

  return (
    <div
      className="fixed inset-0 bg-white/30 backdrop-blur-sm flex items-center justify-center z-50 px-4"
      onClick={onClose}
    >
      <div
        onClick={(e) => e.stopPropagation()}
        className="bg-white rounded-xl w-full max-w-5xl shadow-2xl relative overflow-y-auto max-h-[90vh] animate-fade-in"
      >
        <button
          onClick={onClose}
          className="absolute top-4 right-4 text-gray-500 hover:text-black"
        >
          <X size={24} />
        </button>

        {/* Modal Content */}
        <div className="p-6">
          <div className="mb-4">
            <h2 className="text-2xl font-bold text-gray-800">Patient Profile</h2>
            <p className="text-gray-500">View personal information.</p>
          </div>

          {/* Banner */}
          <div className="bg-gray-100 rounded-lg overflow-hidden mb-6">
            <div className="relative h-48">
              <Image
                src="/images/patient-banner.jpg"
                alt="Banner"
                width={1200}
                height={192}
                className="object-cover w-full h-full"
              />
              <div className="absolute bottom-4 left-6 text-white drop-shadow">
                <h3 className="text-xl font-bold">{patient.name}</h3>
                <p className="text-sm">Patient ID: #{patient.id}</p>
              </div>
            </div>
            <div className="flex justify-end gap-8 px-6 py-4 bg-white">
              <div className="text-center">
                <p className="text-gray-500 text-sm">Appointments</p>
                <p className="text-lg font-semibold">15</p>
              </div>
              <div className="text-center">
                <p className="text-gray-500 text-sm">Reports</p>
                <p className="text-lg font-semibold">8</p>
              </div>
              <div className="text-center">
                <p className="text-gray-500 text-sm">Tests</p>
                <p className="text-lg font-semibold">4</p>
              </div>
            </div>
          </div>

          <div className="grid grid-cols-1 lg:grid-cols-3 gap-6">



            {/* Main Info */}
            <div className="lg:col-span-2 bg-white rounded-xl shadow p-6">
              <h4 className="text-lg font-semibold text-gray-800 mb-4">Personal Information</h4>
              <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 text-sm text-gray-700">
                <div className="col-span-full mb-4 flex justify-center">
                  <Image
                    src={patient.image}
                    alt="Avatar"
                    width={112}
                    height={112}
                    className="w-28 h-28 rounded-full object-cover shadow-md"
                  />
                </div>
                <div>
                  <p className="font-medium text-gray-600">Full Name</p>
                  <p>{patient.name}</p>
                </div>
                <div>
                  <p className="font-medium text-gray-600">Mobile</p>
                  <p>+254-712345678</p>
                </div>
                <div>
                  <p className="font-medium text-gray-600">Email</p>
                  <p>jane.doe@email.com</p>
                </div>
                <div>
                  <p className="font-medium text-gray-600">Location</p>
                  <p>Nairobi</p>
                </div>
                <div>
                  <p className="font-medium text-gray-600">Gender</p>
                  <p>Female</p>
                </div>
                <div>
                  <p className="font-medium text-gray-600">Date of Birth</p>
                  <p>1990-05-15</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}
