<?php
/**
 * Page Conditions d'Utilisation - SERVICES-AE
 */

// Inclure la configuration
require_once 'config/config.php';
require_once 'config/db.php';
require_once 'admin/LegalPagesManager.php';

// Récupérer le contenu de la page termes
$legalManager = new LegalPagesManager($pdo);
$termsPage = $legalManager->getByType('terms');

// Si la page n'existe pas, créer la table et récupérer à nouveau
if (!$termsPage) {
    $legalManager->createTable();
    $termsPage = $legalManager->getByType('terms');
}

// Données SEO
$current_page = 'terms';
?>

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <?php if ($termsPage): ?>
        <title><?php echo htmlspecialchars($termsPage['title']); ?> - SERVICES-AE</title>
        <meta name="description" content="<?php echo htmlspecialchars($termsPage['meta_description']); ?>">
    <?php else: ?>
        <title>Conditions d'Utilisation - SERVICES-AE</title>
        <meta name="description" content="Conditions d'utilisation de SERVICES-AE">
    <?php endif; ?>
    
    <!-- SEO et réseaux sociaux -->
    <?php
    // Inclure les helpers SEO si disponibles
    if (file_exists('seo-helper.php')) {
        require_once 'seo-helper.php';
        echo generateSEOTags($current_page);
    }
    ?>
    
    <!-- Favicon -->
    <link rel="icon" type="image/x-icon" href="images/fevicon/fevicon.png">
    
    <!-- Bootstrap CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/responsive.css" rel="stylesheet">
    <link href="css/colors1.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    
    <!-- Font Awesome -->
    <link rel="stylesheet" href="css/font-awesome.min.css">
    
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
</head>

<body>
    <!-- Header -->
    <?php include 'includes/topbar.php'; ?>
    <?php include 'includes/navbar.php'; ?>
    
    <!-- Page Header -->
    <section class="banner_main" style="background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); padding: 100px 0 60px 0;">
        <div class="container">
            <div class="row">
                <div class="col-md-12 text-center">
                    <h1 class="text-white mb-3">
                        <?php echo $termsPage ? htmlspecialchars($termsPage['title']) : 'Conditions d\'Utilisation'; ?>
                    </h1>
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb justify-content-center">
                            <li class="breadcrumb-item"><a href="index.php" class="text-white-50">Accueil</a></li>
                            <li class="breadcrumb-item active text-white">Conditions</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
    </section>
    
    <!-- Contenu principal -->
    <section class="py-5">
        <?php if ($termsPage && $termsPage['status'] === 'active'): ?>
            <?php echo $termsPage['content']; ?>
        <?php else: ?>
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        <div class="text-center py-5">
                            <i class="fa fa-file-text-o fa-5x text-muted mb-4"></i>
                            <h2>Page en cours de création</h2>
                            <p class="lead text-muted">Cette page sera bientôt disponible.</p>
                            <a href="index.php" class="btn btn-primary">
                                <i class="fa fa-home me-2"></i>
                                Retour à l'accueil
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </section>
    
    <!-- Footer -->
    <?php include 'includes/footer.php'; ?>
    
    <!-- JavaScript -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/custom.js"></script>
</body>
</html>