<?php
include('db_connection.php'); // Include your database connection file

if (isset($_GET['id'])) {
    $activity_id = $_GET['id'];

    // Query to fetch activity details
    $query = "SELECT activity_name, description, activity_date FROM upcoming_activities WHERE activity_id = ?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param("i", $activity_id);
    $stmt->execute();
    $stmt->bind_result($activity_name, $description, $activity_date);
    $stmt->fetch();
    $stmt->close();
    $conn->close();
} else {
    die('Error: Activity not found.');
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>View Activity</title>
    <link rel="stylesheet" href="styles.css"> <!-- Link your CSS file here -->
    <style type="text/css">/* General styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 800px;
    margin: 50px auto;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* Header styles */
h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}

/* Paragraph styles */
p {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}

p strong {
    color: #333;
}

/* Button styles */
.button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    text-align: center;
}

.button:hover {
    background-color: #0056b3;
}

/* Responsive styles */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    h2 {
        font-size: 20px;
    }

    p {
        font-size: 14px;
    }

    .button {
        font-size: 14px;
        padding: 8px 16px;
    }
}
</style>
</head>
<body>
    <div class="container">
        <h2><?php echo htmlspecialchars($activity_name); ?></h2>
        <p><strong>Description:</strong> <?php echo nl2br(htmlspecialchars($description)); ?></p>
        <p><strong>Date:</strong> <?php echo htmlspecialchars($activity_date); ?></p>
        <a href="admin_dashboard.php" class="button">Back to Dashboard</a>
    </div>
</body>
</html>
