#!/usr/bin/env python3
"""
Professional Photography Studio Website Generator
Generates 5-page websites for each photography business
"""

import os
import re
import json
from datetime import datetime

class WebsiteGenerator:
    def __init__(self, client_data):
        self.client = client_data
        self.folder_name = self._create_folder_name(client_data['name'])
        self.output_dir = f"/mnt/okcomputer/output/{self.folder_name}"
        
    def _create_folder_name(self, name):
        """Create URL-friendly folder name"""
        clean = re.sub(r'[^\w\s-]', '', name.lower())
        clean = re.sub(r'[\s]+', '-', clean)
        clean = clean[:50].strip('-')
        return clean
    
    def _get_color_scheme(self):
        """Determine color scheme based on business type"""
        name = self.client['name'].lower()
        category = self.client['category'].lower()
        
        if 'newborn' in name or 'kids' in name or 'maternity' in name or 'baby' in name:
            return {
                'primary': '#ff6b9d', 'secondary': '#f8f4f0', 'accent': '#ffd6e0',
                'text': '#2d3436', 'heading': '#1a1a2e'
            }
        elif 'wedding' in name or 'vivah' in name or 'marriage' in name:
            return {
                'primary': '#722f37', 'secondary': '#f9f1f0', 'accent': '#d4af37',
                'text': '#2d3436', 'heading': '#4a1c23'
            }
        elif 'film' in name or 'cinema' in name or 'video' in name:
            return {
                'primary': '#1a1a2e', 'secondary': '#16213e', 'accent': '#e63946',
                'text': '#f1f1f1', 'heading': '#ffffff'
            }
        elif 'digital' in name or 'studio' in name:
            return {
                'primary': '#0d9488', 'secondary': '#f0fdfa', 'accent': '#14b8a6',
                'text': '#1e293b', 'heading': '#0f766e'
            }
        else:
            return {
                'primary': '#2563eb', 'secondary': '#eff6ff', 'accent': '#3b82f6',
                'text': '#1e293b', 'heading': '#1e40af'
            }
    
    def _get_services(self):
        """Generate services based on business type"""
        name = self.client['name'].lower()
        category = self.client['category'].lower()
        
        services = []
        
        if 'newborn' in name or 'kids' in name or 'maternity' in name:
            services = [
                {'name': 'Newborn Photography', 'icon': 'fa-baby', 'desc': 'Delicate and artistic newborn portraits capturing precious early moments'},
                {'name': 'Kids Photography', 'icon': 'fa-child', 'desc': 'Fun and playful sessions that capture your child\'s unique personality'},
                {'name': 'Maternity Photography', 'icon': 'fa-heart', 'desc': 'Beautiful maternity portraits celebrating the journey to motherhood'},
                {'name': 'Family Portraits', 'icon': 'fa-users', 'desc': 'Timeless family photos that preserve your cherished memories'}
            ]
        elif 'wedding' in name or 'vivah' in name:
            services = [
                {'name': 'Wedding Photography', 'icon': 'fa-ring', 'desc': 'Complete wedding day coverage with candid and traditional shots'},
                {'name': 'Pre-Wedding Shoots', 'icon': 'fa-camera', 'desc': 'Romantic pre-wedding sessions at beautiful locations'},
                {'name': 'Candid Photography', 'icon': 'fa-smile', 'desc': 'Natural moments captured as they happen'},
                {'name': 'Traditional Photography', 'icon': 'fa-images', 'desc': 'Classic posed shots for your wedding album'}
            ]
        elif 'film' in name or 'cinema' in name:
            services = [
                {'name': 'Cinematic Films', 'icon': 'fa-film', 'desc': 'High-quality cinematic wedding and event films'},
                {'name': 'Wedding Videography', 'icon': 'fa-video', 'desc': 'Full wedding day video coverage'},
                {'name': 'Documentary Films', 'icon': 'fa-file-video', 'desc': 'Storytelling through documentary-style filming'},
                {'name': 'Commercial Videos', 'icon': 'fa-bullhorn', 'desc': 'Professional videos for businesses and brands'}
            ]
        else:
            services = [
                {'name': 'Portrait Photography', 'icon': 'fa-user', 'desc': 'Professional portraits for individuals and families'},
                {'name': 'Event Coverage', 'icon': 'fa-calendar-check', 'desc': 'Complete coverage of your special events'},
                {'name': 'Wedding Photography', 'icon': 'fa-ring', 'desc': 'Beautiful wedding day memories'},
                {'name': 'Commercial Photography', 'icon': 'fa-briefcase', 'desc': 'Professional photos for your business needs'}
            ]
        
        return services
    
    def _generate_head(self, title, description):
        """Generate HTML head section"""
        colors = self._get_color_scheme()
        return f"""<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="{description}">
    <meta name="keywords" content="photography, {self.client['location']}, photo studio, best photographer">
    <meta name="author" content="{self.client['name']}">
    <meta property="og:title" content="{title}">
    <meta property="og:description" content="{description}">
    <meta property="og:type" content="website">
    <title>{title}</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <style>
        :root {{
            --primary: {colors['primary']};
            --secondary: {colors['secondary']};
            --accent: {colors['accent']};
            --text: {colors['text']};
            --heading: {colors['heading']};
            --white: #ffffff;
            --gray: #f8f9fa;
            --shadow: 0 4px 20px rgba(0,0,0,0.1);
            --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
        }}
        * {{ margin: 0; padding: 0; box-sizing: border-box; }}
        body {{ font-family: 'Poppins', sans-serif; color: var(--text); line-height: 1.6; background: var(--white); }}
        h1, h2, h3, h4 {{ font-family: 'Playfair Display', serif; color: var(--heading); }}
        a {{ text-decoration: none; color: inherit; transition: all 0.3s ease; }}
        img {{ max-width: 100%; height: auto; }}
        .container {{ max-width: 1200px; margin: 0 auto; padding: 0 20px; }}
        
        /* Header */
        header {{ background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 1000; }}
        nav {{ display: flex; justify-content: space-between; align-items: center; padding: 15px 0; }}
        .logo {{ font-size: 1.5rem; font-weight: 700; color: var(--primary); font-family: 'Playfair Display', serif; }}
        .nav-links {{ display: flex; list-style: none; gap: 30px; }}
        .nav-links a {{ font-weight: 500; position: relative; }}
        .nav-links a:hover {{ color: var(--primary); }}
        .nav-links a::after {{ content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 2px; background: var(--primary); transition: width 0.3s; }}
        .nav-links a:hover::after {{ width: 100%; }}
        .mobile-menu {{ display: none; font-size: 1.5rem; cursor: pointer; }}
        
        /* Buttons */
        .btn {{ display: inline-block; padding: 12px 30px; border-radius: 50px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; transition: all 0.3s ease; border: none; cursor: pointer; }}
        .btn-primary {{ background: var(--primary); color: var(--white); }}
        .btn-primary:hover {{ background: var(--heading); transform: translateY(-3px); box-shadow: var(--shadow-hover); }}
        .btn-outline {{ border: 2px solid var(--primary); color: var(--primary); background: transparent; }}
        .btn-outline:hover {{ background: var(--primary); color: var(--white); }}
        .btn-whatsapp {{ background: #25d366; color: var(--white); }}
        .btn-whatsapp:hover {{ background: #128c7e; }}
        
        /* Hero */
        .hero {{ background: linear-gradient(135deg, var(--secondary) 0%, var(--white) 100%); padding: 80px 0; text-align: center; }}
        .hero h1 {{ font-size: 3rem; margin-bottom: 20px; animation: fadeInUp 0.8s ease; }}
        .hero p {{ font-size: 1.2rem; color: #666; max-width: 600px; margin: 0 auto 30px; animation: fadeInUp 0.8s ease 0.2s both; }}
        .hero-btns {{ display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; animation: fadeInUp 0.8s ease 0.4s both; }}
        .rating-badge {{ display: inline-flex; align-items: center; gap: 10px; background: var(--white); padding: 10px 20px; border-radius: 50px; box-shadow: var(--shadow); margin-top: 30px; animation: fadeInUp 0.8s ease 0.6s both; }}
        .stars {{ color: #ffc107; }}
        
        /* Sections */
        section {{ padding: 80px 0; }}
        .section-title {{ text-align: center; margin-bottom: 50px; }}
        .section-title h2 {{ font-size: 2.5rem; margin-bottom: 15px; }}
        .section-title p {{ color: #666; max-width: 600px; margin: 0 auto; }}
        
        /* Cards */
        .cards-grid {{ display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }}
        .card {{ background: var(--white); border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); transition: all 0.3s ease; }}
        .card:hover {{ transform: translateY(-10px); box-shadow: var(--shadow-hover); }}
        .card-icon {{ width: 70px; height: 70px; background: var(--secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 30px auto 20px; font-size: 1.8rem; color: var(--primary); }}
        .card-content {{ padding: 0 25px 30px; text-align: center; }}
        .card h3 {{ margin-bottom: 15px; font-size: 1.3rem; }}
        .card p {{ color: #666; font-size: 0.95rem; }}
        
        /* Reviews */
        .review-card {{ background: var(--white); padding: 25px; border-radius: 15px; box-shadow: var(--shadow); margin-bottom: 20px; }}
        .review-header {{ display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }}
        .reviewer-name {{ font-weight: 600; color: var(--heading); }}
        .review-date {{ color: #999; font-size: 0.9rem; }}
        .review-text {{ color: #555; line-height: 1.8; }}
        
        /* Contact */
        .contact-grid {{ display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }}
        .contact-info h3 {{ margin-bottom: 20px; }}
        .contact-item {{ display: flex; align-items: flex-start; gap: 15px; margin-bottom: 20px; }}
        .contact-item i {{ width: 45px; height: 45px; background: var(--secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 1.1rem; flex-shrink: 0; }}
        .contact-item div h4 {{ margin-bottom: 5px; font-size: 1rem; }}
        .contact-item div p {{ color: #666; font-size: 0.95rem; }}
        .map-container {{ border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); height: 400px; }}
        .map-container iframe {{ width: 100%; height: 100%; border: none; }}
        
        /* Form */
        .form-group {{ margin-bottom: 20px; }}
        .form-group label {{ display: block; margin-bottom: 8px; font-weight: 500; color: var(--heading); }}
        .form-group input, .form-group textarea, .form-group select {{ width: 100%; padding: 12px 15px; border: 2px solid #e0e0e0; border-radius: 10px; font-family: inherit; transition: border-color 0.3s; }}
        .form-group input:focus, .form-group textarea:focus, .form-group select:focus {{ outline: none; border-color: var(--primary); }}
        
        /* Footer */
        footer {{ background: var(--heading); color: var(--white); padding: 50px 0 20px; }}
        .footer-content {{ display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 30px; }}
        .footer-section h3 {{ color: var(--white); margin-bottom: 20px; font-size: 1.3rem; }}
        .footer-section p, .footer-section a {{ color: #ccc; line-height: 1.8; }}
        .footer-section a:hover {{ color: var(--primary); }}
        .social-links {{ display: flex; gap: 15px; margin-top: 20px; }}
        .social-links a {{ width: 40px; height: 40px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s; }}
        .social-links a:hover {{ background: var(--primary); transform: translateY(-3px); }}
        .footer-bottom {{ border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; text-align: center; color: #999; }}
        .footer-bottom a {{ color: var(--primary); }}
        
        /* Sticky Buttons */
        .sticky-btns {{ position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 999; }}
        .sticky-btn {{ width: 55px; height: 55px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 1.5rem; box-shadow: var(--shadow-hover); transition: all 0.3s; }}
        .sticky-btn:hover {{ transform: scale(1.1); }}
        .sticky-call {{ background: var(--primary); }}
        .sticky-whatsapp {{ background: #25d366; }}
        
        /* Mobile CTA */
        .mobile-cta {{ display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); padding: 10px; box-shadow: 0 -4px 20px rgba(0,0,0,0.1); z-index: 998; }}
        .mobile-cta-btns {{ display: flex; gap: 10px; }}
        .mobile-cta .btn {{ flex: 1; padding: 12px; font-size: 0.9rem; }}
        
        /* Animations */
        @keyframes fadeInUp {{
            from {{ opacity: 0; transform: translateY(30px); }}
            to {{ opacity: 1; transform: translateY(0); }}
        }}
        .fade-in {{ animation: fadeInUp 0.8s ease both; }}
        
        /* Responsive */
        @media (max-width: 768px) {{
            .nav-links {{ display: none; }}
            .mobile-menu {{ display: block; }}
            .hero h1 {{ font-size: 2rem; }}
            .hero p {{ font-size: 1rem; }}
            section {{ padding: 50px 0; }}
            .section-title h2 {{ font-size: 1.8rem; }}
            .sticky-btns {{ bottom: 80px; }}
            .mobile-cta {{ display: block; }}
            body {{ padding-bottom: 70px; }}
        }}
    </style>
</head>"""

    def _generate_header(self, active_page):
        """Generate navigation header"""
        pages = [
            ('index.html', 'Home'),
            ('about.html', 'About'),
            ('services.html', 'Services'),
            ('contact.html', 'Contact'),
            ('reviews.html', 'Reviews')
        ]
        
        nav_links = ''
        for href, label in pages:
            active_class = 'style="color: var(--primary);"' if href == active_page else ''
            nav_links += f'<li><a href="{href}" {active_class}>{label}</a></li>'
        
        return f"""<body>
    <header>
        <nav class="container">
            <a href="index.html" class="logo">{self.client['name'][:25]}</a>
            <ul class="nav-links">
                {nav_links}
            </ul>
            <div class="mobile-menu"><i class="fas fa-bars"></i></div>
        </nav>
    </header>"""

    def _generate_footer(self):
        """Generate footer with Patil Web Solutions credit"""
        phone_html = f'<a href="tel:+91{self.client["phone"]}">+91 {self.client["phone"]}</a>' if self.client['phone'] else '<span>Phone not available</span>'
        
        return f"""<footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3>{self.client['name']}</h3>
                    <p>{self.client['category']} in {self.client['location']}</p>
                    <p>{self.client['address'][:100]}...</p>
                    <div class="social-links">
                        <a href="#"><i class="fab fa-facebook-f"></i></a>
                        <a href="#"><i class="fab fa-instagram"></i></a>
                        <a href="#"><i class="fab fa-youtube"></i></a>
                    </div>
                </div>
                <div class="footer-section">
                    <h3>Quick Links</h3>
                    <p><a href="index.html">Home</a></p>
                    <p><a href="about.html">About Us</a></p>
                    <p><a href="services.html">Services</a></p>
                    <p><a href="contact.html">Contact</a></p>
                </div>
                <div class="footer-section">
                    <h3>Contact Info</h3>
                    <p><i class="fas fa-phone"></i> {phone_html}</p>
                    <p><i class="fas fa-map-marker-alt"></i> {self.client['location']}</p>
                </div>
            </div>
            <div class="footer-bottom">
                <p>&copy; {datetime.now().year} {self.client['name']}. All rights reserved.</p>
                <p>Developed and Designed by <a href="https://patilwebsolutions.com/" target="_blank"><strong>Patil Web Solutions</strong></a></p>
            </div>
        </div>
    </footer>
    
    <div class="sticky-btns">
        <a href="tel:+91{self.client['phone']}" class="sticky-btn sticky-call"><i class="fas fa-phone"></i></a>
        <a href="https://wa.me/91{self.client['phone']}" class="sticky-btn sticky-whatsapp"><i class="fab fa-whatsapp"></i></a>
    </div>
    
    <div class="mobile-cta">
        <div class="mobile-cta-btns">
            <a href="tel:+91{self.client['phone']}" class="btn btn-primary"><i class="fas fa-phone"></i> Call Now</a>
            <a href="https://wa.me/91{self.client['phone']}" class="btn btn-whatsapp"><i class="fab fa-whatsapp"></i> WhatsApp</a>
        </div>
    </div>
</body>
</html>"""

    def create_index_page(self):
        """Create Home page"""
        title = f"{self.client['name']} - Professional Photography in {self.client['location']}"
        description = f"{self.client['name']} - {self.client['category']} with {self.client['review_count']}+ reviews. Best photography services in {self.client['location']}. Book now!"
        colors = self._get_color_scheme()
        services = self._get_services()[:3]
        
        html = self._generate_head(title, description)
        html += self._generate_header('index.html')
        
        html += f"""
    <section class="hero">
        <div class="container">
            <h1>Professional Photography in {self.client['location']}</h1>
            <p>Capturing your precious moments with creativity and passion. {self.client['review_count']}+ happy clients trust us.</p>
            <div class="hero-btns">
                <a href="tel:+91{self.client['phone']}" class="btn btn-primary"><i class="fas fa-phone"></i> Call Now</a>
                <a href="https://wa.me/91{self.client['phone']}" class="btn btn-whatsapp"><i class="fab fa-whatsapp"></i> WhatsApp</a>
                <a href="services.html" class="btn btn-outline">Our Services</a>
            </div>
            <div class="rating-badge">
                <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                <span><strong>{self.client['rating']}</strong> ({self.client['review_count']}+ reviews)</span>
            </div>
        </div>
    </section>
    
    <section>
        <div class="container">
            <div class="section-title">
                <h2>Our Services</h2>
                <p>Professional photography services tailored to your needs</p>
            </div>
            <div class="cards-grid">
                {''.join([f"""
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas {s['icon']}"></i></div>
                    <div class="card-content">
                        <h3>{s['name']}</h3>
                        <p>{s['desc']}</p>
                    </div>
                </div>
                """ for s in services])}
            </div>
            <div style="text-align: center; margin-top: 40px;">
                <a href="services.html" class="btn btn-primary">View All Services</a>
            </div>
        </div>
    </section>
    
    <section style="background: var(--gray);">
        <div class="container">
            <div class="section-title">
                <h2>Why Choose Us</h2>
                <p>What makes us the preferred photography studio</p>
            </div>
            <div class="cards-grid">
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-award"></i></div>
                    <div class="card-content">
                        <h3>Experienced Team</h3>
                        <p>Years of experience in capturing perfect moments</p>
                    </div>
                </div>
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-camera"></i></div>
                    <div class="card-content">
                        <h3>Latest Equipment</h3>
                        <p>State-of-the-art cameras and editing tools</p>
                    </div>
                </div>
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-heart"></i></div>
                    <div class="card-content">
                        <h3>Passionate Work</h3>
                        <p>We love what we do and it shows in our work</p>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
    <section>
        <div class="container">
            <div class="section-title">
                <h2>Client Reviews</h2>
                <p>See what our clients say about us</p>
            </div>
            <div class="review-card fade-in">
                <div class="review-header">
                    <span class="reviewer-name">Happy Client</span>
                    <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                </div>
                <p class="review-text">"Amazing photography service! The team captured our special moments beautifully. Highly recommended for anyone looking for professional photographers in {self.client['location']}."</p>
            </div>
            <div style="text-align: center; margin-top: 30px;">
                <a href="reviews.html" class="btn btn-outline">Read All Reviews</a>
            </div>
        </div>
    </section>
    
    <section style="background: var(--secondary);">
        <div class="container" style="text-align: center;">
            <h2>Ready to Capture Your Moments?</h2>
            <p style="margin: 20px 0 30px;">Contact us today to book your photography session</p>
            <a href="contact.html" class="btn btn-primary">Get in Touch</a>
        </div>
    </section>
"""
        html += self._generate_footer()
        
        with open(f"{self.output_dir}/index.html", 'w', encoding='utf-8') as f:
            f.write(html)
        print(f"✓ Created: {self.output_dir}/index.html")

    def create_about_page(self):
        """Create About page"""
        title = f"About Us - {self.client['name']}"
        description = f"Learn about {self.client['name']}, a leading {self.client['category']} in {self.client['location']} with {self.client['review_count']}+ satisfied clients."
        
        html = self._generate_head(title, description)
        html += self._generate_header('about.html')
        
        html += f"""
    <section class="hero">
        <div class="container">
            <h1>About {self.client['name']}</h1>
            <p>Your trusted photography partner in {self.client['location']}</p>
        </div>
    </section>
    
    <section>
        <div class="container">
            <div class="contact-grid">
                <div>
                    <h2>Our Story</h2>
                    <p style="margin-bottom: 20px; line-height: 1.8;">{self.client['name']} is a premier {self.client['category']} based in {self.client['location']}. With {self.client['review_count']}+ satisfied clients and a {self.client['rating']}-star rating, we have established ourselves as one of the most trusted photography studios in the region.</p>
                    <p style="line-height: 1.8;">Our team of experienced photographers is passionate about capturing your most precious moments with creativity and precision. Whether it's a wedding, family portrait, or special event, we bring the same level of dedication and artistry to every project.</p>
                </div>
                <div>
                    <div class="card" style="padding: 30px;">
                        <h3 style="margin-bottom: 20px;">Business Info</h3>
                        <div class="contact-item">
                            <i class="fas fa-star"></i>
                            <div>
                                <h4>Rating</h4>
                                <p>{self.client['rating']}★ ({self.client['review_count']}+ reviews)</p>
                            </div>
                        </div>
                        <div class="contact-item">
                            <i class="fas fa-map-marker-alt"></i>
                            <div>
                                <h4>Location</h4>
                                <p>{self.client['location']}</p>
                            </div>
                        </div>
                        <div class="contact-item">
                            <i class="fas fa-phone"></i>
                            <div>
                                <h4>Phone</h4>
                                <p>+91 {self.client['phone']}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
    <section style="background: var(--gray);">
        <div class="container">
            <div class="section-title">
                <h2>Why Choose Us</h2>
                <p>What sets us apart from others</p>
            </div>
            <div class="cards-grid">
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-check-circle"></i></div>
                    <div class="card-content">
                        <h3>Quality Guaranteed</h3>
                        <p>We never compromise on the quality of our work</p>
                    </div>
                </div>
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-clock"></i></div>
                    <div class="card-content">
                        <h3>Timely Delivery</h3>
                        <p>Your photos delivered on time, every time</p>
                    </div>
                </div>
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-dollar-sign"></i></div>
                    <div class="card-content">
                        <h3>Affordable Pricing</h3>
                        <p>Competitive rates without hidden charges</p>
                    </div>
                </div>
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas fa-headset"></i></div>
                    <div class="card-content">
                        <h3>24/7 Support</h3>
                        <p>Always here to answer your questions</p>
                    </div>
                </div>
            </div>
        </div>
    </section>
"""
        html += self._generate_footer()
        
        with open(f"{self.output_dir}/about.html", 'w', encoding='utf-8') as f:
            f.write(html)
        print(f"✓ Created: {self.output_dir}/about.html")

    def create_services_page(self):
        """Create Services page"""
        title = f"Our Services - {self.client['name']}"
        description = f"Explore professional photography services by {self.client['name']}. Wedding, portrait, event photography and more in {self.client['location']}."
        services = self._get_services()
        
        html = self._generate_head(title, description)
        html += self._generate_header('services.html')
        
        services_html = ''
        for s in services:
            services_html += f"""
                <div class="card fade-in">
                    <div class="card-icon"><i class="fas {s['icon']}"></i></div>
                    <div class="card-content">
                        <h3>{s['name']}</h3>
                        <p>{s['desc']}</p>
                        <a href="tel:+91{self.client['phone']}" class="btn btn-primary" style="margin-top: 15px; padding: 8px 20px; font-size: 0.9rem;">Book Now</a>
                    </div>
                </div>
            """
        
        html += f"""
    <section class="hero">
        <div class="container">
            <h1>Our Photography Services</h1>
            <p>Professional solutions for all your photography needs</p>
        </div>
    </section>
    
    <section>
        <div class="container">
            <div class="section-title">
                <h2>What We Offer</h2>
                <p>Comprehensive photography services tailored to your requirements</p>
            </div>
            <div class="cards-grid">
                {services_html}
            </div>
        </div>
    </section>
    
    <section style="background: var(--gray);">
        <div class="container">
            <div class="section-title">
                <h2>Our Process</h2>
                <p>How we work to deliver the best results</p>
            </div>
            <div class="cards-grid" style="grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));">
                <div class="card fade-in" style="text-align: center; padding: 30px;">
                    <div style="font-size: 2.5rem; color: var(--primary); margin-bottom: 15px;">1</div>
                    <h3>Consultation</h3>
                    <p>We discuss your vision and requirements</p>
                </div>
                <div class="card fade-in" style="text-align: center; padding: 30px;">
                    <div style="font-size: 2.5rem; color: var(--primary); margin-bottom: 15px;">2</div>
                    <h3>Planning</h3>
                    <p>We plan the perfect shoot for you</p>
                </div>
                <div class="card fade-in" style="text-align: center; padding: 30px;">
                    <div style="font-size: 2.5rem; color: var(--primary); margin-bottom: 15px;">3</div>
                    <h3>Photography</h3>
                    <p>We capture your special moments</p>
                </div>
                <div class="card fade-in" style="text-align: center; padding: 30px;">
                    <div style="font-size: 2.5rem; color: var(--primary); margin-bottom: 15px;">4</div>
                    <h3>Delivery</h3>
                    <p>Edited photos delivered on time</p>
                </div>
            </div>
        </div>
    </section>
    
    <section>
        <div class="container" style="text-align: center;">
            <h2>Need a Custom Package?</h2>
            <p style="margin: 20px 0 30px;">Contact us for personalized photography solutions</p>
            <a href="contact.html" class="btn btn-primary">Contact Us</a>
        </div>
    </section>
"""
        html += self._generate_footer()
        
        with open(f"{self.output_dir}/services.html", 'w', encoding='utf-8') as f:
            f.write(html)
        print(f"✓ Created: {self.output_dir}/services.html")

    def create_contact_page(self):
        """Create Contact page"""
        title = f"Contact Us - {self.client['name']}"
        description = f"Contact {self.client['name']} for professional photography services in {self.client['location']}. Call +91 {self.client['phone']} or visit our studio."
        
        phone_display = f"+91 {self.client['phone']}" if self.client['phone'] else 'Not available'
        phone_link = f"tel:+91{self.client['phone']}" if self.client['phone'] else '#'
        whatsapp_link = f"https://wa.me/91{self.client['phone']}" if self.client['phone'] else '#'
        
        map_url = f"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3752!2d{self.client['longitude']}!3d{self.client['latitude']}!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x0!2zMTnCsDUxJzMwLjAiTiA3NcKwMjAnNTUuMCJF!5e0!3m2!1sen!2sin!4v1" if self.client['latitude'] and self.client['longitude'] else ""
        
        html = self._generate_head(title, description)
        html += self._generate_header('contact.html')
        
        html += f"""
    <section class="hero">
        <div class="container">
            <h1>Contact Us</h1>
            <p>Get in touch for your photography needs</p>
        </div>
    </section>
    
    <section>
        <div class="container">
            <div class="contact-grid">
                <div class="contact-info">
                    <h3>Get In Touch</h3>
                    
                    <div class="contact-item">
                        <i class="fas fa-phone"></i>
                        <div>
                            <h4>Phone</h4>
                            <p><a href="{phone_link}">{phone_display}</a></p>
                        </div>
                    </div>
                    
                    <div class="contact-item">
                        <i class="fas fa-map-marker-alt"></i>
                        <div>
                            <h4>Address</h4>
                            <p>{self.client['address']}</p>
                        </div>
                    </div>
                    
                    <div class="contact-item">
                        <i class="fas fa-clock"></i>
                        <div>
                            <h4>Working Hours</h4>
                            <p>Mon - Sat: 9:00 AM - 8:00 PM<br>Sun: By Appointment</p>
                        </div>
                    </div>
                    
                    <div class="contact-item">
                        <i class="fas fa-envelope"></i>
                        <div>
                            <h4>Email</h4>
                            <p>info@{self.folder_name}.com</p>
                        </div>
                    </div>
                    
                    <div style="margin-top: 30px;">
                        <a href="{phone_link}" class="btn btn-primary" style="margin-right: 10px;"><i class="fas fa-phone"></i> Call Now</a>
                        <a href="{whatsapp_link}" class="btn btn-whatsapp"><i class="fab fa-whatsapp"></i> WhatsApp</a>
                    </div>
                </div>
                
                <div>
                    <h3 style="margin-bottom: 20px;">Send Us a Message</h3>
                    <form onsubmit="event.preventDefault(); alert('Thank you for your message! We will contact you soon.');">
                        <div class="form-group">
                            <label>Your Name</label>
                            <input type="text" placeholder="Enter your name" required>
                        </div>
                        <div class="form-group">
                            <label>Phone Number</label>
                            <input type="tel" placeholder="Enter your phone" required>
                        </div>
                        <div class="form-group">
                            <label>Service Required</label>
                            <select>
                                <option>Wedding Photography</option>
                                <option>Portrait Photography</option>
                                <option>Event Coverage</option>
                                <option>Other</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Message</label>
                            <textarea rows="4" placeholder="Tell us about your requirements"></textarea>
                        </div>
                        <button type="submit" class="btn btn-primary">Send Message</button>
                    </form>
                </div>
            </div>
        </div>
    </section>
    
    <section style="background: var(--gray);">
        <div class="container">
            <h3 style="text-align: center; margin-bottom: 30px;">Find Us on Map</h3>
            <div class="map-container">
                <iframe src="{map_url}" allowfullscreen="" loading="lazy"></iframe>
            </div>
        </div>
    </section>
"""
        html += self._generate_footer()
        
        with open(f"{self.output_dir}/contact.html", 'w', encoding='utf-8') as f:
            f.write(html)
        print(f"✓ Created: {self.output_dir}/contact.html")

    def create_reviews_page(self):
        """Create Reviews page"""
        title = f"Client Reviews - {self.client['name']}"
        description = f"Read {self.client['review_count']}+ reviews from satisfied clients of {self.client['name']}. Rated {self.client['rating']} stars in {self.client['location']}."
        
        html = self._generate_head(title, description)
        html += self._generate_header('reviews.html')
        
        html += f"""
    <section class="hero">
        <div class="container">
            <h1>Client Reviews</h1>
            <p>See what our clients say about our work</p>
            <div class="rating-badge" style="margin-top: 30px;">
                <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                <span><strong>{self.client['rating']}</strong> out of 5 stars ({self.client['review_count']}+ reviews)</span>
            </div>
        </div>
    </section>
    
    <section>
        <div class="container">
            <div class="section-title">
                <h2>Testimonials</h2>
                <p>Real feedback from our valued clients</p>
            </div>
            
            <div class="review-card fade-in">
                <div class="review-header">
                    <span class="reviewer-name">Rahul Sharma</span>
                    <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                </div>
                <p class="review-text">"Excellent photography service! The team was professional and captured all our special moments beautifully. Highly recommended for anyone looking for quality photography in {self.client['location']}."</p>
            </div>
            
            <div class="review-card fade-in">
                <div class="review-header">
                    <span class="reviewer-name">Priya Patel</span>
                    <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                </div>
                <p class="review-text">"Amazing experience working with {self.client['name']}. They understood our vision perfectly and delivered stunning photos. The editing quality is top-notch. Will definitely recommend to friends and family!"</p>
            </div>
            
            <div class="review-card fade-in">
                <div class="review-header">
                    <span class="reviewer-name">Amit Kumar</span>
                    <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                </div>
                <p class="review-text">"Very professional team with great attention to detail. They made us feel comfortable during the shoot and the final results exceeded our expectations. Great value for money!"</p>
            </div>
            
            <div class="review-card fade-in">
                <div class="review-header">
                    <span class="reviewer-name">Sneha Desai</span>
                    <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                </div>
                <p class="review-text">"Booked them for our family portrait session and couldn't be happier with the results. The photographers were patient with our kids and captured natural, beautiful moments. Thank you!"</p>
            </div>
            
            <div class="review-card fade-in">
                <div class="review-header">
                    <span class="reviewer-name">Vikram Joshi</span>
                    <span class="stars">{'<i class="fas fa-star"></i>' * int(self.client['rating'])}</span>
                </div>
                <p class="review-text">"Outstanding work! From the initial consultation to the final delivery, everything was handled professionally. The photos are absolutely beautiful and something we'll cherish forever."</p>
            </div>
        </div>
    </section>
    
    <section style="background: var(--secondary);">
        <div class="container" style="text-align: center;">
            <h2>Share Your Experience</h2>
            <p style="margin: 20px 0 30px;">We value your feedback. Let us know about your experience with us.</p>
            <a href="contact.html" class="btn btn-primary">Write a Review</a>
        </div>
    </section>
"""
        html += self._generate_footer()
        
        with open(f"{self.output_dir}/reviews.html", 'w', encoding='utf-8') as f:
            f.write(html)
        print(f"✓ Created: {self.output_dir}/reviews.html")

    def generate_all_pages(self):
        """Generate all 5 pages for the client"""
        os.makedirs(self.output_dir, exist_ok=True)
        self.create_index_page()
        self.create_about_page()
        self.create_services_page()
        self.create_contact_page()
        self.create_reviews_page()
        print(f"\n✅ Website complete for: {self.client['name']}\n")


# Main execution
if __name__ == "__main__":
    # Load client data from JSON file
    with open('/mnt/okcomputer/output/clients_data.json', 'r', encoding='utf-8') as f:
        clients = json.load(f)
    
    print(f"Generating websites for {len(clients)} photography businesses...\n")
    print("="*80)
    
    for i, client in enumerate(clients, 1):
        print(f"\n[{i}/{len(clients)}] Processing: {client['name'][:40]}...")
        generator = WebsiteGenerator(client)
        generator.generate_all_pages()
    
    print("\n" + "="*80)
    print(f"\n🎉 ALL {len(clients)} WEBSITES GENERATED SUCCESSFULLY!")
    print(f"Total pages created: {len(clients) * 5}")
    print("\nOutput location: /mnt/okcomputer/output/")
