<?php
require_once __DIR__ . '/includes/functions.php';
$currentPage = 'study-abroad';
$slug = $_GET['slug'] ?? '';
$stmt = db()->prepare("SELECT * FROM countries WHERE slug = ? AND status = 'active' LIMIT 1");
$stmt->execute([$slug]);
$country = $stmt->fetch();
if (!$country) {
http_response_code(404);
$pageSeoTitle = 'Page Not Found';
require __DIR__ . '/partials/header.php';
echo '<section class="py-32 text-center"><h1 class="font-heading font-extrabold text-3xl mb-4">Country Page Not Found</h1><a href="study-abroad.php" class="text-brand-red font-semibold">Back to Study Abroad</a></section>';
require __DIR__ . '/partials/footer.php';
exit;
}
$whyPoints = jd($country['why_points']);
$costItems = jd($country['cost_items']);
$universities = jd($country['universities']);
$scholarships = jd($country['scholarships']);
$visaSteps = jd($country['visa_steps']);
$galleryImages = jd($country['gallery_images']);
$pageSeoTitle = $country['seo_title'] ?: ('Study in ' . $country['name']);
$pageSeoDescription = $country['seo_description'] ?: $country['tagline'];
$pageSeoImage = $country['hero_image'];
require __DIR__ . '/partials/header.php';
?>
<section class="page-banner relative py-24 md:py-32 overflow-hidden">
<div class="max-w-7xl mx-auto px-6 relative z-10 text-center" data-aos="fade-up">
<span class="inline-block px-4 py-1.5 rounded-full bg-brand-gold/20 border border-brand-gold text-brand-gold text-xs font-semibold mb-5">Study Abroad</span>
<h1 class="text-white font-heading font-extrabold text-3xl md:text-5xl leading-tight mb-4">Study in <?= e($country['name']) ?></h1>
<p class="text-gray-300 max-w-2xl mx-auto"><?= e($country['tagline']) ?></p>
</div>
</section>
<?php if ($whyPoints): ?>
<section class="py-20">
<div class="max-w-7xl mx-auto px-6 grid md:grid-cols-2 gap-14 items-center">
<div data-aos="fade-right">
<span class="text-brand-red font-semibold text-sm tracking-widest uppercase">Why Study Here</span>
<h2 class="font-heading font-extrabold text-3xl mt-3 mb-6">Why Choose <span class="gradient-text"><?= e($country['name']) ?></span></h2>
<ul class="space-y-4">
<?php foreach ($whyPoints as $p): ?>
<li class="flex items-start gap-3"><i class="fa-solid fa-circle-check text-brand-green mt-1"></i><span class="text-gray-500 dark:text-gray-400 text-sm"><?= e($p) ?></span></li>
<?php endforeach; ?>
</ul>
</div>
<img src="<?= e(resolve_image($country['hero_image'])) ?>" class="rounded-2xl shadow-xl" data-aos="fade-left">
</div>
</section>
<?php endif; ?>
<?php if ($costItems): ?>
<section class="py-20 bg-gray-50 dark:bg-gray-900/40">
<div class="max-w-7xl mx-auto px-6">
<div class="text-center max-w-2xl mx-auto mb-14" data-aos="fade-up">
<span class="text-brand-green font-semibold text-sm tracking-widest uppercase">Budget Planning</span>
<h2 class="font-heading font-extrabold text-3xl mt-3">Cost of Living</h2>
</div>
<div class="grid sm:grid-cols-3 gap-6 max-w-4xl mx-auto">
<?php foreach ($costItems as $i => $item): ?>
<div class="card-hover bg-white dark:bg-gray-800 rounded-2xl p-6 text-center shadow-sm" data-aos="fade-up" data-aos-delay="<?= $i * 80 ?>">
<i class="fa-solid <?= e($item['icon'] ?? 'fa-circle') ?> text-brand-gold text-2xl mb-3"></i>
<p class="font-heading font-bold text-lg"><?= e($item['amount'] ?? '') ?></p>
<p class="text-xs text-gray-500 dark:text-gray-400"><?= e($item['label'] ?? '') ?></p>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<?php if ($universities): ?>
<section class="py-20">
<div class="max-w-7xl mx-auto px-6">
<div class="text-center max-w-2xl mx-auto mb-14" data-aos="fade-up">
<span class="text-brand-red font-semibold text-sm tracking-widest uppercase">Partner Institutions</span>
<h2 class="font-heading font-extrabold text-3xl mt-3">Popular Universities</h2>
</div>
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-5">
<?php foreach ($universities as $i => $u): ?>
<div class="card-hover bg-white dark:bg-gray-800 rounded-xl p-6 text-center shadow-sm" data-aos="zoom-in" data-aos-delay="<?= $i * 60 ?>"><i class="fa-solid fa-university text-brand-green text-2xl mb-3"></i><p class="font-semibold text-sm"><?= e($u) ?></p></div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<?php if ($scholarships || $visaSteps): ?>
<section class="py-20 bg-gray-50 dark:bg-gray-900/40">
<div class="max-w-7xl mx-auto px-6 grid md:grid-cols-2 gap-10">
<?php if ($scholarships): ?>
<div data-aos="fade-right">
<span class="text-brand-gold font-semibold text-sm tracking-widest uppercase">Financial Aid</span>
<h2 class="font-heading font-extrabold text-3xl mt-3 mb-6">Scholarships</h2>
<ul class="space-y-3">
<?php foreach ($scholarships as $s): ?>
<li class="flex items-center gap-3 bg-white dark:bg-gray-800 rounded-xl p-4 shadow-sm"><i class="fa-solid fa-award text-brand-gold"></i><span class="text-sm"><?= e($s) ?></span></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php if ($visaSteps): ?>
<div data-aos="fade-left">
<span class="text-brand-green font-semibold text-sm tracking-widest uppercase">Step by Step</span>
<h2 class="font-heading font-extrabold text-3xl mt-3 mb-6">Visa Process</h2>
<ol class="space-y-4">
<?php foreach ($visaSteps as $i => $step): ?>
<li class="flex items-start gap-4"><span class="w-8 h-8 shrink-0 rounded-full bg-brand-red text-white flex items-center justify-center text-xs font-bold"><?= $i + 1 ?></span><span class="text-sm text-gray-500 dark:text-gray-400 pt-1"><?= e($step) ?></span></li>
<?php endforeach; ?>
</ol>
</div>
<?php endif; ?>
</div>
</section>
<?php endif; ?>
<?php if ($galleryImages): ?>
<section class="py-20">
<div class="max-w-7xl mx-auto px-6">
<div class="text-center max-w-2xl mx-auto mb-14" data-aos="fade-up">
<span class="text-brand-red font-semibold text-sm tracking-widest uppercase">Gallery</span>
<h2 class="font-heading font-extrabold text-3xl mt-3">Campus & Student Life</h2>
</div>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<?php foreach ($galleryImages as $i => $img): ?>
<img src="<?= e(resolve_image($img)) ?>" class="card-hover rounded-2xl h-40 w-full object-cover" data-aos="zoom-in" data-aos-delay="<?= $i * 60 ?>">
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<section class="py-20 bg-gray-50 dark:bg-gray-900/40">
<div class="max-w-3xl mx-auto px-6">
<div class="glass-light dark:glass rounded-3xl shadow-2xl p-8 md:p-10 border-t-4 border-brand-gold" data-aos="zoom-in">
<div class="text-center mb-8">
<h2 class="font-heading font-extrabold text-2xl md:text-3xl">Interested in Studying in <span class="gradient-text"><?= e($country['name']) ?></span>?</h2>
<p class="text-gray-500 dark:text-gray-400 mt-2 text-sm">Fill out the form below and our <?= e($country['name']) ?> specialist will contact you.</p>
</div>
<form method="post" action="lead_submit.php" class="grid sm:grid-cols-2 gap-5">
<?= csrf_field() ?>
<input type="hidden" name="source_page" value="study-abroad-<?= e($country['slug']) ?>">
<input type="hidden" name="interested_country" value="<?= e($country['name']) ?>">
<input type="text" name="hp_field" class="hidden" tabindex="-1" autocomplete="off">
<input type="text" name="name" placeholder="Full Name" required class="rounded-xl border border-gray-300 dark:border-gray-600 bg-white/70 dark:bg-gray-800/60 px-5 py-3.5 focus:outline-none focus:ring-2 focus:ring-brand-green">
<input type="tel" name="phone" placeholder="Phone Number" required class="rounded-xl border border-gray-300 dark:border-gray-600 bg-white/70 dark:bg-gray-800/60 px-5 py-3.5 focus:outline-none focus:ring-2 focus:ring-brand-green">
<input type="email" name="email" placeholder="Email Address" class="rounded-xl border border-gray-300 dark:border-gray-600 bg-white/70 dark:bg-gray-800/60 px-5 py-3.5 focus:outline-none focus:ring-2 focus:ring-brand-green sm:col-span-2">
<textarea name="message" placeholder="Message" rows="3" class="rounded-xl border border-gray-300 dark:border-gray-600 bg-white/70 dark:bg-gray-800/60 px-5 py-3.5 focus:outline-none focus:ring-2 focus:ring-brand-green sm:col-span-2"></textarea>
<button type="submit" class="gradient-btn text-white font-semibold py-4 rounded-xl sm:col-span-2">Submit Enquiry <i class="fa-solid fa-paper-plane ml-2"></i></button>
</form>
</div>
</div>
</section>
<?php require __DIR__ . '/partials/footer.php'; ?>