<?php
session_start();

$page = isset($_GET['page']) ? $_GET['page'] : 'home';
$id = isset($_GET['id']) ? $_GET['id'] : null;

if ($page === 'destination' && $id) {
    $page = 'destination-detail';
}

$valid_pages = ['home', 'about', 'destinations', 'visa-services', 'private-jets', 'contact', 'destination-detail'];

if (!in_array($page, $valid_pages)) {
    $page = 'home';
}

$is_ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
           strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';

if (!$is_ajax) {
    include 'includes/splash.php';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
    <title>Maltepe Vize | The Privilege of Global Access - Elite Visa & Travel Services</title>
    <meta name="description" content="Maltepe Vize offers premium visa consultancy and luxury travel services. Global access, VIP processing, and personalized itineraries for the discerning traveler.">
    <meta name="keywords" content="visa services, luxury travel, Maltepe, Istanbul visa, private jet, VIP travel, global access">
    <meta name="author" content="Maltepe Vize">
    <meta name="robots" content="index, follow">

    <!-- Open Graph -->
    <meta property="og:title" content="Maltepe Vize | The Privilege of Global Access">
    <meta property="og:description" content="Premium visa consultancy and luxury travel services for global citizens.">
    <meta property="og:image" content="https://maltepevize.com/assets/images/og-image.jpg">
    <meta property="og:type" content="website">
    <meta property="og:site_name" content="Maltepe Vize">

    <!-- Twitter Card -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="Maltepe Vize | Elite Travel & Visa Services">
    <meta name="twitter:description" content="Your gateway to the world. VIP visa processing and luxury travel experiences.">

    <meta name="theme-color" content="#0B1A3A">

    <!-- Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800;900&family=Montserrat:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">

    <link rel="stylesheet" href="assets/css/style.css?v=<?php echo time(); ?>">
</head>
<body>

<div id="main-content" style="display: none;">
    <?php include 'includes/header.php'; ?>

    <main>
        <?php
        if ($page === 'destination-detail' && $id) {
            include 'pages/destination-detail.php';
        } else {
            include "pages/{$page}.php";
        }
        ?>
    </main>

    <?php include 'includes/footer.php'; ?>
</div>

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="assets/js/script.js?v=<?php echo time(); ?>"></script>
</body>
</html>