<?php
$page_title = "Privacy Policy";
require_once '../config/config.php';
require_once '../includes/user_auth.php';
require_once '../includes/functions.php';

// Initialize auth if not already done (for header compatibility)
if (!isset($auth)) {
    $auth = new Auth();
}

require_once '../includes/header_user.php';
?>

<div class="container mx-auto px-4 py-8">
    <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-lg p-8">
        <h1 class="text-3xl font-bold text-gray-800 mb-6">Privacy Policy</h1>
        <p class="text-gray-600 mb-4">Last updated: <?php echo date('F d, Y'); ?></p>

        <div class="prose max-w-none text-gray-700 space-y-6">
            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">1. Introduction</h2>
                <p>Welcome to <?php echo SITE_NAME; ?>. We respect your privacy and are committed to protecting your personal data. This privacy policy will inform you as to how we look after your personal data when you visit our website and tell you about your privacy rights and how the law protects you.</p>
            </section>

            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">2. Data We Collect</h2>
                <p>We may collect, use, store and transfer different kinds of personal data about you which we have grouped together follows:</p>
                <ul class="list-disc pl-5 mt-2 space-y-1">
                    <li><strong>Identity Data:</strong> includes first name, last name, username or similar identifier.</li>
                    <li><strong>Contact Data:</strong> includes email address and telephone numbers.</li>
                    <li><strong>Financial Data:</strong> includes bank account and payment card details.</li>
                    <li><strong>Transaction Data:</strong> includes details about payments to and from you.</li>
                    <li><strong>Technical Data:</strong> includes internet protocol (IP) address, your login data, browser type and version.</li>
                </ul>
            </section>

            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">3. How We Use Your Data</h2>
                <p>We will only use your personal data when the law allows us to. Most commonly, we will use your personal data in the following circumstances:</p>
                <ul class="list-disc pl-5 mt-2 space-y-1">
                    <li>Where we need to perform the contract we are about to enter into or have entered into with you.</li>
                    <li>Where it is necessary for our legitimate interests (or those of a third party) and your interests and fundamental rights do not override those interests.</li>
                    <li>Where we need to comply with a legal or regulatory obligation.</li>
                </ul>
            </section>

            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">4. Data Security</h2>
                <p>We have put in place appropriate security measures to prevent your personal data from being accidentally lost, used or accessed in an unauthorized way, altered or disclosed. In addition, we limit access to your personal data to those employees, agents, contractors and other third parties who have a business need to know.</p>
            </section>

            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">5. Data Retention</h2>
                <p>We will only retain your personal data for as long as necessary to fulfil the purposes we collected it for, including for the purposes of satisfying any legal, accounting, or reporting requirements.</p>
            </section>

            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">6. Your Legal Rights</h2>
                <p>Under certain circumstances, you have rights under data protection laws in relation to your personal data, including the right to request access, correction, erasure, restriction, transfer, to object to processing, to portability of data and (where the lawful ground of processing is consent) to withdraw consent.</p>
            </section>

            <section>
                <h2 class="text-xl font-semibold text-gray-800 mb-3">7. Contact Us</h2>
                <p>If you have any questions about this privacy policy or our privacy practices, please contact us at: <a href="mailto:<?php echo SITE_EMAIL; ?>" class="text-blue-600 hover:underline"><?php echo SITE_EMAIL; ?></a>.</p>
            </section>
        </div>
    </div>
</div>

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