<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars($pageTitle ?? 'Admin') ?> — Fit Bot</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
    <style>
        :root { --sidebar: 230px; }
        body { background: #f4f6fb; }
        .sidebar {
            width: var(--sidebar); min-height: 100vh;
            background: #1a1d2e; position: fixed;
            top: 0; left: 0; bottom: 0;
            display: flex; flex-direction: column; z-index: 100;
        }
        .sidebar-brand { padding: 1.4rem 1.2rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
        .sidebar nav { flex: 1; padding: .5rem 0; }
        .sidebar .nav-link {
            color: #9ca3af; padding: .55rem 1.2rem; font-size: .875rem;
            display: flex; align-items: center; gap: .55rem;
            border-left: 3px solid transparent; border-radius: 0; text-decoration: none;
        }
        .sidebar .nav-link i { width: 18px; text-align: center; }
        .sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
        .sidebar .nav-link.active { color: #a5b4fc; background: rgba(99,102,241,.18); border-left-color: #818cf8; }
        .sidebar-footer { padding: .75rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); }
        .sidebar-footer a { color: #f87171; font-size: .875rem; display: flex; align-items: center; gap: .5rem; text-decoration: none; }
        .sidebar-footer a:hover { color: #fca5a5; }
        .main { margin-left: var(--sidebar); padding: 1.75rem 2rem; min-height: 100vh; }
        .page-header { margin-bottom: 1.5rem; }
        .stat-card { border: none; border-radius: 14px; box-shadow: 0 1px 8px rgba(0,0,0,.07); }
        .stat-card:hover { transform: translateY(-1px); transition: transform .15s; }
        .stat-card .icon-box { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
        .table-card { border: none; border-radius: 14px; box-shadow: 0 1px 8px rgba(0,0,0,.07); overflow: hidden; }
        .table thead th { background: #f9fafb; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; border-bottom: 1px solid #e5e7eb; font-weight: 600; padding: .6rem .75rem; }
        .table tbody td { vertical-align: middle; font-size: .875rem; }
        .badge { font-weight: 500; }
        .form-control:focus, .form-select:focus { border-color: #818cf8; box-shadow: 0 0 0 .2rem rgba(129,140,248,.25); }
        .btn-primary { background: #6366f1; border-color: #6366f1; }
        .btn-primary:hover { background: #4f46e5; border-color: #4f46e5; }
    </style>
</head>
<body>
<aside class="sidebar">
    <div class="sidebar-brand">
        <div class="fw-bold text-white" style="font-size:1.05rem">🤖 Fit Bot</div>
        <div class="text-muted" style="font-size:.7rem;margin-top:.1rem">Admin Panel</div>
    </div>
    <nav>
        <div class="text-muted px-3 pt-3 pb-1" style="font-size:.65rem;text-transform:uppercase;letter-spacing:.1em">Navigation</div>
        <a href="index.php"        class="nav-link <?= ($activePage??'')==='dashboard'   ?'active':'' ?>"><i class="bi bi-speedometer2"></i>Dashboard</a>
        <a href="users.php"        class="nav-link <?= ($activePage??'')==='users'        ?'active':'' ?>"><i class="bi bi-people"></i>Users</a>
        <a href="transactions.php" class="nav-link <?= ($activePage??'')==='transactions' ?'active':'' ?>"><i class="bi bi-credit-card"></i>Transactions</a>
        <a href="broadcast.php"    class="nav-link <?= ($activePage??'')==='broadcast'    ?'active':'' ?>"><i class="bi bi-megaphone"></i>Broadcast</a>
        <a href="subscriptions.php" class="nav-link <?= ($activePage??'')==='subscriptions' ?'active':'' ?>"><i class="bi bi-star"></i>Subscriptions</a>
        <a href="settings.php"     class="nav-link <?= ($activePage??'')==='settings'     ?'active':'' ?>"><i class="bi bi-gear"></i>Settings</a>
    </nav>
    <div class="sidebar-footer">
        <a href="logout.php"><i class="bi bi-box-arrow-left"></i>Logout</a>
    </div>
</aside>
<main class="main">
