<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Edit Role</title>
  <style>
    /* General Styling */
    body {
      font-family: 'Arial', sans-serif;
      background-color: #f4f6f9;
      color: #333;
      margin: 0;
      padding: 20px;
    }

    h1 {
      text-align: center;
      color: #007bff;
      margin-bottom: 20px;
    }

    /* Form Styling */
    form {
      max-width: 800px;
      margin: 0 auto;
      padding: 20px;
      background-color: #fff;
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    form label {
      display: block;
      font-weight: bold;
      margin-bottom: 8px;
      color: #555;
    }

    form select, form button {
      width: 100%;
      padding: 10px;
      margin-bottom: 20px;
      border: 1px solid #ddd;
      border-radius: 4px;
    }

    form button {
      background-color: #007bff;
      color: white;
      font-size: 16px;
      font-weight: bold;
      border: none;
      cursor: pointer;
      transition: background-color 0.3s ease;
    }

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

    /* Permissions Container */
    #permissionsContainer {
      display: flex;
      flex-direction: column;
      gap: 20px;
      margin-top: 20px;
    }

    /* Category Styling */
    .permissions-category {
      background-color: #ffffff;
      border: 1px solid #ddd;
      border-radius: 8px;
      padding: 15px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .permissions-category h4 {
      margin: 0 0 15px 0;
      font-size: 18px;
      color: #007bff;
      border-bottom: 2px solid #007bff;
      padding-bottom: 5px;
    }

    /* Permissions Grid */
    .permissions-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 15px;
    }

    /* Permission Item */
    .permission-item {
      display: flex;
      align-items: center;
      background-color: #f8f9fa;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 4px;
      transition: background-color 0.3s ease, box-shadow 0.3s ease;
    }

    .permission-item:hover {
      background-color: #e9ecef;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .permission-item label {
      font-size: 14px;
      color: #555;
      margin-left: 10px;
    }

    /* Toggle Switch Styling */
    .switch {
      position: relative;
      display: inline-block;
      width: 40px;
      height: 22px;
    }

    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      cursor: pointer;
      background-color: #ccc;
      border-radius: 34px;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      transition: 0.4s;
    }

    .slider::before {
      position: absolute;
      content: "";
      height: 16px;
      width: 16px;
      left: 3px;
      bottom: 3px;
      background-color: white;
      border-radius: 50%;
      transition: 0.4s;
    }

    input:checked + .slider {
      background-color: #007bff;
    }

    input:checked + .slider::before {
      transform: translateX(18px);
    }

    /* Responsive Design */
    @media (max-width: 600px) {
      .permissions-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      }
    }
  </style>
</head>
<body>
  <h1>Edit Role</h1>
  <form id="editRoleForm">
    <label for="roleSelect">Select Role:</label>
    <select id="roleSelect" name="roleSelect" required>
      <!-- Roles will be dynamically loaded -->
    </select>

    <div id="permissionsContainer" class="permissions-container">
      <!-- Permissions toggle switches will be dynamically loaded -->
    </div>

    <button type="submit">Update Role</button>
  </form>

  <script src="./js/edit-role.js"></script>
</body>
</html>
