╔════════════════════════════════════════════════════════════════════════════════╗
║                    🎯 ADMIN PANEL - QUICK REFERENCE CARD                        ║
╚════════════════════════════════════════════════════════════════════════════════╝

📍 ADMIN PAGES

1. MANAGE PLANS
   URL: localhost/extract/admin/subscription_plans.php
   ┌─────────────────────────────────────────────────────┐
   │ ✓ View all subscription plans                       │
   │ ✓ Create new plan (click "New Plan")                │
   │ ✓ Edit existing plan (click "Edit")                 │
   │ ✓ Delete plan (click "Delete")                      │
   │ ✓ See stats: Total Plans, Revenue, Users            │
   └─────────────────────────────────────────────────────┘

2. ADD TO USER
   URL: localhost/extract/admin/manage_subscriptions.php
   ┌─────────────────────────────────────────────────────┐
   │ ✓ Add subscription to user                          │
   │ ✓ Select user from dropdown                         │
   │ ✓ Select plan from dropdown                         │
   │ ✓ View available plans and prices                   │
   │ ✓ See plan details (duration, searches, price)      │
   └─────────────────────────────────────────────────────┘

3. SYSTEM CHECK
   URL: localhost/extract/admin_check.php
   ┌─────────────────────────────────────────────────────┐
   │ ✓ Verify all database tables                        │
   │ ✓ Check file existence                              │
   │ ✓ Quick links to admin pages                        │
   │ ✓ System status indicator                           │
   └─────────────────────────────────────────────────────┘

📋 FORM TEMPLATES

CREATE PLAN FORM:
┌─────────────────────────────────────────────────────┐
│ Field                 │ Example                      │
├─────────────────────────────────────────────────────┤
│ Plan Name             │ "7 Days Premium"             │
│ Duration (Days)       │ 7                            │
│ Search Limit          │ 20                           │
│ Price (₹)             │ 49.99                        │
│ Description           │ "7 days with 20 searches"   │
└─────────────────────────────────────────────────────┘

ADD SUBSCRIPTION FORM:
┌─────────────────────────────────────────────────────┐
│ Select User           │ (dropdown)                   │
│ Select Plan           │ (dropdown)                   │
└─────────────────────────────────────────────────────┘

🎨 COLOR SCHEME

Primary Color:    #007AFF (Blue)
Success:          #34C759 (Green)
Warning:          #FF9500 (Orange)
Danger:           #FF3B30 (Red)
Background:       #F5F7FA (Light Gray)
Text:             #1C1C1E (Dark)

💾 DATABASE TABLES

1. subscription_plans
   - id (Primary Key)
   - plan_name
   - duration_days
   - search_limit
   - price
   - description
   - is_active
   - created_at
   - updated_at

2. user_subscriptions
   - id (Primary Key)
   - user_id (Foreign Key)
   - plan_id (Foreign Key)
   - status (active/cancelled)
   - payment_status (pending/success)
   - start_date
   - end_date
   - search_used
   - created_at

3. free_trial_tracking
   - id (Primary Key)
   - user_id (Foreign Key)
   - trial_searches_limit
   - trial_searches_used
   - is_trial_active

4. subscription_history
   - id (Primary Key)
   - user_id (Foreign Key)
   - subscription_id
   - action
   - old_status
   - new_status
   - details (JSON)
   - created_at

🔧 TROUBLESHOOTING

PROBLEM: Modal doesn't open
SOLUTION: 
  1. Clear browser cache (Ctrl+Shift+Delete)
  2. Hard refresh page (Ctrl+F5)
  3. Try different browser
  4. Check browser console for errors

PROBLEM: Plans not saving
SOLUTION:
  1. Check browser console (F12)
  2. Verify all form fields are filled
  3. Check PHP error logs
  4. Ensure database connection works

PROBLEM: Can't see wallet balance
SOLUTION:
  1. Make sure you're logged in as user
  2. Check /user/wallet_sidebar.php exists
  3. Refresh page (Ctrl+F5)
  4. Check browser console

PROBLEM: Sidebar looks wrong
SOLUTION:
  1. Clear cache (Ctrl+Shift+Delete)
  2. Try different browser
  3. Check CSS is loaded (F12 > Network tab)

✨ FEATURES BY PAGE

┌──────────────────────────────────────────────────────┐
│ MANAGE PLANS (subscription_plans.php)                │
├──────────────────────────────────────────────────────┤
│ ✓ Dashboard with stats                               │
│ ✓ Table view of all plans                            │
│ ✓ Create Plan modal                                  │
│ ✓ Edit Plan modal                                    │
│ ✓ Delete Plan confirmation                           │
│ ✓ Success/Error messages                             │
│ ✓ Form validation                                    │
│ ✓ Sidebar navigation                                 │
└──────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────┐
│ ADD TO USER (manage_subscriptions.php)               │
├──────────────────────────────────────────────────────┤
│ ✓ User dropdown selector                             │
│ ✓ Plan dropdown selector                             │
│ ✓ Add button                                         │
│ ✓ Plans overview cards                               │
│ ✓ Success/Error messages                             │
│ ✓ Sidebar navigation                                 │
└──────────────────────────────────────────────────────┘

📊 DEFAULT PLANS

┌─────────────────────────────────────────────────────┐
│ Plan Name         │ Duration │ Searches │ Price    │
├─────────────────────────────────────────────────────┤
│ 7 Days Trial      │ 7 days   │ 20       │ ₹49.99   │
│ 30 Days Basic     │ 30 days  │ 100      │ ₹199.99  │
│ 90 Days Premium   │ 90 days  │ 500      │ ₹499.99  │
│ 365 Days Plus     │ 365 days │ 2000     │ ₹999.99  │
└─────────────────────────────────────────────────────┘

🎯 WORKFLOW EXAMPLES

EXAMPLE 1: Create a New Plan
1. Go to /admin/subscription_plans.php
2. Click "New Plan" button (top-right)
3. Fill in form:
   - Plan Name: "2 Days Trial"
   - Duration: 2
   - Search Limit: 10
   - Price: 25.00
   - Description: "Test plan"
4. Click "Create Plan"
5. See green success message
6. Plan appears in table below

EXAMPLE 2: Add Subscription to User
1. Go to /admin/manage_subscriptions.php
2. Select user: "John Doe"
3. Select plan: "7 Days Trial"
4. Click "Add Subscription"
5. See success message
6. User now has subscription

EXAMPLE 3: Edit Existing Plan
1. Go to /admin/subscription_plans.php
2. Find plan in table
3. Click "Edit" button
4. Modify fields (price, search limit, etc.)
5. Click "Update Plan"
6. See success message

EXAMPLE 4: Delete a Plan
1. Go to /admin/subscription_plans.php
2. Find plan in table
3. Click "Delete" button
4. Confirm deletion in popup
5. Plan is removed from table

📱 RESPONSIVE DESIGN

┌──────────────────────────────────────────────────────┐
│ DESKTOP (> 768px)                                    │
│ ├─ Sidebar (fixed, left) 240px                      │
│ └─ Main content (right) auto                        │
└──────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────┐
│ MOBILE (< 768px)                                     │
│ ├─ Sidebar (stacked, full width)                    │
│ └─ Main content (full width below)                  │
└──────────────────────────────────────────────────────┘

🔐 SECURITY

✓ Admin-only access (requires authentication)
✓ Input validation on all forms
✓ SQL injection protection (parameterized queries)
✓ XSS protection (htmlspecialchars)
✓ CSRF protection (session validation)
✓ Error messages don't expose system details

📞 GETTING HELP

1. Check /ADMIN_PANEL_COMPLETE.md for details
2. Visit /admin_check.php to verify system
3. Check browser console (F12) for errors
4. Look at PHP error logs
5. Try clearing cache and hard refresh (Ctrl+F5)

═════════════════════════════════════════════════════════════════════════════════
✅ LAST UPDATE: November 24, 2025 | STATUS: Ready for Production | VERSION: 1.0
═════════════════════════════════════════════════════════════════════════════════
