<!-- DESKTOP SIDEBAR -->
<nav id="sidebar">
    <ul class="components">
        <!-- Dashboard -->
        <li class="<?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>">
            <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? '../index.php' : 'index.php'; ?>">
                <i class="fas fa-tachometer-alt"></i> Dashboard
            </a>
        </li>
        
        <!-- ========== FUEL MANAGEMENT (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-gas-pump"></i> FUEL MANAGEMENT
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'fuel_types.php' : 'pages/fuel_types.php'; ?>"><i class="fas fa-oil-can"></i> Fuel Types</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'tanks.php' : 'pages/tanks.php'; ?>"><i class="fas fa-tachometer-alt"></i> Tank Management</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'tank_closing_report.php' : 'pages/tank_closing_report.php'; ?>"><i class="fas fa-chart-line"></i> Tank Closing Report</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'purchases.php' : 'pages/purchases.php'; ?>"><i class="fas fa-shopping-cart"></i> Fuel Purchase</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'calibration_data.php' : 'pages/calibration_data.php'; ?>"><i class="fas fa-chart-line"></i> Add Calibration</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'dip_readings.php' : 'pages/dip_readings.php'; ?>"><i class="fas fa-tape"></i> Dip Readings</a></li>
            </ul>
        </li>
        
        <!-- ========== LUBE MANAGEMENT (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-oil-can"></i> LUBE MANAGEMENT
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_products.php' : 'pages/lube_products.php'; ?>"><i class="fas fa-boxes"></i> Lube Products</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_purchase.php' : 'pages/lube_purchase.php'; ?>"><i class="fas fa-shopping-cart"></i> Lube Purchase</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_sales.php' : 'pages/lube_sales.php'; ?>"><i class="fas fa-cash-register"></i> Lube POS</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_stock.php' : 'pages/lube_stock.php'; ?>"><i class="fas fa-chart-line"></i> Lube Stock</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_reports.php' : 'pages/lube_reports.php'; ?>"><i class="fas fa-chart-bar"></i> Lube Reports</a></li>
            </ul>
        </li>
        
        <!-- ========== SHIFT & SALES (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-clock"></i> SHIFT & SALES
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'nozzles.php' : 'pages/nozzles.php'; ?>"><i class="fas fa-oil-can"></i> Nozzles</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'shift_open.php' : 'pages/shift_open.php'; ?>"><i class="fas fa-door-open"></i> Shift Open</a></li>
            </ul>
        </li>
        
        <!-- ========== SUPPLIER MANAGEMENT (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-truck"></i> SUPPLIER MANAGEMENT
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'suppliers.php' : 'pages/suppliers.php'; ?>"><i class="fas fa-truck"></i> Suppliers</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'supplier_payments.php' : 'pages/supplier_payments.php'; ?>"><i class="fas fa-hand-holding-usd"></i> Supplier Payments</a></li>
                <li>
                    <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'supplier_closing_report.php' : 'pages/supplier_closing_report.php'; ?>">
                        <i class="fas fa-file-invoice"></i> Supplier Closing Report
                    </a>
                </li>
                <!--<li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'supplier_ledger.php' : 'pages/supplier_ledger.php'; ?>"><i class="fas fa-book"></i> Supplier Ledger</a></li>-->
            </ul>
        </li>
        <!-- ========== FINANCIAL & LEDGER (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-file-invoice-dollar"></i> FINANCIAL & LEDGER
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'expenses.php' : 'pages/expenses.php'; ?>"><i class="fas fa-file-invoice-dollar"></i> Expenses</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'customers.php' : 'pages/customers.php'; ?>"><i class="fas fa-users"></i> Customers</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'credit_sales.php' : 'pages/credit_sales.php'; ?>"><i class="fas fa-shopping-cart"></i> Credit Sales</a></li>
                <!-- NEW: Credit Sales Report -->
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'credit_sales_report.php' : 'pages/credit_sales_report.php'; ?>"><i class="fas fa-file-alt"></i> Credit Sales Report</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'customer_receiving.php' : 'pages/customer_receiving.php'; ?>"><i class="fas fa-hand-holding-usd"></i> Customer Receiving</a></li>
                
                <!-- ========== NEW: MANUAL ENTRY LINK ========== -->
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'manual_entries_list.php' : 'pages/manual_entries_list.php'; ?>"><i class="fas fa-pen-alt"></i> Manual Entries</a></li>
                <!-- ========== END MANUAL ENTRY LINK ========== -->
                
                <!--<li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'customer_advance.php' : 'pages/customer_advance.php'; ?>"><i class="fas fa-money-bill-wave"></i> Customer Advance</a></li>-->
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'customer_closing_report.php' : 'pages/customer_closing_report.php'; ?>"><i class="fas fa-file-invoice"></i> Customer Closing</a></li>
                <!--<li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'customer_ledger.php' : 'pages/customer_ledger.php'; ?>"><i class="fas fa-book"></i> Customer Ledger</a></li>-->
            </ul>
        </li>
        
        <!-- ========== EMPLOYEE MANAGEMENT (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-users"></i> EMPLOYEE MANAGEMENT
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'employees.php' : 'pages/employees.php'; ?>"><i class="fas fa-user-plus"></i> Employees List</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'employee_ledger_report.php' : 'pages/employee_ledger_report.php'; ?>"><i class="fas fa-chart-bar"></i> Ledger Report</a></li>
            </ul>
        </li>
        
        <!-- ========== GENERAL PARTY LEDGER (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-address-book"></i> GENERAL PARTY LEDGER
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'general_parties.php' : 'pages/general_parties.php'; ?>"><i class="fas fa-plus-circle"></i> Add General Party</a></li>
                <!--<li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'general_parties.php' : 'pages/general_parties.php'; ?>"><i class="fas fa-eye"></i> View General Parties</a></li>-->
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'gp_closing_report.php' : 'pages/gp_closing_report.php'; ?>"><i class="fas fa-file-invoice"></i> GP Closing Report</a></li>
            </ul>
        </li>
        
        <!-- ========== BANK MANAGEMENT (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-university"></i> BANK MANAGEMENT
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'bank_accounts.php' : 'pages/bank_accounts.php'; ?>"><i class="fas fa-plus-circle"></i> Bank Accounts</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'bank_book.php' : 'pages/bank_book.php'; ?>"><i class="fas fa-book"></i> Bank Book</a></li>
            </ul>
        </li>
        
        <!-- ========== REPORTS (Dropdown) ========== -->
        <li class="nav-item-dropdown">
            <a href="#" class="dropdown-toggle">
                <i class="fas fa-chart-bar"></i> REPORTS
                <i class="fas fa-chevron-down arrow"></i>
            </a>
            <ul class="dropdown-menu-list">
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'sales_report.php' : 'pages/sales_report.php'; ?>"><i class="fas fa-chart-line"></i> Sales Report</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'cash_book.php' : 'pages/cash_book.php'; ?>"><i class="fas fa-book"></i> Cash Book</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_reports.php' : 'pages/lube_reports.php'; ?>"><i class="fas fa-chart-bar"></i> Lube Report</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'profit_loss_report.php' : 'pages/profit_loss_report.php'; ?>"><i class="fas fa-chart-bar"></i> Profit & Loss</a></li>
                <li><a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'expense_closing_report.php' : 'pages/expense_closing_report.php'; ?>"><i class="fas fa-chart-bar"></i> Expense Report</a></li>
                <li>
                    <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'cashbook_closing_report.php' : 'pages/cashbook_closing_report.php'; ?>">
                        <i class="fas fa-book"></i> Cash Book Closing
                    </a>
                </li>
                <li>
                    <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'rate_revision.php' : 'pages/rate_revision.php'; ?>">
                        <i class="fas fa-chart-line"></i> Rate Gain/Loss
                    </a>
                </li>
                <!-- NEW: Rate Revision Report -->
                <li>
                    <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'rate_revision_report.php' : 'pages/rate_revision_report.php'; ?>">
                        <i class="fas fa-file-alt"></i> Rate Revision Report
                    </a>
                </li>
            </ul>
        </li>
                
        <!-- Logout -->
        <li class="logout-item">
            <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? '../logout.php' : 'logout.php'; ?>">
                <i class="fas fa-sign-out-alt"></i> Logout
            </a>
        </li>
        
    </ul>
</nav>
<!-- END OF DESKTOP SIDEBAR -->

<!-- MOBILE BOTTOM NAVBAR -->
<div class="mobile-bottom-nav">
    <div class="nav-items">
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? '../index.php' : 'index.php'; ?>" class="nav-item">
            <i class="fas fa-tachometer-alt"></i>
            <span>Home</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'fuel_types.php' : 'pages/fuel_types.php'; ?>" class="nav-item">
            <i class="fas fa-gas-pump"></i>
            <span>Fuel</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'lube_sales.php' : 'pages/lube_sales.php'; ?>" class="nav-item">
            <i class="fas fa-cash-register"></i>
            <span>POS</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'suppliers.php' : 'pages/suppliers.php'; ?>" class="nav-item">
            <i class="fas fa-truck"></i>
            <span>Suppliers</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'customers.php' : 'pages/customers.php'; ?>" class="nav-item">
            <i class="fas fa-users"></i>
            <span>Customers</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'cash_book.php' : 'pages/cash_book.php'; ?>" class="nav-item">
            <i class="fas fa-book"></i>
            <span>Cash</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? 'rate_revision.php' : 'pages/rate_revision.php'; ?>" class="nav-item">
            <i class="fas fa-chart-line"></i>
            <span>Rate</span>
        </a>
        <a href="<?php echo (strpos($_SERVER['PHP_SELF'], '/pages/') !== false) ? '../logout.php' : 'logout.php'; ?>" class="nav-item">
            <i class="fas fa-sign-out-alt"></i>
            <span>Exit</span>
        </a>
    </div>
</div>
<!-- END OF MOBILE BOTTOM NAVBAR -->

<div id="content">
    <div class="top-header">
        <div class="header-left">
            <button class="mobile-toggle" id="mobileToggle">
                <i class="fas fa-bars"></i>
            </button>
            <div class="header-logo">
                <img src="../assets/images/logo.jpeg" alt="Logo" onerror="this.style.display='none'">
                <div class="header-title">
                    <h4><i class="fas fa-gas-pump"></i> PETROL PUMP SOFTWARE</h4>
                    <p>Complete Fuel Station Management Solution</p>
                </div>
            </div>
        </div>
        <div class="header-right">
            <div class="user-profile">
                <i class="fas fa-user-circle"></i>
                <div class="user-details">
                    <span class="user-name"><?php echo isset($_SESSION['username']) ? $_SESSION['username'] : 'Guest'; ?></span>
                    <span class="user-role"><?php echo isset($_SESSION['role']) ? $_SESSION['role'] : 'Administrator'; ?></span>
                </div>
            </div>
        </div>
    </div>
    <div class="content-wrapper">