i want to fix this codes (<?php

// Include the header
include '../includes/header.php';

session_start();
require_once '../db_connect.php';

// Enable error reporting for debugging (remove or comment out in production)
ini_set('display_errors', 1);
error_reporting(E_ALL);

// Check if admin is logged in
if (!isset($_SESSION['admin_id'])) {
    header("Location: ../admin_login.php");
    exit();
}


// Fetch prescriptions with patient and doctor names
$stmt = $pdo->prepare("
    SELECT p.*, pat.name AS patient_name, doc.name AS doctor_name
    FROM prescriptions p
    LEFT JOIN patients pat ON p.patient_id = pat.id
    LEFT JOIN doctors doc ON p.doctor_id = doc.id
    ORDER BY p.date_prescribed DESC
");
$stmt->execute();
$prescriptions = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
    <title>Prescriptions List</title>
    <!-- Include Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
    <!-- Include DataTables CSS -->
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.css">
    <!-- Custom Styles -->
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

        :root {
            --primary-color: #4F3F02;
            --secondary-color: #D1C287;
            --background-color: #f9f9f9;
            --text-color: #333;
        }

        body {
            font-family: 'Roboto', sans-serif;
            line-height: 1.6;
            background-color: var(--background-color);
            color: var(--text-color);
            margin: 0;
            padding: 0;
        }

        .container-prescriptions {
            max-width: 1200px;
            margin: 40px auto;
            padding: 0;
            background-color: white;
            border-radius: 20px;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .header {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            padding: 20px;
            text-align: center;
        }

        .header h1 {
            margin: 0;
            font-size: 32px;
            font-weight: 700;
        }

        .content {
            padding: 20px;
        }

        .add-prescription {
            text-align: right;
            margin-bottom: 15px;
        }

        .add-prescription a {
            background-color: var(--primary-color);
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 30px;
            font-weight: 700;
            transition: background-color 0.3s ease;
        }

        .add-prescription a:hover {
            background-color: var(--secondary-color);
        }

        table.dataTable {
            width: 100% !important;
        }

        table.dataTable thead th {
            background-color: var(--primary-color);
            color: white;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button {
            background-color: var(--primary-color);
            color: white !important;
            border: none;
            border-radius: 5px;
            padding: 5px 10px;
            margin: 2px;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
            background-color: var(--secondary-color);
            color: white !important;
        }

        .actions a {
            background-color: var(--primary-color);
            color: white;
            padding: 5px 10px;
            text-decoration: none;
            border-radius: 20px;
            font-weight: 700;
            margin: 2px;
            display: inline-block;
            transition: background-color 0.3s ease;
        }

        .actions a:hover {
            background-color: var(--secondary-color);
        }

        .back-dashboard {
            margin-top: 20px;
            text-align: center;
        }

        .back-dashboard a {
            background-color: var(--primary-color);
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 30px;
            font-weight: 700;
            transition: background-color 0.3s ease;
        }

        .back-dashboard a:hover {
            background-color: var(--secondary-color);
        }

        @media (max-width: 800px) {
            .content {
                padding: 10px;
            }

            table.dataTable thead th,
            table.dataTable tbody td {
                font-size: 14px;
            }

            .actions a {
                padding: 5px 8px;
                margin: 1px;
                font-size: 12px;
            }

            .add-prescription a {
                padding: 8px 15px;
                font-size: 14px;
            }
        }
    </style>
</head>
<body>
    <div class="container-prescriptions">
        <!-- Header -->
        <div class="header">
            <h1>Prescriptions List</h1>
        </div>
        <!-- Content -->
        <div class="content">
            <!-- Add Prescription Button -->
            <div class="add-prescription">
                <a href="add_prescription.php">Add Prescription</a>
            </div>
            <!-- Table -->
            <table id="prescriptionsTable" class="display">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Patient</th>
                        <th>Doctor</th>
                        <th>Date Prescribed</th>
                        <th>Status</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($prescriptions as $prescription): ?>
                        <tr>
                            <td><?= htmlspecialchars($prescription['id']) ?></td>
                            <td><?= htmlspecialchars($prescription['patient_name']) ?></td>
                            <td><?= htmlspecialchars($prescription['doctor_name']) ?></td>
                            <td><?= date('F j, Y', strtotime($prescription['date_prescribed'])) ?></td>
                            <td><?= ucfirst(htmlspecialchars($prescription['status'])) ?></td>
                            <td class="actions">
                                <a href="prescription_detail.php?id=<?= $prescription['id'] ?>">View</a>
                                <a href="edit_prescription.php?id=<?= $prescription['id'] ?>">Edit</a>
                                <a href="delete_prescription.php?id=<?= $prescription['id'] ?>" onclick="return confirm('Are you sure you want to delete this prescription?')">Delete</a>
                                <a href="download_prescription.php?id=<?= $prescription['id'] ?>" target="_blank">Download PDF</a>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
            <!-- Back to Dashboard -->
            <div class="back-dashboard">
                <a href="../admin_dashboard.php">Back to Admin Dashboard</a>
            </div>
        </div>
    </div>

    <!-- Include jQuery -->
    <!--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->
    <!-- Include DataTables JS -->
    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.js"></script>
    <!-- Initialize DataTables -->

    <script>
        $(document).ready(function() {
            $('#prescriptionsTable').DataTable({
                "order": [[ 3, "desc" ]], // Order by Date Prescribed descending
                "pageLength": 10,
                "lengthMenu": [10, 25, 50, 100],
                "columnDefs": [
                    { "orderable": false, "targets": 5 } // Disable sorting on Actions column
                ]
            });
        });
    </script>
</body>
</html>

<?php 
// Include the footer
include '../includes/footer.php';
?>) and change the table to make it better and use this styles (    <style>
        @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

        :root {
            --primary-color: #4F3F02;
            --secondary-color: #D1C287;
            --background-color: #f9f9f9;
            --text-color: #333;
        }

        body {
            font-family: 'Roboto', sans-serif;
            line-height: 1.6;
            background-color: var(--background-color);
            color: var(--text-color);
            margin: 0;
            padding: 0;
        }

        .container-prescriptions {
            max-width: 1200px;
            margin: 40px auto;
            padding: 0;
            background-color: white;
            border-radius: 20px;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .header {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            padding: 20px;
            text-align: center;
        }

        .header h1 {
            margin: 0;
            font-size: 32px;
            font-weight: 700;
        }

        .content {
            padding: 20px;
        }

        .add-prescription {
            text-align: right;
            margin-bottom: 15px;
        }

        .add-prescription a {
            background-color: var(--primary-color);
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 30px;
            font-weight: 700;
            transition: background-color 0.3s ease;
        }

        .add-prescription a:hover {
            background-color: var(--secondary-color);
        }

        table.dataTable {
            width: 100% !important;
        }

        table.dataTable thead th {
            background-color: var(--primary-color);
            color: white;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button {
            background-color: var(--primary-color);
            color: white !important;
            border: none;
            border-radius: 5px;
            padding: 5px 10px;
            margin: 2px;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
            background-color: var(--secondary-color);
            color: white !important;
        }

        .actions a {
            background-color: var(--primary-color);
            color: white;
            padding: 5px 10px;
            text-decoration: none;
            border-radius: 20px;
            font-weight: 700;
            margin: 2px;
            display: inline-block;
            transition: background-color 0.3s ease;
        }

        .actions a:hover {
            background-color: var(--secondary-color);
        }

        .back-dashboard {
            margin-top: 20px;
            text-align: center;
        }

        .back-dashboard a {
            background-color: var(--primary-color);
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 30px;
            font-weight: 700;
            transition: background-color 0.3s ease;
        }

        .back-dashboard a:hover {
            background-color: var(--secondary-color);
        }

        @media (max-width: 800px) {
            .content {
                padding: 10px;
            }

            table.dataTable thead th,
            table.dataTable tbody td {
                font-size: 14px;
            }

            .actions a {
                padding: 5px 8px;
                margin: 1px;
                font-size: 12px;
            }

            .add-prescription a {
                padding: 8px 15px;
                font-size: 14px;
            }
        }
    </style>
) nadm make it different classes names and add more codes to fix