# MASTER IMPLEMENTATION PROMPT — VRIDOVA WEBSITE + LMS + ADMIN

Act as a senior PHP architect, UX designer, database engineer and application-security engineer. Build a complete, production-oriented EdTech website for **VRIDOVA Digital Marketing Institute**, taking inspiration from the general user experience of TuteDude (do not copy its branding, text, images, code or exact layouts). The deployment target is **Red Server shared hosting with cPanel**. Deliver a complete source-code project that can be uploaded to cPanel and configured with MySQL/phpMyAdmin.

## 1. Mandatory hosting constraints
- Use PHP 8.2+ and MySQL/MariaDB. Do not require a permanently running Node.js process, Docker, Redis, queue worker, SSH, Composer or root access for the basic production deployment. If Composer is useful, vendor dependencies locally and include them in the deployment archive.
- Use Apache and `.htaccess`; keep private PHP code, configuration, logs, backups, uploaded student files and course assets outside `public_html` whenever possible.
- Provide a fallback protected-storage approach if hosting cannot serve a private folder outside the web root.
- Use PDO, prepared statements, database migrations or a repeatable SQL installer, PHP sessions, CSRF tokens, secure password hashing, output escaping and server-side validation.
- Use a maintainable MVC-style structure with a small router/front controller. Avoid putting all logic in one PHP file.
- Build responsive mobile-first UI. Use Bootstrap 5 or clean custom CSS, semantic HTML and vanilla JavaScript. Do not rely on an SPA build process at deployment time.
- Include `.htaccess`, a sample config, SQL schema, setup wizard or clear manual installer, seed data, README and cPanel deployment guide.

## 2. Brand and visual direction
- Brand: VRIDOVA Digital Marketing Institute.
- Visual identity: warm orange, white and black; premium, clean, modern, credible and education-focused.
- Use orange for primary CTAs and accents, white/light neutral surfaces, charcoal typography and restrained shadows.
- Avoid clutter, excessive gradients, generic AI-looking graphics and oversized blocks of text.
- Use real course/student imagery only when licensed or supplied by VRIDOVA. Use placeholders otherwise.
- Ensure typography, spacing, buttons, cards, navigation and forms are consistent.
- Make all pages responsive at 360px mobile, tablet and desktop widths.

## 3. Initial course catalogue (admin-editable)
Seed these courses, but make every title, fee, duration, description, curriculum, image, status and offer editable in admin:
1. Advanced Digital Marketing Course — 6 months — ₹45,000.
2. AI Powered Digital Marketing Course — 8 months — ₹55,000.
3. Meta Ads Expert Course — 45 days — ₹12,000.
Teaching mode can support online and offline, with per-course configuration. Do not hardcode prices in checkout; always load the current price from the database.

## 4. Public website pages
Build:
- Home page with hero, course discovery, benefits, learning process, testimonials, FAQs, CTA and footer.
- About VRIDOVA, contact/enquiry page, all courses, category filters/search, course detail pages, pricing/offer display, mentor/team page if enabled.
- Login, registration, forgot/reset password, email verification.
- Terms, privacy policy, refund policy, cancellation policy and contact/support pages.
- SEO-friendly slugs, metadata, sitemap.xml and robots.txt.
- Enquiry forms with validation, spam protection/rate limiting and admin lead management.

## 5. Authentication, roles and security
Roles: student, mentor, admin, with authorization enforced on the server for every protected route and action. Include secure registration/login/logout, password reset with expiring single-use tokens, session ID regeneration on login, secure cookie flags, inactivity/session expiry, login throttling, CSRF protection, validation, output escaping, upload MIME/size validation and audit logs. Never trust a user-supplied role, course fee, payment status, refund amount or enrollment ID. Prevent IDOR by checking ownership on every student resource. Admin accounts must not be publicly self-registered; create the first admin using a one-time CLI/manual installer or protected setup process and disable installer after setup.

## 6. Student LMS
Student dashboard should include:
- Overview: enrolled courses, course progress, upcoming tasks, recent activity.
- My Courses and course curriculum, modules and lessons.
- Video lesson player with resume progress and access checks. Do not expose raw private video URLs. Integrate a secure video provider such as Cloudflare Stream or Mux via environment/config settings; provide a provider abstraction and a placeholder mode for local testing.
- Downloadable notes/resources stored privately and delivered only after enrollment authorization.
- Assignments: instructions, due dates, file uploads and text answers; submission history and resubmission rules.
- Quizzes/assessments with configurable questions, scoring and attempt limits.
- Progress calculation, completion criteria and course completion state.
- Student profile, password change, order/payment history, support ticket/doubt query and notifications.
- Certificates generated only after configured completion requirements; unique verification URL/code and public verification page that reveals only certificate validity and minimal necessary data.

## 7. Mentor area
Mentors can see only assigned students/courses, review assigned submissions, add feedback/scores, answer support queries and manage availability/session requests if enabled. Admin assigns mentors. Enforce role and ownership checks on every operation.

## 8. Admin panel
Create a separate protected `/admin` area with dashboard KPIs and modules:
- Students, mentors, roles and account status.
- Courses, categories, pricing, course modes, modules, lessons, resources and publication state.
- Assignment creation, grading queue, feedback and resubmission.
- Quiz/question bank and results.
- Enrollments, orders, Razorpay payment records and coupon codes.
- Refund rules, refund requests, review queue, approvals/rejections and processing state.
- Certificate templates, issue/revoke and verification.
- Leads/enquiries, support tickets, announcements and notification templates.
- Reports: revenue, enrollments, course completion, assignment performance, refunds and coupon use; export CSV safely.
- Settings: brand details, contact details, SMTP, Razorpay keys, video provider, course defaults and legal policy content.
- Audit log for sensitive actions.

## 9. Razorpay integration — required correctness
Implement Razorpay Checkout using the official current API/SDK approach. Keep Key Secret and webhook secret exclusively server-side.
1. Checkout initiation endpoint authenticates the student, calculates amount from database, creates an internal pending order and creates the Razorpay order server-side.
2. Browser receives only the public Key ID, order ID, amount and currency needed for Checkout.
3. Verify `razorpay_signature` server-side using HMAC SHA-256 and constant-time comparison. Never activate enrollment based only on client callback or redirect.
4. Configure webhook endpoint; verify signature against the exact raw request body and secret before parsing/trusting the event.
5. Store webhook event IDs uniquely; process idempotently and safely handle retries, out-of-order events and duplicate callbacks.
6. Reconcile payment ID, order ID, amount, currency and internal order. Mark paid only after verified evidence. Create enrollment transactionally and exactly once.
7. Handle failed, cancelled, pending, captured, refunded and disputed states. Never log secrets or full card/bank details.
8. Include a Razorpay test-mode guide and test cases for success, failure, abandoned checkout, replay, duplicate webhook and amount tampering.

## 10. 100% refund eligibility engine
VRIDOVA wants a 100% course-fee refund for students who satisfy the published course completion requirements. Build this as a configurable, auditable policy engine, not an unconditional automatic refund.
- Admin can define refund rules per course/intake: eligibility window/deadline, minimum course progress, required assignment completion, minimum scores if any, project requirements, attendance/mentorship requirements if any, excluded fees if legally applicable, evidence required and any other published conditions.
- Display the exact course-specific refund policy before purchase and require the student to acknowledge it. Save a versioned policy snapshot against the order/enrollment so later edits do not silently change the student's purchase terms.
- Student dashboard shows progress toward eligibility, unmet requirements and deadline; allow a refund request only when requirements are met or allow a manual review request if policy says so.
- Eligibility engine must calculate from server-side records, never from client-submitted completion values. Admin can inspect evidence and approve/reject with a mandatory reason.
- On approval, admin initiates refund through Razorpay API using the original captured payment ID and eligible amount. Verify API response/webhook, store Razorpay refund ID and update statuses. Handle partial/failed/pending refunds and retries without duplicate refunds.
- Keep separate states: requested, under_review, approved, rejected, processing, processed, failed. Log all decisions and refund actions.
- Do not claim Razorpay will always return money instantly. Display processing status and the provider/bank settlement timeline as applicable.
- Provide a clear policy page and a pre-checkout summary. Require VRIDOVA to supply/approve final legal wording before production.

## 11. Database
Use the supplied `database/schema.sql` as a starting point; review, normalize and extend it. Include indexes, foreign keys, unique constraints, timestamps and transactions. Add migrations/installer and seed course records. Use integer paise for INR amounts; never use floating point for money. Add any missing tables for password resets, email verification, support tickets, notifications, mentor assignments, quiz attempts, policy versions and settings. Do not store secrets in the database unless encrypted and necessary.

## 12. Email, files and notifications
- SMTP configuration via cPanel email or a transactional email provider.
- Email verification, password reset, order receipt, enrollment activation, assignment status, refund status and certificate notifications.
- File uploads: random generated names, strict extension + MIME validation, size limits, malware scanning integration where available, deny executable formats, private storage and authorized download controller.
- Never trust original filenames or store user uploads in a directly executable web directory.

## 13. Quality, accessibility and performance
- Accessible forms, labels, keyboard navigation, visible focus, semantic headings and contrast.
- Optimize images, lazy-load below-fold media, paginate large tables, cache safe public pages and avoid N+1 database queries.
- Add friendly 403/404/500 pages, centralized error handling and private logs.
- Do not expose stack traces, SQL errors, secrets or filesystem paths in production.
- Provide database backup/restore instructions and a rollback plan.

## 14. Required deliverables
Return a complete project folder and ZIP ready for cPanel upload, containing:
1. Public website source.
2. Private application source.
3. SQL schema and seed data.
4. Sample config with placeholders only.
5. Razorpay integration code and webhook route.
6. Student LMS, mentor panel and admin panel.
7. Refund eligibility and review workflow.
8. README with exact cPanel deployment steps.
9. Environment/configuration checklist.
10. Test plan and test accounts/seed data clearly marked for development only.
11. Security checklist and production go-live checklist.
12. No fake claims that an integration is live; mark missing credentials or external-provider setup clearly.

## 15. Build sequence
First inspect the supplied starter project and database. Then implement in this order: project foundation and installer; public pages; authentication and RBAC; course/admin management; student LMS; assignment and progress; Razorpay checkout/webhooks; refund policy engine; certificates; notifications; reports; hardening and tests. After each phase, run syntax checks and relevant tests. Do not omit code by writing “same as above”, TODO-only placeholders or pseudo-code for required core flows.

## 16. Final response format
At completion, provide: project ZIP link, exact cPanel upload paths, PHP version/extensions required, database import instructions, configuration fields to fill, Razorpay test/live switch instructions, webhook URL to register, first-admin creation procedure, smoke-test checklist and a clear list of anything that still requires VRIDOVA credentials or hosting-provider confirmation.
