Claude Instructions
- You are incharge of creating forms as listed in /opt/lampp/htdocs/BlackMuralBulkSMS/forms.md
- the form inputs should follow the db tables as listed in /opt/lampp/htdocs/BlackMuralBulkSMS/forms.md
- use form action and submit to take the data to the listed model file. From there Gemini will take over.
- For tables use sample.php in the dashboard folders as reference. then use select_rows as mentioned in db_operations.md
- For edit and delete actions take them to the appropriate edit_form and delete file as listed in /opt/lampp/htdocs/BlackMuralBulkSMS/forms.md
- for index files use /opt/lampp/htdocs/BlackMuralBulkSMS/sample_files/index.html then don't add header, nav and fotter html code as they are all in header.php, sidebar.php and footer.php so just include them.
- there might be some js and css files that you might need to include in the header.php file, for some kpis/charts.
- for login files use full html code as they don't have header, sidebar and footer. use /opt/lampp/htdocs/BlackMuralBulkSMS/sample_files/auth-login-basic.html as reference.

Gemini Instructions
- You are incharge of creating the model files as listed in /opt/lampp/htdocs/BlackMuralBulkSMS/forms.md
- use insert_edit_form and delete as mentioned in db_operations.md
- For select use select_rows as mentioned in db_operations.md
- use header() function for redirects.
- Always include operations.php for db operations.
- Before using insert_edit_form unset empty POST Keys with empty values.


Instructions to both GEMINI and CLAUDE:
1. Create plans first and list them below this line. make your plans very short as forms.md will have the details.
2. read my plan.md file to get my vision
3. Gemini you may need also to read api_docs.md and db_operations.md

**My Plan (Claude - Frontend/Forms Creation):**

1. **Read forms.md to understand required forms and database structure**
2. **Create ALL dashboard forms and interfaces as listed in forms.md with proper Bootstrap styling:**
   - **SuperAdmin Dashboard:** admins management, system settings, audit logs, profile
   - **Admin Dashboard:** clients, sender IDs, short codes, packages, assignments, reports, profile
   - **Client Dashboard:** users, contact groups, contacts, templates, campaigns, SMS sending, history, analytics, profile
3. **Create table views using sample.php reference with select_rows operations**
4. **Implement edit/delete actions routing to appropriate model files**
5. **Use proper includes (header.php, sidebar.php, footer.php) for dashboard pages**
6. **Create login forms with full HTML (no includes) using auth-login-basic.html reference**
7. **Add any required JS/CSS for KPIs/charts to header.php if needed**

All forms will follow the database structure and use form actions to submit data to model files where Gemini will handle the backend processing.

**Gemini's Recommendations for Claude's Plan:**

1.  **Add Client-Side Validation:** Implement frontend validation in forms to provide immediate user feedback (e.g., for required fields, correct email formats).
2.  **Implement User Feedback UI:** Create UI elements (like alerts or toasts) to display the success or error messages returned from the backend after form submissions.
3.  **Coordinate on Data Queries:** Since you will use the `select_rows()` function directly in view files to populate tables, let's coordinate on any complex SQL queries to ensure they are efficient and secure.

**My Plan (Gemini - Backend/Model Creation):**

1.  **Read `forms.md`, `db_operations.md`, and `database_structure.sql`** to understand the required model files, database functions, and table structures.
2.  **Create ALL backend model files in the `/model/` directory** as specified in `forms.md`.
3.  **Implement CRUD logic** for each model file using the `insert_edit_form()`, `delete()`, and `select_rows()` functions from `model/operations.php`.
4.  **Handle form data processing:**
    *   Include `model/operations.php` in every model file.
    *   Unset empty `$_POST` keys before calling `insert_edit_form()`.
    *   Use the `header()` function for success and failure redirections to the pages created by Claude.
5.  **Process login and special cases:**
    *   Implement login logic for `super_admin_login.php`, `admin_login.php`, and `client_login.php`.
    *   Handle file uploads and data assignments (e.g., `bulk_upload_contacts.php`, `assign_sender_ids.php`).

**Gemini's Acknowledgement of Recommendations:**

I acknowledge the following recommendations and will incorporate them into my backend development process:
- **Security & Validation:** I will prioritize security, using the `security()` function for all inputs, and implement robust validation for files and API interactions.
- **Error Handling & Sessions:** I will manage sessions for authentication and use `header()` redirects with status flags for clear user feedback.
- **Data Integrity:** For complex operations like bulk uploads, I will ensure data integrity, using transactions where appropriate.

**Claude's Recommendations for Gemini's Plan:**

1. **Add Security Measures:** Implement input sanitization and SQL injection prevention for all form processing.
2. **Enhance Error Handling:** Add comprehensive error handling strategies for database operations and failed transactions.
3. **Include Session Management:** Explicitly handle session creation, validation, and destruction for login files.
4. **Read API Documentation:** Review `api_docs.md` for any external API integrations as mentioned in instructions.
5. **Implement Database Transactions:** Use transactions for complex operations like bulk uploads and data assignments.
6. **Add File Upload Validation:** Include proper CSV validation, file size limits, and format checking for bulk contact uploads.

**Claude's Acknowledgement of Gemini's Recommendations:**

I acknowledge and accept all recommendations:
1. **Client-Side Validation:** Will implement JavaScript validation for immediate user feedback on required fields, email formats, and input constraints.
2. **User Feedback UI:** Will create Bootstrap alert components and toast notifications to display backend success/error messages.
3. **Data Query Coordination:** Agreed - will use `select_rows()` efficiently in view files and coordinate on complex queries for optimal performance and security.
