<?php
// error.php - Custom error page
$error_code = $_GET['code'] ?? 404;
$error_messages = [
    400 => 'Bad Request',
    401 => 'Unauthorized',
    403 => 'Forbidden - You don\'t have permission to access this resource',
    404 => 'Page Not Found',
    500 => 'Internal Server Error'
];
$message = $error_messages[$error_code] ?? 'An error occurred';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Error <?php echo $error_code; ?> - BMYO</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(135deg, #2c3e50, #3498db);
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .error-card {
            background: white;
            border-radius: 15px;
            padding: 40px;
            text-align: center;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            max-width: 500px;
        }
        .error-code {
            font-size: 80px;
            font-weight: bold;
            color: #e74c3c;
        }
    </style>
</head>
<body>
    <div class="error-card">
        <h1 class="error-code"><?php echo $error_code; ?></h1>
        <h2><?php echo $message; ?></h2>
        <p class="text-muted">The page you are looking for might have been removed or is temporarily unavailable.</p>
        <a href="index.php" class="btn btn-primary mt-3">
            <i class="fas fa-home"></i> Back to Home
        </a>
    </div>
</body>
</html>