<?php
require_once 'includes/db.php';
require_once 'includes/functions.php';

$privacyTitle = getSetting($pdo, 'privacy_page_title', 'Privacy Policy');
$privacyContent = getSetting($pdo, 'privacy_page_content', '');

$pageTitle = $privacyTitle;
$pageDescription = 'Read our privacy policy to understand how we collect, use, and protect your personal information.';

$defaultContent = '
<h2>1. Information We Collect</h2>
<p>We collect information you provide directly to us, such as when you create an account, submit a job application, or contact us.</p>

<h2>2. How We Use Your Information</h2>
<p>We use the information to provide and improve our services, process applications, and send updates.</p>

<h2>3. Data Security</h2>
<p>We implement appropriate security measures to protect your personal information.</p>

<h2>4. Contact Us</h2>
<p>If you have any questions about this Privacy Policy, please contact us.</p>
';

$displayContent = !empty($privacyContent) ? $privacyContent : $defaultContent;

require_once 'includes/header.php';
?>

<div style="max-width: 900px; margin: 40px auto; padding: 0 20px;">
    <div style="background: white; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); padding: 40px;">
        <h1 style="font-size: 2rem; color: #1e293b; margin-bottom: 20px;">
            <i class="fas fa-shield-alt" style="color: #6366f1;"></i> <?php echo sanitize($privacyTitle); ?>
        </h1>
        <p style="color: #64748b; margin-bottom: 30px;">Last updated: <?php echo date('F d, Y'); ?></p>
        
        <div class="page-content" style="color: #475569; line-height: 1.8;">
            <?php echo $displayContent; ?>
        </div>
    </div>
</div>

<style>
.page-content h2 { color: #1e293b; font-size: 1.3rem; margin: 25px 0 15px; }
.page-content ul { margin: 15px 0; padding-left: 25px; }
.page-content li { margin-bottom: 8px; }
.page-content p { margin-bottom: 15px; }
</style>

<?php require_once 'includes/footer.php'; ?>
