<?php
session_start();
require_once('mysqli_connect.php');

// ---- Only allow super admins ----
if (!isset($_SESSION['user_id']) || ($_SESSION['role'] ?? '') !== 'super_admin') {
    die("Access denied. Administrators only.");
}

function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title> Admin Dashboard • Sideline</title>
  <link rel="icon" type="image/x-icon" href="images/sideline_logo.ico">
  <style>
    body {
      margin:0;
      font-family:system-ui,Segoe UI,Arial,sans-serif;
      background:#F6F7FB;
      min-height:100vh;
      display:flex;
      flex-direction:column;
      align-items:center;
    }

    /* ---- Updated Header Layout ---- */
    .topbar {
      width:100%;
      display:flex;
      align-items:center;
      justify-content:flex-start; /* moved from space-between */
      gap:30px; /* spacing between brand and nav */
      padding:14px 18px;
      background: linear-gradient(to right, #251F47, #111827, #2B784A);
      color:#fff;
    }

    .nav {
      display:flex;
      gap:10px; /* spacing between buttons */
    }

    .nav a {
      color:#fff;
      text-decoration:none;
      padding:8px 12px;
      border-radius:8px;
      background:#2B784A;
    }

    .container {
      margin-top:50px;
      display:flex;
      flex-direction:column;
      gap:20px;
    }

    .btn {
      background:#2B784A;
      color:#fff;
      border:none;
      border-radius:12px;
      padding:14px 20px;
      font-size:1rem;
      cursor:pointer;
      text-decoration:none;
      text-align:center;
      width:200px;
    }
  </style>
</head>
<body>

<header class="topbar">
  <div class="brand" style="margin-left:6px;">
    <a href="superadmin_dashboard.php" 
       style="color:#fff; font-weight:800; text-decoration:none;">
      Sideline
    <span style="opacity:.8; font-weight:600;">• Admin</span></a>
  </div>

  <div class="nav">
    <a href="logout.php" 
       style="color:#fff; text-decoration:none; padding:8px 12px; border-radius:8px; background:#2B784A;">
      Logout
    </a>
  </div>
</header>


<div class="container">
  <a class="btn" href="manage_users.php">Manage Users</a>
  <a class="btn" href="manage_teams.php">Manage Teams</a>
</div>

</body>
</html>
