@extends('layouts.app')
@section('title',@$title)
@section('content')
<section id="section1" class="relative overflow-hidden md:py-50 md:pt-20 md:px-20">
	<!-- Enhanced Animated Background Elements -->
	<div class="absolute inset-0 bg-gradient-to-br from-slate-50 via-white to-gray-100">
		<div class="absolute inset-0 bg-grid-pattern opacity-[0.03]"></div>
		<div class="absolute top-0 left-0 w-full h-full overflow-hidden">
			<div class="blob blob-1 absolute top-[10%] right-[15%] w-[40vw] h-[40vw] rounded-full mix-blend-multiply filter blur-[80px] animate-blob-slow opacity-15 bg-gradient-to-br from-green-300 to-emerald-400"></div>
			<div class="blob blob-2 absolute bottom-[5%] left-[20%] w-[35vw] h-[35vw] rounded-full mix-blend-multiply filter blur-[80px] animate-blob-slow animation-delay-2000 opacity-15 bg-gradient-to-br from-amber-300 to-orange-400"></div>
			<div class="blob blob-3 absolute top-[30%] left-[10%] w-[30vw] h-[30vw] rounded-full mix-blend-multiply filter blur-[80px] animate-blob-slow animation-delay-4000 opacity-15 bg-gradient-to-tr from-green-400 to-teal-300"></div>
		</div>
	</div>

	<div class="flex flex-col md:flex-row px-4 container mx-auto my-40 md:my-0 gap-3">
		<div class="w-full md:w-3/5 z-10 relative items-center">
			<div class="flex flex-col justify-center text-center md:text-left item-center gap-0">
					<h4 class="mb-2 text-lg font-semibold animate-fade-in" style="animation-delay: 0.4s">
						<span class="text-black">Selamat Datang di Portal Resmi SIDIA Jakarta</span>
					</h4>
					<h2 class="mb-5 text-3xl md:text-3xl lg:text-4xl font-extrabold animate-fade-in" style="animation-delay: 0.4s">
						<span class="text-warning">Sistem Informasi Sekolah Adiwiyata</span> <br>
						<span class="text-black">DKI Jakarta (SIDIA Jakarta)</span>
					</h2>
				
					<p class="mb-5 text-gray-600 text-lg max-w-2xl leading-relaxed mb-2 animate-fade-in" style="animation-delay: 0.8s">
						Sistem Informasi Sekolah Adiwiyata DKI Jakarta <br>
						Bersama kita wujudkan pendidikan yang berwawasan lingkungan, terintegrasi, dan berkelanjutan
					</p>
					<a onclick="document.getElementById('section2').scrollIntoView({ behavior: 'smooth' });" class="p-3 cursor-pointer text-white bg-success rounded-[10px] mx-auto md:mx-0 w-50 text-center flex flex-row gap-3 shadow-[10px_10px_10px_0px_rgba(0,0,0,0.25)]">
						<span>Lihat Selengkapnya</span> <x-lucide-arrow-down width="20" class="text-white"/>
					</a>
			</div>
		</div>
		<div class="w-2/5 relative flex md:block hidden">
			<div class="flex flex-col absolute top-0 left-0 right-10  w-full h-full">
				<img class="left-[100px] top-0 absolute " src="{{ asset('img2.svg') }}" />
				<img class="left-0 top-[90px] absolute " src="{{ asset('img1.svg') }}" />
			</div>
		</div>
	</div>
</section>
<section id="section2" class="container mx-auto p-12 md:py-12">
	<div class="grid grid-rows-1 md:grid-cols-4 gap-5">
		<div class="bg-danger flex flex-col justify-around text-white rounded-xl gap-3 py-10 shadow-[10px_10px_10px_0px_rgba(0,0,0,0.25)]">
			<div class="text-6xl lg:text-7xl font-extrabold text-center">{{ $usulan['kota'] }}</div>
			<div class="flex justify-around items-center">
				<div class="flex flex-col items-center">
					<span class="font-extrabold">Kota</span>
					<span class="opacity-[70%]">Sekolah Adiwiyata</span>
				</div>
				{{-- <div>
					<span class="font-extrabold">2025</span>
				</div> --}}
			</div>
		</div>
		<div class="bg-info flex flex-col justify-around text-white rounded-xl gap-3 py-10 shadow-[10px_10px_10px_0px_rgba(0,0,0,0.25)]">
			<div class="text-6xl lg:text-7xl font-extrabold text-center">{{ $usulan['provinsi'] }}</div>
			<div class="flex justify-around items-center">
				<div class="flex flex-col items-center">
					<span class="font-extrabold">Provinsi</span>
					<span class="opacity-[70%]">Sekolah Adiwiyata</span>
				</div>
				{{-- <div>
					<span class="font-extrabold">2025</span>
				</div> --}}
			</div>
		</div>
		<div class="bg-warning flex flex-col justify-around text-white rounded-xl gap-3 py-10 shadow-[10px_10px_10px_0px_rgba(0,0,0,0.25)]">
			<div class="text-6xl lg:text-7xl font-extrabold text-center">{{ $usulan['nasional'] }}</div>
			<div class="flex justify-around items-center">
				<div class="flex flex-col items-center">
					<span class="font-extrabold">Nasional</span>
					<span class="opacity-[70%]">Sekolah Adiwiyata</span>
				</div>
				{{-- <div>
					<span class="font-extrabold">2025</span>
				</div> --}}
			</div>
		</div>
		<div class="bg-success flex flex-col justify-around text-white rounded-xl gap-3 py-10 shadow-[10px_10px_10px_0px_rgba(0,0,0,0.25)]">
			<div class="text-6xl lg:text-7xl font-extrabold text-center">{{ $usulan['mandiri'] }}</div>
			<div class="flex justify-around items-center">
				<div class="flex flex-col items-center">
					<span class="font-extrabold">Mandiri</span>
					<span class="opacity-[70%]">Sekolah Adiwiyata</span>
				</div>
				{{-- <div>
					<span class="font-extrabold">2025</span>
				</div> --}}
			</div>
		</div>
	</div>
</section>
<section id="section3" class="container mx-auto p-12 md:py-12">
	<div class="flex justify-between mb-15">
		<h4 class="text-lg md:text-2xl font-extrabold text-black">Kegiatan Sekolah Adiwiyata</h4>
		<a href="{{ url('kegiatan') }}" class="p-2 text-white text-sm bg-warning rounded-[10px] mx-auto md:mx-0 text-center flex flex-row justify-between gap-3 ">
			<span>Lihat Semua</span> <x-lucide-arrow-right width="20" class="text-white text-right"/>
		</a>
	</div>
	<div class="flex flex-row gap-10">
		<div class="w-full lg:w-2/3">
			<div class="flex flex-col gap-3">
				<?php
				$image = json_decode(@$kegiatan[0]->image);
				?>
				<img src="{{ asset(@$image[0]) }}" alt="" class="w-full lg:w-[100%] rounded-[10px]">
				<div class="flex flex-row gap-3 items-center">
					<span class="p-2 bg-warning text-xs rounded-[10px] text-white">Kegiatan {{ @$kegiatan[0]->kategori }}</span>
					<span class="text-xs opacity-[50%]">{{ date('D',strtotime(@$kegiatan[0]->created_at)) }}, {{ date('d M Y',strtotime(@$kegiatan[0]->created_at)) }}</span>
				</div>
				<h4 class="text-2xl text-black font-bold mt-2">{{ @$kegiatan[0]->judul }}</h4>
				<div class="text-sm opacity-[50%]">
					{!! substr(strip_tags(@$kegiatan[0]->body),0,1000) !!}
				</div>
				<a href="{{ url('kegiatan/'.@$kegiatan[0]->slug) }}" class="text-sm text-warning rounded-[10px] mx-auto md:mx-0 flex flex-row gap-3 ">
					<span>Baca Selengkapnya</span> <x-lucide-arrow-right width="20" class="text-warning"/>
				</a>
			</div>				
		</div>
		<div class="hidden lg:block w-1/3">
			<div class="flex flex-col gap-3">
				@foreach($side_kegiatan as $dataKeg)
				<?php
				$images = json_decode($dataKeg->image);
				?>
				<div class="flex items-center gap-3 flex-row border-b-1 border-b-[#eee] pb-3">
					<div class="flex justify-end w-2/5">
						<img src="{{ asset(@$images[0]) }}" class="rounded-[10px] ">
					</div>
					<div class="flex flex-col gap-3 justify-center w-3/5">
						<span class="text-xs opacity-[50%]">{{ date('D',strtotime($dataKeg->created_at)) }}, {{ date('d M Y',strtotime($dataKeg->created_at)) }}</span>
						<a href="{{ url('kegiatan/'.$dataKeg->slug) }}" class="text-xs text-black font-bold">{{ $dataKeg->judul }}</a>
					</div>
				</div>
				@endforeach
				
			</div>	
		</div>

	</div>
</section>
<section id="section4" class="container mx-auto p-12 md:py-12">
	<div class="flex justify-between mb-15">
		<h4 class="text-lg md:text-2xl font-extrabold text-black">Galeri Sekolah Adiwiyata</h4>
		<a href="{{ url('galeri') }}" class="p-2 text-white text-sm bg-warning rounded-[10px] mx-auto md:mx-0 text-center flex flex-row justify-between gap-3 ">
			<span>Lihat Semua</span> <x-lucide-arrow-right width="20" class="text-white text-right"/>
		</a>
	</div>
	<div class="flex flex-row gap-10">
		<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-5">
			@foreach($kegiatan as $dataKeg)
			<?php
				$images = json_decode($dataKeg->image);
			?>
			<div class="relative group  w-full h-50 overflow-hidden rounded-lg shadow-[10px_10px_10px_0px_rgba(0,0,0,0.25)]">
				<img src="{{ asset(@$images[0]) }}" class="w-full h-full object-cover" alt="Galeri">
				<div class="absolute inset-0 bg-success bg-opacity-50 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col justify-center p-4 gap-3">
					<h4 class="mb-5 font-bold text-white w-50">{{ substr($dataKeg->judul,0,35) }}...</h4>
					{{-- <p class="text-white text-sm font-normal">1 Agustus 2025</p> --}}
					<a href="#" data-url="{{$dataKeg->image}}" data-judul="{{$dataKeg->judul}}" class="btnmodal p-2 text-black text-sm bg-white opacity-50 rounded-[10px] mx-auto md:mx-0 text-center flex flex-row justify-between gap-3 w-40 ">
						<span>Lihat Detail</span> <x-lucide-arrow-right width="20" class="text-black text-right"/>
					</a>
				</div>
			</div>
			@endforeach
		</div>
	</div>
</section>
<section id="helpdesk" class="bg-gradient-to-r from-[#009D66] to-[#F7AE15]">
	<div class="container mx-auto p-12 md:py-12">
		<div class="flex flex-col md:flex-row items-center justify-between">
			<div class="flex flex-col gap-1">
				<h4 class="md:text-left text-center text-white">Ada Kendala Terkait Sekolah Adiwiyata Jakarta ?</h4>
				<h4 class="md:text-left text-center text-3xl md:text-4xl font-extrabold text-white">Hubungi Helpdesk Kami</h4>
			</div>
			<div class="flex flex-col mt-5 md:mt-0 md:flex-row gap-2">
				<div class="border rounded text-white px-3 py-3 hover:bg-white hover:border-white hover:text-[#009D66] transition">
					<a target="_blank" href="https://api.whatsapp.com/send/?phone=6285212436339" class=" flex">
						<span class="mt-1">
							<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"><path fill="currentColor" d="M19.05 4.91A9.82 9.82 0 0 0 12.04 2c-5.46 0-9.91 4.45-9.91 9.91c0 1.75.46 3.45 1.32 4.95L2.05 22l5.25-1.38c1.45.79 3.08 1.21 4.74 1.21c5.46 0 9.91-4.45 9.91-9.91c0-2.65-1.03-5.14-2.9-7.01m-7.01 15.24c-1.48 0-2.93-.4-4.2-1.15l-.3-.18l-3.12.82l.83-3.04l-.2-.31a8.26 8.26 0 0 1-1.26-4.38c0-4.54 3.7-8.24 8.24-8.24c2.2 0 4.27.86 5.82 2.42a8.18 8.18 0 0 1 2.41 5.83c.02 4.54-3.68 8.23-8.22 8.23m4.52-6.16c-.25-.12-1.47-.72-1.69-.81c-.23-.08-.39-.12-.56.12c-.17.25-.64.81-.78.97c-.14.17-.29.19-.54.06c-.25-.12-1.05-.39-1.99-1.23c-.74-.66-1.23-1.47-1.38-1.72c-.14-.25-.02-.38.11-.51c.11-.11.25-.29.37-.43s.17-.25.25-.41c.08-.17.04-.31-.02-.43s-.56-1.34-.76-1.84c-.2-.48-.41-.42-.56-.43h-.48c-.17 0-.43.06-.66.31c-.22.25-.86.85-.86 2.07s.89 2.4 1.01 2.56c.12.17 1.75 2.67 4.23 3.74c.59.26 1.05.41 1.41.52c.59.19 1.13.16 1.56.1c.48-.07 1.47-.6 1.67-1.18c.21-.58.21-1.07.14-1.18s-.22-.16-.47-.28"/></svg>
						</span>&nbsp;0852-1243-6339
					</a>
				</div>
				<div class="border rounded text-white px-3 py-3 hover:bg-white hover:border-white hover:text-[#009D66] transition">
					<a target="_blank" href="mailto:dinaslh@jakarta.go.id" class=" flex">
						<span class="mt-1"><x-lucide-mail width="18" class=""/></span>&nbsp;dinaslh@jakarta.go.id
					</a>
				</div>
				<div class="border rounded text-white px-3 py-3 hover:bg-white hover:border-white hover:text-[#009D66] transition">
					<a target="_blank" href="{{ asset('manual_book.pdf') }}" download class=" flex">
						<span class="mt-1"><x-lucide-download width="18" class=""/></span>&nbsp;Download Panduan
					</a>
				</div>
			</div>
		</div>
		
		{{-- <br> --}}
		{{-- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus odio quo mollitia blanditiis ab dolor commodi rerum eaque! Tempore corporis doloribus amet culpa repudiandae similique! Blanditiis a dolorem soluta vero.</p> --}}
	</div>
</section>

<div id="myModal" class="fixed inset-0 z-50 hidden bg-black/50 flex items-center justify-center overflow-y-scroll">
	<div class="bg-white rounded-lg shadow-lg w-1/2 p-6 relative">
		<div id="carousel" class="relative w-full flex transition-transform duration-500">
			<img id="image" src="" alt="" class="w-full rounded">
			<!-- tombol navigasi -->
			<button id="prev" class="absolute left-0 top-1/2 transform -translate-y-1/2 bg-gray-800 text-white px-3 py-1 rounded">‹</button>
			<button id="next" class="absolute right-0 top-1/2 transform -translate-y-1/2 bg-gray-800 text-white px-3 py-1 rounded">›</button>
		</div>
		<div class="flex justify-end space-x-2 mt-1">
			<button onclick="closeModal()" class="bg-gray-300 text-gray-700 px-4 py-2 cursor-pointer rounded">Tutup</button>
		</div>
	</div>
</div>
@endsection
@section('js')
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script>
	let slides = [];
	let currentIndex = 0;

	$('.btnmodal').on('click', function(e){
		e.preventDefault();
		$('#myModal').removeClass('hidden');

		$('#judul').html($(this).data('judul'));
		// ambil data-images dan parse JSON
		slides = $(this).data('url');
		if (!Array.isArray(slides)) {
			slides = JSON.parse(slides);
		}

		console.log(slides);

		currentIndex = 0;
		$('#image').attr('src', "{{ asset('/') }}"+slides[currentIndex]);
	});

	// tombol navigasi
	$('#next').on('click', function(){
		if(slides.length > 0){
			currentIndex = (currentIndex + 1) % slides.length;
			$('#image').attr('src', "{{ asset('/') }}"+slides[currentIndex]);
		}
	});

	$('#prev').on('click', function(){
		if(slides.length > 0){
			currentIndex = (currentIndex - 1 + slides.length) % slides.length;
			$('#image').attr('src', "{{ asset('/') }}"+slides[currentIndex]);
		}
	});

	function closeModal(){
		$('#myModal').addClass('hidden');
	}

</script>
@endsection