# BuzzTrail Video Demo - Local Development Setup

This guide helps you iterate on the conversation UI styling locally using the fake Tavus server.

## Quick Start

1. **Start the fake Tavus server:**
   ```bash
   # From the extension root
   cd /Users/lars/mycode/buzztrail/extension
   pnpm nx serve fake-tavus-server
   # OR run the simple server directly:
   node apps/fake-tavus-server/simple-server.js
   ```

2. **Open the local development page:**
   ```bash
   # From this directory
   open local-dev.html
   # OR serve it with a simple HTTP server:
   python3 -m http.server 8080
   # Then visit: http://localhost:8080/local-dev.html
   ```

## Development Workflow

### Testing Conversation UI Changes

1. **Start fake server** (runs on port 3001)
2. **Open `local-dev.html`** in your browser
3. **Use development controls** to adjust settings
4. **Click "Talk to Tom"** to test conversation flow
5. **Iterate on styling** in the embedded conversation

### Key Files

- `local-dev.html` - Development test page with controls
- `.env.local` / `.env.production` - Environment variables (edit these)
- `src/wix-combined.js` - Source code with inline implementation
- `wix-custom-code-built.html` - Production build (auto-generated)
- `fake-tavus-server/simple-server.js` - Local API server

### BuzzTrail Brand Colors (from buzztrail.ai)

Based on the website analysis, here are the key brand elements:

#### Color Palette
- **Primary Gradient**: `linear-gradient(135deg, #a855f7 0%, #ec4899 100%)`
- **Purple**: `#a855f7` (primary brand color)
- **Pink**: `#ec4899` (secondary brand color)
- **Text Dark**: `#1a1a1a`
- **Text Light**: `#4a5568`
- **Background**: `#f8f9fa`

#### Typography
- **Font Stack**: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`
- **Button Font Weight**: `600`
- **Heading Font Weight**: `700`

#### Button Styles
- **Primary Button**: Purple to pink gradient background
- **Secondary Button**: White/transparent with brand color borders
- **Border Radius**: `50px` for buttons, `24px` for containers
- **Hover Effects**: Scale transform (`scale(1.02)`) with enhanced shadows

### Daily.co Theme Configuration

The conversation interface uses Daily.co's prebuilt UI. To customize it for BuzzTrail:

```javascript
// Example theme configuration (implement in the iframe creation)
const dailyTheme = {
  colors: {
    accent: "#a855f7",           // BuzzTrail purple
    accentText: "#ffffff",       // White text on accent
    background: "#f8f9fa",       // Light background
    backgroundAccent: "#ffffff", // White panels
    baseText: "#1a1a1a",        // Dark text
    border: "#e2e8f0",          // Light borders
    mainAreaBg: "#ffffff",       // Main video area
    mainAreaBgAccent: "#f8f9fa", // Accent background
    mainAreaText: "#1a1a1a",    // Main area text
    supportiveText: "#4a5568"    // Secondary text
  },
  // Additional customizations
  borderRadius: "16px",
  fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"
};
```

### Development Controls

The `local-dev.html` page includes controls for:

- **Server URL**: Switch between local fake server and production
- **API Key**: Test API key for local server
- **Persona Key**: Choose different personas
- **Replica ID**: Configure replica
- **Duration**: Set conversation duration
- **Reload Demo**: Apply changes without page refresh

### Styling Guidelines

1. **Match BuzzTrail Brand**: Use the gradient and color palette consistently
2. **Maintain Professional Look**: Clean, modern design with subtle animations
3. **Responsive Design**: Test on desktop, tablet, and mobile sizes
4. **Accessibility**: Ensure good contrast and readable text
5. **Performance**: Keep animations smooth and loading fast

### Building and Deployment

After making changes to environment variables:

```bash
# Build the Wix version
pnpm nx build:wix demos

# Copy the built content to Wix
# Content is in: wix-custom-code-built.html
```

### Troubleshooting

**"Section not found" error:**
- Make sure the `sectionId` matches your Wix component ID
- Check the development controls in `local-dev.html`

**API connection issues:**
- Verify fake server is running on port 3001
- Check API key matches in development controls
- Look at browser console for detailed error messages

**Styling not applying:**
- Check browser console for CSS conflicts
- Use browser dev tools to inspect element styles
- Ensure `!important` declarations are working

### Testing Checklist

- [ ] Video loads and loops correctly
- [ ] Click on video starts conversation
- [ ] Button hover effects work
- [ ] Responsive sizing (desktop/tablet/mobile)
- [ ] Conversation UI matches BuzzTrail branding
- [ ] Timer counts down correctly
- [ ] End call button works
- [ ] Return to video after conversation ends
- [ ] Browser console shows no errors

## Next Steps

1. **Customize Daily.co Theme**: Implement the BuzzTrail color scheme in the conversation UI
2. **Add Custom CSS**: Inject additional styling for specific conversation elements
3. **Test Across Devices**: Ensure consistent experience on all screen sizes
4. **Performance Optimization**: Monitor loading times and smooth animations