<?php
if (empty($pageTitle)) $pageTitle = 'Admin';
$currentPage = basename($_SERVER['PHP_SELF']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title><?= htmlspecialchars($pageTitle) ?> - Admin · FamAPI Enterprise</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="../assets/coinbase.css?v=10">
<link rel="stylesheet" href="../assets/admin.css?v=3">
</head>
<body>
<header class="topnav">
  <div class="container topnav-inner" style="display:flex; align-items:center; justify-content:space-between;">
    <a href="../index.php" class="nav-logo">
      <i class="fa-solid fa-shield-halved" style="color: var(--primary);"></i> Fam<span class="nav-logo-accent">API</span> 
      <span class="logo-tag">ENTERPRISE ADMIN</span>
    </a>
  </div>
</header>

<div class="admin-top">
  <div class="brand">
    <i class="fa-solid fa-sliders"></i> Control Center 
    <span class="tag"><?= htmlspecialchars(strtoupper($pageTitle)) ?></span>
  </div>
  <div class="user-box">
    <span>Signed in as <strong>Administrator</strong></span>
    <a href="../logout.php"><i class="fa-solid fa-right-from-bracket"></i> Logout</a>
  </div>
</div>

<div class="admin-nav">
  <a href="dashboard.php" class="<?= $currentPage === 'dashboard.php' ? 'active' : '' ?>"><i class="fa-solid fa-chart-pie"></i> Overview</a>
  <a href="users.php" class="<?= $currentPage === 'users.php' || $currentPage === 'user_edit.php' ? 'active' : '' ?>"><i class="fa-solid fa-users"></i> Users</a>
  <a href="plans.php" class="<?= $currentPage === 'plans.php' ? 'active' : '' ?>"><i class="fa-solid fa-tags"></i> Plan Editor</a>
  <a href="payment_links.php" class="<?= $currentPage === 'payment_links.php' ? 'active' : '' ?>"><i class="fa-solid fa-link"></i> Payment Links</a>
  <a href="settings.php" class="<?= $currentPage === 'settings.php' ? 'active' : '' ?>"><i class="fa-solid fa-gear"></i> Settings</a>
  <span class="spacer"></span>
  <a href="../docs.php" class="logout"><i class="fa-solid fa-book"></i> Docs</a>
  <a href="../index.php" class="logout"><i class="fa-solid fa-globe"></i> View Site</a>
  <a href="../logout.php" class="logout"><i class="fa-solid fa-power-off"></i> Logout</a>
</div>

<div class="admin-hero">
  <div class="admin-hero-inner">
    <div>
      <div class="hero-badge">
        <i class="fa-solid fa-shield-virus"></i> Automated Gateway Engine 2026
      </div>
      <h1><?= htmlspecialchars($pageTitle) ?></h1>
      <p><?= !empty($pageSub) ? htmlspecialchars($pageSub) : 'Manage your FamAPI platform.' ?></p>
    </div>
    <div class="hero-live"><span class="dot"></span> All systems operational (100% Uptime)</div>
  </div>
</div>