"use client";

import React, { useState, useEffect } from "react";

const services = [
    {
        id: 0,
        title: "Excellent infection prevention",
        text: "Lorem ipsum dolor sit amet, conse ctetur adipiscing eliteiusmod tempor incididunt",
        icon: "/assets/imgs/icon/icon-6.png",
        link: "service-details.html",
    },
    {
        id: 1,
        title: "Health patients comprehensive",
        text: "From its medieval origins to the digital era , learn everything there is to know",
        icon: "/assets/imgs/icon/icon-2.png",
        link: "service-details.html",
    },
    {
        id: 2,
        title: "Pediatric Hematology Oncology",
        text: "Creation timelines for the standard lorem ipsum passage vary, with some citing the",
        icon: "/assets/imgs/icon/icon-3.png",
        link: "service-details.html",
    },
    {
        id: 3,
        title: "Care Pediatric & Medicine",
        text: "Letraset's dry-transfer sheets, and later entered the digital world via Aldus",
        icon: "/assets/imgs/icon/icon-4.png",
        link: "service-details.html",
    },
    {
        id: 4,
        title: "Labor & Delivery: The Birthplace",
        text: "Some claim lorem ipsum threatens to promote design over content, while others defend",
        icon: "/assets/imgs/icon/icon-5.png",
        link: "service-details.html",
    },
    {
        id: 5,
        title: "Urogynecology & Pelvic Health",
        text: "Generally, lorem ipsum is best suited to keeping templates from looking bare or",
        icon: "/assets/imgs/icon/icon-6.png",
        link: "service-details.html",
    },
];

const MedicalServices = () => {
    const [activeTab, setActiveTab] = useState(0);


    const handleTabClick = (e: React.MouseEvent, id: number) => {
        e.preventDefault();
        setActiveTab(id);
    };

    return (
        <section
            className="medical-services-circle p-relative overflow-hidden"
            style={{
                backgroundImage: `url('/assets/img/all-images/blog/blog-img1.png')`,
                backgroundAttachment: 'fixed',
                backgroundPosition: 'center',
                backgroundRepeat: 'no-repeat',
                backgroundSize: 'cover'
            }}
        >
            {/* Background Overlay */}
            <div className="section-overlay" style={{
                position: 'absolute',
                top: 0,
                left: 0,
                width: '100%',
                height: '100%',
                background: 'rgba(7, 23, 43, 0.65)',
                zIndex: 1
            }}></div>

            {/* Decorative Elements - 4 Left, 4 Right */}
            <div className="decorative-element elem-left-1"><img src="/assets/img/elements/elements24.png" alt="shape" /></div>
            <div className="decorative-element elem-left-2"><img src="/assets/img/elements/elements23.png" alt="shape" /></div>
            {/* <div className="decorative-element elem-left-3"><img src="/assets/img/elements/elements25.png" alt="shape" style={{ opacity: 0.4 }} /></div> */}
            <div className="decorative-element elem-left-4"><img src="/assets/img/elements/elements47.png" alt="shape" style={{ opacity: 0.3 }} /></div>

            <div className="decorative-element elem-right-1"><img src="/assets/img/elements/elements25.png" alt="shape" /></div>
            <div className="decorative-element elem-right-2"><img src="/assets/img/elements/elements24.png" alt="shape" /></div>
            {/* <div className="decorative-element elem-right-3"><img src="/assets/img/elements/elements23.png" alt="shape" style={{ opacity: 0.4 }} /></div> */}
            <div className="decorative-element elem-right-4"><img src="/assets/img/elements/elements47.png" alt="shape" style={{ opacity: 0.3 }} /></div>

            <div className="container p-relative" style={{ zIndex: 5 }}>
                <div
                    className="sec-title-wrapper text-center wow fadeInUp animated mb-50"
                    data-wow-delay="0.3s"
                >
                    <div className="sec-title">
                        <div className="sec-title__shape"></div>
                        <h6 className="sec-title__tagline text-white">WELCOME</h6>
                        <h3 className="sec-title__title text-white">Driving Client <span className="inner-text">Success </span></h3>
                    </div>

                    <p className="sec-text mt-15 text-white">It is a long established fact that a reader will be distracted the readable content of <br /> a page when looking at layout the point of using lorem the is Ipsum less normal distribution of letters.</p>
                </div>
                <div
                    className="service-circle wow fadeInUp animated"
                    data-wow-delay="0.4s"
                    style={{ visibility: "visible", animationDelay: "0.4s" }}
                >
                    <div className="service-circle__lines">
                        <div className="line"></div>
                        <div className="line"></div>
                        <div className="line"></div>
                        <div className="line"></div>
                    </div>
                    <nav className="service-circle__menu">
                        <ul>
                            {services.map((service, index) => (
                                <li
                                    key={service.id}
                                    style={{ "--rotate-item": `${index * 60}deg` } as React.CSSProperties}
                                    className={activeTab === index ? "active" : ""}
                                >
                                    {activeTab === index && <div className="active-tab-pointer"></div>}
                                    <a
                                        href="#"
                                        onClick={(e) => handleTabClick(e, index)}
                                        data-tab-link={index}
                                    >
                                        <img
                                            src={service.icon}
                                            alt="icon"
                                            style={{
                                                "--rotate-icon": `${-(index * 60)}deg`,
                                                "--icon-top": "30%",
                                                "--icon-left": "50%"
                                            } as React.CSSProperties}
                                        />
                                    </a>
                                </li>
                            ))}
                        </ul>
                    </nav>
                    <div className="service-circle__center">
                        {services.map((service, index) => (
                            <div
                                key={service.id}
                                className={`service-circle__item ${activeTab === index ? "active" : ""}`}
                                data-tab-no={index}
                            >
                                <h3 className="service-circle__title h4">
                                    <a href={service.link} className="text-white">{service.title}</a>
                                </h3>
                                <p className="service-circle__text text-white">{service.text}</p>
                            </div>
                        ))}
                    </div>
                </div>
            </div>
        </section>
    );
};

export default MedicalServices;
