LIVEXWIN PLATFORM — COMPLETE PRODUCTION SETUP & UPDATE GUIDE
==============================================================

1. OVERVIEW & BRANDING
- Platform & Domain: LIVEXWIN (livexwin.com)
- Android Official APK Path: /Livexwin.apk (2-inch bottom download popup displayed automatically on Android devices)
- Homepage Game Display: 12 games in Slot category and 12 games in Fishing category, rendered in a 3-column mobile / 6-column desktop grid.
- No Demo Users or Demo Admins: The platform starts clean without any hardcoded demo accounts or passwords.

2. DATABASE & CONFIGURATION
- Database credentials are loaded from environment variables (LIVEXWIN_DB_HOST, LIVEXWIN_DB_NAME, LIVEXWIN_DB_USER, LIVEXWIN_DB_PASS) or from website/config.local.php created by website/install.php.
- Automatic Table Bootstrap: On connection, website/config.php automatically ensures all required MySQL tables exist (users, wallets, deposits, withdrawals, user_payment_methods, reward_wallets, reward_events, reward_items, payment_modules, provider_logos, games, promotions, support_keywords, system_settings, game_provider_configs).
- First User / Admin Setup: Run website/install.php once to create your MySQL schema and Master Admin account, then delete install.php. Alternatively, if no admin exists in the users table, the very first user registered becomes the Master Admin.
- No IP Whitelist Requirement: Admin authentication relies on secure session verification, password_verify() hashing, CSRF tokens, and brute-force rate limiting (no IP restriction).

3. RAPIDAPI 50+ ALL-IN-ONE CASINO HUB
- Admin Panel -> API Hub manages the RapidAPI 50+ All-in-One Casino Aggregator (live-casino-slots-evolution-jili-and-50-plus-provider.p.rapidapi.com).
- From Admin Panel -> API Hub, you can:
  1) Save your x-rapidapi-key and host.
  2) Test API Connection (rapidapi_test_connection).
  3) Load Available Providers (rapidapi_get_providers).
  4) One-Click Sync Provider Games into the lobby (rapidapi_sync_games).

4. REBATE, RECOVERY FUND & BONUS SYSTEM
- Standardized Rates:
  * Rebate: 5 BDT per 1,000 BDT wagered (auto-calculated from verified round callbacks).
  * Recovery Fund: 30 BDT per 1,000 BDT net loss (auto-calculated from verified round callbacks, plus manual/admin bonus rewards).
- User Menu Display: Shown under a single unified category "Rebate, Recovery & Bonus" with a numeric badge (1, 2, 3) indicating how many reward buckets are ready to collect. Rate ratios are not shown on the user interface.
- Cycle Rule: Each reward bucket (Rebate, Recovery Fund, Bonus) can be collected once per play/loss cycle. The cycle resets ONLY when a new deposit is approved by the Admin.
- Signed Callbacks: callback.php and website/provider_callback.php require POST + valid X-Livexwin-Signature (HMAC-SHA256 using provider_callback_secret) and run inside an atomic MySQL transaction with SELECT ... FOR UPDATE.

5. PAYMENT METHODS & /modules PAYMENT GATEWAY
- Supported Payment Methods: bKash, Nagad, Rocket, Upay, and Bank.
- Custom Logos: Upload or paste custom logo URLs for bKash, Nagad, Rocket, Upay, and Bank in the Admin Panel.
- /modules Payment Gateway Folder: Upload PHP gateway modules into /modules (or via Admin Panel -> Payment Modules), toggle modules ON/OFF, and toggle Manual Payment ON/OFF.
- SERVERXPAY Number Manager (/serverxpay/index.php): Admin-protected gateway number manager with deterministic round-robin number rotation for public deposit lookups.

6. WITHDRAWAL & PROFILE FEATURES
- Profile Settings: Users can set/update Full Name, Mobile Number, Email, and 6-Digit Withdrawal PIN.
- User Withdrawal Cancellation: Users can cancel their own pending withdrawal requests (instantly refunding their main wallet balance).
- Admin Rejection Reason: When rejecting a withdrawal in the Admin Panel, the admin can write a custom rejection reason which is shown to the user in their withdrawal history.
