<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>PBM DATA HUB</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css">
    <script src="https://js.paystack.co/v1/inline.js"></script>
    <style>
        body {
            font-family: 'Poppins', sans-serif;
        }
        .spinner {
            width: 100px;
            height: 100px;
            background-image: url('https://media.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif');
            background-size: contain;
            background-repeat: no-repeat;
            animation: spin 2s linear infinite;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .btn-hover:hover {
            filter: brightness(110%);
            transform: translateY(-1px);
            transition: all 0.2s ease;
        }
        .active-nav {
            background-color: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
        }
        @media (max-width: 640px) {
            .text-sm { font-size: 0.75rem; }
            .text-base { font-size: 0.875rem; }
            .text-lg { font-size: 1rem; }
            .text-xl { font-size: 1.125rem; }
            .text-2xl { font-size: 1.25rem; }
        }
    </style>
</head>
<body class="bg-gray-900 flex flex-col items-center justify-between min-h-screen text-sm sm:text-base">
    <!-- Navbar -->
    <nav class="bg-gray-800 w-full py-2 sm:py-4 flex justify-center items-center fixed top-0 z-10">
        <h1 class="text-yellow-400 text-lg sm:text-xl font-bold"><span class="material-icons mr-1 align-middle text-base sm:text-lg">bolt</span>PBM DATA HUB</h1>
    </nav>

    <!-- Main Content -->
    <div id="main-content" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4 hidden">
        <!-- Home Section -->
        <div id="home-section" class="hidden">
            <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3"><span class="material-icons mr-1 align-middle">home</span>Home</h2>
            <div id="user-greeting" class="text-yellow-400 text-lg mb-4"></div>
            <div class="grid grid-cols-2 gap-4 mb-6">
                <div class="bg-gray-700 p-3 rounded">
                    <p class="text-gray-300 text-sm">Total Spent</p>
                    <p id="total-spent" class="text-white text-lg font-semibold"></p>
                </div>
                <div class="bg-gray-700 p-3 rounded">
                    <p class="text-gray-300 text-sm">Orders Made</p>
                    <p id="orders-made" class="text-white text-lg font-semibold"></p>
                </div>
                <div class="bg-gray-700 p-3 rounded">
                    <p class="text-gray-300 text-sm">Data Activated</p>
                    <p id="data-activated" class="text-white text-lg font-semibold"></p>
                </div>
                <div class="bg-gray-700 p-3 rounded">
                    <p class="text-gray-300 text-sm">Last Order</p>
                    <p id="last-order" class="text-white text-lg font-semibold"></p>
                </div>
            </div>
            <div class="flex space-x-4">
                <button id="purchase-button" class="flex-1 bg-blue-500 text-white px-4 py-2 rounded text-sm btn-hover flex items-center justify-center">
                    <span class="material-icons mr-2">start</span>DATA OFFERS
                </button>
                <a href="agent.html"><button class="flex-1 bg-green-500 text-white px-4 py-2 rounded text-sm btn-hover flex items-center justify-center">
                    <span class="material-icons mr-2">support_agent</span>Agent Portal
                </button></a>
            </div>
        </div>

        <!-- Bundle Purchase Section -->
        <div id="bundle-purchase-section" class="hidden">
            <div class="flex items-center mb-3 sm:mb-4">
                <img src="https://storage.googleapis.com/a1aa/image/05S6wOFvzhqLJp5bN2mUJ44neY6ge1sDZrNMviWL3Bv3tifnA.jpg" alt="MTN logo" class="w-8 h-8 sm:w-10 sm:h-10 rounded-full" width="32" height="32"/>
                <h1 class="text-yellow-400 text-lg sm:text-xl font-bold ml-2">MTN OFFERS</h1>
            </div>
            <div class="bg-red-500 text-white p-2 rounded mb-3 sm:mb-4">
                <span class="material-icons mr-1 align-middle">info</span>
             Your bundle will arrive within the next 5 - 20 minutes after a purchase.
            </div>
            <div class="mb-3 sm:mb-4">
                <label for="phone-number" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">phone</span>PHONE NUMBER</label>
                <input type="text" id="phone-number" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter phone number"/>
            </div>
            <div class="mb-3 sm:mb-4">
                <label for="network" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">network_cell</span>NETWORK</label>
                <select id="network" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm">
                    <option value="">Select Network</option>
                    <option value="mtn">MTN</option>
                    <option value="at">AirtelTigo</option>
                </select>
            </div>
            <div id="bundle-volume-container"></div>
            <div style="margin-top: 10px;" id="bundle-price" class="mb-3 sm:mb-4 text-gray-300"></div>
            <div class="flex space-x-2">
                <button id="send-bundle" class="bg-red-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">send</span>Send Bundle</button>
            </div>
            <div id="loader" class="hidden mt-3 sm:mt-4 flex justify-center">
                <div class="spinner"></div>
            </div>
        </div>

        <!-- Order Receipt Section -->
        <div id="order-receipt" class="hidden bg-white text-gray-800 p-4 rounded-lg mt-4">
            <h3 class="text-xl font-semibold mb-2">Order Receipt</h3>
            <div id="receipt-content"></div>
        </div>
    </div>

    <!-- Bottom Bar Navigation -->
    <div class="bg-gray-800 w-full py-2 sm:py-4 flex justify-around items-center fixed bottom-0 z-10">
        <a href="#" id="home-icon" class="text-gray-400 hover:text-yellow-400 p-1 sm:p-2 flex flex-col items-center">
            <span class="material-icons text-lg sm:text-2xl">home</span>
            <span class="text-xs mt-1">Home</span>
        </a>
        <a href="#" id="data-icon" class="text-gray-400 hover:text-yellow-400 p-1 sm:p-2 flex flex-col items-center">
            <span class="material-icons text-lg sm:text-2xl">wifi</span>
            <span class="text-xs mt-1">Data</span>
        </a>
        <a href="#" id="profile-icon" class="text-gray-400 hover:text-yellow-400 p-1 sm:p-2 flex flex-col items-center">
            <span class="material-icons text-lg sm:text-2xl">person</span>
            <span class="text-xs mt-1">Profile</span>
        </a>
        <a href="#" id="orders-icon" class="text-gray-400 hover:text-yellow-400 p-1 sm:p-2 flex flex-col items-center">
            <span class="material-icons text-lg sm:text-2xl">inventory</span>
            <span class="text-xs mt-1">Orders</span>
        </a>
        <a href="#" id="agent-icon" class="text-gray-400 hover:text-yellow-400 p-1 sm:p-2 flex flex-col items-center">
            <span class="material-icons text-lg sm:text-2xl">support_agent</span>
            <span class="text-xs mt-1">Report</span>
        </a>
        <a href="#" id="logout" class="text-gray-400 hover:text-yellow-400 p-1 sm:p-2 flex flex-col items-center">
            <span class="material-icons text-lg sm:text-2xl">logout</span>
            <span class="text-xs mt-1">Logout</span>
        </a>
    </div>

    <!-- Login Page -->
    <div id="login-page" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4">
        <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3 sm:mb-4"><span class="material-icons mr-1 align-middle">login</span>Login</h2>
        <div class="mb-3 sm:mb-4">
            <label for="login-email" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">email</span>Email</label>
            <input type="email" id="login-email" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your email"/>
        </div>
        <div class="mb-3 sm:mb-4">
            <label for="login-password" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">lock</span>Password</label>
            <input type="password" id="login-password" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your password"/>
        </div>
        <div class="flex space-x-2">
            <button id="login-button" class="bg-green-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">login</span>Login</button>
            <button id="go-to-signup" class="bg-blue-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">person_add</span>Sign Up</button>
            <button id="go-to-reset" class="bg-yellow-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">key</span>Reset</button>
        </div>
    </div>

    <!-- Sign Up Page -->
    <div id="signup-page" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4 hidden">
        <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3 sm:mb-4"><span class="material-icons mr-1 align-middle">person_add</span>Sign Up</h2>
        <div class="mb-3 sm:mb-4">
            <label for="signup-name" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">person</span>Name</label>
            <input type="text" id="signup-name" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your name"/>
        </div>
        <div class="mb-3 sm:mb-4">
            <label for="signup-email" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">email</span>Email</label>
            <input type="email" id="signup-email" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your email"/>
        </div>
        <div class="mb-3 sm:mb-4">
            <label for="signup-phone" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">phone</span>Phone</label>
            <input type="tel" id="signup-phone" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your phone number"/>
        </div>
        <div class="mb-3 sm:mb-4">
            <label for="signup-password" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">lock</span>Password</label>
            <input type="password" id="signup-password" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your password"/>
        </div>
        <div class="mb-3 sm:mb-4">
            <label for="signup-confirm-password" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">lock</span>Confirm Password</label>
            <input type="password" id="signup-confirm-password" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Confirm your password"/>
        </div>
        <div class="flex space-x-2">
            <button id="signup-button" class="bg-green-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">person_add</span>Sign Up</button>
            <button id="go-to-login" class="bg-blue-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">login</span>Login</button>
        </div>
    </div>

    <!-- Reset Password Page -->
    <div id="reset-page" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4 hidden">
        <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3 sm:mb-4"><span class="material-icons mr-1 align-middle">key</span>Reset Password</h2>
        <div class="mb-3 sm:mb-4">
            <label for="reset-email" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">email</span>Email</label>
            <input type="email" id="reset-email" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your email"/>
        </div>
        <div class="flex space-x-2">
            <button id="reset-button" class="bg-yellow-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">key</span>Reset</button>
            <button id="go-to-login-from-reset" class="bg-blue-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">arrow_back</span>Back</button>
        </div>
    </div>

    <script>
        var s=document.createElement('script');s.src='pathenv.js';s.type='module';document.body.appendChild(s);
    </script>

    <!-- Profile Page -->
    <div id="profile-page" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4 hidden">
        <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3 sm:mb-4"><span class="material-icons mr-1 align-middle">person</span>Profile</h2>
        <div id="profile-info" class="text-gray-300 mb-4"></div>
        <div id="edit-profile" class="mt-3 sm:mt-4">
            <h3 class="text-white text-lg sm:text-xl font-semibold mb-2">Edit Profile</h3>
            <div class="mb-3 sm:mb-4">
                <label for="edit-name" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">person</span>Name</label>
                <input type="text" id="edit-name" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your name"/>
            </div>
            <div class="mb-3 sm:mb-4">
                <label for="edit-phone" class="block text-gray-400 mb-1 sm:mb-2"><span class="material-icons mr-1 align-middle text-sm">phone</span>Phone</label>
                <input type="tel" id="edit-phone" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" placeholder="Enter your phone number"/>
            </div>
            <button id="save-profile" class="bg-green-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">save</span>Save Changes</button>
            <p id="edit-count" class="text-gray-400 mt-2 text-xs">Edits remaining: 3</p>
        </div>
    </div>

    <!-- Orders Page -->
    <div id="orders-page" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4 hidden">
        <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3 sm:mb-4"><span class="material-icons mr-1 align-middle">inventory</span>Your Orders</h2>
        <div id="orders-list" class="text-gray-300 space-y-3 max-h-96 overflow-y-auto pr-2"></div>
    </div>

    <!-- Agent Page -->
    <div id="agent-page" class="bg-gray-800 p-4 sm:p-6 rounded-lg shadow-lg w-full max-w-md mt-14 sm:mt-20 mx-2 sm:mx-4 hidden">
        <h2 class="text-white text-xl sm:text-2xl font-semibold mb-3 sm:mb-4"><span class="material-icons mr-1 align-middle">support_agent</span>Agent Support</h2>
        <div class="text-gray-300 mb-4">
            <p>Need help? Contact our support team:</p>
            <p class="mt-2"><span class="material-icons mr-1 align-middle">phone</span>Phone: 054 608 2554</p>
            <p class="mt-2"><span class="material-icons mr-1 align-middle">email</span>Email: pdmdatahub@gmail.com</p>
        </div>
        <div class="mt-4">
            <h3 class="text-white text-lg font-semibold mb-2">Report to us</h3>
            <textarea id="support-message" class="w-full p-2 bg-gray-700 text-gray-300 rounded text-sm" rows="4" placeholder="You can report failed and delayed orders, Bugs or system issues!"></textarea>
            <button id="send-support-message" class="mt-2 bg-blue-500 text-white px-3 py-1 sm:px-4 sm:py-2 rounded text-xs sm:text-sm btn-hover"><span class="material-icons mr-1 align-middle text-sm">send</span>Send Message</button>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js"></script>
</body>
</html>

