<?php
// admin/header.php
// Check if user is admin using admin session
if (!isset($_SESSION['admin_id']) || !isset($_SESSION['admin_role']) || $_SESSION['admin_role'] !== 'admin') {
    header('Location: login.php');
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Admin Panel - SellBazar</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    <link rel="stylesheet" href="../assets/css/style.css">
    <style>
        /* ========================================
           ADMIN PANEL - COMPLETE RESPONSIVE STYLES
           ======================================== */
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #f1f5f9;
            overflow-x: hidden;
        }

        /* ===== ADMIN WRAPPER ===== */
        .admin-wrapper {
            display: flex;
            min-height: 100vh;
            background: #f1f5f9;
        }

        /* ========================================
           DESKTOP SIDEBAR (Always Visible)
           ======================================== */
        .admin-sidebar {
            width: 260px;
            background: #0f172a;
            color: #fff;
            padding: 15px 0;
            min-height: 100vh;
            flex-shrink: 0;
            position: sticky;
            top: 0;
            height: 100vh;
            overflow-y: auto;
            overflow-x: hidden;
            z-index: 1050;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        }

        .admin-sidebar::-webkit-scrollbar {
            width: 4px;
        }

        .admin-sidebar::-webkit-scrollbar-thumb {
            background: #475569;
            border-radius: 10px;
        }

        .admin-sidebar::-webkit-scrollbar-track {
            background: transparent;
        }

        /* Sidebar Brand */
        .admin-sidebar .brand {
            text-align: center;
            padding: 15px 15px 15px;
            border-bottom: 1px solid rgba(255,255,255,0.08);
            margin-bottom: 15px;
        }

        .admin-sidebar .brand h4 {
            color: #fff;
            font-weight: 700;
            font-size: 20px;
            margin: 0;
        }

        .admin-sidebar .brand h4 span {
            color: #047dc3;
        }

        .admin-sidebar .brand small {
            color: #ffffff;
            font-size: 11px;
            display: block;
            margin-top: 2px;
        }

        /* Sidebar Close Button (Mobile Only) */
        .sidebar-close {
            display: none;
            position: absolute;
            top: 12px;
            right: 15px;
            background: none;
            border: none;
            color: #94a3b8;
            font-size: 22px;
            cursor: pointer;
            transition: all 0.3s ease;
            padding: 5px;
        }

        .sidebar-close:hover {
            color: #fff;
            transform: rotate(90deg);
        }

        /* Sidebar Overlay (Mobile Only) */
        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 1040;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .sidebar-overlay.active {
            display: block;
            opacity: 1;
        }

        /* Sidebar Navigation Sections */
        .admin-sidebar .nav-section {
            padding: 8px 20px 4px;
            font-size: 15px;
            text-transform: uppercase;
            color: #64748b;
            letter-spacing: 0.8px;
            font-weight: 600;
        }

        .admin-sidebar .nav-link {
            color: #ffffff;
            padding: 10px 20px;
            border-radius: 0;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 14px;
            border-left: 3px solid transparent;
            text-decoration: none;
            cursor: pointer;
        }

        .admin-sidebar .nav-link:hover {
            color: #fff;
            background: rgba(255,255,255,0.05);
        }

        .admin-sidebar .nav-link.active {
            color: #fff;
            background: rgba(255,255,255,0.08);
            border-left-color: #047dc3;
        }

        .admin-sidebar .nav-link i {
            width: 20px;
            text-align: center;
            font-size: 16px;
            flex-shrink: 0;
        }

        .admin-sidebar .nav-link span {
            flex: 1;
        }

        /* Submenu */
        .admin-sidebar .nav-link.has-submenu {
            cursor: pointer;
        }

        .admin-sidebar .nav-link.has-submenu .submenu-arrow {
            margin-left: auto;
            transition: transform 0.3s ease;
            font-size: 12px;
        }

        .admin-sidebar .nav-link.has-submenu.open .submenu-arrow {
            transform: rotate(180deg);
        }

        .admin-sidebar .submenu {
            list-style: none;
            padding: 0;
            margin: 0;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease;
        }

        .admin-sidebar .submenu.open {
            max-height: 600px;
        }

        .admin-sidebar .submenu li a {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 20px 8px 55px;
            color: #94a3b8;
            font-size: 13px;
            transition: all 0.3s ease;
            text-decoration: none;
            border-left: 3px solid transparent;
        }

        .admin-sidebar .submenu li a:hover {
            color: #fff;
            background: rgba(255,255,255,0.05);
        }

        .admin-sidebar .submenu li a.active {
            color: #fff;
            background: rgba(255,255,255,0.08);
            border-left-color: #047dc3;
        }

        .admin-sidebar .submenu li a i {
            width: 18px;
            text-align: center;
            font-size: 13px;
            flex-shrink: 0;
        }

        /* Logout Button */
        .admin-sidebar .nav-link.logout {
            color: #f87171;
            border-top: 1px solid rgba(255,255,255,0.08);
            margin-top: 10px;
            padding-top: 15px;
        }

        .admin-sidebar .nav-link.logout:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
        }

        /* ===== SIDEBAR TOGGLE BUTTON (Mobile Only) ===== */
        .sidebar-toggle {
            display: none;
            position: fixed;
            top: 12px;
            left: 12px;
            z-index: 1060;
            background: #0f172a;
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 10px 12px;
            font-size: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        }

        .sidebar-toggle:hover {
            background: #047dc3;
        }

        /* ===== MAIN CONTENT ===== */
        .admin-content {
            flex: 1;
            padding: 20px 25px;
            min-height: 100vh;
            width: 100%;
            overflow-x: hidden;
        }

        /* ===== ADMIN HEADER ===== */
        .admin-header {
            background: #fff;
            padding: 12px 25px;
            border-radius: 12px;
            margin-bottom: 25px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
            flex-wrap: wrap;
            gap: 10px;
        }

        .admin-header .page-title {
            font-size: 18px;
            font-weight: 600;
            color: #0f172a;
            margin: 0;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .admin-header .page-title .mobile-menu-btn {
            display: none;
            background: none;
            border: none;
            font-size: 20px;
            color: #0f172a;
            cursor: pointer;
            padding: 0;
        }

        .admin-header .user-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .admin-header .user-info span {
            font-size: 14px;
            color: #1e293b;
        }

        .admin-header .user-info .avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: #047dc3;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 14px;
            flex-shrink: 0;
        }

        /* ===== ADMIN CARDS ===== */
        .admin-card {
            background: #fff;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
            margin-bottom: 20px;
            overflow-x: auto;
        }

        .admin-card .card-title {
            font-weight: 600;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #f1f5f9;
            font-size: 16px;
        }

        /* ===== STAT CARDS ===== */
        .stat-card {
            background: #fff;
            border-radius: 12px;
            padding: 18px 20px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
            text-align: center;
            transition: all 0.3s ease;
            height: 100%;
        }

        .stat-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }

        .stat-card .stat-icon {
            font-size: 28px;
            margin-bottom: 8px;
        }

        .stat-card .stat-number {
            font-size: 24px;
            font-weight: 700;
            color: #0f172a;
        }

        .stat-card .stat-label {
            font-size: 13px;
            color: #64748b;
            margin-top: 2px;
        }

        /* ===== TABLES ===== */
        .table-responsive {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .table {
            min-width: 600px;
            width: 100%;
            margin-bottom: 0;
        }

        .table th,
        .table td {
            padding: 10px 12px;
            font-size: 13px;
            white-space: nowrap;
            vertical-align: middle;
        }

        .table th {
            font-weight: 600;
            color: #475569;
            background: #f8fafc;
            border-bottom: 2px solid #e2e8f0;
        }

        .table td {
            border-bottom: 1px solid #e2e8f0;
        }

        .table tbody tr:hover {
            background: #f8fafc;
        }

        /* ===== ACCOUNT NAV ===== */
        .account-nav {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 20px;
            padding: 12px 15px;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        }

        .account-nav a {
            padding: 6px 14px;
            border-radius: 6px;
            color: #64748b;
            text-decoration: none;
            font-size: 13px;
            transition: all 0.3s ease;
            white-space: nowrap;
        }

        .account-nav a:hover,
        .account-nav a.active {
            background: #047dc3;
            color: #fff;
        }

        /* ========================================
           RESPONSIVE BREAKPOINTS
           ======================================== */

        /* ===== DESKTOP (Default) ===== */
        /* Sidebar is always visible */

        /* ===== TABLET & SMALL LAPTOP ===== */
        @media (max-width: 1024px) {
            .admin-content {
                padding: 15px 18px;
            }
            
            .admin-header {
                padding: 10px 18px;
            }
            
            .stat-card .stat-number {
                font-size: 20px;
            }
        }

        /* ===== MOBILE (<= 768px) ===== */
        @media (max-width: 768px) {
            /* Sidebar - Hidden by default, slide in */
            .admin-sidebar {
                position: fixed;
                top: 0;
                left: 0;
                height: 100vh;
                width: 280px;
                transform: translateX(-100%);
                box-shadow: 2px 0 20px rgba(0,0,0,0.3);
            }

            .admin-sidebar.open {
                transform: translateX(0);
            }

            .sidebar-close {
                display: block;
            }

            .sidebar-overlay.active {
                display: block;
            }

            .sidebar-toggle {
                display: block;
            }

            /* Main Content - Full width */
            .admin-content {
                padding: 12px 12px;
                padding-top: 65px;
                margin-left: 0 !important;
            }

            /* Admin Header */
            .admin-header {
                padding: 10px 15px;
                flex-direction: row;
                align-items: center;
                gap: 8px;
                flex-wrap: wrap;
            }

            .admin-header .page-title {
                font-size: 15px;
            }

            .admin-header .page-title .mobile-menu-btn {
                display: block;
            }

            .admin-header .user-info span {
                font-size: 13px;
            }

            .admin-header .user-info .avatar {
                width: 32px;
                height: 32px;
                font-size: 12px;
            }

            /* Cards */
            .admin-card {
                padding: 14px;
            }

            .admin-card .card-title {
                font-size: 14px;
            }

            /* Stat Cards */
            .stat-card {
                padding: 14px 16px;
            }

            .stat-card .stat-number {
                font-size: 18px;
            }

            .stat-card .stat-icon {
                font-size: 22px;
            }

            .stat-card .stat-label {
                font-size: 12px;
            }

            /* Tables */
            .table th,
            .table td {
                padding: 7px 10px;
                font-size: 12px;
            }

            .table {
                min-width: 500px;
            }

            /* Buttons */
            .btn {
                font-size: 12px;
                padding: 5px 12px;
            }

            .btn-sm {
                font-size: 11px;
                padding: 4px 8px;
            }

            /* Forms */
            .form-control {
                font-size: 14px;
                padding: 7px 12px;
            }

            .form-label {
                font-size: 13px;
            }

            /* Modals */
            .modal-dialog {
                margin: 10px;
            }

            .modal-body {
                padding: 15px;
            }

            .modal-header h5 {
                font-size: 16px;
            }

            /* Account Nav */
            .account-nav {
                padding: 8px 10px;
                gap: 4px;
                overflow-x: auto;
                flex-wrap: nowrap;
                -webkit-overflow-scrolling: touch;
            }

            .account-nav a {
                padding: 4px 10px;
                font-size: 12px;
                flex-shrink: 0;
            }

            /* Grid */
            .row.g-4 {
                --bs-gutter-y: 0.75rem;
                --bs-gutter-x: 0.75rem;
            }

            /* Invoice View */
            .invoice-header {
                flex-direction: column;
                text-align: center;
            }
            
            .invoice-header .invoice-title {
                text-align: center;
                margin-top: 10px;
            }
            
            .billing-grid {
                grid-template-columns: 1fr;
                gap: 15px;
            }
            
            .summary-box {
                max-width: 100%;
            }
        }

        /* ===== SMALL MOBILE (<= 480px) ===== */
        @media (max-width: 480px) {
            .admin-sidebar {
                width: 100%;
                max-width: 300px;
            }

            .admin-content {
                padding: 8px 8px;
                padding-top: 60px;
            }

            .admin-header {
                padding: 8px 12px;
            }

            .admin-header .page-title {
                font-size: 14px;
            }

            .admin-header .user-info span {
                font-size: 12px;
                display: none;
            }

            .admin-header .user-info .avatar {
                width: 28px;
                height: 28px;
                font-size: 11px;
            }

            .sidebar-toggle {
                top: 8px;
                left: 8px;
                padding: 7px 9px;
                font-size: 16px;
            }

            .stat-card .stat-number {
                font-size: 16px;
            }

            .stat-card .stat-label {
                font-size: 11px;
            }

            .table th,
            .table td {
                padding: 5px 8px;
                font-size: 11px;
            }

            .table {
                min-width: 400px;
            }

            .admin-card {
                padding: 10px 12px;
            }

            .account-nav a {
                padding: 3px 8px;
                font-size: 11px;
            }

            .btn {
                font-size: 11px;
                padding: 4px 10px;
            }

            .btn-sm {
                font-size: 10px;
                padding: 3px 6px;
            }

            .modal-body {
                padding: 12px;
            }
        }

        /* ===== UTILITY CLASSES ===== */
        .text-truncate-mobile {
            max-width: 120px;
            display: inline-block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        @media (max-width: 768px) {
            .text-truncate-mobile {
                max-width: 80px;
            }
        }

        @media (max-width: 480px) {
            .text-truncate-mobile {
                max-width: 60px;
            }
        }

        /* ===== PRINT STYLES ===== */
        @media print {
            .admin-sidebar,
            .sidebar-toggle,
            .sidebar-overlay,
            .admin-header .page-title .mobile-menu-btn,
            .no-print {
                display: none !important;
            }

            .admin-content {
                padding: 20px !important;
                margin-left: 0 !important;
            }

            .admin-card {
                box-shadow: none !important;
                border: 1px solid #e2e8f0 !important;
            }

            .stat-card {
                box-shadow: none !important;
                border: 1px solid #e2e8f0 !important;
            }
        }
    </style>
</head>
<body>

<!-- ===== SIDEBAR OVERLAY (Mobile Only) ===== -->
<div class="sidebar-overlay" id="sidebarOverlay" onclick="closeSidebar()"></div>

<!-- ===== SIDEBAR TOGGLE BUTTON (Mobile Only) ===== -->
<button class="sidebar-toggle" id="sidebarToggle" onclick="toggleSidebar()" aria-label="Toggle Sidebar">
    <i class="fa-solid fa-bars"></i>
</button>

<div class="admin-wrapper">
    <!-- ===== SIDEBAR ===== -->
    <div class="admin-sidebar" id="adminSidebar">
        <!-- Close Button (Mobile Only) -->
        <button class="sidebar-close" onclick="closeSidebar()" aria-label="Close Sidebar">
            <i class="fa-solid fa-xmark"></i>
        </button>

        <div class="brand">
            <h4>Sell<span>Bazar</span></h4>
            <small>Admin Panel</small>
        </div>

        <nav class="nav flex-column">
            <!-- Dashboard -->
            <a href="/Admin/index.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>">
                <i class="fa-solid fa-dashboard"></i>
                <span>Dashboard</span>
            </a>

            <!-- Products Section -->
            <div class="nav-section">Products</div>
            <a href="/Admin/products.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['products.php', 'add-product.php', 'edit-product.php']) ? 'active' : ''; ?>">
                <i class="fa-solid fa-box"></i>
                <span>Products</span>
            </a>
            <a href="/Admin/categories.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['categories.php', 'add-category.php', 'edit-category.php']) ? 'active' : ''; ?>">
                <i class="fa-solid fa-tags"></i>
                <span>Categories</span>
            </a>
<a href="/admin/inventory.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['inventory.php', 'inventory-movement.php', 'low-stock.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-warehouse"></i>
    <span>Inventory</span>
</a>
            <!-- Orders Section -->
            <div class="nav-section">Orders</div>
<a href="/admin/orders.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['orders.php', 'order-details.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-shopping-cart"></i>
    <span>Orders</span>
</a>
<a href="/admin/shipments.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['shipments.php', 'add-shipment.php', 'edit-shipment.php', 'view-shipment.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-truck"></i>
    <span>Shipments</span>
</a>
<a href="/admin/couriers.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['couriers.php', 'add-courier.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-people-carry-box"></i>
    <span>Couriers Service List</span>
</a>
<a href="/admin/delivery-reports.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['delivery-reports.php', 'add-delivery-report.php', 'edit-delivery-report.php', 'view-delivery-report.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-clipboard-list"></i>
    <span>Delivery Reports</span>
</a>
<a href="/admin/delivery-agents.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['delivery-agents.php', 'add-delivery-agent.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-user-tie"></i>
    <span>Delivery Agents</span>
</a>

<!-- Customers Section -->
<div class="nav-section">Customers</div>
<a href="/admin/customers.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'customers.php' ? 'active' : ''; ?>">
    <i class="fa-solid fa-users"></i>
    <span>Customers</span>
</a>
            <!-- Accounts Section -->
            <div class="nav-section">Accounts</div>

            <!-- Accounts Dropdown -->
            <a href="javascript:void(0)" class="nav-link has-submenu <?php echo strpos($_SERVER['PHP_SELF'], 'accounts/') !== false ? 'open active' : ''; ?>" onclick="toggleSubmenu(this)">
                <i class="fa-solid fa-coins"></i>
                <span>Accounting</span>
                <i class="fa-solid fa-chevron-down submenu-arrow"></i>
            </a>
            <ul class="submenu <?php echo strpos($_SERVER['PHP_SELF'], 'accounts/') !== false ? 'open' : ''; ?>">
                <li>
                    <a href="/Admin/accounts/dashboard.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'dashboard.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-chart-pie"></i>
                        <span>Dashboard</span>
                    </a>
                </li>
                <li>
    <a href="/Admin/accounts/bank-accounts.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'bank-accounts.php' ? 'active' : ''; ?>">
        <i class="fa-solid fa-university"></i>
        <span>Bank Accounts</span>
    </a>
</li>
<li>
    <a href="/Admin/accounts/deposits.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'deposits.php' ? 'active' : ''; ?>">
        <i class="fa-solid fa-arrow-down"></i>
        <span>Deposits</span>
    </a>
</li>
<li>
    <a href="/Admin/accounts/withdrawals.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'withdrawals.php' ? 'active' : ''; ?>">
        <i class="fa-solid fa-arrow-up"></i>
        <span>Withdrawals</span>
    </a>
</li>
                <li>
                    <a href="/Admin/accounts/income.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'income.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-arrow-down"></i>
                        <span>Income</span>
                    </a>
                </li>
                <li>
                    <a href="/Admin/accounts/expenses.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'expenses.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-arrow-up"></i>
                        <span>Expenses</span>
                    </a>
                </li>
                <li>
                    <a href="/Admin/accounts/invoices.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'invoices.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-file-invoice"></i>
                        <span>Invoices</span>
                    </a>
                </li>
                <li>
                    <a href="/Admin/accounts/purchase-orders.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'purchase-orders.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-file-purchase"></i>
                        <span>Purchase Orders</span>
                    </a>
                </li>
                <li>
                    <a href="/Admin/accounts/po-payments.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'po-payments.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-hand-holding-dollar"></i>
                        <span>PO Payments</span>
                    </a>
                </li>
                <li>
                    <a href="/Admin/accounts/vendors.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'vendors.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-building"></i>
                        <span>Supplier</span>
                    </a>
                </li>
                <li>
                    <a href="/admin/accounts/transactions.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'transactions.php' ? 'active' : ''; ?>">
            <i class="fa-solid fa-arrow-right-arrow-left"></i>
            <span>Transactions</span>
        </a>
    </li>
    <li>
                    <a href="/Admin/accounts/reports.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'reports.php' ? 'active' : ''; ?>">
                        <i class="fa-solid fa-chart-bar"></i>
                        <span>Reports</span>
                    </a>
                </li>
            </ul>

            <!-- Users Section -->
            <div class="nav-section">Users</div>
             <a href="/admin/users.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'users.php' ? 'active' : ''; ?>">
             <i class="fa-solid fa-users"></i>
              <span>Users</span>
                  </a>
             <a href="/admin/employees.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['employees.php', 'add-employee.php', 'edit-employee.php', 'view-employee.php']) ? 'active' : ''; ?>">
             <i class="fa-solid fa-user-tie"></i>
            <span>Employees</span>
        </a>
             <a href="/admin/employee-attendance.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'employee-attendance.php' ? 'active' : ''; ?>">
    <i class="fa-solid fa-clock"></i>
    <span>Attendance</span>
</a>
          <a href="/admin/employee-leaves.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'employee-leaves.php' ? 'active' : ''; ?>">
         <i class="fa-solid fa-calendar-check"></i>
        <span>Leaves</span>
           </a>
        <a href="/admin/employee-salaries.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'employee-salaries.php' ? 'active' : ''; ?>">
    <i class="fa-solid fa-money-bill-wave"></i>
    <span>Salaries</span>
    </a>
            <!-- Settings -->
            <div class="nav-section">Settings</div>
            <a href="/Admin/settings.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'settings.php' ? 'active' : ''; ?>">
                <i class="fa-solid fa-cog"></i>
                <span>Settings</span>
            </a>
<!-- In admin/header.php, add under Products section -->
<div class="nav-section">Content</div>
<a href="/admin/banners.php" class="nav-link <?php echo in_array(basename($_SERVER['PHP_SELF']), ['banners.php', 'add-banner.php', 'edit-banner.php']) ? 'active' : ''; ?>">
    <i class="fa-solid fa-images"></i>
    <span>Banners</span>
</a>
            <hr class="border-light my-2">

            <!-- View Site -->
            <a href="../index.php" class="nav-link" target="_blank">
                <i class="fa-solid fa-globe"></i>
                <span>View Site</span>
            </a>

            <!-- Logout -->
            <a href="/Admin/logout.php" class="nav-link logout">
                <i class="fa-solid fa-sign-out-alt"></i>
                <span>Logout</span>
            </a>

             <!-- Teacher Panel Link -->
<a href="../admin/reset-password.php" target="_blank" class="<?php echo $current_page == 'reset-password.php' ? 'active' : ''; ?>">
    <i class="fas fa-chalkboard-teacher"></i>
    <span class="nav-text">👨‍🏫 Reset Password</span>
</a>
        </nav>
    </div>

    <!-- ===== MAIN CONTENT ===== -->
    <div class="admin-content">
        <!-- Admin Header -->
        <div class="admin-header">
            <div class="page-title">
                <button class="mobile-menu-btn" onclick="toggleSidebar()" aria-label="Toggle Sidebar">
                    <i class="fa-solid fa-bars"></i>
                </button>
                <?php echo ucfirst(str_replace('.php', '', basename($_SERVER['PHP_SELF']))); ?>
            </div>
            <div class="user-info">
                <span><?php echo $_SESSION['admin_name'] ?? 'Admin'; ?></span>
                <div class="avatar"><?php echo strtoupper(substr($_SESSION['admin_name'] ?? 'A', 0, 1)); ?></div>
            </div>
        </div>
<div class="nav-section">Marketing</div>
<a href="facebook-test.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'facebook-test.php' ? 'active' : ''; ?>">
    <i class="fa-brands fa-facebook"></i>
    <span>Facebook Pixel</span>
</a>
        <!-- Page Content Starts Here -->