diff --git a/ALL_ISSUES_FIXED.md b/ALL_ISSUES_FIXED.md
deleted file mode 100644
index e9b8fd4..0000000
--- a/ALL_ISSUES_FIXED.md
+++ /dev/null
@@ -1,299 +0,0 @@
-# โ
ALL 4 ISSUES FIXED - Complete System Overhaul
-
-## ๐ด Issues You Reported
-
-1. โ Customer showing 7 templates instead of 9 (missing "Registered" and "VIP Upgraded")
-2. โ Card types missing (all showing `[card]` instead of `[card type="hero"]`)
-3. โ Preview showing raw markdown (not converting to HTML)
-4. โ Button text and syntax highlighting issues
-
----
-
-## โ
Root Causes Found & Fixed
-
-### **Issue #1: Missing Customer Templates**
-
-**Root Cause:**
-```php
-// DefaultEmailTemplates.php - WRONG mapping!
-'customer_registered' => 'customer_registered', // โ Wrong key!
-'customer_vip_upgraded' => 'customer_vip_upgraded', // โ Wrong key!
-
-// But DefaultTemplates.php uses:
-'registered' => self::customer_registered(), // โ
Correct key
-'vip_upgraded' => self::customer_vip_upgraded(), // โ
Correct key
-```
-
-**The Problem:**
-- `DefaultTemplates.php` uses keys: `'registered'` and `'vip_upgraded'`
-- `DefaultEmailTemplates.php` was mapping to: `'customer_registered'` and `'customer_vip_upgraded'`
-- **Mismatch!** Templates not found, so only 7 showed instead of 9
-
-**Fix Applied:**
-```php
-// File: includes/Core/Notifications/DefaultEmailTemplates.php
-// Lines 37-40
-
-'new_customer' => 'registered', // โ
Fixed!
-'customer_registered' => 'registered', // โ
Fixed!
-'customer_vip_upgraded' => 'vip_upgraded', // โ
Fixed!
-```
-
----
-
-### **Issue #2: Card Types Missing**
-
-**Root Cause:**
-```typescript
-// markdownToBlocks() regex wasn't trimming attributes
-const attributes = cardMatch[1]; // " type=\"hero\"" with leading space
-const typeMatch = attributes.match(/type=["']([^"']+)["']/); // โ Fails!
-```
-
-**Fix Applied:**
-```typescript
-// File: admin-spa/src/components/EmailBuilder/converter.ts
-// Lines 230-235
-
-const attributes = cardMatch[1].trim(); // โ
Trim first!
-const typeMatch = attributes.match(/type\s*=\s*["']([^"']+)["']/); // โ
Handle spaces!
-const cardType = (typeMatch?.[1] || 'default') as CardType;
-```
-
----
-
-### **Issue #3: Preview Showing Raw Markdown**
-
-**Root Cause:**
-```typescript
-// Preview was showing markdown like "# heading" instead of "
โ
- โ
-โ
Beautiful preview!
-```
-
----
-
-## ๐ Files Modified
-
-### **1. DefaultTemplates.php**
-**Lines:** 42-43
-**Change:** Fixed template keys from `'customer_registered'` to `'registered'`
-**Impact:** Customer now shows 9 templates โ
-
-### **2. DefaultEmailTemplates.php**
-**Lines:** 37-40
-**Change:** Fixed event mapping to use correct keys
-**Impact:** Templates now found correctly โ
-
-### **3. converter.ts**
-**Lines:** 230-235
-**Change:** Trim attributes and handle spaces in regex
-**Impact:** Card types now parsed correctly โ
-
-### **4. EditTemplate.tsx**
-**Lines:** 224-227, 534, 542
-**Changes:**
-- Convert markdown to HTML in preview
-- Update button text to be clearer
-- Dynamic tab label
-**Impact:** Preview works, UI is clearer โ
-
----
-
-## ๐งช Testing Checklist
-
-### โ
Test 1: Customer Templates Count
-1. Go to Customer Notifications
-2. Expand Email channel
-3. **Expected:** 9 templates showing
-4. **Result:** โ
PASS
-
-### โ
Test 2: Card Types Preserved
-1. Open "Order Placed" template
-2. Check first card in Visual Builder
-3. **Expected:** Card type = "hero"
-4. **Result:** โ
PASS
-
-### โ
Test 3: Preview Rendering
-1. Open any template
-2. Click "Preview" tab
-3. **Expected:** Headings rendered as HTML, not markdown
-4. **Result:** โ
PASS
-
-### โ
Test 4: Markdown Mode
-1. Click "Switch to Markdown"
-2. **Expected:** Clean markdown, button says "Switch to Visual Builder"
-3. **Result:** โ
PASS
-
-### โ
Test 5: Mode Switching
-1. Visual โ Markdown โ Visual โ Markdown
-2. **Expected:** No data loss, types preserved
-3. **Result:** โ
PASS
-
----
-
-## ๐ฏ What Was The Real Problem?
-
-### **The Core Issue:**
-We had **THREE DIFFERENT SYSTEMS** trying to work together:
-1. `DefaultTemplates.php` - New markdown templates (uses `'registered'` key)
-2. `DefaultEmailTemplates.php` - Legacy wrapper (was using `'customer_registered'` key)
-3. `TemplateProvider.php` - Template fetcher (relies on exact key match)
-
-**Key mismatch = Templates not found!**
-
-### **The Solution:**
-- **Aligned all keys** across the system
-- **Fixed parsing** to handle attributes correctly
-- **Added markdown conversion** in preview
-- **Improved UI** for clarity
-
----
-
-## ๐ก Why This Happened
-
-### **Historical Context:**
-1. Originally: HTML-based templates
-2. Refactored: Markdown-based templates in `DefaultTemplates.php`
-3. Wrapper: `DefaultEmailTemplates.php` created for compatibility
-4. **Problem:** Wrapper used wrong keys!
-
-### **The Cascade Effect:**
-```
-Wrong key in wrapper
- โ
-Template not found
- โ
-Fallback to default
- โ
-Only 7 templates show (missing 2)
-```
-
----
-
-## ๐ Next Steps
-
-1. **Stop dev server** (Ctrl+C)
-2. **Restart:** `npm run dev`
-3. **Hard refresh browser:** Cmd+Shift+R
-4. **Test all 4 issues:**
- - โ
Customer shows 9 templates
- - โ
Card types preserved
- - โ
Preview renders HTML
- - โ
Markdown mode works
-
----
-
-## ๐ Summary
-
-| Issue | Root Cause | Fix | Status |
-|-------|------------|-----|--------|
-| **Missing templates** | Key mismatch | Aligned keys | โ
FIXED |
-| **Card types missing** | Regex not trimming | Trim + better regex | โ
FIXED |
-| **Raw markdown in preview** | No conversion | Added markdownToHtml() | โ
FIXED |
-| **Confusing UI** | Short button text | Clear labels | โ
FIXED |
-
----
-
-**๐ ALL ISSUES RESOLVED! The system is now working as designed!**
-
-**Test it now - everything should work perfectly!** ๐
diff --git a/BACKEND_INTEGRATION_NEEDED.md b/BACKEND_INTEGRATION_NEEDED.md
deleted file mode 100644
index 074d56e..0000000
--- a/BACKEND_INTEGRATION_NEEDED.md
+++ /dev/null
@@ -1,268 +0,0 @@
-# โ ๏ธ Backend Integration Required
-
-## Issues Found
-
-### Issue #1: Incorrect Template Count in UI โ
-
-**Problem:**
-The Staff Notifications page shows "9 templates" but there are only **7 staff events**.
-
-**Location:**
-`admin-spa/src/routes/Settings/Notifications/Templates.tsx` line 132
-
-**Current Code:**
-```tsx
-
- {allEvents.length} {__('templates')} // โ Shows ALL events (customer + staff)
-
-```
-
-**Root Cause:**
-- `allEvents` combines ALL event types (orders, products, customers)
-- It doesn't filter by recipient type (staff vs customer)
-- Shows same count for both customer and staff pages
-
-**Expected:**
-- **Customer page:** Should show 9 templates (customer events only)
-- **Staff page:** Should show 7 templates (staff events only)
-
-**Solution Needed:**
-The backend API `/notifications/events` needs to return events grouped by recipient type, OR the frontend needs to filter events based on the current page (staff/customer).
-
----
-
-### Issue #2: Old Templates Still Being Used โ
-
-**Problem:**
-After reloading multiple times, the email templates shown in the editor are still using the OLD format, not the new improved markdown templates.
-
-**Current State:**
-- โ
New templates exist: `includes/Email/DefaultTemplates.php`
-- โ Backend still using: `includes/Core/Notifications/DefaultEmailTemplates.php`
-
-**Evidence:**
-The old `DefaultEmailTemplates.php` uses HTML-heavy syntax:
-```php
-'body' => '[card type="hero"]
-
' . __('New Order Received!', 'woonoow') . '
-
' . __('You have received a new order...', 'woonoow') . '
-[/card]'
-```
-
-The new `DefaultTemplates.php` uses clean markdown:
-```php
-return '[card type="hero"]
-
-New order received!
-
-A customer has placed a new order. Please review and process.
-[/card]'
-```
-
-**Root Cause:**
-The backend API controller is still calling the old `DefaultEmailTemplates` class instead of the new `DefaultTemplates` class.
-
----
-
-## Required Backend Changes
-
-### 1. Update Default Templates Integration
-
-**Option A: Replace Old Class (Recommended)**
-
-Replace `includes/Core/Notifications/DefaultEmailTemplates.php` with a wrapper that uses the new class:
-
-```php
- 'order_placed',
- 'order_processing' => 'order_confirmed',
- 'order_completed' => 'order_completed',
- 'order_cancelled' => 'order_cancelled',
- 'order_refunded' => 'order_cancelled', // Map to cancelled for now
- 'low_stock' => 'order_placed', // Placeholder
- 'out_of_stock' => 'order_placed', // Placeholder
- 'new_customer' => 'customer_registered',
- 'customer_note' => 'order_placed', // Placeholder
- ];
-
- $newEventId = $eventMap[$event_id] ?? $event_id;
-
- // Get templates from new class
- $allTemplates = NewDefaultTemplates::get_all_templates();
- $templates = $allTemplates[$recipient_type] ?? [];
-
- if (isset($templates[$newEventId])) {
- return [
- 'subject' => NewDefaultTemplates::get_default_subject($recipient_type, $newEventId),
- 'body' => $templates[$newEventId],
- ];
- }
-
- // Fallback
- return [
- 'subject' => __('Notification from {store_name}', 'woonoow'),
- 'body' => '[card]New notification[/card]',
- ];
- }
-}
-```
-
-**Option B: Update API Controller Directly**
-
-Update the API controller to use the new `DefaultTemplates` class:
-
-```php
-use WooNooW\Email\DefaultTemplates;
-
-// In the get_template endpoint:
-$templates = DefaultTemplates::get_all_templates();
-$subject = DefaultTemplates::get_default_subject($recipient_type, $event_id);
-$body = $templates[$recipient_type][$event_id] ?? '';
-```
-
----
-
-### 2. Fix Event Counts in API
-
-**Update:** `includes/Api/NotificationsController.php`
-
-The `/notifications/events` endpoint should return events with recipient type information:
-
-```php
-public function get_events($request) {
- $events = [
- 'orders' => [
- [
- 'id' => 'order_placed',
- 'label' => __('Order Placed'),
- 'description' => __('When a new order is placed'),
- 'recipients' => ['customer', 'staff'], // โ Add this
- ],
- [
- 'id' => 'order_confirmed',
- 'label' => __('Order Confirmed'),
- 'description' => __('When order is confirmed'),
- 'recipients' => ['customer', 'staff'], // โ Add this
- ],
- // ... etc
- ],
- 'customers' => [
- [
- 'id' => 'customer_registered',
- 'label' => __('Customer Registered'),
- 'description' => __('When customer creates account'),
- 'recipients' => ['customer'], // โ Customer only
- ],
- [
- 'id' => 'customer_vip_upgraded',
- 'label' => __('VIP Upgraded'),
- 'description' => __('When customer becomes VIP'),
- 'recipients' => ['customer'], // โ Customer only
- ],
- ],
- ];
-
- return rest_ensure_response($events);
-}
-```
-
----
-
-### 3. Update Frontend to Filter Events
-
-**Update:** `admin-spa/src/routes/Settings/Notifications/Templates.tsx`
-
-```tsx
-// Determine recipient type from current page
-const isStaffPage = window.location.pathname.includes('/staff');
-const recipientType = isStaffPage ? 'staff' : 'customer';
-
-// Filter events by recipient
-const filteredEvents = allEvents.filter((event: any) => {
- return event.recipients && event.recipients.includes(recipientType);
-});
-
-// Use filteredEvents instead of allEvents
-
- {filteredEvents.length} {__('templates')}
-
-```
-
----
-
-## Event Mapping
-
-### Customer Events (9 total)
-1. `order_placed` โ Order Placed
-2. `order_confirmed` โ Order Confirmed
-3. `order_shipped` โ Order Shipped
-4. `order_completed` โ Order Completed
-5. `order_cancelled` โ Order Cancelled
-6. `payment_received` โ Payment Received
-7. `payment_failed` โ Payment Failed
-8. `customer_registered` โ Customer Registered
-9. `customer_vip_upgraded` โ VIP Upgraded
-
-### Staff Events (7 total)
-1. `order_placed` โ New Order
-2. `order_confirmed` โ Order Confirmed
-3. `order_shipped` โ Order Shipped
-4. `order_completed` โ Order Completed
-5. `order_cancelled` โ Order Cancelled
-6. `payment_received` โ Payment Received
-7. `payment_failed` โ Payment Failed
-
----
-
-## Testing Checklist
-
-After backend integration:
-
-- [ ] Navigate to Customer Notifications โ Templates
-- [ ] Verify "9 templates" badge shows
-- [ ] Open any customer event template
-- [ ] Verify new markdown format is shown (not HTML)
-- [ ] Navigate to Staff Notifications โ Templates
-- [ ] Verify "7 templates" badge shows
-- [ ] Open any staff event template
-- [ ] Verify new markdown format is shown
-- [ ] Test saving a template
-- [ ] Test resetting a template to default
-- [ ] Verify preview shows correct formatting
-
----
-
-## Priority
-
-**HIGH PRIORITY** - These issues prevent the new templates from being used and show incorrect information to users.
-
-**Estimated Time:** 1-2 hours to implement and test
-
----
-
-## Summary
-
-**What Works:**
-- โ
Frontend email builder
-- โ
Markdown parser
-- โ
Preview system
-- โ
New template files created
-
-**What Needs Fixing:**
-- โ Backend not using new templates
-- โ Template count incorrect in UI
-- โ Event-to-recipient mapping needed
-
-**Once Fixed:**
-- โ
Users will see new improved templates
-- โ
Correct template counts
-- โ
Better UX overall
diff --git a/BACKEND_WIRING_COMPLETE.md b/BACKEND_WIRING_COMPLETE.md
deleted file mode 100644
index 35b41da..0000000
--- a/BACKEND_WIRING_COMPLETE.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# Backend Wiring Complete โ
-
-## Summary
-All notification system components are fully wired and functional.
-
-## What's Wired
-
-### 1. Template System โ
-- Save/Get templates via API
-- EmailRenderer uses templates
-- Variables replaced automatically
-- Markdown parsed (cards, buttons, images)
-
-### 2. Channel Toggles โ
-- Frontend toggles saved to database
-- NotificationManager checks before sending
-- Email: `woonoow_email_notifications_enabled`
-- Push: `woonoow_push_notifications_enabled`
-
-### 3. Event Toggles โ
-- Per-event channel settings saved
-- Stored in `woonoow_notification_settings`
-- Checked before sending notifications
-
-### 4. Global System Toggle โ
-- NEW: Switch between WooNooW and WooCommerce
-- API: `GET/POST /notifications/system-mode`
-- Stored in: `woonoow_notification_system_mode`
-- EmailManager respects this setting
-- NotificationManager checks before sending
-
-### 5. Email Customization โ
-- Colors, logo, branding saved
-- EmailRenderer applies customization
-- Stored in: `woonoow_email_settings`
-
-### 6. Push Settings โ
-- Icon, badge, sound settings
-- PushNotificationHandler applies settings
-
-## Notification Flow
-
-```
-Event โ EmailManager โ Check System Mode โ Check Channel Toggle
-โ Check Event Toggle โ EmailRenderer โ Get Template โ Replace Variables
-โ Parse Markdown โ Apply Branding โ wp_mail() โ Sent โ
-```
-
-## Key Files Modified
-- `NotificationsController.php`: Added system-mode endpoints
-- `NotificationManager.php`: Added system mode check
-- `EmailManager.php`: Added is_enabled() check
-
-## Testing
-All settings are now saved and applied when sending notifications.
diff --git a/BASIC_CARD_COMPLETE.md b/BASIC_CARD_COMPLETE.md
deleted file mode 100644
index 6b32dfa..0000000
--- a/BASIC_CARD_COMPLETE.md
+++ /dev/null
@@ -1,228 +0,0 @@
-# โ
Basic Card Type & Newline Fixes Complete!
-
-## Problems Solved! ๐
-
-1. โ
**Newlines preserved** - Text no longer collapses into one line
-2. โ
**Basic card type added** - Plain text sections without styling
-3. โ
**No content loss** - All content can be wrapped in cards
-
----
-
-## What Was Fixed
-
-### 1. Newline Parsing โ
-
-**Problem:** Markdown newlines were collapsed, making everything inline
-
-**Solution:** Updated `markdown-utils.ts` to:
-- Preserve paragraph breaks (double newlines)
-- Add `
` tags for single newlines within paragraphs
-- Properly close and open `
` tags
-
-**Result:**
-```markdown
-Order Number: #12345
-Customer: John Doe
-```
-Now renders as:
-```html
-
-Order Number: #12345
-Customer: John Doe
-
-```
-
----
-
-### 2. Basic Card Type โ
-
-**What It Is:**
-- A new card type: `[card type="basic"]`
-- **No background** color
-- **No border**
-- **No padding**
-- Just plain text in a section
-
-**Why It's Useful:**
-- Wrap footer text without styling
-- Ensure all content is in blocks (no loss)
-- Give users a "plain text" option
-- Makes templates more structured
-
-**CSS:**
-```css
-.card-basic {
- background: none;
- border: none;
- padding: 0;
- margin: 16px 0;
-}
-```
-
----
-
-### 3. Template Footer Updates ๐
-
-**Old Pattern:**
-```markdown
----
-
-Need help? Contact {support_email}
-ยฉ {current_year} {site_name}
-```
-
-**New Pattern:**
-```markdown
-[card type="basic"]
-
-Need help? Contact {support_email}
-
-[/card]
-```
-
-**Changes:**
-- โ
Removed `ยฉ {current_year} {site_name}` (already in global footer)
-- โ
Wrapped support text in `[card type="basic"]`
-- โ
Removed standalone `---` separators
-- โ
Staff templates: Removed footer entirely
-
----
-
-## Files Modified
-
-### 1. **`admin-spa/src/lib/markdown-utils.ts`**
-- Fixed newline handling
-- Proper paragraph and line break parsing
-- Better list handling
-
-### 2. **`admin-spa/src/components/EmailBuilder/types.ts`**
-- Added `'basic'` to `CardType`
-
-### 3. **`admin-spa/src/components/EmailBuilder/EmailBuilder.tsx`**
-- Added "Basic (Plain Text)" option to card type selector
-
-### 4. **`admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx`**
-- Added CSS for `.card-basic` (no styling)
-
-### 5. **`includes/Email/DefaultTemplates.php`** (needs manual update)
-- See `TEMPLATE_UPDATE_SCRIPT.md` for all changes
-- 17 templates need footer updates
-
----
-
-## How Basic Card Works
-
-### In Markdown:
-```markdown
-[card type="basic"]
-
-This is plain text.
-No background, no border, no padding.
-
-Just content.
-
-[/card]
-```
-
-### Renders As:
-```html
-
-
This is plain text.
-No background, no border, no padding.
-
Just content.
-
-```
-
-### Displays As:
-```
-This is plain text.
-No background, no border, no padding.
-
-Just content.
-```
-(No visual styling - just text!)
-
----
-
-## Benefits
-
-### โ
For Content:
-- All content wrapped in blocks
-- No content loss in converter
-- Structured templates
-
-### โ
For Users:
-- Can add plain text sections
-- No forced styling
-- More flexible templates
-
-### โ
For Developers:
-- Cleaner template structure
-- Easier to parse
-- Better maintainability
-
----
-
-## Card Type Comparison
-
-| Type | Background | Border | Padding | Use Case |
-|------|------------|--------|---------|----------|
-| **basic** | None | None | None | Plain text, footers |
-| **default** | White | Gray | Yes | Standard content |
-| **hero** | Gradient | None | Yes | Headers, highlights |
-| **success** | Gradient | None | Yes | Confirmations |
-| **info** | Light blue | Blue | Yes | Information |
-| **warning** | Light yellow | Orange | Yes | Warnings |
-
----
-
-## Next Steps
-
-### Manual Template Updates Required:
-
-You need to update `includes/Email/DefaultTemplates.php`:
-
-1. Open the file
-2. Follow `TEMPLATE_UPDATE_SCRIPT.md`
-3. Update all 17 template footers
-4. Remove copyright lines
-5. Wrap support text in `[card type="basic"]`
-
-**Estimated time:** 10-15 minutes
-
-**Or:** I can help you do it programmatically if you prefer!
-
----
-
-## Testing Checklist
-
-### โ
Newlines:
-- [x] Text with newlines displays correctly
-- [x] Paragraphs separated properly
-- [x] Line breaks within paragraphs work
-
-### โ
Basic Card:
-- [x] Can select "Basic (Plain Text)" in editor
-- [x] No background/border/padding applied
-- [x] Content displays as plain text
-- [x] Works in preview
-
-### โ
Templates:
-- [ ] Update all template footers
-- [ ] Test customer templates
-- [ ] Test staff templates
-- [ ] Verify no content loss
-
----
-
-## Summary
-
-| Feature | Status |
-|---------|--------|
-| Newline parsing | โ
Fixed |
-| Basic card type | โ
Added |
-| Card type selector | โ
Updated |
-| Preview CSS | โ
Updated |
-| Template updates | ๐ Manual needed |
-
-**Almost done! Just need to update the template footers! ๐**
diff --git a/CLEAN_MARKDOWN_FIX.md b/CLEAN_MARKDOWN_FIX.md
deleted file mode 100644
index 2b108d5..0000000
--- a/CLEAN_MARKDOWN_FIX.md
+++ /dev/null
@@ -1,402 +0,0 @@
-# โ
CLEAN MARKDOWN - NO MORE HTML POLLUTION! ๐
-
-## Problem Identified & Fixed!
-
----
-
-## ๐ด The Problem You Reported
-
-### **What You Saw:**
-1. Click "Markdown" button
-2. See HTML code with `
` and `
` tags โ
-3. Mixed HTML + markdown syntax (messy!)
-4. Switch back to visual โ More `
` and `
` added
-5. **Endless pollution!** โ
-
-### **Root Cause:**
-```typescript
-// OLD (BROKEN) FLOW:
-Visual Builder (blocks)
- โ
-blocksToHTML() โ Adds
and
- โ
-htmlToMarkdown() โ Tries to clean, but messy
- โ
-"Markdown mode" shows:
,
, mixed syntax โ
-```
-
----
-
-## โ
The Solution
-
-### **New Clean Flow:**
-```typescript
-// NEW (FIXED) FLOW:
-Visual Builder (blocks)
- โ
-blocksToMarkdown() โ Direct conversion!
- โ
-Markdown mode shows: Clean markdown โ
-```
-
-### **Key Insight:**
-**Skip HTML entirely when converting blocks โ markdown!**
-
----
-
-## ๐ ๏ธ What Was Built
-
-### **1. New Function: `blocksToMarkdown()`**
-```typescript
-// Direct conversion: Blocks โ Markdown (no HTML!)
-export function blocksToMarkdown(blocks: EmailBlock[]): string {
- return blocks.map(block => {
- switch (block.type) {
- case 'card':
- return `[card type="${block.cardType}"]\n\n${block.content}\n\n[/card]`;
- case 'button':
- return `[button url="${block.link}"]${block.text}[/button]`;
- case 'divider':
- return '---';
- // ... etc
- }
- }).join('\n\n');
-}
-```
-
-**Result:** Clean markdown, no `
`, no `
`! โ
-
----
-
-### **2. New Function: `markdownToBlocks()`**
-```typescript
-// Direct conversion: Markdown โ Blocks (no HTML!)
-export function markdownToBlocks(markdown: string): EmailBlock[] {
- const blocks: EmailBlock[] = [];
-
- // Parse [card] blocks
- const cardMatch = markdown.match(/\[card([^\]]*)\]([\s\S]*)\[\/card\]/);
- if (cardMatch) {
- blocks.push({
- type: 'card',
- cardType: extractType(cardMatch[1]),
- content: cardMatch[2].trim(), // Clean content!
- });
- }
-
- // ... parse other blocks
-
- return blocks;
-}
-```
-
-**Result:** Direct parsing, no HTML intermediary! โ
-
----
-
-### **3. Updated EditTemplate.tsx**
-
-#### **Before (BROKEN):**
-```typescript
-// Switching to markdown mode
-const html = blocksToHTML(blocks); // Adds
,
-const markdown = htmlToMarkdown(html); // Messy conversion
-setMarkdownContent(markdown); // Shows HTML pollution โ
-```
-
-#### **After (FIXED):**
-```typescript
-// Switching to markdown mode
-const markdown = blocksToMarkdown(blocks); // Direct, clean!
-setMarkdownContent(markdown); // Shows clean markdown โ
-```
-
----
-
-## ๐ Comparison
-
-### **Old Flow (HTML Pollution):**
-```
-Visual Builder
- โ
-Blocks: { content: "Hello world" }
- โ
-blocksToHTML()
- โ
-HTML: "
Hello world
"
- โ
-htmlToMarkdown()
- โ
-Markdown: "
Hello world
" โ Still has HTML!
-```
-
-### **New Flow (Clean Markdown):**
-```
-Visual Builder
- โ
-Blocks: { content: "Hello world" }
- โ
-blocksToMarkdown()
- โ
-Markdown: "Hello world" โ
Clean!
-```
-
----
-
-## ๐ฏ What You'll See Now
-
-### **Markdown Mode (Clean!):**
-```markdown
-[card type="hero"]
-
-# New order received!
-
-A customer has placed a new order. Please review and process.
-
-[/card]
-
-[card]
-
-**Order Number:** #{order_number}
-**Customer:** {customer_name}
-**Order Date:** {order_date}
-
-[/card]
-
-[button url="{order_url}"]View Order[/button]
-```
-
-**No `
`, no `
`, just clean markdown!** โ
-
----
-
-## ๐ The Complete Data Flow
-
-### **Loading Template:**
-```
-Database (HTML)
- โ
-htmlToBlocks() โ Blocks
- โ
-blocksToMarkdown() โ Clean markdown
- โ
-โ
Both views ready!
-```
-
-### **Visual Mode Editing:**
-```
-User edits blocks
- โ
-handleBlocksChange()
- โ
-โโ blocksToHTML() โ HTML (for saving)
-โโ blocksToMarkdown() โ Markdown (for markdown mode)
- โ
-โ
Both synced, no pollution!
-```
-
-### **Markdown Mode Editing:**
-```
-User types markdown
- โ
-handleMarkdownChange()
- โ
-โโ markdownToBlocks() โ Blocks (for visual mode)
-โโ blocksToHTML() โ HTML (for saving)
- โ
-โ
Both synced, no pollution!
-```
-
-### **Mode Switching:**
-```
-Visual โ Markdown:
- blocksToMarkdown(blocks) โ Clean markdown โ
-
-Markdown โ Visual:
- markdownToBlocks(markdown) โ Blocks โ
-
-No HTML intermediary = No pollution!
-```
-
----
-
-## ๐งช Testing Results
-
-### โ
Test 1: Visual โ Markdown
-1. Edit in visual mode
-2. Click "Markdown"
-3. **Result:** Clean markdown, no `
`, no `
` โ
-
-### โ
Test 2: Markdown โ Visual
-1. Type clean markdown
-2. Click "Visual Builder"
-3. **Result:** Blocks created correctly โ
-
-### โ
Test 3: Multiple Switches
-1. Visual โ Markdown โ Visual โ Markdown
-2. **Result:** No pollution accumulation โ
-
-### โ
Test 4: Save & Reload
-1. Edit in any mode
-2. Save
-3. Reload
-4. **Result:** Clean markdown, no pollution โ
-
----
-
-## ๐ Files Modified
-
-### **1. `converter.ts`**
-**Added:**
-- โ
`blocksToMarkdown()` - Direct blocks โ markdown
-- โ
`markdownToBlocks()` - Direct markdown โ blocks
-
-**Result:** Clean conversions without HTML pollution
-
----
-
-### **2. `index.ts`**
-**Added:**
-- โ
Export `blocksToMarkdown`
-- โ
Export `markdownToBlocks`
-
-**Result:** Functions available throughout the app
-
----
-
-### **3. `EditTemplate.tsx`**
-**Changed:**
-- โ
Import new functions
-- โ
Use `blocksToMarkdown()` instead of `htmlToMarkdown()`
-- โ
Use `markdownToBlocks()` instead of `markdownToHtml() โ htmlToBlocks()`
-- โ
Direct conversions in all handlers
-
-**Result:** No more HTML pollution!
-
----
-
-## ๐จ Architecture Summary
-
-```
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-โ USER INTERFACE โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
-โ Visual Builder โโ Markdown โ
-โ โ
-โ Direct conversion (no HTML pollution!) โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- โ โ
- blocksToMarkdown markdownToBlocks
- โ โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-โ INTERNAL PIVOT โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
-โ HTML (for database & preview only) โ
-โ Generated via blocksToHTML() โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-โ DATABASE โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-```
-
----
-
-## ๐ก Key Principles
-
-### **1. Direct Conversion**
-- Blocks โ Markdown: Direct, no HTML
-- Only use HTML for database & preview
-
-### **2. Clean Separation**
-- **User-facing:** Markdown (clean, readable)
-- **Internal:** HTML (for compatibility)
-- **Never mix them!**
-
-### **3. No Pollution**
-- Markdown mode shows pure markdown
-- No `
`, no `
`, no HTML tags
-- Clean, mobile-friendly typing
-
----
-
-## ๐ Benefits
-
-| Feature | Before | After |
-|---------|--------|-------|
-| **Markdown view** | Mixed HTML + markdown โ | Pure markdown โ
|
-| **HTML pollution** | Accumulates with switches โ | Never happens โ
|
-| **Mobile typing** | Hard (HTML tags) โ | Easy (clean markdown) โ
|
-| **Readability** | Poor โ | Excellent โ
|
-| **Maintainability** | Complex โ | Simple โ
|
-
----
-
-## ๐ Example Output
-
-### **Before (Polluted):**
-```
-[card type="hero"]
-
-
-
-
-
-
-
-# New order received!
-
-
-
-
-
-A customer has placed...
-
-
-
-
-
-
-
-[/card]
-```
-
-### **After (Clean):**
-```
-[card type="hero"]
-
-# New order received!
-
-A customer has placed a new order. Please review and process.
-
-[/card]
-```
-
-**Perfect!** โ
-
----
-
-## ๐ Summary
-
-### **Problem:**
-- Markdown mode showed HTML with `
` and `
` tags
-- Pollution accumulated with mode switches
-- Not truly "markdown mode"
-
-### **Solution:**
-- Created `blocksToMarkdown()` for direct conversion
-- Created `markdownToBlocks()` for direct parsing
-- Bypassed HTML entirely for markdown โ blocks
-- HTML only used for database & preview
-
-### **Result:**
-- โ
Clean, pure markdown in markdown mode
-- โ
No HTML pollution ever
-- โ
Mobile-friendly typing
-- โ
Professional, modern approach
-
----
-
-**๐ FIXED! Test it now with hard refresh (Cmd+Shift+R)! ๐**
-
-**Click "Markdown" โ See clean markdown, no HTML pollution!**
diff --git a/CONVERTER_FIXES_SUMMARY.md b/CONVERTER_FIXES_SUMMARY.md
deleted file mode 100644
index a4c1198..0000000
--- a/CONVERTER_FIXES_SUMMARY.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# Converter Fixes Summary
-
-## Issues Fixed
-
-### 1. โ
Exact Event Naming - No Mapping
-
-**Problem:** API used `order_processing` but Email templates had `order_confirmed`. Required a "bridge" mapping.
-
-**Solution:** Renamed template methods to match API exactly:
-- `customer_order_confirmed()` โ `customer_order_processing()`
-- `staff_order_confirmed()` โ `staff_order_processing()`
-- `customer_registered()` โ `customer_new_customer()`
-
-**Result:** Direct 1:1 mapping, no confusion, clean code.
-
-### 2. โ
Markdown Converter Respects [card] Boundaries
-
-**Problem:** `markdownToBlocks()` was splitting by double newlines (`\n\n`), causing:
-- Raw `[/card]` tags left in output
-- Each line with double space became a new card
-- `##` headings not rendered
-
-**Root Cause:**
-```typescript
-// OLD - WRONG
-const sections = markdown.split(/\n\n+/); // Splits by double newlines!
-```
-
-**Solution:** Parse by `[card]...[/card]` boundaries:
-```typescript
-// NEW - CORRECT
-while (remaining.length > 0) {
- const cardMatch = remaining.match(/^\[card([^\]]*)\]([\s\S]*?)\[\/card\]/);
- if (cardMatch) {
- // Extract content between [card] and [/card]
- const content = cardMatch[2].trim();
- blocks.push({ type: 'card', content });
- remaining = remaining.substring(cardMatch[0].length); // Advance!
- }
-}
-```
-
-**Key Changes:**
-- Uses regex to find `[card]...[/card]` pairs
-- Extracts content between tags
-- Advances `remaining` string after each match
-- No splitting by newlines
-
-### 3. โ ๏ธ Markdown Rendering in Preview (Partial)
-
-**Current State:**
-- Markdown is stored in database: `## Heading\n\n**bold**`
-- Frontend CodeEditor shows clean markdown โ
-- Preview shows markdown as-is (not converted to HTML) โ
-
-**Why:**
-The preview uses `htmlContent` which contains `[card]## Heading[/card]` but doesn't convert the markdown inside to HTML.
-
-**Next Steps:**
-Backend PHP needs to convert markdown to HTML when rendering emails. The `[card]` shortcode handler should:
-1. Extract content
-2. Convert markdown to HTML
-3. Wrap in styled div
-
-## Files Modified
-
-1. `/includes/Email/DefaultTemplates.php`
- - Renamed methods to match API event IDs exactly
- - Updated subject keys
-
-2. `/includes/Core/Notifications/TemplateProvider.php`
- - Removed event mapping
- - Direct lookup: `$allEmailTemplates[$recipient_type][$event_id]`
-
-3. `/admin-spa/src/components/EmailBuilder/converter.ts`
- - Fixed `markdownToBlocks()` to respect `[card]...[/card]` boundaries
- - Added proper string advancement
- - No more double-newline splitting
-
-## Testing Checklist
-
-- [x] Event names match between API and templates
-- [x] No mapping/bridging code
-- [x] Markdown editor shows clean markdown
-- [x] `[/card]` tags not left in output
-- [x] Double newlines don't create new cards
-- [ ] Preview renders markdown as HTML (needs backend fix)
-- [ ] Headings show as `
` not `##` in preview
-- [ ] Line breaks work correctly in preview
-
-## Remaining Work
-
-**Backend Markdown Rendering:**
-The WordPress shortcode handler for `[card]` needs to convert markdown content to HTML before rendering.
-
-Location: Likely in `/includes/Email/` or `/includes/Core/Notifications/`
-
-Required: A function that processes `[card]` shortcodes and converts their markdown content to HTML using a markdown parser.
diff --git a/CONVERTER_FIX_COMPLETE.md b/CONVERTER_FIX_COMPLETE.md
deleted file mode 100644
index 882fb83..0000000
--- a/CONVERTER_FIX_COMPLETE.md
+++ /dev/null
@@ -1,265 +0,0 @@
-# โ
Converter Fixed - All Content Now Displays!
-
-## Problem Solved! ๐
-
-The visual builder and code mode now display **ALL content** from templates, not just the last button!
-
----
-
-## The Issue
-
-**Before:** Only the last button showed in the editor
-- Visual Builder: Only 1 button visible โ
-- Code Mode: Only 1 line of HTML โ
-- Preview: Everything rendered correctly โ
-
-**Why:** The `htmlToBlocks()` converter was:
-1. Only looking for `[card]` syntax
-2. Not recognizing `` HTML (from markdown conversion)
-3. Skipping all unrecognized content
-
----
-
-## The Solution
-
-### Updated `converter.ts` โ
-
-**What Changed:**
-1. โ
Now recognizes **both** `[card]` syntax AND `
` HTML
-2. โ
Properly extracts all cards regardless of format
-3. โ
Preserves all content between cards
-4. โ
Handles markdown-converted HTML correctly
-
-**New Regex:**
-```typescript
-// Match both [card] syntax and
HTML
-const cardRegex = /(?:\[card([^\]]*)\]([\s\S]*?)\[\/card\]|
]*>([\s\S]*?)<\/div>)/gs;
-```
-
-**New Card Detection:**
-```typescript
-// Check both [card] and
-let cardMatch = part.match(/\[card([^\]]*)\]([\s\S]*?)\[\/card\]/s);
-
-if (cardMatch) {
- // [card] syntax
- content = cardMatch[2].trim();
- cardType = typeMatch ? typeMatch[1] : 'default';
-} else {
- //
HTML syntax
- const htmlCardMatch = part.match(/
]*>([\s\S]*?)<\/div>/s);
- if (htmlCardMatch) {
- cardType = htmlCardMatch[1] || 'default';
- content = htmlCardMatch[2].trim();
- }
-}
-```
-
----
-
-## How It Works Now
-
-### Loading Flow:
-
-```
-1. Template loaded (markdown format)
- โ
-2. Markdown converted to HTML
- [card] โ
- โ
-3. htmlToBlocks() called
- โ
-4. Recognizes BOTH formats:
- - [card]...[/card]
- -
...
- โ
-5. Extracts ALL cards
- โ
-6. Creates blocks for visual builder
- โ
-7. ALL content displays! โ
-```
-
----
-
-## What's Fixed
-
-### โ
Visual Builder:
-- **Before:** Only 1 button visible
-- **After:** All cards and buttons visible!
-
-### โ
Code Mode:
-- **Before:** Only 1 line of HTML
-- **After:** Complete HTML with all cards!
-
-### โ
Preview:
-- **Before:** Already working
-- **After:** Still working perfectly!
-
----
-
-## Files Modified
-
-### `admin-spa/src/components/EmailBuilder/converter.ts`
-
-**Changes:**
-1. Updated `htmlToBlocks()` function
-2. Added support for `
` HTML
-3. Improved card detection logic
-4. Fixed TypeScript types
-
-**Key Improvements:**
-- Dual format support ([card] and HTML)
-- Better content extraction
-- No content loss
-- Backwards compatible
-
----
-
-## Testing Checklist
-
-### โ
Visual Builder:
-- [x] Open any template
-- [x] All cards visible
-- [x] All buttons visible
-- [x] All content preserved
-- [x] Can edit each block
-
-### โ
Code Mode:
-- [x] Switch to code mode
-- [x] See complete HTML
-- [x] All cards present
-- [x] All buttons present
-- [x] Can edit HTML
-
-### โ
Preview:
-- [x] Switch to preview
-- [x] Everything renders
-- [x] All cards styled
-- [x] All buttons clickable
-
----
-
-## Edge Cases Handled
-
-### 1. **Mixed Formats**
-- Template has both `[card]` and `
`
-- โ
Both recognized and converted
-
-### 2. **Nested Content**
-- Cards with complex HTML inside
-- โ
Content preserved correctly
-
-### 3. **Multiple Card Types**
-- hero, success, info, warning, default
-- โ
All types recognized from both formats
-
-### 4. **Empty Cards**
-- Cards with no content
-- โ
Handled gracefully
-
----
-
-## Complete Flow
-
-### From Database โ Editor:
-
-```
-Database (Markdown)
- โ
-[card type="hero"]
-New order received!
-[/card]
- โ
-Markdown Detection
- โ
-Convert to HTML
- โ
-
-New order received!
-
- โ
-htmlToBlocks()
- โ
-Recognizes
- โ
-Creates Card Block:
-{
- type: 'card',
- cardType: 'hero',
- content: 'New order received!'
-}
- โ
-Visual Builder Displays Card โ
-```
-
----
-
-## Summary
-
-| Component | Before | After |
-|-----------|--------|-------|
-| Visual Builder | 1 button only | All content โ
|
-| Code Mode | 1 line | Complete HTML โ
|
-| Preview | Working | Still working โ
|
-| Card Detection | [card] only | Both formats โ
|
-| Content Loss | Yes โ | None โ
|
-
----
-
-## What Users See Now
-
-### Visual Builder:
-- โ
Hero card with gradient
-- โ
Order details card
-- โ
Customer contact card
-- โ
Items ordered card
-- โ
Process order button
-- โ
Everything editable!
-
-### Code Mode:
-- โ
Complete HTML structure
-- โ
All cards with proper classes
-- โ
All buttons with proper styling
-- โ
Can edit any part
-
-### Preview:
-- โ
Beautiful rendering
-- โ
Brand colors applied
-- โ
All content visible
-- โ
Professional appearance
-
----
-
-## Performance
-
-**Impact:** None
-- Same parsing speed
-- No extra overhead
-- Efficient regex matching
-- No performance degradation
-
----
-
-## Backwards Compatibility
-
-**100% Compatible:**
-- Old [card] syntax still works
-- New HTML format works
-- Mixed formats work
-- No breaking changes
-
----
-
-## Next Steps
-
-**Nothing!** The system is complete! ๐
-
-**Test it now:**
-1. Hard refresh browser (Cmd+Shift+R)
-2. Open any template
-3. โ
See all content in visual builder
-4. โ
See all content in code mode
-5. โ
See all content in preview
-
-**Everything works! ๐**
diff --git a/CUSTOM_EMAIL_SYSTEM.md b/CUSTOM_EMAIL_SYSTEM.md
deleted file mode 100644
index b3723a6..0000000
--- a/CUSTOM_EMAIL_SYSTEM.md
+++ /dev/null
@@ -1,488 +0,0 @@
-# ๐จ Custom Email System - Implementation Complete!
-
-**Date:** November 12, 2025
-**Status:** โ
**CORE COMPLETE - READY FOR TESTING**
-
----
-
-## ๐ What Was Built
-
-### 1. Email Manager (`EmailManager.php`) โ
-
-**Purpose:** Manages email sending and disables WooCommerce emails
-
-**Features:**
-- โ
Disables all WooCommerce default emails (prevents duplicates)
-- โ
Hooks into ALL WooCommerce order status changes
-- โ
Hooks into customer, product, stock events
-- โ
Checks if events are enabled before sending
-- โ
Sends via `wp_mail()` (SMTP plugin compatible!)
-- โ
Singleton pattern for single instance
-
-**WooCommerce Hooks:**
-```php
-// Order status changes
-- woocommerce_order_status_pending_to_processing
-- woocommerce_order_status_completed
-- woocommerce_order_status_cancelled
-- woocommerce_order_status_refunded
-- woocommerce_new_order (admin notification)
-
-// Customer events
-- woocommerce_new_customer_note
-- woocommerce_created_customer
-
-// Product events
-- woocommerce_low_stock
-- woocommerce_no_stock
-- woocommerce_product_set_stock
-```
-
----
-
-### 2. Email Renderer (`EmailRenderer.php`) โ
-
-**Purpose:** Renders beautiful HTML emails from templates
-
-**Features:**
-- โ
Loads design templates (modern, classic, minimal)
-- โ
Replaces variables in subject and body
-- โ
Gets recipient email (staff/customer)
-- โ
Extracts order/product/customer data
-- โ
Renders final HTML email
-- โ
Filter hook: `apply_filters('woonoow_email_template', $path, $design)`
-
-**Variable System:**
-```php
-Order Variables:
-- {order_number}, {order_total}, {order_date}
-- {customer_name}, {customer_email}
-- {billing_address}, {shipping_address}
-- {payment_method}, {shipping_method}
-- {order_items} (HTML table)
-
-Product Variables:
-- {product_name}, {product_sku}, {product_price}
-- {stock_quantity}, {stock_status}
-
-Customer Variables:
-- {customer_name}, {customer_email}
-- {customer_username}
-
-Store Variables:
-- {store_name}, {store_url}
-- {current_year}
-```
-
----
-
-### 3. Email Design Templates (3 HTML Files) โ
-
-#### **Modern Template** (`modern.html`)
-- โ
Clean, minimalist, Apple-inspired design
-- โ
Sans-serif fonts (system fonts)
-- โ
Subtle shadows and rounded corners
-- โ
Dark mode support
-- โ
Mobile responsive
-- โ
2024 design trends
-
-**Colors:**
-- Background: `#f5f5f7`
-- Text: `#1d1d1f`
-- Accent: `#0071e3` (Apple blue)
-- Muted: `#6e6e73`
-
-#### **Classic Template** (`classic.html`)
-- โ
Professional, traditional design
-- โ
Serif fonts (Georgia)
-- โ
Gradient header (purple gradient)
-- โ
Table styling with alternating rows
-- โ
Business-appropriate
-- โ
Bold, confident look
-
-**Colors:**
-- Gradient: `#667eea` to `#764ba2`
-- Background: `#f4f4f4`
-- Text: `#333333`
-
-#### **Minimal Template** (`minimal.html`)
-- โ
Ultra-clean, brutalist design
-- โ
Monospace font (Courier New)
-- โ
Black & white only
-- โ
Text-focused, no distractions
-- โ
Dark mode (inverted colors)
-- โ
High contrast
-
-**Colors:**
-- Black: `#000000`
-- White: `#ffffff`
-- That's it!
-
-**All Templates Include:**
-- โ
Email client compatibility (Outlook, Gmail, Apple Mail)
-- โ
Mobile responsive design
-- โ
Dark mode support
-- โ
Proper HTML email structure
-- โ
Inline CSS for maximum compatibility
-
----
-
-### 4. Rich Text Editor (`RichTextEditor.tsx`) โ
-
-**Purpose:** Modern WYSIWYG editor for email content
-
-**Technology:** TipTap (React)
-
-**Features:**
-- โ
Bold, Italic formatting
-- โ
Bullet lists, numbered lists
-- โ
Link insertion
-- โ
Undo/Redo
-- โ
Variable insertion buttons
-- โ
Placeholder text
-- โ
Clean, minimal toolbar
-- โ
HTML output
-
-**UI:**
-```
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-โ [B] [I] โ [โข] [1.] โ [๐] โ [โถ] [โท] โ โ Toolbar
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
-โ โ
-โ [Rich text content here...] โ
-โ โ
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
-โ Variables: [{order_number}] [...] โ โ Quick insert
-โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-```
-
----
-
-### 5. Template Editor Updated โ
-
-**Changes:**
-- โ
Replaced `