JIT
improving the css of my existing code
i want you to improve the css of my existing code, can you do it?
Updated files
v1
This code is my dashboard fro my helpdesk. I want the sidebar menu to be on the left, just occupying the small amount of the space. While on the right side, all the "Total Users", Total Tickets" , Total Messages and Total Department to put inside a separate box for each and places in grid sttyle on the remaing space of the right side. <?php session_start(); // Check if user is logged in if (!isset($_SESSION['user_id'])) { header("Location: http://localhost/helpdesk/?page_id=24"); exit(); } // Database connection $host = 'localhost'; $dbname = 'helpdesk'; $username = 'root'; $password = ''; try { $pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("Database connection failed: " . $e->getMessage()); } // Get counts for dashboard cards $ticketCount = $pdo->query("SELECT COUNT(*) FROM tickets")->fetchColumn(); $userCount = $pdo->query("SELECT COUNT(*) FROM users")->fetchColumn(); $messageCount = $pdo->query("SELECT COUNT(*) FROM messages")->fetchColumn(); $departmentCount = $pdo->query("SELECT COUNT(*) FROM departments")->fetchColumn(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dashboard - RJL DeskTrack</title> <style> body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; background-color: #f4f7f9; color: #333; } .dashboard-container { display: flex; } .sidebar { width: 240px; background-color: #D1B48C; color: #000; height: 100vh; position: fixed; left: 0; top: 0; overflow-y: auto; box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); z-index: 1000; padding-bottom: 20px; } .logo h2 { font-size: 24px; font-weight: 700; padding: 20px; margin: 0; border-bottom: 1px solid rgba(0,0,0,0.1); color: #000; } .menu { padding-left: 20px; margin-top: 20px; } .menu li { list-style: none; margin-bottom: 12px; } .menu li a { font-size: 16px; color: #000; text-decoration: none; display: flex; align-items: center; } .menu li a i { margin-right: 10px; font-style: normal; /* emojis look fine as normal */ font-size: 18px; width: 25px; text-align: center; } .menu li a:hover, .menu li a.active { background-color: #ffffff; color: #000; border-radius: 6px; padding-left: 12px; } .header { position: fixed; top: 0; left: 240px; right: 0; height: 60px; background-color: #77693A; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 999; } .header h1 { font-size: 24px; margin: 0; font-weight: 700; } .header .user-info { display: flex; align-items: center; gap: 10px; } .header .user-info img { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; } .header .user-info span { font-size: 16px; font-weight: 600; color: #fff; } .main-content { margin-left: 240px; padding: 80px 30px 30px; min-height: 100vh; background-color: #f4f7f9; } /* Card container */ .card-container { display: flex; flex-wrap: wrap; gap: 25px; justify-content: start; } /* Individual card */ .card { background-color: #63e5ff; flex-basis: calc(25% - 20px); padding: 20px; border-radius: 10px; box-shadow: 0 2px 7px rgba(0,0,0,0.1); display: flex; flex-direction: column; align-items: flex-start; position: relative; min-width: 220px; transition: box-shadow 0.3s ease; } .card:hover { box-shadow: 0 4px 15px rgba(0,0,0,0.15); } .card h3 { margin: 0 0 15px; font-size: 20px; font-weight: 700; color: #343a40; } .card .number { font-size: 36px; font-weight: 700; color: #77693A; } .card .icon { font-size: 40px; position: absolute; right: 20px; top: 20px; opacity: 0.15; } .card .view-link { margin-top: 20px; font-weight: 600; text-decoration: none; color: #77693A; font-size: 14px; transition: color 0.3s ease; } .card .view-link:hover { text-decoration: underline; color: #5a4d1b; } /* Responsive */ @media (max-width: 1100px) { .card-container { justify-content: center; } .card { flex-basis: calc(50% - 20px); min-width: unset; } } @media (max-width: 600px) { .main-content { padding: 100px 10px 20px 10px; } .card { flex-basis: 100%; min-width: unset; } .header { left: 0; padding: 0 10px; } .main-content { margin-left: 0; } .sidebar { width: 100%; height: auto; position: relative; } .dashboard-grid { grid-template-columns: 1fr; gap: 20px; } </style> </head> <body> <!-- Sidebar --> <div class="sidebar"> <div class="logo"> <h2>RJL DeskTrack</h2> </div> <ul class="menu"> <li><a href="http://localhost/helpdesk/?page_id=30" class="active"><i>📊</i> Dashboard</a></li> <li><a href="http://localhost/helpdesk/?page_id=35"><i>👥</i> Users</a></li> <li><a href="#"><i>🏢</i> Department</a></li> <li><a href="#"><i>🎫</i> Tickets</a></li> <li><a href="#"><i>✉️</i> Messages</a></li> <li><a href="#"><i>📈</i> Report</a></li> </ul> </div> <!-- Main Content --> <div class="main-content"> <div class="header"> <h1>Dashboard</h1> <div class="user-info"> <img src="https://ui-avatars.com/api/?name=<?= urlencode($_SESSION['username']) ?>&background=007bff&color=fff" alt="User"> <span><?= htmlspecialchars($_SESSION['username']) ?></span> </div> </div> <div class="main-content"> <div class = "dashboard-grid"> <!-- Tickets Card --> <div class="card"> <h3>Total Tickets</h3> <div class="number"><?= $ticketCount ?></div> <div class="icon">🎫</div> <a href="#" class="view-link">View All</a> </div> <!-- Users Card --> <div class="card"> <h3>Total Users</h3> <div class="number"><?= $userCount ?></div> <div class="icon">👥</div> <a href="#" class="view-link">View All</a> </div> <!-- Messages Card --> <div class="card"> <h3>Total Messages</h3> <div class="number"><?= $messageCount ?></div> <div class="icon">✉️</div> <a href="#" class="view-link">View All</a> </div> <!-- Departments Card --> <div class="card"> <h3>Departments</h3> <div class="number"><?= $departmentCount ?></div> <div class="icon">🏢</div> <a href="#" class="view-link">View All</a> </div> </div> </div> <script> // Simple script to handle active menu items document.querySelectorAll('.menu a').forEach(link => { link.addEventListener('click', function() { document.querySelectorAll('.menu a').forEach(item => { item.classList.remove('active'); }); this.classList.add('active'); }); }); </script> </body> </html>
Updated files
v2
what changes didi you made?

Here's a concise summary of the key CSS improvements made:

  1. CSS Variables:
:root {
  --sidebar-width: 240px;
  --header-height: 60px;
  --primary-color: #77693A;
  --secondary-color: #D1B48C;
  --card-colors: #63e5ff, #6c5ce7, #00b894, #fd79a8;
}
  1. Improved Grid Layout:
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}
  1. Card Enhancements:
.card {
  border-top: 4px solid var(--card-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
  1. Responsive Improvements:
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; }
  .header { left: 0; }
  .main-content { margin-left: 0; width: 100%; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
  1. Visual Hierarchy:
  • Added colored top borders to cards
  • Improved hover effects
  • Better spacing and shadows
  • Consistent color scheme

The changes maintain all existing functionality while improving the visual design and responsiveness.

make the "RJL DeskTrack" placed on left side, as weel as the menu. Move the "User Management" on top at center, together with "admin". Divide the screen in to two, side bar menu on left and the "Add User" and List of users on the right <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); // Check if user is logged in and is admin if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') { header("Location: http://localhost/helpdesk/?page_id=24"); exit(); } // Database connection $host = 'localhost'; $dbname = 'helpdesk'; $username = 'root'; $password = ''; try { $pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("Database connection failed: " . $e->getMessage()); } // Initialize messages $error = ''; $success = ''; // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { try { // Validate inputs if (empty($_POST['first_name']) || !preg_match('/^[A-Za-z. ]+$/', $_POST['first_name'])) { throw new Exception("First name can only contain letters, periods and spaces"); } if (empty($_POST['last_name']) || !preg_match('/^[A-Za-z. ]+$/', $_POST['last_name'])) { throw new Exception("Last name can only contain letters, periods and spaces"); } if (empty($_POST['username'])) { throw new Exception("Username is required"); } if (empty($_POST['password'])) { throw new Exception("Password is required"); } $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $username = $_POST['username']; $password = password_hash($_POST['password'], PASSWORD_BCRYPT); $role = $_POST['role']; $department_id = !empty($_POST['department_id']) ? (int)$_POST['department_id'] : null; // Check if username exists $stmt = $pdo->prepare("SELECT id FROM users WHERE username = ?"); $stmt->execute([$username]); if ($stmt->fetch()) { throw new Exception("Username already exists. Please choose a different one."); } // Insert new user $stmt = $pdo->prepare("INSERT INTO users (first_name, last_name, username, password, role, department_id) VALUES (?, ?, ?, ?, ?, ?)"); $stmt->execute([$first_name, $last_name, $username, $password, $role, $department_id]); if ($stmt->rowCount() > 0) { $success = "User added successfully!"; // Clear form fields on success $_POST = []; } else { throw new Exception("Failed to add user. Please try again."); } } catch (Exception $e) { $error = $e->getMessage(); } } // Get all users and departments for the table $users = $pdo->query("SELECT users.*, departments.name as department_name FROM users LEFT JOIN departments ON users.department_id = departments.id")->fetchAll(); $departments = $pdo->query("SELECT * FROM departments")->fetchAll(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>User Management - RJL DeskTrack</title> <style> /* Copy the exact same CSS from your dashboard.php */ body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; background-color: #f4f7f9; color: #333; } .dashboard-container { display: flex; } /* Sidebar Styles */ .sidebar { width: 240px; background-color: #D1B48C; color: #000; height: 100vh; position: fixed; left: 0; top: 0; overflow-y: auto; box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); z-index: 1000; } .logo h2 { font-size: 24px; font-weight: 700; padding: 20px; margin: 0; border-bottom: 1px solid rgba(0,0,0,0.1); color: #000; } .menu { padding-left: 20px; margin-top: 20px; } .menu li { list-style: none; margin-bottom: 12px; } .menu li a { font-size: 16px; color: #000; text-decoration: none; display: flex; align-items: center; padding: 8px 12px; border-radius: 6px; } .menu li a i { margin-right: 10px; font-style: normal; font-size: 18px; width: 25px; text-align: center; } .menu li a:hover, .menu li a.active { background-color: #ffffff; color: #000; } /* Header Styles */ .header { position: fixed; top: 0; left: 240px; right: 0; height: 60px; background-color: #77693A; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 999; } .header h1 { font-size: 24px; margin: 0; font-weight: 700; } .header .user-info { display: flex; align-items: center; gap: 10px; } .header .user-info img { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; } .header .user-info span { font-size: 16px; font-weight: 600; color: #fff; } /* Main Content Area */ .main-content { margin-left: 240px; padding: 80px 30px 30px; min-height: 100vh; background-color: #f4f7f9; } /* User Management Styles */ .user-management { background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding: 20px; margin-top: 20px; } .user-form { margin-bottom: 30px; padding: 20px; background: #f8f9fa; border-radius: 8px; } .form-group { margin-bottom: 15px; } .form-group label { display: block; margin-bottom: 5px; font-weight: 600; } .form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; } .btn { background-color: #77693A; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 16px; } .btn:hover { background-color: #5a4d1b; } .user-table { width: 100%; border-collapse: collapse; margin-top: 20px; } .user-table th, .user-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #ddd; } .user-table th { background-color: #f8f9fa; font-weight: 600; } .user-table tr:hover { background-color: #f1f3f5; } .action-btn { padding: 5px 10px; margin-right: 5px; border-radius: 4px; text-decoration: none; font-size: 14px; } .edit-btn { background-color: #3498db; color: white; } .delete-btn { background-color: #e74c3c; color: white; } /* Responsive Adjustments */ @media (max-width: 768px) { .sidebar { width: 70px; } .logo h2, .menu li a span { display: none; } .menu li a { justify-content: center; padding: 8px; } .menu li a i { margin-right: 0; font-size: 20px; } .main-content { margin-left: 70px; } .header { left: 70px; } } @media (max-width: 480px) { .sidebar { width: 100%; height: auto; position: relative; } .main-content { margin-left: 0; padding-top: 20px; } .header { left: 0; position: relative; } } </style> </head> <body> <!-- Sidebar --> <div class="sidebar"> <div class="logo"> <h2>RJL DeskTrack</h2> </div> <ul class="menu"> <li><a href="http://localhost/helpdesk/?page_id=30"><i>📊</i> Dashboard</a></li> <li><a href="http://localhost/helpdesk/?page_id=35" class="active"><i>👥</i> Users</a></li> <li><a href="departments.php"><i>🏢</i> Departments</a></li> <li><a href="tickets.php"><i>🎫</i> Tickets</a></li> <li><a href="messages.php"><i>✉️</i> Messages</a></li> <li><a href="reports.php"><i>📈</i> Reports</a></li> </ul> </div> <!-- Main Content --> <div class="main-content"> <div class="header"> <h1>User Management</h1> <div class="user-info"> <img src="https://ui-avatars.com/api/?name=<?= urlencode($_SESSION['username']) ?>&background=007bff&color=fff" alt="User"> <span><?= htmlspecialchars($_SESSION['username']) ?></span> </div> </div> <div class="user-management"> <!-- Add User Form --> <div class="user-form"> <h2>Add New User</h2> <?php if ($success): ?> <div class="success-message" style="color: green; margin-bottom: 15px;"> <?= htmlspecialchars($success) ?> </div> <?php endif; ?> <?php if ($error): ?> <div class="error-message" style="color: red; margin-bottom: 15px;"> <?= htmlspecialchars($error) ?> </div> <?php endif; ?> <form method="POST"> <div class="form-group"> <label for="first_name">First Name</label> <input type="text" id="first_name" name="first_name" pattern="[A-Za-z. ]+" title="Only letters, periods and spaces allowed" required value="<?= isset($_POST['first_name']) ? htmlspecialchars($_POST['first_name']) : '' ?>"> </div> <div class="form-group"> <label for="last_name">Last Name</label> <input type="text" id="last_name" name="last_name" pattern="[A-Za-z. ]+" title="Only letters, periods and spaces allowed" required value="<?= isset($_POST['last_name']) ? htmlspecialchars($_POST['last_name']) : '' ?>"> </div> <div class="form-group"> <label for="username">Username</label> <input type="text" id="username" name="username" required value="<?= isset($_POST['username']) ? htmlspecialchars($_POST['username']) : '' ?>"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" id="password" name="password" required> </div> <div class="form-group"> <label for="role">Role</label> <select id="role" name="role" required> <option value="admin" <?= (isset($_POST['role']) && $_POST['role'] === 'admin') ? 'selected' : '' ?>>Admin</option> <option value="user" <?= !isset($_POST['role']) || $_POST['role'] === 'user' ? 'selected' : '' ?>>User</option> </select> </div> <div class="form-group"> <label for="department_id">Department</label> <select id="department_id" name="department_id"> <option value="">None</option> <?php foreach ($departments as $dept): ?> <option value="<?= $dept['id'] ?>" <?= (isset($_POST['department_id']) && $_POST['department_id'] == $dept['id']) ? 'selected' : '' ?>> <?= htmlspecialchars($dept['name']) ?> </option> <?php endforeach; ?> </select> </div> <button type="submit" class="btn">Add User</button> </form> </div> <!-- Users Table --> <h2>All Users</h2> <table class="user-table"> <thead> <tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> <th>Username</th> <th>Role</th> <th>Department</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($users as $user): ?> <tr> <td><?= $user['id'] ?></td> <td><?= htmlspecialchars($user['first_name']) ?></td> <td><?= htmlspecialchars($user['last_name']) ?></td> <td><?= htmlspecialchars($user['username']) ?></td> <td><?= ucfirst($user['role']) ?></td> <td><?= $user['department_name'] ?? 'None' ?></td> <td> <a href="edit_user.php?id=<?= $user['id'] ?>" class="action-btn edit-btn">Edit</a> <a href="delete_user.php?id=<?= $user['id'] ?>" class="action-btn delete-btn" onclick="return confirm('Are you sure?')">Delete</a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <script> // Simple script to handle active menu items document.querySelectorAll('.menu a').forEach(link => { if (link.href === window.location.href) { link.classList.add('active'); } link.addEventListener('click', function() { document.querySelectorAll('.menu a').forEach(item => { item.classList.remove('active'); }); this.classList.add('active'); }); }); </script> </body> </html>

Here's the improved version with the requested layout changes:

<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Check if user is logged in and is admin
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
    header("Location: http://localhost/helpdesk/?page_id=24");
    exit();
}

// Database connection
$host = 'localhost';
$dbname = 'helpdesk';
$username = 'root';
$password = '';

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    die("Database connection failed: " . $e->getMessage());
}

// Initialize messages
$error = '';
$success = '';

// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    try {
        // Validate inputs
        if (empty($_POST['first_name']) || !preg_match('/^[A-Za-z. ]+$/', $_POST['first_name'])) {
            throw new Exception("First name can only contain letters, periods and spaces");
        }
        if (empty($_POST['last_name']) || !preg_match('/^[A-Za-z. ]+$/', $_POST['last_name'])) {
            throw new Exception("Last name can only contain letters, periods and spaces");
        }
        if (empty($_POST['username'])) {
            throw new Exception("Username is required");
        }
        if (empty($_POST['password'])) {
            throw new Exception("Password is required");
        }

        $first_name = $_POST['first_name'];
        $last_name = $_POST['last_name'];
        $username = $_POST['username'];
        $password = password_hash($_POST['password'], PASSWORD_BCRYPT);
        $role = $_POST['role'];
        $department_id = !empty($_POST['department_id']) ? (int)$_POST['department_id'] : null;

        // Check if username exists
        $stmt = $pdo->prepare("SELECT id FROM users WHERE username = ?");
        $stmt->execute([$username]);
        
        if ($stmt->fetch()) {
            throw new Exception("Username already exists. Please choose a different one.");
        }

        // Insert new user
        $stmt = $pdo->prepare("INSERT INTO users 
                              (first_name, last_name, username, password, role, department_id) 
                              VALUES (?, ?, ?, ?, ?, ?)");
        
        $stmt->execute([$first_name, $last_name, $username, $password, $role, $department_id]);
        
        if ($stmt->rowCount() > 0) {
            $success = "User added successfully!";
            // Clear form fields on success
            $_POST = [];
        } else {
            throw new Exception("Failed to add user. Please try again.");
        }

    } catch (Exception $e) {
        $error = $e->getMessage();
    }
}

// Get all users and departments for the table
$users = $pdo->query("SELECT users.*, departments.name as department_name 
                     FROM users LEFT JOIN departments ON users.department_id = departments.id")->fetchAll();
$departments = $pdo->query("SELECT * FROM departments")->fetchAll();
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>User Management - RJL DeskTrack</title>
    <style>
        :root {
            --sidebar-width: 240px;
            --header-height: 80px;
            --primary-color: #77693A;
            --secondary-color: #D1B48C;
            --text-dark: #333;
            --text-light: #f8f9fa;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f7f9;
            color: var(--text-dark);
        }

        .dashboard-container {
            display: flex;
            min-height: 100vh;
        }

        /* Sidebar Styles */
        .sidebar {
            width: var(--sidebar-width);
            background-color: var(--secondary-color);
            color: #000;
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            overflow-y: auto;
            box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
            z-index: 1000;
        }

        .logo {
            padding: 20px;
            text-align: left;
            border-bottom: 1px solid rgba(0,0,0,0.1);
        }

        .logo h2 {
            font-size: 24px;
            font-weight: 700;
            margin: 0;
            color: #000;
        }

        .menu {
            padding: 20px 0;
            margin: 0;
        }

        .menu li {
            list-style: none;
        }

        .menu li a {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            color: #000;
            text-decoration: none;
            font-size: 16px;
            transition: all 0.3s ease;
        }

        .menu li a i {
            margin-right: 10px;
            font-style: normal;
            font-size: 18px;
            width: 25px;
            text-align: center;
        }

        .menu li a:hover,
        .menu li a.active {
            background-color: #ffffff;
            color: #000;
        }

        /* Main Content Area */
        .main-content {
            margin-left: var(--sidebar-width);
            width: calc(100% - var(--sidebar-width));
            min-height: 100vh;
        }

        /* Top Header Bar */
        .top-bar {
            background-color: var(--primary-color);
            color: white;
            height: var(--header-height);
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .top-bar h1 {
            font-size: 24px;
            margin: 0;
            font-weight: 700;
        }

        .user-info {
            position: absolute;
            right: 30px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .user-info img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }

        .user-info span {
            font-size: 16px;
            font-weight: 600;
            color: white;
        }

        /* Content Layout */
        .content-wrapper {
            display: flex;
            padding: 20px;
            gap: 20px;
        }

        .form-section {
            flex: 1;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 20px;
        }

        .table-section {
            flex: 2;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 20px;
            overflow-x: auto;
        }

        /* Form Styles */
        .form-title {
            margin-top: 0;
            margin-bottom: 20px;
            font-size: 20px;
            color: var(--primary-color);
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 600;
        }

        .form-group input,
        .form-group select {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }

        .btn {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s;
        }

        .btn:hover {
            background-color: #5a4d1b;
        }

        /* Table Styles */
        .table-title {
            margin-top: 0;
            margin-bottom: 20px;
            font-size: 20px;
            color: var(--primary-color);
        }

        .user-table {
            width: 100%;
            border-collapse: collapse;
        }

        .user-table th,
        .user-table td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        .user-table th {
            background-color: #f8f9fa;
            font-weight: 600;
        }

        .user-table tr:hover {
            background-color: #f1f3f5;
        }

        .action-btn {
            padding: 5px 10px;
            margin-right: 5px;
            border-radius: 4px;
            text-decoration: none;
            font-size: 14px;
        }

        .edit-btn {
            background-color: #3498db;
            color: white;
        }

        .delete-btn {
            background-color: #e74c3c;
            color: white;
        }

        /* Message Styles */
        .message {
            padding: 10px 15px;
            margin-bottom: 15px;
            border-radius: 4px;
        }

        .success-message {
            background-color: #d4edda;
            color: #155724;
        }

        .error-message {
            background-color: #f8d7da;
            color: #721c24;
        }

        /* Responsive Adjustments */
        @media (max-width: 992px) {
            .content-wrapper {
                flex-direction: column;
            }
        }

        @media (max-width: 768px) {
            .sidebar {
                width: 70px;
            }
            .logo h2 {
                display: none;
            }
            .menu li a span {
                display: none;
            }
            .menu li a {
                justify-content: center;
                padding: 12px 0;
            }
            .menu li a i {
                margin-right: 0;
                font-size: 20px;
            }
            .main-content {
                margin-left: 70px;
                width: calc(100% - 70px);
            }
        }

        @media (max-width: 576px) {
            .sidebar {
                width: 100%;
                height: auto;
                position: relative;
            }
            .main-content {
                margin-left: 0;
                width: 100%;
            }
            .top-bar {
                justify-content: flex-start;
                padding-left: 20px;
            }
            .user-info {
                position: static;
                margin-left: auto;
                padding-right: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="dashboard-container">
        <!-- Sidebar -->
        <div class="sidebar">
            <div class="logo">
                <h2>RJL DeskTrack</h2>
            </div>
            <ul class="menu">
                <li><a href="http://localhost/helpdesk/?page_id=30"><i>📊</i> <span>Dashboard</span></a></li>
                <li><a href="http://localhost/helpdesk/?page_id=35" class="active"><i>👥</i> <span>Users</span></a></li>
                <li><a href="departments.php"><i>🏢</i> <span>Departments</span></a></li>
                <li><a href="tickets.php"><i>🎫</i> <span>Tickets</span></a></li>
                <li><a href="messages.php"><i>✉️</i> <span>Messages</span></a></li>
                <li><a href="reports.php"><i>📈</i> <span>Reports</span></a></li>
            </ul>
        </div>

        <!-- Main Content -->
        <div class="main-content">
            <!-- Top Bar -->
            <div class="top-bar">
                <h1>User Management</h1>
                <div class="user-info">
                    <img src="https://ui-avatars.com/api/?name=<?= urlencode($_SESSION['username']) ?>&background=007bff&color=fff" alt="User">
                    <span><?= htmlspecialchars($_SESSION['username']) ?></span>
                </div>
            </div>

            <!-- Content Wrapper -->
            <div class="content-wrapper">
                <!-- Add User Form Section -->
                <div class="form-section">
                    <h2 class="form-title">Add New User</h2>
                    
                    <?php if ($success): ?>
                        <div class="message success-message">
                            <?= htmlspecialchars($success) ?>
                        </div>
                    <?php endif; ?>
                    
                    <?php if ($error): ?>
                        <div class="message error-message">
                            <?= htmlspecialchars($error) ?>
                        </div>
                    <?php endif; ?>
                    
                    <form method="POST">
                        <div class="form-group">
                            <label for="first_name">First Name</label>
                            <input type="text" id="first_name" name="first_name" 
                                   pattern="[A-Za-z. ]+" 
                                   title="Only letters, periods and spaces allowed" 
                                   required
                                   value="<?= isset($_POST['first_name']) ? htmlspecialchars($_POST['first_name']) : '' ?>">
                        </div>
                        <div class="form-group">
                            <label for="last_name">Last Name</label>
                            <input type="text" id="last_name" name="last_name" 
                                   pattern="[A-Za-z. ]+" 
                                   title="Only letters, periods and spaces allowed" 
                                   required
                                   value="<?= isset($_POST['last_name']) ? htmlspecialchars($_POST['last_name']) : '' ?>">
                        </div>
                        <div class="form-group">
                            <label for="username">Username</label>
                            <input type="text" id="username" name="username" 
                                   required
                                   value="<?= isset($_POST['username']) ? htmlspecialchars($_POST['username']) : '' ?>">
                        </div>
                        <div class="form-group">
                            <label for="password">Password</label>
                            <input type="password" id="password" name="password" required>
                        </div>
                        <div class="form-group">
                            <label for="role">Role</label>
                            <select id="role" name="role" required>
                                <option value="admin" <?= (isset($_POST['role']) && $_POST['role'] === 'admin') ? 'selected' : '' ?>>Admin</option>
                                <option value="user" <?= !isset($_POST['role']) || $_POST['role'] === 'user' ? 'selected' : '' ?>>User</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="department_id">Department</label>
                            <select id="department_id" name="department_id">
                                <option value="">None</option>
                                <?php foreach ($departments as $dept): ?>
                                    <option value="<?= $dept['id'] ?>" 
                                        <?= (isset($_POST['department_id']) && $_POST['department_id'] == $dept['id']) ? 'selected' : '' ?>>
                                        <?= htmlspecialchars($dept['name']) ?>
                                    </option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                        <button type="submit" class="btn">Add User</button>
                    </form>
                </div>

                <!-- Users Table Section -->
                <div class="table-section">
                    <h2 class="table-title">All Users</h2>
                    <table class="user-table">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>First Name</th>
                                <th>Last Name</th>
                                <th>Username</th>
                                <th>Role</th>
                                <th>Department</th>
                                <th>Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($users as $user): ?>
                            <tr>
                                <td><?= $user['id'] ?></td>
                                <td><?= htmlspecialchars($user['first_name']) ?></td>
                                <td><?= htmlspecialchars($user['last_name']) ?></td>
                                <td><?= htmlspecialchars($user['username']) ?></td>
                                <td><?= ucfirst($user['role']) ?></td>
                                <td><?= $user['department_name'] ?? 'None' ?></td>
                                <td>
                                    <a href="edit_user.php?id=<?= $user['id'] ?>" class="action-btn edit-btn">Edit</a>
                                    <a href="delete_user.php?id=<?= $user['id'] ?>" class="action-btn delete-btn" onclick="return confirm('Are you sure?')">Delete</a>
                                </td>
                            </tr>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Simple script to handle active menu items
        document.querySelectorAll('.menu a').forEach(link => {
            if (link.href === window.location.href) {
                link.classList.add('active');
            }
            
            link.addEventListener('click', function() {
                document.querySelectorAll('.menu a').forEach(item => {
                    item.classList.remove('active');
                });
                this.classList.add('active');
            });
        });
    </script>
</body>
</html>

Key changes made:

  1. Reorganized the layout to have the sidebar on the left with "RJL DeskTrack" logo
  2. Moved "User Management" and admin info to a centered top bar
  3. Split the right side into two sections:
    • Left side: Add User form
    • Right side: Users table
  4. Improved responsive design for different screen sizes
  5. Enhanced visual hierarchy with better spacing and colors
  6. Maintained all existing functionality while improving the layout
nothings changes, stop using new syntax of code in css, just use the ordinary one

Here's the simplified version with basic CSS syntax as requested:

<?php
// [Previous PHP code remains exactly the same until the closing PHP tag]
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>User Management - RJL DeskTrack</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f7f9;
            color: #333;
        }

        .sidebar {
            width: 240px;
            background-color: #D1B48C;
            color: #000;
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            overflow-y: auto;
            box-shadow: 2px 0 5px rgba(0,0,0,0.1);
            z-index: 1000;
        }

        .logo h2 {
            font-size: 24px;
            font-weight: 700;
            padding: 20px;
            margin: 0;
            border-bottom: 1px solid rgba(0,0,0,0.1);
            color: #000;
        }

        .menu {
            padding-left: 20px;
            margin-top: 20px;
        }

        .menu li {
            list-style: none;
            margin-bottom: 12px;
        }

        .menu li a {
            font-size: 16px;
            color: #000;
            text-decoration: none;
            display: flex;
            align-items: center;
            padding: 8px 12px;
            border-radius: 6px;
        }

        .menu li a i {
            margin-right: 10px;
            font-style: normal;
            font-size: 18px;
            width: 25px;
            text-align: center;
        }

        .menu li a:hover,
        .menu li a.active {
            background-color: #ffffff;
            color: #000;
        }

        .header {
            position: fixed;
            top: 0;
            left: 240px;
            right: 0;
            height: 60px;
            background-color: #77693A;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            z-index: 999;
        }

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

        .user-info {
            position: absolute;
            right: 30px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .user-info img {
            width: 35px;
            height: 35px;
            border-radius: 50%;
            object-fit: cover;
        }

        .user-info span {
            font-size: 16px;
            font-weight: 600;
            color: #fff;
        }

        .main-content {
            margin-left: 240px;
            padding: 80px 30px 30px;
            min-height: 100vh;
            background-color: #f4f7f9;
            display: flex;
        }

        .form-section {
            flex: 1;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 20px;
            margin-right: 20px;
        }

        .table-section {
            flex: 2;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 20px;
            overflow-x: auto;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 600;
        }

        .form-group input,
        .form-group select {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }

        .btn {
            background-color: #77693A;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }

        .btn:hover {
            background-color: #5a4d1b;
        }

        .user-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        .user-table th,
        .user-table td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        .user-table th {
            background-color: #f8f9fa;
            font-weight: 600;
        }

        .user-table tr:hover {
            background-color: #f1f3f5;
        }

        .action-btn {
            padding: 5px 10px;
            margin-right: 5px;
            border-radius: 4px;
            text-decoration: none;
            font-size: 14px;
        }

        .edit-btn {
            background-color: #3498db;
            color: white;
        }

        .delete-btn {
            background-color: #e74c3c;
            color: white;
        }

        .success-message {
            color: green;
            margin-bottom: 15px;
        }

        .error-message {
            color: red;
            margin-bottom: 15px;
        }

        @media (max-width: 768px) {
            .sidebar {
                width: 70px;
            }
            .logo h2,
            .menu li a span {
                display: none;
            }
            .menu li a {
                justify-content: center;
                padding: 8px;
            }
            .menu li a i {
                margin-right: 0;
                font-size: 20px;
            }
            .main-content {
                margin-left: 70px;
                flex-direction: column;
            }
            .form-section {
                margin-right: 0;
                margin-bottom: 20px;
            }
            .header {
                left: 70px;
            }
        }

        @media (max-width: 480px) {
            .sidebar {
                width: 100%;
                height: auto;
                position: relative;
            }
            .main-content {
                margin-left: 0;
                padding-top: 20px;
            }
            .header {
                left: 0;
                position: relative;
            }
        }
    </style>
</head>
<body>
    <!-- Sidebar -->
    <div class="sidebar">
        <div class="logo">
            <h2>RJL DeskTrack</h2>
        </div>
        <ul class="menu">
            <li><a href="http://localhost/helpdesk/?page_id=30"><i>📊</i> <span>Dashboard</span></a></li>
            <li><a href="http://localhost/helpdesk/?page_id=35" class="active"><i>👥</i> <span>Users</span></a></li>
            <li><a href="departments.php"><i>🏢</i> <span>Departments</span></a></li>
            <li><a href="tickets.php"><i>🎫</i> <span>Tickets</span></a></li>
            <li><a href="messages.php"><i>✉️</i> <span>Messages</span></a></li>
            <li><a href="reports.php"><i>📈</i> <span>Reports</span></a></li>
        </ul>
    </div>

    <!-- Main Content -->
    <div class="main-content">
        <div class="header">
            <h1>User Management</h1>
            <div class="user-info">
                <img src="https://ui-avatars.com/api/?name=<?= urlencode($_SESSION['username']) ?>&background=007bff&color=fff" alt="User">
                <span><?= htmlspecialchars($_SESSION['username']) ?></span>
            </div>
        </div>

        <!-- Form Section -->
        <div class="form-section">
            <h2>Add New User</h2>
            
            <?php if ($success): ?>
                <div class="success-message"><?= htmlspecialchars($success) ?></div>
            <?php endif; ?>
            
            <?php if ($error): ?>
                <div class="error-message"><?= htmlspecialchars($error) ?></div>
            <?php endif; ?>
            
            <form method="POST">
                <div class="form-group">
                    <label for="first_name">First Name</label>
                    <input type="text" id="first_name" name="first_name" 
                           pattern="[A-Za-z. ]+" 
                           title="Only letters, periods and spaces allowed" 
                           required
                           value="<?= isset($_POST['first_name']) ? htmlspecialchars($_POST['first_name']) : '' ?>">
                </div>
                <div class="form-group">
                    <label for="last_name">Last Name</label>
                    <input type="text" id="last_name" name="last_name" 
                           pattern="[A-Za-z. ]+" 
                           title="Only letters, periods and spaces allowed" 
                           required
                           value="<?= isset($_POST['last_name']) ? htmlspecialchars($_POST['last_name']) : '' ?>">
                </div>
                <div class="form-group">
                    <label for="username">Username</label>
                    <input type="text" id="username" name="username" 
                           required
                           value="<?= isset($_POST['username']) ? htmlspecialchars($_POST['username']) : '' ?>">
                </div>
                <div class="form-group">
                    <label for="password">Password</label>
                    <input type="password" id="password" name="password" required>
                </div>
                <div class="form-group">
                    <label for="role">Role</label>
                    <select id="role" name="role" required>
                        <option value="admin" <?= (isset($_POST['role']) && $_POST['role'] === 'admin') ? 'selected' : '' ?>>Admin</option>
                        <option value="user" <?= !isset($_POST['role']) || $_POST['role'] === 'user' ? 'selected' : '' ?>>User</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="department_id">Department</label>
                    <select id="department_id" name="department_id">
                        <option value="">None</option>
                        <?php foreach ($departments as $dept): ?>
                            <option value="<?= $dept['id'] ?>" 
                                <?= (isset($_POST['department_id']) && $_POST['department_id'] == $dept['id']) ? 'selected' : '' ?>>
                                <?= htmlspecialchars($dept['name']) ?>
                            </option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <button type="submit" class="btn">Add User</button>
            </form>
        </div>

        <!-- Table Section -->
        <div class="table-section">
            <h2>All Users</h2>
            <table class="user-table">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Username</th>
                        <th>Role</th>
                        <th>Department</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($users as $user): ?>
                    <tr>
                        <td><?= $user['id'] ?></td>
                        <td><?= htmlspecialchars($user['first_name']) ?></td>
                        <td><?= htmlspecialchars($user['last_name']) ?></td>
                        <td><?= htmlspecialchars($user['username']) ?></td>
                        <td><?= ucfirst($user['role']) ?></td>
                        <td><?= $user['department_name'] ?? 'None' ?></td>
                        <td>
                            <a href="edit_user.php?id=<?= $user['id'] ?>" class="action-btn edit-btn">Edit</a>
                            <a href="delete_user.php?id=<?= $user['id'] ?>" class="action-btn delete-btn" onclick="return confirm('Are you sure?')">Delete</a>
                        </td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>

    <script>
        document.querySelectorAll('.menu a').forEach(link => {
            if (link.href === window.location.href) {
                link.classList.add('active');
            }
            
            link.addEventListener('click', function() {
                document.querySelectorAll('.menu a').forEach(item => {
                    item.classList.remove('active');
                });
                this.classList.add('active');
            });
        });
    </script>
</body>
</html>

Key changes:

  1. Removed all CSS variables and modern syntax
  2. Used basic CSS properties and selectors
  3. Kept the layout with:
    • Left sidebar with logo and menu
    • Top header with centered "User Management" title
    • Split main content into form (left) and table (right)
  4. Maintained all functionality
  5. Kept responsive design for mobile devices
  6. Used simple color definitions and standard CSS properties