<?php
$settingsContent = settings('content')->getAll();
?>
<!DOCTYPE html>
<html lang="<?= $seo['extra_fields']['locale'] ?? 'en' ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <base href="/">
    <title><?= $seo['title'] ?></title>
    <link rel="stylesheet" href="css/styles.css">
    <meta name='robots' content='index, follow' />
    <?php if (!empty($settingsContent['favicon'])): ?>
        <link rel="icon" href="<?= htmlspecialchars($settingsContent['favicon']) ?>" type="image/x-icon">
    <?php endif; ?>
    <meta property="og:title" content="<?= $seo['title'] ?? '' ?>">
    <meta property="og:description" content="<?= $seo['description'] ?? '' ?>">
    <meta property="og:locale" content="<?= $seo['extra_fields']['locale'] ?? '' ?>">
    <meta property="og:image" content="<?= htmlspecialchars($seo['image'] ?? '') ?>">
    <meta name="description" content="<?= $seo['description'] ?? '' ?>">

    <link rel="canonical" href="<?= $seo['canonical'] ?? '' ?>">

    <script type="application/ld+json">
        <?php include __DIR__ . '/../partials/schema.php'; ?>
    </script>
    <?php include __DIR__ . '/../partials/styles.php'; ?>
</head>

<body>
    <?php include __DIR__ . '/../partials/header.php'; ?>
    <main class="main">
        <?php if (!empty($topContent)): ?>
            <section class="top-content">
                <div class="container">
                    <?= $topContent ?>
                </div>
            </section>
        <?php endif; ?>
        
        <section class="page-content">
            <div class="container">
                <h1><?= htmlspecialchars($pageData['name']) ?></h1>
                <div class="content">
                    <?= $pageContent ?>
                </div>
            </div>
        </section>

        <?php if (!empty($faqItems)): ?>
            <section class="faq-section">
                <div class="container">
                    <h2>FAQ</h2>
                    <div class="faq-list">
                        <?php foreach ($faqItems as $faq): ?>
                            <div class="faq-item">
                                <h3><?= htmlspecialchars($faq['question']) ?></h3>
                                <div class="faq-answer">
                                    <?= $faq['answer'] ?>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </section>
        <?php endif; ?>
    </main>
    <?php include __DIR__ . '/../partials/footer.php'; ?>
    <script src="js/script.js"></script>
</body>

</html>