<?php
/**
 * Access Denied Page
 * Kenyan Pension & Life Insurance Management System
 */

require_once 'layouts/main.php';
require_once 'includes/auth.php';

// Check if user is logged in
if (!isLoggedIn()) {
    header('Location: login.php');
    exit();
}

$pageTitle = 'Access Denied';
include 'layouts/topbar.php';
?>

<body data-sidebar="dark">
    <div id="layout-wrapper">
        <?php include 'layouts/sidebar.php'; ?>
        
        <div class="main-content">
            <div class="page-content">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-12">
                            <div class="card">
                                <div class="card-body text-center py-5">
                                    <div class="mb-4">
                                        <lord-icon src="https://cdn.lordicon.com/tdrtiskw.json" 
                                                   trigger="loop" 
                                                   colors="primary:#f06548,secondary:#f7b801"
                                                   style="width:150px;height:150px">
                                        </lord-icon>
                                    </div>
                                    <h2 class="text-danger mb-3">Access Denied</h2>
                                    <p class="text-muted mb-4">
                                        You do not have permission to access this page or perform this action.
                                    </p>
                                    <p class="text-muted mb-4">
                                        If you believe this is an error, please contact your administrator.
                                    </p>
                                    <div class="mt-4">
                                        <a href="index.php" class="btn btn-primary me-2">
                                            <i class="ri-home-line me-2"></i>Go to Dashboard
                                        </a>
                                        <a href="javascript:history.back()" class="btn btn-secondary">
                                            <i class="ri-arrow-left-line me-2"></i>Go Back
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <?php include 'layouts/footer.php'; ?>
        </div>
    </div>

    <?php include 'layouts/vendor-scripts.php'; ?>
    <script src="https://cdn.lordicon.com/lordicon.js"></script>
</body>
</html>
