space-ac-design / app.py
AI Software Factory
fix: Add GitHub token authentication for Gist creation
be2dec1
Raw History Blame Contribute Delete
293 kB
""" AI Software Factory - Space AC: Design Variations Enhanced Gradio UI with visual JSON display + FastAPI """ import gradio as gr from fastapi import FastAPI from agents.moodboard_analyzer import MoodboardAnalyzer from agents.design_variation_generator import DesignVariationGenerator from agents.flutter_screen_generator import FlutterScreenGenerator from agents.simple_flutter_generator import SimpleFlutterGenerator import json import os import requests from dotenv import load_dotenv # Load environment variables from .env file load_dotenv() # Initialize agents moodboard_analyzer = MoodboardAnalyzer() design_variation_generator = DesignVariationGenerator() flutter_screen_generator = FlutterScreenGenerator() simple_flutter_generator = SimpleFlutterGenerator() # FastAPI app for orchestrator app = FastAPI( title="Space AC: Design Variations", description="Design system generation agents", version="1.0.0" ) @app.get("/health") async def health(): return { "status": "healthy", "space": "ac-design", "agents": ["moodboard_analyzer", "design_variation_generator", "flutter_screen_generator"] } @app.post("/api/moodboard-analyzer") async def moodboard_analyzer_endpoint(data: dict): """ API endpoint for Moodboard Analyzer Input: reference_images: List of image URLs/descriptions mood_keywords: List of mood keywords Output: analysis: Color palettes, typography, UI patterns, insights """ try: result = moodboard_analyzer.process(data) return { "success": True, "agent": "moodboard_analyzer", "output": result } except Exception as e: return { "success": False, "error": str(e) } @app.post("/api/design-variation-generator") async def design_variation_generator_endpoint(data: dict): """ API endpoint for Design Variation Generator Input: moodboard_analysis: Output from AC1 wireframe: Wireframe description app_context: App context info Output: themes: List of 4 design theme variations """ try: result = design_variation_generator.process(data) return { "success": True, "agent": "design_variation_generator", "output": result } except Exception as e: return { "success": False, "error": str(e) } @app.post("/api/flutter-screen-generator") async def flutter_screen_generator_endpoint(data: dict): """ API endpoint for Flutter Screen Generator (AC3) Input: theme: Complete theme from AC2 app_type: Type of app (fitness, banking, rider, etc.) screens: List of screen names to generate Output: screens: List of generated screens with Flutter/Dart code """ try: result = flutter_screen_generator.process(data) return { "success": True, "agent": "flutter_screen_generator", "output": result } except Exception as e: return { "success": False, "error": str(e) } def create_color_palette_html(palettes): """Create HTML visualization for color palettes""" html = """ <style> .palette-container { display: flex; flex-direction: column; gap: 20px; padding: 10px; } .palette-card { border: 1px solid #e0e0e0; border-radius: 12px; padding: 20px; background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .palette-header { font-size: 20px; font-weight: bold; margin-bottom: 8px; color: #333; } .palette-mood { color: #666; font-style: italic; margin-bottom: 15px; } .color-row { display: flex; gap: 10px; flex-wrap: wrap; } .color-box { display: flex; flex-direction: column; align-items: center; gap: 5px; } .color-swatch { width: 80px; height: 80px; border-radius: 8px; border: 2px solid #ddd; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .color-code { font-family: monospace; font-size: 12px; font-weight: bold; color: #444; } </style> <div class="palette-container"> """ for palette in palettes: html += f""" <div class="palette-card"> <div class="palette-header">🎨 {palette['name']}</div> <div class="palette-mood">{palette['mood']}</div> <div class="color-row"> """ for color in palette['colors']: html += f""" <div class="color-box"> <div class="color-swatch" style="background-color: {color};"></div> <div class="color-code">{color}</div> </div> """ html += """ </div> </div> """ html += """ </div> """ return html def create_typography_html(typography_trends): """Create HTML visualization for typography""" html = """ <style> .typo-container { display: flex; flex-direction: column; gap: 15px; padding: 10px; } .typo-card { border-left: 4px solid #007AFF; padding: 15px 20px; background: #f8f9fa; border-radius: 8px; } .typo-font { font-size: 24px; font-weight: bold; margin-bottom: 8px; color: #333; } .typo-usage { display: inline-block; background: #007AFF; color: white; padding: 4px 12px; border-radius: 12px; font-size: 12px; margin-bottom: 8px; } .typo-char { color: #666; font-size: 14px; } </style> <div class="typo-container"> """ for typo in typography_trends: html += f""" <div class="typo-card"> <div class="typo-font">✍️ {typo['font_family']}</div> <div class="typo-usage">{typo['usage']}</div> <div class="typo-char">{typo['characteristics']}</div> </div> """ html += """ </div> """ return html def create_ui_patterns_html(ui_patterns): """Create HTML visualization for UI patterns""" html = """ <style> .pattern-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; padding: 10px; } .pattern-card { border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; background: white; transition: transform 0.2s; } .pattern-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); } .pattern-name { font-weight: bold; font-size: 16px; margin-bottom: 8px; color: #333; } .pattern-freq { display: inline-block; background: #34C759; color: white; padding: 3px 10px; border-radius: 10px; font-size: 11px; margin-bottom: 8px; } .pattern-freq.common { background: #FF9500; } .pattern-freq.rare { background: #8E8E93; } .pattern-examples { color: #666; font-size: 13px; font-style: italic; } </style> <div class="pattern-container"> """ for pattern in ui_patterns: freq_class = pattern.get('frequency', 'common').replace(' ', '-').lower() freq_label = pattern.get('frequency', 'common') html += f""" <div class="pattern-card"> <div class="pattern-name">🧩 {pattern['pattern']}</div> <div class="pattern-freq {freq_class}">{freq_label}</div> """ if 'examples' in pattern: examples_text = ', '.join(pattern['examples'][:3]) html += f""" <div class="pattern-examples">Examples: {examples_text}</div> """ html += """ </div> """ html += """ </div> """ return html def create_theme_card_html(theme: dict, theme_number: int) -> str: """Create HTML card for a single design theme""" html = f""" <style> .theme-card-{theme_number} {{ border: 2px solid #e0e0e0; border-radius: 16px; padding: 24px; background: white; box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: transform 0.3s, box-shadow 0.3s; height: 100%; display: flex; flex-direction: column; }} .theme-card-{theme_number}:hover {{ transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); border-color: #007AFF; }} .theme-header-{theme_number} {{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }} .theme-name-{theme_number} {{ font-size: 22px; font-weight: bold; color: #1C1C1E; }} .theme-badge-{theme_number} {{ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; }} .theme-mood-{theme_number} {{ color: #8E8E93; font-style: italic; margin-bottom: 20px; font-size: 14px; }} .theme-section-{theme_number} {{ margin-bottom: 16px; }} .theme-section-title-{theme_number} {{ font-size: 13px; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }} .theme-colors-{theme_number} {{ display: flex; gap: 8px; flex-wrap: wrap; }} .theme-color-box-{theme_number} {{ width: 32px; height: 32px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }} .theme-detail-{theme_number} {{ font-size: 13px; color: #444; line-height: 1.6; padding: 8px; background: #f8f9fa; border-radius: 6px; margin-bottom: 8px; }} .theme-select-btn-{theme_number} {{ margin-top: auto; padding: 12px 24px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; text-align: center; transition: transform 0.2s; }} .theme-select-btn-{theme_number}:hover {{ transform: scale(1.05); }} </style> <div class="theme-card-{theme_number}"> <div class="theme-header-{theme_number}"> <div class="theme-name-{theme_number}">🎨 {theme.get('name', 'Theme')}</div> <div class="theme-badge-{theme_number}">{theme.get('style', '').upper()}</div> </div> <div class="theme-mood-{theme_number}">{theme.get('mood', '')}</div> <div class="theme-section-{theme_number}"> <div class="theme-section-title-{theme_number}">Colors</div> <div class="theme-colors-{theme_number}"> """ # Add color swatches palette = theme.get('palette', {}) for color_name, color_value in list(palette.items())[:6]: # Show first 6 colors html += f'<div class="theme-color-box-{theme_number}" style="background-color: {color_value};" title="{color_name}: {color_value}"></div>' html += f""" </div> </div> <div class="theme-section-{theme_number}"> <div class="theme-section-title-{theme_number}">Typography</div> <div class="theme-detail-{theme_number}"> Display: {theme.get('typography', {}).get('display', {}).get('font_family', 'System')}<br> Body: {theme.get('typography', {}).get('body', {}).get('font_family', 'System')} </div> </div> <div class="theme-section-{theme_number}"> <div class="theme-section-title-{theme_number}">Components</div> <div class="theme-detail-{theme_number}"> {theme.get('component_style', {}).get('buttons', 'Standard buttons')} </div> </div> <div class="theme-section-{theme_number}"> <div class="theme-section-title-{theme_number}">Animations</div> <div class="theme-detail-{theme_number}"> {theme.get('animations', {}).get('style', 'Standard animations')} <br><small>Speed: {theme.get('animations', {}).get('speed', 'Medium')}</small> </div> </div> <button class="theme-select-btn-{theme_number}">Select This Theme →</button> </div> """ return html def create_themes_grid_html(themes: list) -> str: """Create grid of all 4 themes""" html = """ <style> .themes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; padding: 20px; } @media (max-width: 768px) { .themes-grid { grid-template-columns: 1fr; } } </style> <div class="themes-grid"> """ for idx, theme in enumerate(themes, 1): html += create_theme_card_html(theme, idx) html += """ </div> """ return html def create_preview_gallery_html(previews: list) -> str: """Create HTML gallery for screen previews""" html = """ <style> .preview-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; padding: 20px; } .preview-card { border: 2px solid #e0e0e0; border-radius: 16px; overflow: hidden; background: white; box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: transform 0.3s, box-shadow 0.3s; } .preview-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); border-color: #007AFF; } .preview-image-container { position: relative; width: 100%; background: #f5f5f5; display: flex; align-items: center; justify-content: center; min-height: 400px; } .preview-image { width: 100%; height: auto; display: block; } .preview-placeholder { width: 100%; height: 400px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; color: white; font-size: 18px; font-weight: 600; } .preview-info { padding: 16px; } .preview-screen-name { font-size: 18px; font-weight: bold; color: #1C1C1E; margin-bottom: 8px; text-transform: capitalize; } .preview-status { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; margin-bottom: 8px; } .status-generated { background: #34C759; color: white; } .status-placeholder { background: #FF9500; color: white; } .status-error { background: #FF3B30; color: white; } .preview-message { font-size: 12px; color: #8E8E93; margin-top: 8px; } @media (max-width: 768px) { .preview-gallery { grid-template-columns: 1fr; } } </style> <div class="preview-gallery"> """ for preview in previews: screen = preview.get("screen", "Screen") image_url = preview.get("image_url", "") status = preview.get("status", "generated") message = preview.get("message", "") # Status badge status_class = { "generated": "status-generated", "placeholder": "status-placeholder", "error": "status-error", "timeout": "status-error" }.get(status, "status-placeholder") status_text = { "generated": "✅ GENERATED", "placeholder": "⚠️ PLACEHOLDER", "error": "❌ ERROR", "timeout": "⏱️ TIMEOUT" }.get(status, "UNKNOWN") html += f""" <div class="preview-card"> <div class="preview-image-container"> """ if image_url and status == "generated": html += f'<img src="{image_url}" alt="{screen} screen" class="preview-image" />' else: html += f'<div class="preview-placeholder">📱 {screen.upper()}</div>' html += f""" </div> <div class="preview-info"> <div class="preview-screen-name">📱 {screen}</div> <div class="preview-status {status_class}">{status_text}</div> """ if message: html += f'<div class="preview-message">{message}</div>' html += """ </div> </div> """ html += """ </div> """ return html # Gradio UI functions def analyze_moodboard( image_descriptions: str, mood_keywords: str ): """ Gradio interface function for Moodboard Analyzer with enhanced visual output """ # Parse inputs descriptions = [d.strip() for d in image_descriptions.split('\n') if d.strip()] keywords = [k.strip() for k in mood_keywords.split(',') if k.strip()] # Prepare input data reference_images = [ {"description": desc, "url": ""} for desc in descriptions ] input_data = { "reference_images": reference_images, "mood_keywords": keywords } # Process result = moodboard_analyzer.process(input_data) # Format output analysis = result.get("analysis", {}) # Create visual HTML components color_palette_html = create_color_palette_html(analysis.get("color_palettes", [])) typography_html = create_typography_html(analysis.get("typography_trends", [])) ui_patterns_html = create_ui_patterns_html(analysis.get("ui_patterns", [])) # Layout styles markdown layout_md = "## 📐 Layout Styles\n\n" for style in analysis.get("layout_styles", []): layout_md += f"- {style}\n" # Insights markdown insights_md = "## 💡 Design Insights\n\n" insights_md += "```\n" + analysis.get("insights", "") + "\n```" # JSON output json_output = json.dumps(analysis, indent=2) return ( color_palette_html, typography_html, ui_patterns_html, layout_md, insights_md, json_output, analysis # Return raw data for state ) def generate_design_themes( moodboard_analysis_json: str, wireframe_description: str ): """ Generate 4 design theme variations from moodboard analysis """ try: # Parse moodboard analysis moodboard_analysis = json.loads(moodboard_analysis_json) except: return ( "<p style='color: red;'>Error: Invalid moodboard analysis. Please run AC1 first.</p>", "{}" ) # Prepare input for AC2 input_data = { "moodboard_analysis": moodboard_analysis, "wireframe": wireframe_description, "app_context": { "type": "mobile_app" } } # Generate themes result = design_variation_generator.process(input_data) themes = result.get("themes", []) if not themes: return ( "<p style='color: red;'>No themes generated</p>", "{}" ) # Create visual grid themes_grid_html = create_themes_grid_html(themes) # JSON output json_output = json.dumps(result, indent=2) return ( themes_grid_html, json_output, result # Return raw data for state ) def create_anonymous_gist(code: str, description: str = "Flutter code from AI Software Factory") -> str: """ Create a GitHub Gist with the generated code Returns the Gist ID for use with DartPad Requires GITHUB_TOKEN environment variable for authentication """ try: # Get GitHub token from environment github_token = os.getenv("GITHUB_TOKEN", "").strip() if not github_token: print("❌ GITHUB_TOKEN not configured - Gist creation requires authentication") print(" Add GITHUB_TOKEN to HuggingFace Space Secrets") return None url = "https://api.github.com/gists" payload = { "description": description, "public": True, "files": { "main.dart": { "content": code } } } headers = { "Accept": "application/vnd.github+json", "Authorization": f"Bearer {github_token}", "X-GitHub-Api-Version": "2022-11-28" } print(f"📤 Creating Gist with GitHub API (authenticated)...") response = requests.post(url, json=payload, headers=headers, timeout=10) response.raise_for_status() gist_data = response.json() gist_id = gist_data["id"] gist_url = gist_data.get("html_url", f"https://gist.github.com/{gist_id}") print(f"✅ Created Gist: {gist_id}") print(f" URL: {gist_url}") return gist_id except requests.exceptions.HTTPError as e: print(f"❌ Gist creation failed (HTTP {e.response.status_code}): {e}") if e.response.status_code == 401: print(" Check that GITHUB_TOKEN is valid and has 'gist' scope") return None except Exception as e: print(f"❌ Gist creation failed: {e}") return None def generate_simple_flutter(prompt: str): """ Simple Flutter generation: prompt -> DeepSeek -> code Automatically creates Gist and embeds in DartPad """ if not prompt or not prompt.strip(): return ("", "<p style='color: red;'>Please enter a prompt</p>", "") result = simple_flutter_generator.generate(prompt) if not result["success"]: error_msg = result.get("error", "Unknown error") return ("", f"<p style='color: red;'>❌ Error: {error_msg}</p>", "") code = result["code"] lines = result["lines"] # Create anonymous Gist print("📤 Creating anonymous Gist...") gist_id = create_anonymous_gist(code, f"Flutter code: {prompt[:100]}") if gist_id: # Success - embed DartPad with code loaded dartpad_url = f"https://dartpad.dev/embed-flutter.html?id={gist_id}&theme=dark" gist_url = f"https://gist.github.com/{gist_id}" summary_html = f""" <div style='padding: 20px; background: #f0f9ff; border-radius: 8px; border-left: 4px solid #10b981;'> <h3 style='margin: 0 0 10px 0; color: #059669;'>✅ Codice Generato e Caricato in DartPad</h3> <p style='margin: 5px 0;'><strong>Prompt:</strong> {prompt}</p> <p style='margin: 5px 0;'><strong>Righe di codice:</strong> {lines}</p> <p style='margin: 5px 0;'><strong>Gist ID:</strong> <code>{gist_id}</code></p> <div style='margin-top: 15px; padding: 10px; background: white; border-radius: 4px; border: 1px solid #10b981;'> <p style='margin: 5px 0; color: #059669; font-weight: bold;'>🎉 Il codice è già caricato nel DartPad qui sotto!</p> <p style='margin: 5px 0;'>Clicca il pulsante "▶ Run" nel DartPad per eseguire l'app</p> <p style='margin: 10px 0 5px 0; font-size: 13px;'> 📎 Link Gist: <a href='{gist_url}' target='_blank' style='color: #2563eb;'>{gist_url}</a> </p> </div> </div> """ dartpad_html = f""" <div style='border: 2px solid #10b981; border-radius: 8px; overflow: hidden;'> <div style='background: linear-gradient(135deg, #059669 0%, #10b981 100%); color: white; padding: 12px; font-weight: bold; display: flex; justify-content: space-between; align-items: center;'> <span>📱 DartPad - Codice Automaticamente Caricato</span> <a href='https://dartpad.dev/?id={gist_id}' target='_blank' style='background: white; color: #059669; padding: 6px 12px; border-radius: 4px; text-decoration: none; font-size: 13px;'> 🚀 Apri in DartPad Full Screen </a> </div> <iframe src="{dartpad_url}" style="width:100%; height:700px; border:none;" allow="clipboard-write"> </iframe> </div> """ else: # Fallback - Gist creation failed summary_html = f""" <div style='padding: 20px; background: #fff3cd; border-radius: 8px; border-left: 4px solid #ffc107;'> <h3 style='margin: 0 0 10px 0; color: #856404;'>⚠️ Codice Generato (Auto-load DartPad non disponibile)</h3> <p style='margin: 5px 0;'><strong>Prompt:</strong> {prompt}</p> <p style='margin: 5px 0;'><strong>Righe di codice:</strong> {lines}</p> <div style='margin: 10px 0; padding: 10px; background: #fff; border-radius: 4px; border-left: 3px solid #ffc107;'> <p style='margin: 0 0 5px 0; font-weight: bold; color: #856404;'>ℹ️ Configurazione richiesta:</p> <p style='margin: 5px 0; font-size: 13px;'>Per abilitare il caricamento automatico in DartPad, l'admin dello Space deve:</p> <ol style='margin: 5px 0; padding-left: 20px; font-size: 13px;'> <li>Creare un GitHub Personal Access Token con scope "gist"</li> <li>Aggiungerlo come Secret "GITHUB_TOKEN" nelle impostazioni dello Space</li> </ol> </div> <p style='margin: 10px 0 5px 0; color: #856404; font-weight: bold;'>Come testare manualmente:</p> <ol style='margin: 5px 0; padding-left: 20px;'> <li>Espandi la sezione "💻 Codice Sorgente" qui sotto</li> <li>Copia tutto il codice</li> <li>Apri <a href='https://dartpad.dev' target='_blank' style='color: #2563eb;'>dartpad.dev</a> in una nuova tab</li> <li>Incolla il codice e clicca "Run"</li> </ol> </div> """ dartpad_html = """ <div style='border: 2px solid #ffc107; border-radius: 8px; overflow: hidden;'> <div style='background: #ffc107; color: #000; padding: 10px; font-weight: bold;'> ⚠️ DartPad Manuale - Incolla il codice qui </div> <iframe src="https://dartpad.dev/embed-flutter.html?theme=dark&run=false" style="width:100%; height:600px; border:none;" allow="clipboard-write"> </iframe> </div> """ return (code, summary_html, dartpad_html) def generate_flutter_screens( theme_json: str, app_type: str, custom_prompt: str, screens_text: str ): """ Generate Flutter/Dart screen code from a selected theme """ try: # Parse theme JSON theme_data = json.loads(theme_json) # Get theme from the result if "themes" in theme_data: # Full AC2 output - use first theme theme = theme_data["themes"][0] else: # Single theme object theme = theme_data except: return ( "", "", "", "<p style='color: red;'>❌ Error: Invalid theme JSON. Please run AC2 first and paste a theme.</p>" ) # Parse screens list screens = [s.strip() for s in screens_text.split(',') if s.strip()] if not screens: screens = ["home", "detail", "profile"] # Prepare input for AC3 input_data = { "theme": theme, "app_type": app_type, "custom_prompt": custom_prompt, # Add custom prompt "screens": screens[:3] # Max 3 screens } # Generate Flutter screens result = flutter_screen_generator.process(input_data) screens_data = result.get("screens", []) # Debug logging print(f"🔍 DEBUG: Result keys: {result.keys()}") print(f"🔍 DEBUG: Screens count: {len(screens_data)}") if "error" in result: print(f"❌ DEBUG: Error in result: {result['error']}") if not screens_data or len(screens_data) < 4: error_msg = result.get("error", "Unknown error") empty = "<p style='color: red;'>❌ Error generating backgrounds</p>" return ( f"<p style='color: red;'>❌ No screens generated</p><p>Error: {error_msg}</p>", empty, "", empty, "", empty, "", empty, "" ) # Get theme colors palette = theme.get("palette", {}) primary = palette.get("primary", "#FF6D00") secondary = palette.get("secondary", "#FFE082") accent = palette.get("accent", "#FFA726") def create_preview(variant_data, code): """Create HTML preview for a complete variant (background + header + footer + cards)""" bg_style = variant_data.get("bg_style", "gradient_linear") header_type = variant_data.get("header_type", "minimal") footer_type = variant_data.get("footer_type", "minimal_icons") variant_name = variant_data.get("name", bg_style.replace('_', ' ').title()) card_ids = variant_data.get("cards", []) # Background layer if bg_style == "waves": preview_bg = f"background: linear-gradient(to bottom, {primary}20, {secondary}33, {accent}20); position: relative; overflow: hidden;" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" viewBox="0 0 430 932" preserveAspectRatio="none"> <path d="M 0,140 Q 107.5,75 215,140 T 430,130 L 430,0 L 0,0 Z" fill="{primary}" opacity="0.4"/> <path d="M 0,465 Q 129,418 215,485 T 430,465 L 430,279 L 0,279 Z" fill="{secondary}" opacity="0.35"/> <path d="M 0,820 Q 107.5,763 215,801 T 430,792 L 430,932 L 0,932 Z" fill="{accent}" opacity="0.3"/> </svg> """ elif bg_style == "gradient_linear": preview_bg = f"background: linear-gradient(135deg, {primary}, {secondary}, {accent});" bg_layer = "" elif bg_style == "gradient_radial": preview_bg = f"background: radial-gradient(circle, {primary}, {secondary}, {accent});" bg_layer = "" else: # geometric preview_bg = f"background: linear-gradient(135deg, {primary}33, {secondary}4D);" bg_layer = f""" <div style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; overflow: hidden;"> <div style="position: absolute; left: 20%; top: 15%; width: 40%; padding-top: 40%; background: {primary}; opacity: 0.3; border-radius: 50%;"></div> <div style="position: absolute; right: 10%; bottom: 30%; width: 35%; padding-top: 35%; background: {accent}; opacity: 0.25; border-radius: 50%;"></div> <div style="position: absolute; left: 50%; top: 45%; width: 25%; padding-top: 25%; background: {secondary}; opacity: 0.2; border-radius: 50%; transform: translate(-50%, -50%);"></div> <div style="position: absolute; right: 8%; top: 10%; width: 30%; height: 20%; background: {accent}; opacity: 0.15; border-radius: 20px;"></div> </div> """ # Header layer if header_type == "avatar_search": header_html = f""" <div style="position: absolute; top: 50px; left: 0; right: 0; padding: 0 20px; z-index: 20; display: flex; justify-content: space-between; align-items: center;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; border: 2px solid #fff;"></div> <div style="flex: 1; margin: 0 12px; height: 40px; background: rgba(255,255,255,0.9); border-radius: 20px; display: flex; align-items: center; padding: 0 15px; color: #666; font-size: 13px;">🔍 Search...</div> <div style="width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 18px;">🔔</div> </div> """ elif header_type == "tabs": header_html = f""" <div style="position: absolute; top: 50px; left: 0; right: 0; padding: 0 20px; z-index: 20;"> <div style="color: #fff; font-size: 22px; font-weight: bold; margin-bottom: 12px;">Dashboard</div> <div style="display: flex; gap: 8px;"> <div style="padding: 8px 16px; background: {primary}; color: #fff; border-radius: 20px; font-size: 12px;">All</div> <div style="padding: 8px 16px; background: rgba(255,255,255,0.2); color: #fff; border-radius: 20px; font-size: 12px;">Active</div> <div style="padding: 8px 16px; background: rgba(255,255,255,0.2); color: #fff; border-radius: 20px; font-size: 12px;">Completed</div> </div> </div> """ elif header_type == "stats_header": header_html = f""" <div style="position: absolute; top: 50px; left: 0; right: 0; padding: 0 20px; z-index: 20;"> <div style="display: flex; justify-content: space-around; background: rgba(255,255,255,0.15); backdrop-filter: blur(10px); border-radius: 16px; padding: 16px;"> <div style="text-align: center;"><div style="color: #fff; font-size: 20px; font-weight: bold;">24</div><div style="color: rgba(255,255,255,0.7); font-size: 11px;">Active</div></div> <div style="text-align: center;"><div style="color: #fff; font-size: 20px; font-weight: bold;">156</div><div style="color: rgba(255,255,255,0.7); font-size: 11px;">Total</div></div> <div style="text-align: center;"><div style="color: #fff; font-size: 20px; font-weight: bold;">4.8</div><div style="color: rgba(255,255,255,0.7); font-size: 11px;">Rating</div></div> </div> </div> """ elif header_type == "collapsible": header_html = f""" <div style="position: absolute; top: 50px; left: 0; right: 0; padding: 0 20px; z-index: 20;"> <div style="background: rgba(255,255,255,0.15); backdrop-filter: blur(10px); border-radius: 16px; padding: 20px;"> <div style="color: #fff; font-size: 24px; font-weight: bold;">Welcome Back!</div> <div style="color: rgba(255,255,255,0.8); font-size: 13px; margin-top: 4px;">Ready to continue your journey?</div> </div> </div> """ else: # minimal header_html = f""" <div style="position: absolute; top: 50px; left: 0; right: 0; padding: 0 20px; z-index: 20;"> <div style="color: #fff; font-size: 26px; font-weight: bold; text-shadow: 0 2px 8px rgba(0,0,0,0.2);">Home</div> </div> """ # Footer layer if footer_type == "floating_fab": footer_html = f""" <div style="position: absolute; bottom: 0; left: 0; right: 0; height: 80px; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); border-radius: 28px 28px 0 0; display: flex; justify-content: space-around; align-items: center; z-index: 20;"> <div style="font-size: 22px;">🏠</div> <div style="font-size: 22px; opacity: 0.5;">📊</div> <div style="width: 56px; height: 56px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; font-size: 28px; margin-top: -40px; box-shadow: 0 8px 16px rgba(0,0,0,0.15);">➕</div> <div style="font-size: 22px; opacity: 0.5;">🔔</div> <div style="font-size: 22px; opacity: 0.5;">👤</div> </div> """ elif footer_type == "animated_pills": footer_html = f""" <div style="position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; background: rgba(255,255,255,0.95); padding: 12px 20px; border-radius: 30px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 20;"> <div style="display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: {primary}; color: #fff; border-radius: 20px; font-size: 11px;"><span style="font-size: 16px;">🏠</span> Home</div> <div style="display: flex; align-items: center; gap: 6px; padding: 8px 12px; color: #666; font-size: 16px;">📊</div> <div style="display: flex; align-items: center; gap: 6px; padding: 8px 12px; color: #666; font-size: 16px;">👤</div> </div> """ elif footer_type == "classic_expanded": footer_html = f""" <div style="position: absolute; bottom: 0; left: 0; right: 0; height: 70px; background: #fff; border-top: 1px solid #eee; display: flex; justify-content: space-around; align-items: center; z-index: 20;"> <div style="text-align: center;"><div style="font-size: 22px; color: {primary};">🏠</div><div style="font-size: 10px; color: {primary}; margin-top: 2px;">Home</div></div> <div style="text-align: center;"><div style="font-size: 22px; opacity: 0.4;">📊</div><div style="font-size: 10px; opacity: 0.4; margin-top: 2px;">Stats</div></div> <div style="text-align: center;"><div style="font-size: 22px; opacity: 0.4;">🔔</div><div style="font-size: 10px; opacity: 0.4; margin-top: 2px;">Alerts</div></div> <div style="text-align: center;"><div style="font-size: 22px; opacity: 0.4;">👤</div><div style="font-size: 10px; opacity: 0.4; margin-top: 2px;">Profile</div></div> </div> """ elif footer_type == "gesture_bar": footer_html = f""" <div style="position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: 140px; height: 5px; background: rgba(255,255,255,0.3); border-radius: 10px; z-index: 20;"></div> """ else: # minimal_icons footer_html = f""" <div style="position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 24px; background: rgba(255,255,255,0.2); backdrop-filter: blur(10px); padding: 14px 32px; border-radius: 30px; z-index: 20;"> <div style="font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));">🏠</div> <div style="font-size: 22px; opacity: 0.5; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));">📊</div> <div style="font-size: 22px; opacity: 0.5; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));">🔔</div> <div style="font-size: 22px; opacity: 0.5; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));">👤</div> </div> """ # Generate cards HTML for the content area cards_html = "" if card_ids: cards_html = '<div style="position: absolute; top: 140px; left: 0; right: 0; bottom: 90px; padding: 0 16px; overflow-y: auto; z-index: 15; display: flex; flex-direction: column; gap: 12px;">' for card_id in card_ids[:4]: # Max 4 cards in preview try: card_html = render_card_html(card_id, primary, secondary, accent) # Wrap card in a container with scale to fit preview cards_html += f'<div style="transform: scale(0.85); transform-origin: top center; margin: -8px 0;">{card_html}</div>' except: # Skip cards that fail to render pass cards_html += '</div>' return f""" <div style="width: 100%; padding: 20px; background: #000; border-radius: 16px;"> <div style="margin: 0 auto; max-width: 380px;"> <div style="background: #000; padding: 15px; border-radius: 28px; box-shadow: 0 15px 40px rgba(0,0,0,0.5);"> <div style="width: 100%; padding-top: 216%; border-radius: 20px; {preview_bg} position: relative; overflow: hidden;"> {bg_layer} <div style="position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 140px; height: 24px; background: #000; border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); z-index: 10;"></div> {header_html} {cards_html} {footer_html} </div> </div> <p style="color: #fff; text-align: center; margin-top: 15px; font-size: 13px;">✨ {variant_name}</p> </div> </div> """ # Extract all 4 screens previews = [] codes = [] variant_names = [] for i, screen in enumerate(screens_data[:4]): code = screen.get("code", "") preview = create_preview(screen, code) previews.append(preview) codes.append(code) variant_names.append(screen.get("name", f"Variant {i+1}")) # Create summary with variant details variant_list_html = "" for i, screen in enumerate(screens_data[:4]): variant_list_html += f""" <div style='background: #fff; padding: 12px; margin-bottom: 8px; border-radius: 8px; border-left: 3px solid #007AFF;'> <strong>{screen.get('name', f'Variant {i+1}')}</strong><br/> <span style='font-size: 12px; color: #666;'> Background: {screen.get('bg_style', 'N/A')} | Header: {screen.get('header_type', 'N/A')} | Footer: {screen.get('footer_type', 'N/A')} </span> </div> """ summary_html = f""" <div style='padding: 20px; background: #f0f9ff; border-radius: 12px; border-left: 4px solid #007AFF;'> <h3 style='margin-top: 0; color: #007AFF;'>✅ 4 AI-Generated Variants Created!</h3> <p><strong>Theme:</strong> {theme.get('name', 'Unknown')}</p> <p><strong>App Type:</strong> {app_type.capitalize()}</p> <p><strong>Total Lines:</strong> {result.get('total_lines', 0)}</p> <div style='margin-top: 12px;'> <strong>Variants:</strong> {variant_list_html} </div> <p style='margin-bottom: 0; margin-top: 12px;'><strong>Status:</strong> Ready! 🎨 Each variant intelligently combines background, header, and footer based on your theme style.</p> </div> """ return ( summary_html, previews[0], codes[0], # waves previews[1], codes[1], # linear previews[2], codes[2], # radial previews[3], codes[3] # geometric ) def render_background_html(bg_id: str, bg_info: dict, primary: str, secondary: str, accent: str) -> str: """ Generate HTML/CSS for a single background preview Returns HTML div with the background rendered """ bg_name = bg_info['name'] bg_category = bg_info['category'] # Common container style base_style = "width: 150px; height: 250px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.15);" # Generate background based on type if "gradient_linear" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}, {secondary}, {accent});" bg_layer = "" elif "gradient_radial" in bg_id: bg_style = f"{base_style} background: radial-gradient(circle at 30% 40%, {primary}, {secondary} 50%, {accent});" bg_layer = "" elif "gradient_angular" in bg_id: bg_style = f"{base_style} background: conic-gradient(from 45deg, {primary}, {secondary}, {accent}, {primary});" bg_layer = "" elif "gradient_sweep" in bg_id: bg_style = f"{base_style} background: conic-gradient(from 0deg at 50% 50%, {primary}, {secondary}, {accent}, {primary});" bg_layer = "" elif "gradient_diagonal" in bg_id: bg_style = f"{base_style} background: linear-gradient(45deg, {primary} 0%, {secondary} 50%, {accent} 100%);" bg_layer = "" elif "gradient_mesh" in bg_id: bg_style = f"{base_style} background: radial-gradient(at 20% 30%, {primary} 0%, transparent 50%), radial-gradient(at 80% 70%, {secondary} 0%, transparent 50%), radial-gradient(at 50% 50%, {accent} 0%, transparent 50%), linear-gradient(135deg, {primary}20, {secondary}30);" bg_layer = "" elif "waves_smooth" in bg_id or "waves_sharp" in bg_id or "waves_layered" in bg_id or "waves_curved" in bg_id or "waves_minimal" in bg_id: bg_style = f"{base_style} background: linear-gradient(to bottom, {primary}20, {secondary}33, {accent}20);" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" viewBox="0 0 150 250" preserveAspectRatio="none"> <path d="M 0,60 Q 37.5,30 75,60 T 150,55 L 150,0 L 0,0 Z" fill="{primary}" opacity="0.4"/> <path d="M 0,150 Q 45,130 75,155 T 150,150 L 150,90 L 0,90 Z" fill="{secondary}" opacity="0.35"/> <path d="M 0,210 Q 37.5,190 75,205 T 150,202 L 150,250 L 0,250 Z" fill="{accent}" opacity="0.3"/> </svg> """ elif "geometric_circles" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}33, {secondary}4D);" bg_layer = f""" <div style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;"> <div style="position: absolute; left: 15%; top: 12%; width: 35%; padding-top: 35%; background: {primary}; opacity: 0.3; border-radius: 50%;"></div> <div style="position: absolute; right: 8%; bottom: 25%; width: 30%; padding-top: 30%; background: {accent}; opacity: 0.25; border-radius: 50%;"></div> <div style="position: absolute; left: 45%; top: 40%; width: 22%; padding-top: 22%; background: {secondary}; opacity: 0.2; border-radius: 50%;"></div> </div> """ elif "geometric_triangles" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}1A, {secondary}26);" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" viewBox="0 0 150 250"> <polygon points="30,50 60,10 90,50" fill="{primary}" opacity="0.3"/> <polygon points="80,120 110,80 140,120" fill="{secondary}" opacity="0.3"/> <polygon points="20,180 50,140 80,180" fill="{accent}" opacity="0.25"/> </svg> """ elif "geometric_hexagons" in bg_id: bg_style = f"{base_style} background: linear-gradient(to bottom, {primary}1A, {secondary}26);" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" viewBox="0 0 150 250"> <polygon points="75,30 95,40 95,60 75,70 55,60 55,40" fill="{primary}" opacity="0.3" stroke="{primary}" stroke-width="1"/> <polygon points="45,100 65,110 65,130 45,140 25,130 25,110" fill="{secondary}" opacity="0.3" stroke="{secondary}" stroke-width="1"/> <polygon points="105,160 125,170 125,190 105,200 85,190 85,170" fill="{accent}" opacity="0.25" stroke="{accent}" stroke-width="1"/> </svg> """ elif "geometric_grid" in bg_id: bg_style = f"{base_style} background: repeating-linear-gradient(0deg, transparent, transparent 19px, {primary}40 19px, {primary}40 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, {secondary}40 19px, {secondary}40 20px), {accent}0D;" bg_layer = "" elif "geometric_stripes" in bg_id: bg_style = f"{base_style} background: repeating-linear-gradient(45deg, {primary}40, {primary}40 10px, {secondary}40 10px, {secondary}40 20px, {accent}30 20px, {accent}30 30px);" bg_layer = "" elif "geometric_diamonds" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}1A 25%, transparent 25%), linear-gradient(225deg, {secondary}1A 25%, transparent 25%), linear-gradient(45deg, {accent}1A 25%, transparent 25%), linear-gradient(315deg, {primary}26 25%, {secondary}0D 25%);" bg_layer = "" elif "organic_blobs" in bg_id or "organic_fluid" in bg_id: bg_style = f"{base_style} background: {secondary}26;" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" viewBox="0 0 150 250"> <path d="M 30,40 Q 50,20 70,40 T 110,50 Q 120,70 100,90 T 60,80 Q 40,70 30,40 Z" fill="{primary}" opacity="0.4"/> <path d="M 80,140 Q 100,120 120,140 T 140,180 Q 130,200 110,190 T 80,170 Q 70,150 80,140 Z" fill="{accent}" opacity="0.3"/> </svg> """ elif "organic_noise" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}33, {secondary}4D); filter: contrast(170%) brightness(1000%);" bg_layer = f'<div style="position: absolute; width: 100%; height: 100%; background: url(\'data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noise"%3E%3CfeTurbulence baseFrequency="0.9" /%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noise)" opacity="0.15"/%3E%3C/svg%3E\'); background-size: 100px 100px;"></div>' elif "organic_clouds" in bg_id: bg_style = f"{base_style} background: linear-gradient(to bottom, {primary}40, {secondary}60, {accent}40);" bg_layer = f""" <div style="position: absolute; width: 100%; height: 100%;"> <div style="position: absolute; left: 10%; top: 15%; width: 50px; height: 25px; background: white; opacity: 0.3; border-radius: 50%;"></div> <div style="position: absolute; left: 25%; top: 10%; width: 40px; height: 30px; background: white; opacity: 0.25; border-radius: 50%;"></div> <div style="position: absolute; right: 15%; top: 40%; width: 45px; height: 28px; background: white; opacity: 0.3; border-radius: 50%;"></div> </div> """ elif "pattern_dots" in bg_id: bg_style = f"{base_style} background: radial-gradient(circle, {primary} 2px, transparent 2px); background-size: 20px 20px; background-color: {secondary}1A;" bg_layer = "" elif "pattern_lines" in bg_id: bg_style = f"{base_style} background: repeating-linear-gradient(0deg, {primary}60, {primary}60 2px, transparent 2px, transparent 10px), {secondary}1A;" bg_layer = "" elif "pattern_chevron" in bg_id: bg_style = f"{base_style} background: repeating-linear-gradient(45deg, {primary}40, {primary}40 10px, {secondary}40 10px, {secondary}40 20px);" bg_layer = "" elif "pattern_zigzag" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}40 25%, transparent 25%), linear-gradient(225deg, {secondary}40 25%, transparent 25%), linear-gradient(315deg, {accent}30 25%, transparent 25%); background-size: 20px 20px;" bg_layer = "" elif "abstract_crystalline" in bg_id or "abstract_voronoi" in bg_id: bg_style = f"{base_style} background: linear-gradient(135deg, {primary}26, {secondary}33, {accent}26);" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%;" viewBox="0 0 150 250"> <polygon points="30,20 60,50 40,80 10,70" fill="{primary}" opacity="0.3"/> <polygon points="70,30 110,40 100,80 80,90" fill="{secondary}" opacity="0.3"/> <polygon points="20,120 50,140 30,180 0,160" fill="{accent}" opacity="0.25"/> <polygon points="90,120 130,130 120,180 85,170" fill="{primary}" opacity="0.3"/> </svg> """ elif "abstract_particles" in bg_id: bg_style = f"{base_style} background: {secondary}1A;" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%;" viewBox="0 0 150 250"> <circle cx="30" cy="40" r="3" fill="{primary}" opacity="0.6"/> <circle cx="70" cy="25" r="2" fill="{secondary}" opacity="0.5"/> <circle cx="110" cy="50" r="2.5" fill="{accent}" opacity="0.5"/> <circle cx="40" cy="90" r="2" fill="{primary}" opacity="0.4"/> <circle cx="90" cy="110" r="3" fill="{secondary}" opacity="0.6"/> <circle cx="120" cy="140" r="2" fill="{accent}" opacity="0.5"/> <circle cx="50" cy="170" r="2.5" fill="{primary}" opacity="0.5"/> <circle cx="100" cy="200" r="2" fill="{secondary}" opacity="0.4"/> <line x1="30" y1="40" x2="70" y2="25" stroke="{primary}" opacity="0.2" stroke-width="1"/> <line x1="70" y1="25" x2="110" y2="50" stroke="{secondary}" opacity="0.2" stroke-width="1"/> <line x1="40" y1="90" x2="90" y2="110" stroke="{accent}" opacity="0.2" stroke-width="1"/> </svg> """ elif "abstract_rays" in bg_id: bg_style = f"{base_style} background: radial-gradient(circle at 50% 120%, {primary}, {secondary} 40%, {accent} 80%);" bg_layer = "" elif "abstract_constellation" in bg_id: bg_style = f"{base_style} background: linear-gradient(to bottom, {primary}1A, {secondary}26, {accent}1A);" bg_layer = f""" <svg style="position: absolute; width: 100%; height: 100%;" viewBox="0 0 150 250"> <circle cx="40" cy="30" r="2" fill="white" opacity="0.8"/> <circle cx="80" cy="50" r="2.5" fill="white" opacity="0.9"/> <circle cx="110" cy="40" r="2" fill="white" opacity="0.7"/> <circle cx="30" cy="100" r="2" fill="white" opacity="0.8"/> <circle cx="100" cy="120" r="2.5" fill="white" opacity="0.9"/> <circle cx="60" cy="180" r="2" fill="white" opacity="0.7"/> <circle cx="120" cy="200" r="2" fill="white" opacity="0.8"/> <line x1="40" y1="30" x2="80" y2="50" stroke="white" opacity="0.3" stroke-width="0.5"/> <line x1="80" y1="50" x2="110" y2="40" stroke="white" opacity="0.3" stroke-width="0.5"/> <line x1="30" y1="100" x2="100" y2="120" stroke="white" opacity="0.3" stroke-width="0.5"/> <line x1="60" y1="180" x2="120" y2="200" stroke="white" opacity="0.3" stroke-width="0.5"/> </svg> """ else: # Fallback: simple gradient bg_style = f"{base_style} background: linear-gradient(135deg, {primary}, {secondary});" bg_layer = "" return f""" <div style="{bg_style}"> {bg_layer} </div> """ def render_header_html(header_id: str, header_info: dict, primary: str, secondary: str, accent: str) -> str: """ Generate HTML/CSS for a single header preview (20 realistic headers) Returns HTML div with the header rendered """ header_name = header_info['name'] # Common container style base_style = "width: 300px; height: 100px; border-radius: 12px 12px 0 0; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: linear-gradient(135deg, {}, {});".format(primary, secondary) # SOCIAL & PROFILE (5) if header_id == "profile_avatar_menu": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 12px;"> <div style="width: 44px; height: 44px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; font-size: 24px;">👤</div> <div style="flex: 1;"> <div style="color: white; font-size: 15px; font-weight: 700;">John Doe</div> <div style="color: rgba(255,255,255,0.8); font-size: 11px;">📍 San Francisco, CA</div> </div> <div style="color: white; font-size: 24px; cursor: pointer;">☰</div> </div> """ elif header_id == "avatar_notification_cart": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 14px;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: {accent}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">👤</div> <div style="flex: 1;"></div> <div style="position: relative; color: white; font-size: 22px;"> 🔔 <div style="position: absolute; top: -4px; right: -4px; background: #FF3B30; border-radius: 50%; width: 16px; height: 16px; font-size: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700;">3</div> </div> <div style="position: relative; color: white; font-size: 22px;"> 🛒 <div style="position: absolute; top: -4px; right: -4px; background: #FF3B30; border-radius: 50%; width: 16px; height: 16px; font-size: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700;">2</div> </div> </div> """ elif header_id == "profile_stats_share": content = f""" <div style="padding: 12px; display: flex; align-items: center; gap: 10px;"> <div style="width: 50px; height: 50px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; font-size: 26px;">👤</div> <div style="flex: 1; display: flex; gap: 12px; font-size: 11px; color: white;"> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 15px;">245</div> <div style="opacity: 0.8;">Followers</div> </div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 15px;">189</div> <div style="opacity: 0.8;">Following</div> </div> </div> <div style="color: white; font-size: 20px;">📤</div> </div> """ elif header_id == "social_search_filter": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 10px;"> <div style="flex: 1; background: rgba(255,255,255,0.2); border-radius: 20px; padding: 10px 14px; font-size: 13px; color: rgba(255,255,255,0.9); display: flex; align-items: center; gap: 8px;"> <span>🔍</span> <span>Search posts...</span> </div> <div style="color: white; font-size: 22px;">⚙️</div> <div style="color: white; font-size: 22px;">🎚️</div> </div> """ elif header_id == "messenger_header": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 12px;"> <div style="color: white; font-size: 22px;">←</div> <div style="width: 40px; height: 40px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; font-size: 20px;">👤</div> <div style="flex: 1; color: white;"> <div style="font-weight: 700; font-size: 14px;">Sarah Johnson</div> <div style="opacity: 0.8; font-size: 11px;">Active now</div> </div> <div style="color: white; font-size: 22px;">📞</div> <div style="color: white; font-size: 22px;">📹</div> </div> """ # LOCATION & DELIVERY (4) elif header_id == "location_picker": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 10px;"> <div style="color: white; font-size: 24px;">📍</div> <div style="flex: 1; color: white;"> <div style="font-size: 11px; opacity: 0.8;">Deliver to</div> <div style="font-weight: 700; font-size: 14px;">1234 Market St, SF ▼</div> </div> <div style="color: white; font-size: 20px;">🔔</div> </div> """ elif header_id == "delivery_address_time": content = f""" <div style="padding: 12px; color: white;"> <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 6px;"> <span style="font-size: 16px;">📍</span> <span style="font-size: 13px; font-weight: 600;">1234 Market Street</span> <span style="margin-left: auto; font-size: 11px; background: rgba(255,255,255,0.2); padding: 4px 8px; border-radius: 12px;">Change</span> </div> <div style="font-size: 11px; opacity: 0.9; display: flex; align-items: center; gap: 6px;"> <span>⏱️</span> <span>Delivery in 25-30 mins</span> </div> </div> """ elif header_id == "map_search_location": content = f""" <div style="padding: 14px;"> <div style="background: rgba(255,255,255,0.95); border-radius: 24px; padding: 10px 14px; display: flex; align-items: center; gap: 10px;"> <span style="font-size: 18px;">📍</span> <input style="border: none; background: transparent; flex: 1; font-size: 13px;" placeholder="Search location..."/> <span style="font-size: 18px; color: {primary};">🎯</span> </div> </div> """ elif header_id == "ride_pickup_header": content = f""" <div style="padding: 12px; color: white; font-size: 12px;"> <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;"> <span style="font-size: 14px;">🟢</span> <span style="font-weight: 600;">Home - 123 Main St</span> </div> <div style="display: flex; align-items: center; gap: 8px;"> <span style="font-size: 14px;">🔴</span> <span style="font-weight: 600;">Office - 456 Market St</span> <span style="margin-left: auto; font-size: 18px;">🔄</span> </div> </div> """ # E-COMMERCE (3) elif header_id == "shop_cart_wishlist": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 14px;"> <div style="color: white; font-size: 20px; font-weight: 700;">🏪 ShopApp</div> <div style="flex: 1; background: rgba(255,255,255,0.2); border-radius: 20px; padding: 8px 12px;"> <span style="color: rgba(255,255,255,0.9); font-size: 12px;">🔍 Search products...</span> </div> <div style="color: white; font-size: 20px;">❤️</div> <div style="position: relative; color: white; font-size: 20px;"> 🛒 <div style="position: absolute; top: -6px; right: -6px; background: #FF3B30; border-radius: 50%; width: 16px; height: 16px; font-size: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700;">5</div> </div> </div> """ elif header_id == "category_filter_sort": content = f""" <div style="padding: 14px;"> <div style="display: flex; gap: 8px; align-items: center;"> <div style="flex: 1; background: rgba(255,255,255,0.2); color: white; border-radius: 20px; padding: 8px 12px; font-size: 12px; font-weight: 600;"> Electronics ▼ </div> <div style="background: rgba(255,255,255,0.2); color: white; border-radius: 20px; padding: 8px 12px; font-size: 12px;"> 🎚️ Filter </div> <div style="background: rgba(255,255,255,0.2); color: white; border-radius: 20px; padding: 8px 12px; font-size: 12px;"> ⬍ Sort </div> </div> </div> """ elif header_id == "product_search_scan": content = f""" <div style="padding: 14px;"> <div style="background: rgba(255,255,255,0.95); border-radius: 24px; padding: 10px 14px; display: flex; align-items: center; gap: 10px;"> <span style="font-size: 18px;">🔍</span> <input style="border: none; background: transparent; flex: 1; font-size: 13px;" placeholder="Search products..."/> <span style="font-size: 18px; color: {primary};">📷</span> <span style="font-size: 18px; color: {primary};">🎤</span> </div> </div> """ # FINANCE & WALLET (3) elif header_id == "wallet_balance_qr": content = f""" <div style="padding: 12px; display: flex; align-items: center; gap: 12px;"> <div style="width: 44px; height: 44px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; font-size: 24px;">👤</div> <div style="flex: 1; color: white;"> <div style="font-size: 11px; opacity: 0.8;">Total Balance</div> <div style="font-weight: 700; font-size: 20px;">$2,458.50</div> </div> <div style="background: white; padding: 8px; border-radius: 8px; font-size: 20px;">📱</div> </div> """ elif header_id == "banking_accounts_menu": content = f""" <div style="padding: 14px; color: white;"> <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 6px;"> <div style="flex: 1; font-weight: 700; font-size: 13px;">Checking Account ▼</div> <div style="font-size: 22px;">☰</div> </div> <div style="font-size: 20px; font-weight: 700;">$12,345.67</div> </div> """ elif header_id == "crypto_portfolio_refresh": content = f""" <div style="padding: 14px; color: white;"> <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;"> <div style="font-size: 11px; opacity: 0.8;">Portfolio Value</div> <div style="font-size: 18px;">🔄</div> </div> <div style="display: flex; align-items: baseline; gap: 10px;"> <div style="font-size: 22px; font-weight: 700;">$45,678</div> <div style="font-size: 13px; color: #34C759;">+2.45% ↗</div> </div> </div> """ # HEALTH & FITNESS (2) elif header_id == "fitness_streak_profile": content = f""" <div style="padding: 12px; display: flex; align-items: center; gap: 12px;"> <div style="width: 48px; height: 48px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; font-size: 26px;">💪</div> <div style="flex: 1; color: white;"> <div style="font-weight: 700; font-size: 15px;">Sarah's Fitness</div> <div style="font-size: 11px; opacity: 0.9;">🔥 7 day streak</div> </div> <div style="background: rgba(255,255,255,0.2); padding: 6px 10px; border-radius: 16px; font-size: 11px; color: white; font-weight: 600;"> 🏆 Level 12 </div> </div> """ elif header_id == "workout_timer_pause": content = f""" <div style="padding: 14px; text-align: center; color: white;"> <div style="font-size: 11px; opacity: 0.8; margin-bottom: 4px;">WORKOUT IN PROGRESS</div> <div style="display: flex; justify-content: center; align-items: center; gap: 16px;"> <div style="font-size: 20px;">⏭️</div> <div style="font-size: 28px; font-weight: 700;">12:34</div> <div style="font-size: 24px;">⏸️</div> </div> </div> """ # MEDIA & ENTERTAINMENT (3) elif header_id == "video_player_controls": content = f""" <div style="padding: 14px; display: flex; align-items: center; gap: 12px;"> <div style="color: white; font-size: 22px;">←</div> <div style="flex: 1; color: white;"> <div style="font-weight: 600; font-size: 13px;">How to Code in Python</div> <div style="opacity: 0.8; font-size: 11px;">TechChannel • 1.2M views</div> </div> <div style="color: white; font-size: 20px;">📡</div> <div style="color: white; font-size: 20px;">⋮</div> </div> """ elif header_id == "music_player_header": content = f""" <div style="padding: 16px; display: flex; align-items: center; gap: 12px;"> <div style="color: white; font-size: 22px;">←</div> <div style="flex: 1; color: white; text-align: center;"> <div style="font-weight: 700; font-size: 15px;">Blinding Lights</div> <div style="opacity: 0.8; font-size: 12px;">The Weeknd</div> </div> <div style="color: white; font-size: 22px;">❤️</div> </div> """ elif header_id == "news_category_tabs": content = f""" <div style="padding: 12px; color: white;"> <div style="font-size: 18px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between;"> <span>📰 NewsApp</span> <span style="font-size: 20px;">🔖</span> </div> <div style="display: flex; gap: 14px; font-size: 12px; font-weight: 600;"> <span style="border-bottom: 2px solid white; padding-bottom: 4px;">Top</span> <span style="opacity: 0.6;">Tech</span> <span style="opacity: 0.6;">Sports</span> <span style="opacity: 0.6;">World</span> </div> </div> """ else: content = "<div style='padding: 20px; color: white;'>Header Preview</div>" return f""" <div style="{base_style}"> {content} </div> """ def render_footer_html(footer_id: str, footer_info: dict, primary: str, secondary: str, accent: str) -> str: """ Generate HTML/CSS for a single footer preview (30 footer layouts) Returns HTML div with the footer rendered """ footer_name = footer_info['name'] # Common container style base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: white;" # CLASSIC TAB BARS (6) if footer_id == "classic_4_icons": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px; border-top: 1px solid #eee;"> <div style="color: {primary}; font-size: 24px;">🏠</div> <div style="color: #999; font-size: 24px;">🔍</div> <div style="color: #999; font-size: 24px;">❤️</div> <div style="color: #999; font-size: 24px;">👤</div> </div> """ elif footer_id == "classic_5_icons": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 16px; border-top: 1px solid #eee;"> <div style="text-align: center;"> <div style="color: {primary}; font-size: 20px;">🏠</div> <div style="color: {primary}; font-size: 8px; margin-top: 2px; font-weight: 600;">Home</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">🔍</div> <div style="color: #999; font-size: 8px; margin-top: 2px;">Search</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">➕</div> <div style="color: #999; font-size: 8px; margin-top: 2px;">Add</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">❤️</div> <div style="color: #999; font-size: 8px; margin-top: 2px;">Likes</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">👤</div> <div style="color: #999; font-size: 8px; margin-top: 2px;">Profile</div> </div> </div> """ elif footer_id == "compact_icons_badge": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 24px; border-top: 1px solid #eee;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="position: relative; color: #999; font-size: 22px;"> 🔔 <div style="position: absolute; top: -4px; right: -4px; background: #FF3B30; border-radius: 50%; width: 12px; height: 12px; font-size: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700;">5</div> </div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ elif footer_id == "labeled_vertical": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px; border-top: 2px solid #f0f0f0;"> <div style="text-align: center;"> <div style="color: {primary}; font-size: 24px; margin-bottom: 2px;">🏠</div> <div style="color: {primary}; font-size: 9px; font-weight: 700;">Home</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 24px; margin-bottom: 2px;">🔍</div> <div style="color: #999; font-size: 9px;">Explore</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 24px; margin-bottom: 2px;">❤️</div> <div style="color: #999; font-size: 9px;">Saved</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 24px; margin-bottom: 2px;">👤</div> <div style="color: #999; font-size: 9px;">Profile</div> </div> </div> """ elif footer_id == "colored_active": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 16px; border-top: 1px solid #eee;"> <div style="background: {primary}; color: white; padding: 8px 16px; border-radius: 20px; font-size: 18px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ elif footer_id == "icon_label_inline": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 12px; border-top: 1px solid #eee;"> <div style="display: flex; align-items: center; gap: 6px; color: {primary};"> <span style="font-size: 18px;">🏠</span> <span style="font-size: 11px; font-weight: 600;">Home</span> </div> <div style="display: flex; align-items: center; gap: 6px; color: #999;"> <span style="font-size: 18px;">🔍</span> <span style="font-size: 11px;">Search</span> </div> <div style="color: #999; font-size: 18px;">❤️</div> <div style="color: #999; font-size: 18px;">👤</div> </div> """ # FLOATING & FAB STYLES (5) elif footer_id == "floating_rounded": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: transparent;" content = f""" <div style="position: absolute; bottom: 8px; left: 16px; right: 16px; background: white; border-radius: 24px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); height: 56px; display: flex; justify-content: space-around; align-items: center; padding: 0 16px;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ elif footer_id == "floating_fab_center": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: transparent;" content = f""" <div style="position: absolute; bottom: 8px; left: 16px; right: 16px; background: white; border-radius: 24px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); height: 56px; display: flex; justify-content: space-around; align-items: center; padding: 0 16px; position: relative;"> <div style="color: #999; font-size: 20px;">🏠</div> <div style="color: #999; font-size: 20px;">🔍</div> <div style="width: 54px; height: 54px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 28px; position: absolute; left: 50%; transform: translateX(-50%) translateY(-50%); box-shadow: 0 4px 12px rgba(0,0,0,0.2); top: 0;">+</div> <div style="color: #999; font-size: 20px;">❤️</div> <div style="color: #999; font-size: 20px;">👤</div> </div> """ elif footer_id == "floating_translucent": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: transparent;" content = f""" <div style="position: absolute; bottom: 8px; left: 16px; right: 16px; background: rgba(255,255,255,0.85); backdrop-filter: blur(10px); border-radius: 24px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); height: 56px; display: flex; justify-content: space-around; align-items: center; padding: 0 16px; border: 1px solid rgba(255,255,255,0.3);"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ elif footer_id == "floating_pills_bar": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: transparent;" content = f""" <div style="position: absolute; bottom: 8px; left: 16px; right: 16px; background: white; border-radius: 28px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); height: 56px; display: flex; justify-content: space-around; align-items: center; padding: 0 12px;"> <div style="background: {primary}; color: white; padding: 8px 12px; border-radius: 18px; font-size: 11px; font-weight: 600;">🏠 Home</div> <div style="color: #999; font-size: 20px;">🔍</div> <div style="color: #999; font-size: 20px;">❤️</div> <div style="color: #999; font-size: 20px;">👤</div> </div> """ elif footer_id == "dual_fab": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: transparent;" content = f""" <div style="position: absolute; bottom: 8px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center;"> <div style="width: 50px; height: 50px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.2);">🏠</div> <div style="width: 50px; height: 50px; border-radius: 50%; background: {secondary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.2);">+</div> </div> """ # CURVED & SHAPED DESIGNS (5) elif footer_id == "curved_top": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: white;" content = f""" <div style="position: absolute; top: -20px; left: 0; right: 0; height: 90px; background: white; border-radius: 50% 50% 0 0 / 40px 40px 0 0;"> <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 24px 20px 0;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> </div> """ elif footer_id == "notched_center": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: white;" content = f""" <div style="position: relative; height: 100%; display: flex; justify-content: space-around; align-items: center; padding: 0 20px;"> <div style="position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 60px; height: 30px; background: white; border-radius: 30px 30px 0 0;"></div> <div style="color: #999; font-size: 20px;">🏠</div> <div style="color: #999; font-size: 20px;">🔍</div> <div style="width: 50px; height: 50px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 28px; position: absolute; left: 50%; transform: translateX(-50%) translateY(-50%); box-shadow: 0 4px 12px rgba(0,0,0,0.2); top: 0;">+</div> <div style="color: #999; font-size: 20px;">❤️</div> <div style="color: #999; font-size: 20px;">👤</div> </div> """ elif footer_id == "wave_top": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: white;" content = f""" <svg style="position: absolute; top: -15px; left: 0; width: 100%; height: 20px;" viewBox="0 0 300 20" preserveAspectRatio="none"> <path d="M0,10 Q75,0 150,10 T300,10 L300,20 L0,20 Z" fill="white"/> </svg> <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ elif footer_id == "island_bar": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: visible; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: transparent;" content = f""" <div style="position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: white; border-radius: 28px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); height: 52px; display: flex; justify-content: space-around; align-items: center; padding: 0 24px; gap: 28px;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ elif footer_id == "arc_active": base_style = "width: 300px; height: 70px; border-radius: 0 0 12px 12px; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.15); background: white;" content = f""" <div style="position: absolute; top: 0; left: 20px; width: 52px; height: 4px; background: {primary}; border-radius: 0 0 4px 4px;"></div> <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> """ # SEGMENTED & PILLS (5) elif footer_id == "segmented_control": content = f""" <div style="display: flex; justify-content: center; align-items: center; height: 100%; padding: 0 16px;"> <div style="background: #f0f0f0; border-radius: 24px; padding: 4px; display: flex; gap: 4px;"> <div style="background: {primary}; color: white; padding: 8px 20px; border-radius: 20px; font-size: 11px; font-weight: 600;">Home</div> <div style="background: transparent; color: #666; padding: 8px 20px; border-radius: 20px; font-size: 11px; font-weight: 600;">Search</div> <div style="background: transparent; color: #666; padding: 8px 20px; border-radius: 20px; font-size: 11px; font-weight: 600;">Profile</div> </div> </div> """ elif footer_id == "pill_buttons": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 12px;"> <div style="background: {primary}; color: white; padding: 10px 16px; border-radius: 22px; font-size: 12px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">🏠 Home</div> <div style="background: #f5f5f5; color: #666; padding: 10px 16px; border-radius: 22px; font-size: 12px; font-weight: 600;">🔍</div> <div style="background: #f5f5f5; color: #666; padding: 10px 16px; border-radius: 22px; font-size: 12px; font-weight: 600;">👤</div> </div> """ elif footer_id == "grouped_pills": content = f""" <div style="display: flex; justify-content: center; align-items: center; height: 100%; padding: 0 16px;"> <div style="background: #f8f8f8; border-radius: 26px; padding: 6px 8px; display: flex; gap: 8px;"> <div style="background: {primary}; color: white; padding: 8px 16px; border-radius: 20px; font-size: 11px; font-weight: 600;">🏠</div> <div style="color: #666; padding: 8px 16px; font-size: 18px;">🔍</div> <div style="color: #666; padding: 8px 16px; font-size: 18px;">❤️</div> <div style="color: #666; padding: 8px 16px; font-size: 18px;">👤</div> </div> </div> """ elif footer_id == "slider_nav": content = f""" <div style="position: relative; height: 100%; border-top: 1px solid #eee;"> <div style="position: absolute; bottom: 0; left: 20px; width: 52px; height: 3px; background: {primary}; border-radius: 3px 3px 0 0;"></div> <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px;"> <div style="color: {primary}; font-size: 22px;">🏠</div> <div style="color: #999; font-size: 22px;">🔍</div> <div style="color: #999; font-size: 22px;">❤️</div> <div style="color: #999; font-size: 22px;">👤</div> </div> </div> """ elif footer_id == "morphing_pills": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 12px; background: #fafafa;"> <div style="background: {primary}; color: white; padding: 10px 18px; border-radius: 24px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px;">🏠 Home</div> <div style="color: #999; font-size: 20px; padding: 8px;">🔍</div> <div style="color: #999; font-size: 20px; padding: 8px;">❤️</div> <div style="color: #999; font-size: 20px; padding: 8px;">👤</div> </div> """ # MINIMALIST & GESTURE (4) elif footer_id == "minimal_dots": content = f""" <div style="display: flex; justify-content: center; align-items: center; height: 100%; gap: 12px;"> <div style="width: 8px; height: 8px; border-radius: 50%; background: {primary};"></div> <div style="width: 6px; height: 6px; border-radius: 50%; background: #ddd;"></div> <div style="width: 6px; height: 6px; border-radius: 50%; background: #ddd;"></div> <div style="width: 6px; height: 6px; border-radius: 50%; background: #ddd;"></div> </div> """ elif footer_id == "gesture_swipe": content = f""" <div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; gap: 4px; background: rgba(250,250,250,0.95);"> <div style="width: 40px; height: 4px; background: #ccc; border-radius: 2px;"></div> <div style="font-size: 8px; color: #999; text-transform: uppercase; letter-spacing: 0.5px;">Swipe</div> </div> """ elif footer_id == "thin_bar": content = f""" <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 30px; border-top: 1px solid #f0f0f0;"> <div style="width: 24px; height: 3px; background: {primary}; border-radius: 2px;"></div> <div style="width: 18px; height: 3px; background: #ddd; border-radius: 2px;"></div> <div style="width: 18px; height: 3px; background: #ddd; border-radius: 2px;"></div> <div style="width: 18px; height: 3px; background: #ddd; border-radius: 2px;"></div> </div> """ elif footer_id == "invisible_tap": content = f""" <div style="position: relative; height: 100%; border-top: 1px solid #f8f8f8;"> <div style="position: absolute; top: 0; left: 20px; width: 52px; height: 2px; background: {primary};"></div> <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px; opacity: 0.3;"> <div style="font-size: 18px;">🏠</div> <div style="font-size: 18px;">🔍</div> <div style="font-size: 18px;">❤️</div> <div style="font-size: 18px;">👤</div> </div> </div> """ # ADVANCED & INTERACTIVE (5) elif footer_id == "expandable_drawer": content = f""" <div style="position: relative; height: 100%; background: white; border-top: 1px solid #eee;"> <div style="display: flex; justify-content: center; padding-top: 6px;"> <div style="width: 40px; height: 4px; background: #ddd; border-radius: 2px;"></div> </div> <div style="display: flex; justify-content: space-around; align-items: center; padding: 8px 20px;"> <div style="color: {primary}; font-size: 20px;">🏠</div> <div style="color: #999; font-size: 20px;">🔍</div> <div style="color: #999; font-size: 20px;">❤️</div> <div style="color: #999; font-size: 20px;">☰</div> </div> </div> """ elif footer_id == "grid_menu": content = f""" <div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 16px; background: #fafafa; border-top: 1px solid #eee;"> <div style="text-align: center;"> <div style="color: {primary}; font-size: 18px;">🏠</div> <div style="font-size: 7px; color: {primary}; margin-top: 2px; font-weight: 600;">Home</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 18px;">🔍</div> <div style="font-size: 7px; color: #999; margin-top: 2px;">Search</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 18px;">❤️</div> <div style="font-size: 7px; color: #999; margin-top: 2px;">Saved</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 18px;">👤</div> <div style="font-size: 7px; color: #999; margin-top: 2px;">Profile</div> </div> </div> """ elif footer_id == "carousel_nav": content = f""" <div style="display: flex; align-items: center; height: 100%; padding: 0 12px; gap: 8px; overflow-x: auto; border-top: 1px solid #eee;"> <div style="background: {primary}; color: white; padding: 8px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;">🏠 Home</div> <div style="background: #f5f5f5; color: #666; padding: 8px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;">🔍 Search</div> <div style="background: #f5f5f5; color: #666; padding: 8px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;">❤️ Saved</div> <div style="background: #f5f5f5; color: #666; padding: 8px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;">👤 Profile</div> </div> """ elif footer_id == "context_aware": content = f""" <div style="position: relative; height: 100%; background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); border-top: 1px solid rgba(0,0,0,0.05);"> <div style="display: flex; justify-content: space-around; align-items: center; height: 100%; padding: 0 20px;"> <div style="color: {primary}; font-size: 22px; opacity: 1;">🏠</div> <div style="color: #999; font-size: 18px; opacity: 0.6;">🔍</div> <div style="color: #999; font-size: 18px; opacity: 0.6;">❤️</div> <div style="color: #999; font-size: 18px; opacity: 0.6;">👤</div> </div> </div> """ elif footer_id == "nested_menu": content = f""" <div style="position: relative; height: 100%; background: white; border-top: 1px solid #eee;"> <div style="display: flex; justify-content: space-around; align-items: flex-start; padding: 6px 16px;"> <div style="text-align: center;"> <div style="color: {primary}; font-size: 20px;">🏠</div> <div style="font-size: 7px; color: {primary}; margin-top: 2px; font-weight: 600;">Home</div> <div style="display: flex; gap: 2px; margin-top: 2px; justify-content: center;"> <div style="width: 3px; height: 3px; border-radius: 50%; background: {primary};"></div> <div style="width: 3px; height: 3px; border-radius: 50%; background: {primary}; opacity: 0.3;"></div> </div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">🔍</div> <div style="font-size: 7px; color: #999; margin-top: 2px;">Explore</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">❤️</div> <div style="font-size: 7px; color: #999; margin-top: 2px;">Saved</div> </div> <div style="text-align: center;"> <div style="color: #999; font-size: 20px;">👤</div> <div style="font-size: 7px; color: #999; margin-top: 2px;">Profile</div> </div> </div> </div> """ else: content = "<div style='padding: 20px; color: #333;'>Footer Preview</div>" return f""" <div style="{base_style}"> {content} </div> """ def render_card_html(card_id: str, card_info: dict, primary: str, secondary: str, accent: str) -> str: """ Generate HTML/CSS for a single card preview (30 card types) Returns HTML div with the card rendered """ card_name = card_info['name'] # Common container style - responsive with max-width base_style = "width: 100%; max-width: 180px; min-height: 240px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; flex-direction: column;" # PRODUCT & SHOPPING (6) if card_id == "product_vertical": content = f""" <div style="background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">📱</div> <div style="padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Product Name</div> <div style="font-size: 11px; color: #666;">Short description</div> <div style="margin-top: auto; font-weight: 700; font-size: 16px; color: {primary};">$99.00</div> </div> """ elif card_id == "product_horizontal": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex;" content = f""" <div style="width: 100px; min-width: 100px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; font-size: 36px;">📱</div> <div style="padding: 12px; flex: 1; display: flex; flex-direction: column; justify-content: space-between;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Product Name</div> <div style="font-size: 10px; color: #666;">Category</div> </div> <div style="font-weight: 700; font-size: 14px; color: {primary};">$99.00</div> </div> """ elif card_id == "product_badge": content = f""" <div style="position: relative; background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;"> 📱 <div style="position: absolute; top: 8px; right: 8px; background: #FF3B30; color: white; padding: 4px 10px; border-radius: 12px; font-size: 10px; font-weight: 700;">SALE</div> </div> <div style="padding: 12px; flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Product Name</div> <div style="display: flex; align-items: center; gap: 8px;"> <div style="font-weight: 700; font-size: 16px; color: {primary};">$79.00</div> <div style="font-size: 12px; color: #999; text-decoration: line-through;">$99.00</div> </div> </div> """ elif card_id == "product_rating": content = f""" <div style="background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">📱</div> <div style="padding: 12px; flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 6px;">Product Name</div> <div style="display: flex; align-items: center; gap: 4px; margin-bottom: 8px;"> <span style="color: #FFB800;">⭐⭐⭐⭐⭐</span> <span style="font-size: 10px; color: #666;">(245)</span> </div> <div style="font-weight: 700; font-size: 16px; color: {primary};">$99.00</div> </div> """ elif card_id == "product_grid_compact": base_style = "width: 100%; max-width: 140px; min-height: 180px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; flex-direction: column;" content = f""" <div style="background: #f5f5f5; height: 120px; display: flex; align-items: center; justify-content: center; font-size: 40px;">📱</div> <div style="padding: 8px;"> <div style="font-weight: 600; font-size: 11px; color: #333; margin-bottom: 4px;">Item</div> <div style="font-weight: 700; font-size: 13px; color: {primary};">$99</div> </div> """ elif card_id == "product_featured": base_style = "width: 100%; max-width: 280px; height: 200px; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary});" content = f""" <div style="position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);"> <div style="color: white; font-size: 11px; opacity: 0.9; margin-bottom: 4px;">FEATURED</div> <div style="color: white; font-weight: 700; font-size: 18px; margin-bottom: 4px;">Premium Product</div> <div style="color: white; font-size: 20px; font-weight: 700;">$199.00</div> </div> """ # PROFILE & SOCIAL (5) elif card_id == "profile_user_card": content = f""" <div style="padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;"> <div style="width: 64px; height: 64px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 32px;">👤</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 14px; color: #333;">John Doe</div> <div style="font-size: 11px; color: #666; margin-top: 2px;">@johndoe</div> </div> <div style="font-size: 11px; color: #666; text-align: center;">Creative designer & developer passionate about UI/UX</div> <button style="background: {primary}; color: white; border: none; padding: 8px 24px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-top: 4px;">Follow</button> </div> """ elif card_id == "profile_stats_card": content = f""" <div style="padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;"> <div style="width: 60px; height: 60px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 30px;">👤</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 14px; color: #333;">Sarah Smith</div> <div style="font-size: 10px; color: #666;">Product Designer</div> </div> <div style="display: flex; gap: 16px; margin-top: 4px;"> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 14px; color: #333;">2.5K</div> <div style="font-size: 9px; color: #666;">Followers</div> </div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 14px; color: #333;">856</div> <div style="font-size: 9px; color: #666;">Posts</div> </div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 14px; color: #333;">12K</div> <div style="font-size: 9px; color: #666;">Likes</div> </div> </div> </div> """ elif card_id == "social_post_card": base_style = "width: 100%; max-width: 280px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="padding: 12px; display: flex; align-items: center; gap: 10px;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">👤</div> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Jane Cooper</div> <div style="font-size: 10px; color: #666;">2 hours ago</div> </div> </div> <div style="padding: 0 12px 12px; font-size: 12px; color: #333;">Just launched my new project! 🚀 Check it out!</div> <div style="background: #f0f0f0; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">🎨</div> <div style="padding: 12px; display: flex; gap: 16px; border-top: 1px solid #eee; font-size: 11px; color: #666;"> <span>❤️ 245</span> <span>💬 32</span> <span>📤 12</span> </div> """ elif card_id == "social_story_card": base_style = "width: 100%; max-width: 100px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;" content = f""" <div style="position: absolute; inset: 2px; border-radius: 10px; background: linear-gradient(135deg, {primary}, {secondary}); display: flex; align-items: center; justify-content: center; color: white; font-size: 40px;">👤</div> <div style="position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: white; font-size: 10px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.5);">Sarah</div> """ elif card_id == "contact_card": content = f""" <div style="padding: 16px; display: flex; flex-direction: column; gap: 10px;"> <div style="display: flex; align-items: center; gap: 12px;"> <div style="width: 50px; height: 50px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Mike Johnson</div> <div style="font-size: 10px; color: #666;">Software Engineer</div> </div> </div> <div style="display: flex; flex-direction: column; gap: 6px; font-size: 11px;"> <div style="display: flex; align-items: center; gap: 6px; color: #666;"> <span>📧</span> <span>mike@email.com</span> </div> <div style="display: flex; align-items: center; gap: 6px; color: #666;"> <span>📱</span> <span>+1 234 567 8900</span> </div> </div> <div style="display: flex; gap: 8px; margin-top: 4px;"> <button style="flex: 1; background: {primary}; color: white; border: none; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600;">Message</button> <button style="flex: 1; background: #f0f0f0; color: #333; border: none; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600;">Call</button> </div> </div> """ # CONTENT & MEDIA (5) elif card_id == "article_card": base_style = "width: 100%; max-width: 280px; min-height: 260px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: #f0f0f0; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 48px;">📰</div> <div style="padding: 14px;"> <div style="font-size: 10px; color: {primary}; font-weight: 600; margin-bottom: 6px;">TECHNOLOGY</div> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">The Future of AI in Design</div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 10px;">Discover how artificial intelligence is revolutionizing the creative industry...</div> <div style="font-size: 10px; color: #999;">⏱️ 5 min read</div> </div> """ elif card_id == "video_card": base_style = "width: 100%; max-width: 280px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;" content = f""" <div style="position: absolute; inset: 0; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: white; font-size: 64px;">▶️</div> <div style="position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 600;">12:45</div> <div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 12px; color: white;"> <div style="font-weight: 700; font-size: 13px;">How to Build Apps</div> <div style="font-size: 10px; opacity: 0.9; margin-top: 2px;">12K views • 2 days ago</div> </div> """ elif card_id == "podcast_card": base_style = "width: 100%; max-width: 280px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex;" content = f""" <div style="width: 120px; background: linear-gradient(135deg, {primary}, {secondary}); display: flex; align-items: center; justify-content: center; font-size: 48px; color: white;">🎙️</div> <div style="flex: 1; padding: 12px; display: flex; flex-direction: column; justify-content: space-between;"> <div> <div style="font-weight: 700; font-size: 12px; color: #333;">Tech Talk #42</div> <div style="font-size: 10px; color: #666; margin-top: 2px;">The Future of Web3</div> </div> <div style="display: flex; align-items: center; gap: 8px;"> <button style="width: 32px; height: 32px; border-radius: 50%; background: {primary}; color: white; border: none; display: flex; align-items: center; justify-content: center; font-size: 12px;">▶️</button> <div style="font-size: 10px; color: #666;">45:30</div> </div> </div> """ elif card_id == "news_headline": base_style = "width: 100%; max-width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; gap: 12px; padding: 10px;" content = f""" <div style="width: 60px; height: 60px; border-radius: 8px; background: #f0f0f0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 24px;">📰</div> <div style="flex: 1; display: flex; flex-direction: column; justify-content: space-between;"> <div style="font-weight: 600; font-size: 12px; color: #333; line-height: 1.3;">Breaking: Major Tech Announcement Today</div> <div style="font-size: 9px; color: #999;">2 hours ago • Tech News</div> </div> """ elif card_id == "blog_featured": base_style = "width: 100%; max-width: 280px; height: 240px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;" content = f""" <div style="position: absolute; inset: 0; background: linear-gradient(135deg, {primary}, {secondary});"></div> <div style="position: absolute; top: 12px; left: 12px; background: white; color: {primary}; padding: 4px 10px; border-radius: 16px; font-size: 9px; font-weight: 700;">FEATURED</div> <div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 16px; color: white;"> <div style="font-size: 10px; opacity: 0.9; margin-bottom: 4px;">DESIGN</div> <div style="font-weight: 700; font-size: 16px; margin-bottom: 4px;">Creating Beautiful User Experiences</div> <div style="font-size: 10px; opacity: 0.8;">by Sarah Johnson • 8 min read</div> </div> """ # STATS & ANALYTICS (4) elif card_id == "stats_metric": base_style = "width: 100%; max-width: 160px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; justify-content: space-between;" content = f""" <div style="width: 40px; height: 40px; border-radius: 10px; background: {primary}20; color: {primary}; display: flex; align-items: center; justify-content: center; font-size: 20px;">📊</div> <div> <div style="font-size: 24px; font-weight: 700; color: #333; margin-bottom: 2px;">2,458</div> <div style="font-size: 11px; color: #666;">Total Sales</div> <div style="font-size: 10px; color: #34C759; font-weight: 600; margin-top: 4px;">↗ +12.5%</div> </div> """ elif card_id == "stats_comparison": base_style = "width: 100%; max-width: 240px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; gap: 16px;" content = f""" <div style="flex: 1; text-align: center;"> <div style="font-size: 20px; font-weight: 700; color: #333;">1,234</div> <div style="font-size: 10px; color: #666; margin-top: 2px;">This Month</div> <div style="font-size: 10px; color: #34C759; font-weight: 600; margin-top: 4px;">↗ +18%</div> </div> <div style="width: 1px; background: #eee;"></div> <div style="flex: 1; text-align: center;"> <div style="font-size: 20px; font-weight: 700; color: #333;">1,045</div> <div style="font-size: 10px; color: #666; margin-top: 2px;">Last Month</div> <div style="font-size: 10px; color: #666; font-weight: 600; margin-top: 4px;">— 0%</div> </div> """ elif card_id == "stats_progress": base_style = "width: 100%; max-width: 200px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; justify-content: space-between;" content = f""" <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="font-weight: 600; font-size: 12px; color: #333;">Goal Progress</div> <div style="font-weight: 700; font-size: 14px; color: {primary};">75%</div> </div> <div> <div style="height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden;"> <div style="width: 75%; height: 100%; background: {primary}; border-radius: 4px;"></div> </div> <div style="font-size: 10px; color: #666; margin-top: 6px;">750 / 1000 completed</div> </div> """ elif card_id == "stats_chart": base_style = "width: 100%; max-width: 200px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Weekly Stats</div> <div style="font-size: 10px; color: #666; margin-bottom: 12px;">Last 7 days</div> <div style="display: flex; align-items: flex-end; gap: 6px; height: 60px;"> <div style="flex: 1; background: {primary}; opacity: 0.4; height: 40%; border-radius: 4px 4px 0 0;"></div> <div style="flex: 1; background: {primary}; opacity: 0.6; height: 60%; border-radius: 4px 4px 0 0;"></div> <div style="flex: 1; background: {primary}; opacity: 0.5; height: 50%; border-radius: 4px 4px 0 0;"></div> <div style="flex: 1; background: {primary}; opacity: 0.8; height: 80%; border-radius: 4px 4px 0 0;"></div> <div style="flex: 1; background: {primary}; opacity: 0.9; height: 90%; border-radius: 4px 4px 0 0;"></div> <div style="flex: 1; background: {primary}; height: 100%; border-radius: 4px 4px 0 0;"></div> <div style="flex: 1; background: {primary}; opacity: 0.7; height: 70%; border-radius: 4px 4px 0 0;"></div> </div> """ # MESSAGING & NOTIFICATIONS (4) elif card_id == "message_preview": base_style = "width: 100%; max-width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; align-items: center; gap: 12px; padding: 12px;" content = f""" <div style="width: 48px; height: 48px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">👤</div> <div style="flex: 1; min-width: 0;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Alice Brown</div> <div style="font-size: 9px; color: #999;">2m</div> </div> <div style="font-size: 11px; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">Hey! Did you see the new design?</div> </div> <div style="width: 8px; height: 8px; border-radius: 50%; background: {primary}; flex-shrink: 0;"></div> """ elif card_id == "notification_card": content = f""" <div style="padding: 14px; display: flex; gap: 12px;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 20px;">🔔</div> <div style="flex: 1;"> <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 4px;"> <div style="font-weight: 700; font-size: 12px; color: #333;">New Message</div> <div style="width: 6px; height: 6px; border-radius: 50%; background: {primary};"></div> </div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 6px;">You have a new message from the support team</div> <div style="font-size: 9px; color: #999;">5 minutes ago</div> </div> </div> """ elif card_id == "alert_card": base_style = "width: 100%; max-width: 280px; min-height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: #FFF3CD; border: 1px solid #FFE69C;" content = f""" <div style="padding: 14px; display: flex; gap: 12px; align-items: start;"> <div style="font-size: 20px;">⚠️</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 12px; color: #856404; margin-bottom: 4px;">Warning</div> <div style="font-size: 11px; color: #856404;">Your storage is almost full. Please free up some space.</div> </div> <button style="background: transparent; border: none; color: #856404; font-size: 16px; cursor: pointer;">×</button> </div> """ elif card_id == "chat_bubble": base_style = "width: 100%; max-width: 220px; min-height: 60px; border-radius: 16px 16px 16px 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: {primary}; padding: 12px; position: relative;" content = f""" <div style="color: white; font-size: 12px; line-height: 1.4; margin-bottom: 4px;">Hey! How are you doing? I wanted to check in about the project.</div> <div style="text-align: right; font-size: 9px; color: rgba(255,255,255,0.8);">2:45 PM</div> """ # SPECIAL CARDS (6) elif card_id == "pricing_plan": base_style = "width: 100%; max-width: 200px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; border: 2px solid #eee;" content = f""" <div style="padding: 20px; text-align: center; background: {primary}10;"> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">Pro Plan</div> <div style="font-size: 32px; font-weight: 700; color: {primary}; margin-bottom: 4px;">$29<span style="font-size: 14px; font-weight: 400;">/mo</span></div> </div> <div style="padding: 20px; display: flex; flex-direction: column; gap: 8px;"> <div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">✓ 100 Projects</div> <div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">✓ Unlimited Storage</div> <div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">✓ Priority Support</div> <div style="font-size: 11px; color: #666; display: flex; align-items: center; gap: 6px;">✓ Analytics</div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600; margin-top: 8px;">Get Started</button> </div> """ elif card_id == "review_card": content = f""" <div style="padding: 16px;"> <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 12px; color: #333;">Emily Davis</div> <div style="color: #FFB800; font-size: 12px;">⭐⭐⭐⭐⭐</div> </div> </div> <div style="font-size: 11px; color: #666; line-height: 1.5; margin-bottom: 8px;">"Amazing product! Exceeded all my expectations. Highly recommend to anyone looking for quality."</div> <div style="font-size: 9px; color: #999;">2 days ago</div> </div> """ elif card_id == "event_card": base_style = "width: 100%; max-width: 280px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex;" content = f""" <div style="width: 80px; background: {primary}; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center;"> <div style="font-size: 28px; font-weight: 700;">24</div> <div style="font-size: 11px; opacity: 0.9;">DEC</div> </div> <div style="flex: 1; padding: 14px; display: flex; flex-direction: column; justify-content: space-between;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Tech Conference 2024</div> <div style="font-size: 10px; color: #666; display: flex; align-items: center; gap: 4px;">📍 San Francisco, CA</div> </div> <div style="font-size: 10px; color: #666;">👥 245 attending</div> </div> """ elif card_id == "offer_coupon": base_style = "width: 100%; max-width: 260px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; border: 2px dashed {primary}; position: relative;" content = f""" <div style="padding: 20px; text-align: center;"> <div style="font-size: 10px; color: {primary}; font-weight: 600; margin-bottom: 8px;">SPECIAL OFFER</div> <div style="font-size: 32px; font-weight: 700; color: {primary}; margin-bottom: 4px;">25% OFF</div> <div style="font-size: 11px; color: #666; margin-bottom: 12px;">On your next purchase</div> <div style="background: {primary}10; padding: 8px 16px; border-radius: 8px; display: inline-block;"> <div style="font-size: 10px; color: #666; margin-bottom: 2px;">Code:</div> <div style="font-weight: 700; font-size: 14px; color: {primary}; letter-spacing: 1px;">SAVE25</div> </div> <div style="font-size: 9px; color: #999; margin-top: 8px;">Expires in 3 days</div> </div> """ elif card_id == "weather_card": base_style = "width: 100%; max-width: 200px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary}); color: white; padding: 20px;" content = f""" <div style="text-align: center;"> <div style="font-size: 12px; opacity: 0.9; margin-bottom: 8px;">San Francisco</div> <div style="font-size: 64px; margin-bottom: 8px;">☀️</div> <div style="font-size: 40px; font-weight: 700; margin-bottom: 4px;">72°</div> <div style="font-size: 11px; opacity: 0.9; margin-bottom: 16px;">Sunny</div> <div style="display: flex; justify-content: space-around; font-size: 10px;"> <div>H: 78°</div> <div>L: 65°</div> </div> </div> """ elif card_id == "ticket_card": base_style = "width: 100%; max-width: 280px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; position: relative;" content = f""" <div style="padding: 20px; padding-bottom: 16px;"> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">Concert Night 2024</div> <div style="font-size: 11px; color: #666; margin-bottom: 4px;">📅 Dec 25, 2024 • 8:00 PM</div> <div style="font-size: 11px; color: #666; margin-bottom: 12px;">📍 Madison Square Garden</div> <div style="font-size: 10px; color: #666; margin-bottom: 4px;">Seat: A-12 | Row: 5</div> </div> <div style="position: absolute; bottom: 0; left: 0; right: 0; height: 40px; background: {primary}10; border-top: 2px dashed {primary}; display: flex; align-items: center; justify-content: center;"> <div style="font-family: monospace; font-size: 14px; font-weight: 700; letter-spacing: 2px; color: #333;">|||||||||||||||</div> </div> """ # E-COMMERCE EXTENDED (15) elif card_id == "cart_item": base_style = "width: 100%; max-width: 300px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; display: flex; gap: 12px; padding: 12px;" content = f""" <div style="width: 76px; height: 76px; border-radius: 8px; background: #f5f5f5; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 36px;">👟</div> <div style="flex: 1; display: flex; flex-direction: column; justify-content: space-between;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Running Shoes</div> <div style="font-size: 10px; color: #666;">Size: 42, Color: Blue</div> </div> <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="display: flex; align-items: center; gap: 8px; background: #f5f5f5; border-radius: 6px; padding: 4px;"> <button style="width: 24px; height: 24px; border: none; background: transparent; color: #666; font-size: 16px;">-</button> <span style="font-size: 12px; font-weight: 600;">2</span> <button style="width: 24px; height: 24px; border: none; background: transparent; color: {primary}; font-size: 16px;">+</button> </div> <div style="font-weight: 700; font-size: 16px; color: {primary};">$158.00</div> </div> </div> """ elif card_id == "wishlist_item": base_style = "width: 100%; max-width: 200px; min-height: 260px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="position: relative; background: #f5f5f5; height: 160px; display: flex; align-items: center; justify-content: center; font-size: 56px;"> 👟 <div style="position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">❤️</div> </div> <div style="padding: 12px;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 6px;">Running Shoes</div> <div style="font-weight: 700; font-size: 16px; color: {primary};">$79.00</div> </div> """ elif card_id == "checkout_step": base_style = "width: 100%; max-width: 300px; min-height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;"> <div style="width: 32px; height: 32px; border-radius: 50%; background: {primary}; color: white; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;">2</div> <div style="font-weight: 700; font-size: 14px; color: #333;">Shipping Address</div> </div> <div style="height: 4px; background: #eee; border-radius: 2px; overflow: hidden;"> <div style="width: 50%; height: 100%; background: {primary};"></div> </div> """ elif card_id == "shipping_option": base_style = "width: 100%; max-width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 20px; height: 20px; border-radius: 50%; border: 2px solid {primary}; display: flex; align-items: center; justify-content: center;"> <div style="width: 12px; height: 12px; border-radius: 50%; background: {primary};"></div> </div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Express Delivery</div> <div style="font-size: 11px; color: #666;">Arrives tomorrow</div> </div> <div style="font-weight: 700; font-size: 14px; color: {primary};">$9.99</div> """ elif card_id == "product_review": content = f""" <div style="padding: 14px;"> <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 8px;"> <div style="width: 36px; height: 36px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 18px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 12px; color: #333;">John Doe <span style="background: {primary}20; color: {primary}; padding: 2px 6px; border-radius: 4px; font-size: 9px; margin-left: 4px;">✓ Verified</span></div> <div style="color: #FFB800; font-size: 12px;">⭐⭐⭐⭐⭐</div> </div> </div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 8px;">Great product! Exactly as described. Fast shipping too.</div> <div style="font-size: 10px; color: #999;">👍 45 people found this helpful</div> </div> """ elif card_id == "category_grid": base_style = "width: 100%; max-width: 120px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;" content = f""" <div style="width: 48px; height: 48px; border-radius: 10px; background: {primary}20; color: {primary}; display: flex; align-items: center; justify-content: center; font-size: 28px;">👕</div> <div style="font-weight: 600; font-size: 12px; color: #333; text-align: center;">Clothing</div> <div style="font-size: 10px; color: #666;">245 items</div> """ elif card_id == "filter_chip": base_style = "width: 100%; max-width: 100px; height: 36px; border-radius: 18px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: {primary}; color: white; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 6px;" content = f""" <span style="font-size: 12px; font-weight: 600;">On Sale</span> <span style="font-size: 14px;">×</span> """ elif card_id == "order_summary": base_style = "width: 100%; max-width: 280px; min-height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 12px;">Order Summary</div> <div style="display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;"> <div style="display: flex; justify-content: space-between; font-size: 12px; color: #666;"> <span>Subtotal (3 items)</span> <span>$237.00</span> </div> <div style="display: flex; justify-content: space-between; font-size: 12px; color: #666;"> <span>Shipping</span> <span>$9.99</span> </div> <div style="display: flex; justify-content: space-between; font-size: 12px; color: {primary};"> <span>Discount</span> <span>-$20.00</span> </div> </div> <div style="border-top: 1px solid #eee; padding-top: 12px; display: flex; justify-content: space-between; align-items: center;"> <span style="font-weight: 700; font-size: 14px; color: #333;">Total</span> <span style="font-weight: 700; font-size: 18px; color: {primary};">$226.99</span> </div> """ elif card_id == "payment_method": base_style = "width: 100%; max-width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 48px; height: 32px; border-radius: 6px; background: linear-gradient(135deg, {primary}, {secondary}); display: flex; align-items: center; justify-content: center; color: white; font-size: 10px; font-weight: 700;">VISA</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">•••• 4242</div> <div style="font-size: 10px; color: #666;">Expires 12/25</div> </div> <div style="background: {primary}20; color: {primary}; padding: 4px 8px; border-radius: 6px; font-size: 9px; font-weight: 600;">DEFAULT</div> """ elif card_id == "order_tracking": base_style = "width: 100%; max-width: 300px; min-height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 16px;">Order #12345</div> <div style="display: flex; flex-direction: column; gap: 16px;"> <div style="display: flex; align-items: start; gap: 12px;"> <div style="width: 24px; height: 24px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px;">✓</div> <div style="flex: 1;"> <div style="font-weight: 600; font-size: 12px; color: #333;">Order Placed</div> <div style="font-size: 10px; color: #666;">Dec 15, 2:30 PM</div> </div> </div> <div style="display: flex; align-items: start; gap: 12px;"> <div style="width: 24px; height: 24px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px;">✓</div> <div style="flex: 1;"> <div style="font-weight: 600; font-size: 12px; color: #333;">Shipped</div> <div style="font-size: 10px; color: #666;">Dec 16, 10:00 AM</div> </div> </div> <div style="display: flex; align-items: start; gap: 12px;"> <div style="width: 24px; height: 24px; border-radius: 50%; background: #eee; color: #999; display: flex; align-items: center; justify-content: center; font-size: 12px;">3</div> <div style="flex: 1;"> <div style="font-weight: 600; font-size: 12px; color: #666;">Delivered</div> <div style="font-size: 10px; color: #999;">Estimated: Dec 18</div> </div> </div> </div> """ elif card_id == "brand_showcase": base_style = "width: 100%; max-width: 200px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;" content = f""" <div style="width: 80px; height: 80px; border-radius: 12px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; font-size: 40px;">🏷️</div> <div style="font-weight: 700; font-size: 14px; color: #333; text-align: center;">Nike</div> <div style="font-size: 10px; color: #666;">1,234 products</div> <button style="background: {primary}; color: white; border: none; padding: 8px 20px; border-radius: 20px; font-size: 11px; font-weight: 600; margin-top: 4px;">Follow</button> """ elif card_id == "size_selector": base_style = "width: 100%; max-width: 240px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 600; font-size: 12px; color: #333; margin-bottom: 10px;">Select Size</div> <div style="display: flex; gap: 8px;"> <div style="width: 44px; height: 44px; border-radius: 8px; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #666;">S</div> <div style="width: 44px; height: 44px; border-radius: 8px; border: 2px solid {primary}; background: {primary}10; display: flex; align-items: center; justify-content: center; font-size: 12px; color: {primary}; font-weight: 700;">M</div> <div style="width: 44px; height: 44px; border-radius: 8px; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #666;">L</div> <div style="width: 44px; height: 44px; border-radius: 8px; border: 1px solid #ddd; background: #f5f5f5; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #ccc;">XL</div> </div> """ elif card_id == "color_picker": base_style = "width: 100%; max-width: 200px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 600; font-size: 12px; color: #333; margin-bottom: 10px;">Color: <span style="color: #666;">Ocean Blue</span></div> <div style="display: flex; gap: 8px;"> <div style="width: 36px; height: 36px; border-radius: 50%; background: #1E40AF; border: 3px solid {primary};"></div> <div style="width: 36px; height: 36px; border-radius: 50%; background: #DC2626; border: 1px solid #ddd;"></div> <div style="width: 36px; height: 36px; border-radius: 50%; background: #059669; border: 1px solid #ddd;"></div> <div style="width: 36px; height: 36px; border-radius: 50%; background: #1F2937; border: 1px solid #ddd;"></div> </div> """ elif card_id == "flash_sale": base_style = "width: 100%; max-width: 240px; min-height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, #FF3B30, #FF9500);" content = f""" <div style="padding: 16px; color: white;"> <div style="font-size: 10px; font-weight: 600; margin-bottom: 4px;">FLASH SALE</div> <div style="font-size: 24px; font-weight: 700; margin-bottom: 8px;">50% OFF</div> <div style="display: flex; gap: 6px; margin-bottom: 12px;"> <div style="background: rgba(0,0,0,0.3); padding: 6px; border-radius: 6px; font-size: 18px; font-weight: 700;">02</div> <div style="font-size: 18px; font-weight: 700;">:</div> <div style="background: rgba(0,0,0,0.3); padding: 6px; border-radius: 6px; font-size: 18px; font-weight: 700;">34</div> <div style="font-size: 18px; font-weight: 700;">:</div> <div style="background: rgba(0,0,0,0.3); padding: 6px; border-radius: 6px; font-size: 18px; font-weight: 700;">56</div> </div> </div> <div style="background: #f5f5f5; height: 80px; display: flex; align-items: center; justify-content: center; font-size: 40px;">📱</div> """ elif card_id == "related_products": base_style = "width: 100%; max-width: 120px; min-height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: #f5f5f5; height: 120px; display: flex; align-items: center; justify-content: center; font-size: 48px;">📱</div> <div style="padding: 10px;"> <div style="font-weight: 600; font-size: 11px; color: #333; margin-bottom: 4px;">Product Name</div> <div style="font-weight: 700; font-size: 13px; color: {primary};">$49</div> </div> """ # SOCIAL EXTENDED (10) elif card_id == "comment_thread": base_style = "width: 100%; max-width: 300px; min-height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px;" content = f""" <div style="display: flex; gap: 10px;"> <div style="width: 32px; height: 32px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 16px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 12px; color: #333; margin-bottom: 4px;">Alex Kim <span style="font-size: 10px; color: #999; font-weight: 400;">• 2h ago</span></div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 6px;">This is amazing! Can't wait to try it out.</div> <div style="display: flex; gap: 12px; font-size: 10px; color: #999;"> <span>👍 12</span> <span>💬 Reply</span> </div> </div> </div> """ elif card_id == "reaction_bar": base_style = "width: 100%; max-width: 200px; height: 48px; border-radius: 24px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 8px 16px; display: flex; align-items: center; justify-content: space-around; gap: 8px;" content = f""" <span style="font-size: 20px;">👍</span> <span style="font-size: 20px;">❤️</span> <span style="font-size: 20px;">😂</span> <span style="font-size: 20px;">😮</span> <span style="font-size: 20px;">😢</span> """ elif card_id == "share_sheet": base_style = "width: 100%; max-width: 280px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 16px;">Share</div> <div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;"> <div style="display: flex; flex-direction: column; align-items: center; gap: 6px;"> <div style="width: 48px; height: 48px; border-radius: 50%; background: #1877F2; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">f</div> <div style="font-size: 9px; color: #666;">Facebook</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 6px;"> <div style="width: 48px; height: 48px; border-radius: 50%; background: #1DA1F2; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">𝕏</div> <div style="font-size: 9px; color: #666;">Twitter</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 6px;"> <div style="width: 48px; height: 48px; border-radius: 50%; background: #25D366; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">💬</div> <div style="font-size: 9px; color: #666;">WhatsApp</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 6px;"> <div style="width: 48px; height: 48px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">🔗</div> <div style="font-size: 9px; color: #666;">Copy</div> </div> </div> """ elif card_id == "follower_item": base_style = "width: 100%; max-width: 280px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 48px; height: 48px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">👤</div> <div style="flex: 1; min-width: 0;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Emma Watson</div> <div style="font-size: 10px; color: #666;">Followed by john_doe + 12 others</div> </div> <button style="background: {primary}; color: white; border: none; padding: 6px 16px; border-radius: 6px; font-size: 11px; font-weight: 600;">Follow</button> """ elif card_id == "story_ring": base_style = "width: 100%; max-width: 80px; height: 100px; display: flex; flex-direction: column; align-items: center; gap: 6px;" content = f""" <div style="width: 68px; height: 68px; border-radius: 50%; padding: 3px; background: linear-gradient(135deg, {primary}, {secondary});"> <div style="width: 62px; height: 62px; border-radius: 50%; background: white; padding: 2px;"> <div style="width: 58px; height: 58px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 28px;">👤</div> </div> </div> <div style="font-size: 10px; color: #333; font-weight: 500;">John</div> """ elif card_id == "reel_preview": base_style = "width: 100%; max-width: 160px; height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;" content = f""" <div style="position: absolute; inset: 0; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: white; font-size: 48px;">▶️</div> <div style="position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.6); color: white; padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 600;">0:45</div> <div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 12px; color: white;"> <div style="font-size: 10px; opacity: 0.9;">👁️ 12.5K views</div> </div> """ elif card_id == "live_streaming": base_style = "width: 100%; max-width: 260px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;" content = f""" <div style="position: absolute; inset: 0; background: linear-gradient(135deg, {primary}, {secondary});"></div> <div style="position: absolute; top: 8px; left: 8px; background: #FF3B30; color: white; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 700;">🔴 LIVE</div> <div style="position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.6); color: white; padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 600;">👁️ 2.3K</div> <div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 12px; color: white;"> <div style="font-weight: 700; font-size: 13px;">Tech Talk Live</div> <div style="font-size: 10px; opacity: 0.9;">with @johndoe</div> </div> """ elif card_id == "poll_card": base_style = "width: 100%; max-width: 280px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 12px;">Which feature do you want next?</div> <div style="display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px;"> <div style="position: relative; background: #f5f5f5; border-radius: 8px; padding: 10px; overflow: hidden;"> <div style="position: absolute; left: 0; top: 0; bottom: 0; width: 65%; background: {primary}20; border-radius: 8px;"></div> <div style="position: relative; display: flex; justify-content: space-between; font-size: 11px;"> <span style="font-weight: 600; color: #333;">Dark Mode</span> <span style="color: {primary}; font-weight: 700;">65%</span> </div> </div> <div style="position: relative; background: #f5f5f5; border-radius: 8px; padding: 10px;"> <div style="position: relative; display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Notifications</span> <span style="color: #666;">35%</span> </div> </div> </div> <div style="font-size: 10px; color: #999;">1,234 votes • 2 days left</div> """ elif card_id == "mention_tag": base_style = "width: 100%; max-width: 120px; height: 36px; border-radius: 18px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1); background: {primary}10; color: {primary}; padding: 0 14px; display: flex; align-items: center; justify-content: center;" content = f""" <span style="font-size: 13px; font-weight: 600;">@johndoe</span> """ elif card_id == "group_member": base_style = "width: 100%; max-width: 280px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 48px; height: 48px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Sarah Johnson <span style="background: #FFB800; color: white; padding: 2px 6px; border-radius: 4px; font-size: 9px; margin-left: 4px;">ADMIN</span></div> <div style="font-size: 10px; color: #666;">Joined 3 months ago</div> </div> <button style="color: #666; background: transparent; border: none; font-size: 18px;">⋮</button> """ # FINANCE & BANKING (10) elif card_id == "account_balance": base_style = "width: 100%; max-width: 280px; min-height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary}); padding: 16px; color: white;" content = f""" <div style="font-size: 11px; opacity: 0.9; margin-bottom: 6px;">Checking Account</div> <div style="font-size: 28px; font-weight: 700; margin-bottom: 8px;">$12,459.32</div> <div style="font-size: 10px; opacity: 0.8;">**** 4242</div> """ elif card_id == "transaction_item": base_style = "width: 100%; max-width: 300px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 44px; height: 44px; border-radius: 10px; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 20px;">🏪</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Amazon</div> <div style="font-size: 10px; color: #666;">Shopping • Today at 2:30 PM</div> </div> <div style="font-weight: 700; font-size: 14px; color: #333;">-$49.99</div> """ elif card_id == "credit_card": base_style = "width: 100%; max-width: 320px; height: 200px; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,0.2); background: linear-gradient(135deg, {primary}, {secondary}); padding: 20px; color: white; position: relative;" content = f""" <div style="font-size: 24px; margin-bottom: 40px;">💳</div> <div style="font-size: 18px; font-weight: 600; letter-spacing: 2px; margin-bottom: 16px;">**** **** **** 4242</div> <div style="display: flex; justify-content: space-between; align-items: end;"> <div> <div style="font-size: 9px; opacity: 0.8;">VALID THRU</div> <div style="font-size: 12px; font-weight: 600;">12/25</div> </div> <div style="font-size: 20px; font-weight: 700; opacity: 0.9;">VISA</div> </div> """ elif card_id == "transfer_form": base_style = "width: 100%; max-width: 280px; min-height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 16px;">Transfer Money</div> <div style="margin-bottom: 12px;"> <div style="font-size: 11px; color: #666; margin-bottom: 6px;">To</div> <div style="background: #f5f5f5; border-radius: 8px; padding: 10px; font-size: 12px; color: #333;">John Doe (**** 5678)</div> </div> <div style="margin-bottom: 16px;"> <div style="font-size: 11px; color: #666; margin-bottom: 6px;">Amount</div> <div style="background: #f5f5f5; border-radius: 8px; padding: 10px; font-size: 20px; font-weight: 700; color: {primary};">$500.00</div> </div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 12px; border-radius: 8px; font-size: 13px; font-weight: 600;">Confirm Transfer</button> """ elif card_id == "investment_item": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px;"> <div> <div style="font-weight: 700; font-size: 14px; color: #333;">AAPL</div> <div style="font-size: 10px; color: #666;">Apple Inc.</div> </div> <div style="text-align: right;"> <div style="font-weight: 700; font-size: 14px; color: #333;">$178.45</div> <div style="font-size: 11px; color: #34C759; font-weight: 600;">+2.34%</div> </div> </div> <div style="display: flex; align-items: end; gap: 2px; height: 30px;"> <div style="flex: 1; background: {primary}; opacity: 0.4; height: 40%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.5; height: 60%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.6; height: 50%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.7; height: 70%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.8; height: 85%;"></div> <div style="flex: 1; background: {primary}; height: 100%;"></div> </div> """ elif card_id == "crypto_wallet": base_style = "width: 100%; max-width: 260px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: #F7931A; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; font-weight: 700;">₿</div> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Bitcoin</div> <div style="font-size: 10px; color: #666;">BTC</div> </div> </div> <div style="display: flex; justify-content: space-between; align-items: end;"> <div> <div style="font-size: 18px; font-weight: 700; color: #333;">0.0245 BTC</div> <div style="font-size: 11px; color: #666;">≈ $1,089.50</div> </div> <div style="font-size: 11px; color: #34C759; font-weight: 600;">+5.2%</div> </div> """ elif card_id == "bill_payment": base_style = "width: 100%; max-width: 280px; height: 90px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 56px; height: 56px; border-radius: 12px; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 28px;">⚡</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Electricity Bill</div> <div style="font-size: 10px; color: #666;">Due: Dec 25, 2024</div> <div style="font-size: 16px; font-weight: 700; color: #FF3B30; margin-top: 4px;">$124.50</div> </div> <button style="background: {primary}; color: white; border: none; padding: 8px 16px; border-radius: 8px; font-size: 11px; font-weight: 600;">Pay</button> """ elif card_id == "budget_category": base_style = "width: 100%; max-width: 260px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;"> <div style="width: 36px; height: 36px; border-radius: 8px; background: {primary}20; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 18px;">🍔</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Food & Dining</div> <div style="font-size: 11px; color: #666;">$450 of $600</div> </div> </div> <div style="height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden;"> <div style="width: 75%; height: 100%; background: {primary}; border-radius: 4px;"></div> </div> <div style="font-size: 10px; color: #666; margin-top: 6px; text-align: right;">$150 remaining</div> """ elif card_id == "loan_summary": base_style = "width: 100%; max-width: 280px; min-height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 12px;">Home Loan</div> <div style="display: flex; flex-direction: column; gap: 8px;"> <div style="display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Outstanding</span> <span style="font-weight: 700; color: #333;">$245,000</span> </div> <div style="display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Monthly EMI</span> <span style="font-weight: 700; color: #333;">$1,850</span> </div> <div style="display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Next Payment</span> <span style="font-weight: 700; color: {primary};">Jan 1, 2025</span> </div> </div> """ elif card_id == "statement_month": base_style = "width: 100%; max-width: 240px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; align-items: center; justify-content: space-between;" content = f""" <div> <div style="font-weight: 700; font-size: 14px; color: #333;">December 2024</div> <div style="font-size: 12px; color: #666; margin-top: 4px;">Total Spent</div> <div style="font-size: 18px; font-weight: 700; color: {primary}; margin-top: 4px;">$3,245.80</div> </div> <button style="width: 40px; height: 40px; border-radius: 50%; background: {primary}20; color: {primary}; border: none; font-size: 18px;">📄</button> """ # HEALTH & FITNESS (10) elif card_id == "workout_exercise": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px;"> <div> <div style="font-weight: 700; font-size: 14px; color: #333;">Push-ups</div> <div style="font-size: 11px; color: #666;">Chest • Triceps</div> </div> <div style="width: 44px; height: 44px; border-radius: 10px; background: {primary}20; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 22px;">💪</div> </div> <div style="display: flex; gap: 16px; font-size: 12px; color: #666;"> <div><span style="font-weight: 700; color: #333;">3</span> sets</div> <div><span style="font-weight: 700; color: #333;">15</span> reps</div> <div><span style="font-weight: 700; color: #333;">60s</span> rest</div> </div> """ elif card_id == "nutrition_log": base_style = "width: 100%; max-width: 300px; height: 90px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; gap: 12px;" content = f""" <div style="width: 56px; height: 56px; border-radius: 12px; background: #f5f5f5; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 32px;">🥗</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Grilled Chicken Salad</div> <div style="font-size: 18px; font-weight: 700; color: {primary}; margin-bottom: 4px;">245 cal</div> <div style="font-size: 10px; color: #666;">P: 32g • C: 12g • F: 8g</div> </div> """ elif card_id == "step_counter": base_style = "width: 100%; max-width: 160px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;" content = f""" <div style="width: 100px; height: 100px; border-radius: 50%; border: 8px solid {primary}20; border-top-color: {primary}; display: flex; align-items: center; justify-content: center; position: relative; transform: rotate(270deg);"> <div style="transform: rotate(90deg); text-align: center;"> <div style="font-size: 24px; font-weight: 700; color: #333;">8,234</div> <div style="font-size: 10px; color: #666;">steps</div> </div> </div> <div style="font-size: 11px; color: #666;">Goal: 10,000</div> """ elif card_id == "heart_rate": base_style = "width: 100%; max-width: 240px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 10px;"> <div style="font-size: 36px; color: #FF3B30;">❤️</div> <div> <div style="font-size: 28px; font-weight: 700; color: #333;">72 <span style="font-size: 14px; font-weight: 400; color: #666;">BPM</span></div> <div style="font-size: 11px; color: {primary}; font-weight: 600;">Normal</div> </div> </div> <div style="display: flex; align-items: end; gap: 2px; height: 20px;"> <div style="flex: 1; background: #FF3B30; opacity: 0.4; height: 40%;"></div> <div style="flex: 1; background: #FF3B30; opacity: 0.5; height: 60%;"></div> <div style="flex: 1; background: #FF3B30; opacity: 0.6; height: 55%;"></div> <div style="flex: 1; background: #FF3B30; opacity: 0.7; height: 70%;"></div> <div style="flex: 1; background: #FF3B30; opacity: 0.8; height: 65%;"></div> <div style="flex: 1; background: #FF3B30; height: 80%;"></div> </div> """ elif card_id == "sleep_tracker": base_style = "width: 100%; max-width: 280px; min-height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px;"> <div> <div style="font-weight: 700; font-size: 14px; color: #333;">Sleep Quality</div> <div style="font-size: 11px; color: #666;">Last night</div> </div> <div style="font-size: 32px;">🌙</div> </div> <div style="font-size: 36px; font-weight: 700; color: {primary}; margin-bottom: 8px;">7h 32m</div> <div style="display: flex; gap: 12px; font-size: 11px; color: #666;"> <div>Deep: 2h 15m</div> <div>Light: 4h 45m</div> <div>REM: 32m</div> </div> """ elif card_id == "water_intake": base_style = "width: 100%; max-width: 200px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; justify-content: space-between;" content = f""" <div> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">Water Intake</div> <div style="display: flex; gap: 6px; margin-bottom: 10px;"> <div style="width: 24px; height: 32px; border-radius: 4px; background: {primary};"></div> <div style="width: 24px; height: 32px; border-radius: 4px; background: {primary};"></div> <div style="width: 24px; height: 32px; border-radius: 4px; background: {primary};"></div> <div style="width: 24px; height: 32px; border-radius: 4px; background: {primary}; opacity: 0.5;"></div> <div style="width: 24px; height: 32px; border-radius: 4px; background: #eee;"></div> <div style="width: 24px; height: 32px; border-radius: 4px; background: #eee;"></div> </div> <div style="font-size: 11px; color: #666;">6 of 8 glasses</div> </div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600;">+ Add Glass</button> """ elif card_id == "bmi_calculator": base_style = "width: 100%; max-width: 220px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333;">Body Mass Index</div> <div style="font-size: 48px; font-weight: 700; color: {primary};">22.5</div> <div style="background: {primary}20; color: {primary}; padding: 6px 16px; border-radius: 16px; font-size: 12px; font-weight: 600;">Normal Weight</div> <div style="font-size: 10px; color: #666;">Height: 175cm • Weight: 69kg</div> """ elif card_id == "calorie_goal": base_style = "width: 100%; max-width: 240px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 16px;">Daily Calories</div> <div style="display: flex; justify-content: space-around; margin-bottom: 16px;"> <div style="text-align: center;"> <div style="font-size: 20px; font-weight: 700; color: {primary};">1,850</div> <div style="font-size: 10px; color: #666;">Consumed</div> </div> <div style="text-align: center;"> <div style="font-size: 20px; font-weight: 700; color: #34C759;">420</div> <div style="font-size: 10px; color: #666;">Burned</div> </div> </div> <div style="text-align: center;"> <div style="font-size: 24px; font-weight: 700; color: #333; margin-bottom: 4px;">1,430</div> <div style="font-size: 11px; color: #666;">Remaining of 2,000</div> </div> """ elif card_id == "meditation_session": base_style = "width: 100%; max-width: 260px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary}); padding: 20px; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;" content = f""" <div style="font-size: 48px;">🧘</div> <div style="font-weight: 700; font-size: 16px;">Mindful Breathing</div> <div style="font-size: 13px; opacity: 0.9;">10 minutes</div> <button style="width: 60px; height: 60px; border-radius: 50%; background: white; color: {primary}; border: none; font-size: 24px; display: flex; align-items: center; justify-content: center; margin-top: 8px;">▶️</button> """ elif card_id == "weight_progress": base_style = "width: 100%; max-width: 280px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 12px;">Weight Progress</div> <div style="display: flex; justify-content: space-around; margin-bottom: 16px;"> <div style="text-align: center;"> <div style="font-size: 10px; color: #666; margin-bottom: 4px;">Current</div> <div style="font-size: 24px; font-weight: 700; color: #333;">69kg</div> </div> <div style="text-align: center;"> <div style="font-size: 10px; color: #666; margin-bottom: 4px;">Goal</div> <div style="font-size: 24px; font-weight: 700; color: {primary};">65kg</div> </div> <div style="text-align: center;"> <div style="font-size: 10px; color: #666; margin-bottom: 4px;">Change</div> <div style="font-size: 24px; font-weight: 700; color: #34C759;">-2kg</div> </div> </div> <div style="display: flex; align-items: end; gap: 3px; height: 40px;"> <div style="flex: 1; background: {primary}; opacity: 0.4; height: 100%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.5; height: 95%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.6; height: 90%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.7; height: 85%;"></div> <div style="flex: 1; background: {primary}; opacity: 0.8; height: 80%;"></div> <div style="flex: 1; background: {primary}; height: 75%;"></div> </div> """ # EDUCATION & LEARNING (8) elif card_id == "course_card": base_style = "width: 100%; max-width: 280px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: linear-gradient(135deg, {primary}, {secondary}); height: 140px; display: flex; align-items: center; justify-content: center; color: white; font-size: 56px;">📚</div> <div style="padding: 14px;"> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 6px;">Complete Web Development Bootcamp</div> <div style="font-size: 11px; color: #666; margin-bottom: 8px;">by Dr. Angela Yu</div> <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;"> <div style="color: #FFB800; font-size: 11px;">⭐⭐⭐⭐⭐</div> <div style="font-size: 10px; color: #666;">(12,345)</div> </div> <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="font-size: 10px; color: #666;">👥 45,234 students</div> <div style="font-weight: 700; font-size: 18px; color: {primary};">$89.99</div> </div> </div> """ elif card_id == "lesson_item": base_style = "width: 100%; max-width: 300px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 44px; height: 44px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; font-weight: 700;">5</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Introduction to React Hooks</div> <div style="font-size: 10px; color: #666;">⏱️ 18 min • 📹 Video</div> </div> <div style="width: 20px; height: 20px; border-radius: 50%; background: #34C759; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px;">✓</div> """ elif card_id == "quiz_question": base_style = "width: 100%; max-width: 300px; min-height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 16px;">Question 3 of 10</div> <div style="font-size: 13px; color: #333; margin-bottom: 16px; line-height: 1.4;">What is the correct way to create a useState hook in React?</div> <div style="display: flex; flex-direction: column; gap: 10px;"> <div style="padding: 12px; border-radius: 8px; background: #f5f5f5; font-size: 12px; color: #666; cursor: pointer;">A) const [state, setState] = useState()</div> <div style="padding: 12px; border-radius: 8px; border: 2px solid {primary}; background: {primary}10; font-size: 12px; color: #333; font-weight: 600;">B) const [state, setState] = useState(initialValue)</div> <div style="padding: 12px; border-radius: 8px; background: #f5f5f5; font-size: 12px; color: #666;">C) useState(state, setState)</div> <div style="padding: 12px; border-radius: 8px; background: #f5f5f5; font-size: 12px; color: #666;">D) const state = useState()</div> </div> """ elif card_id == "certificate_card": base_style = "width: 100%; max-width: 320px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, #f5f5f5, #e0e0e0); padding: 20px; position: relative; border: 4px solid {primary};" content = f""" <div style="text-align: center; color: #333;"> <div style="font-size: 11px; color: #666; margin-bottom: 8px;">CERTIFICATE OF COMPLETION</div> <div style="font-size: 18px; font-weight: 700; margin-bottom: 12px; color: {primary};">Web Development Bootcamp</div> <div style="font-size: 13px; margin-bottom: 16px;">Awarded to <strong>John Doe</strong></div> <div style="font-size: 10px; color: #666; margin-bottom: 12px;">Completed on December 15, 2024</div> <div style="font-size: 32px; color: {primary};">🏆</div> </div> """ elif card_id == "learning_progress": base_style = "width: 100%; max-width: 260px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 8px;">JavaScript Masterclass</div> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;"> <div style="font-size: 11px; color: #666;">12 of 24 modules</div> <div style="font-weight: 700; font-size: 16px; color: {primary};">50%</div> </div> <div style="height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden;"> <div style="width: 50%; height: 100%; background: {primary}; border-radius: 4px;"></div> </div> """ elif card_id == "assignment_card": base_style = "width: 100%; max-width: 280px; min-height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Build a React Todo App</div> <div style="font-size: 10px; color: #666; margin-top: 4px;">Due: Dec 20, 2024</div> </div> <div style="background: #FFB800; color: white; padding: 4px 10px; border-radius: 12px; font-size: 9px; font-weight: 600;">PENDING</div> </div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600; margin-top: 8px;">📎 Upload Submission</button> """ elif card_id == "grade_item": base_style = "width: 100%; max-width: 260px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; align-items: center; justify-content: space-between;" content = f""" <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Mathematics</div> <div style="font-size: 10px; color: #666; margin-top: 4px;">Final Exam • 85/100 points</div> </div> <div style="width: 56px; height: 56px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; font-weight: 700;">A</div> """ elif card_id == "study_streak": base_style = "width: 100%; max-width: 180px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;" content = f""" <div style="font-size: 56px;">🔥</div> <div style="font-size: 32px; font-weight: 700; color: {primary};">15</div> <div style="font-weight: 600; font-size: 13px; color: #333;">Day Streak</div> <div style="font-size: 10px; color: #666;">Keep it up!</div> """ # TRAVEL & TOURISM (8) - FOOD & RESTAURANT (8) - REAL ESTATE (7) - MUSIC & AUDIO (7) - GAMING (6) - PRODUCTIVITY (6) - DASHBOARD WIDGETS (8) elif card_id == "flight_card": base_style = "width: 100%; max-width: 320px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;"> <div style="text-align: center;"> <div style="font-size: 20px; font-weight: 700; color: #333;">LAX</div> <div style="font-size: 10px; color: #666;">10:30 AM</div> </div> <div style="flex: 1; display: flex; flex-direction: column; align-items: center; margin: 0 12px;"> <div style="font-size: 24px; color: {primary};">✈️</div> <div style="width: 100%; height: 2px; background: {primary}; margin: 4px 0;"></div> <div style="font-size: 9px; color: #666;">2h 45m • Direct</div> </div> <div style="text-align: center;"> <div style="font-size: 20px; font-weight: 700; color: #333;">JFK</div> <div style="font-size: 10px; color: #666;">1:15 PM</div> </div> </div> <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="font-size: 11px; color: #666;">Delta Airlines</div> <div style="font-weight: 700; font-size: 18px; color: {primary};">$299</div> </div> """ elif card_id == "hotel_listing": base_style = "width: 100%; max-width: 280px; min-height: 240px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: linear-gradient(135deg, {primary}, {secondary}); height: 140px; display: flex; align-items: center; justify-content: center; font-size: 56px; color: white;">🏨</div> <div style="padding: 12px;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Grand Hotel Downtown</div> <div style="color: #FFB800; font-size: 11px; margin-bottom: 6px;">⭐⭐⭐⭐⭐</div> <div style="font-size: 10px; color: #666; margin-bottom: 8px;">📍 Times Square, New York • WiFi, Pool, Gym</div> <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="font-size: 10px; color: #666;">per night</div> <div style="font-weight: 700; font-size: 18px; color: {primary};">$189</div> </div> </div> """ elif card_id == "booking_confirm": base_style = "width: 100%; max-width: 300px; min-height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="text-align: center; margin-bottom: 16px;"> <div style="font-weight: 700; font-size: 14px; color: {primary}; margin-bottom: 8px;">Booking Confirmed</div> <div style="font-size: 11px; color: #666;">ID: BK-12345678</div> </div> <div style="background: #f5f5f5; border-radius: 8px; padding: 12px; margin-bottom: 12px; font-size: 11px;"> <div style="margin-bottom: 6px;"><strong>Grand Hotel</strong></div> <div style="color: #666;">Check-in: Dec 20, 2024</div> <div style="color: #666;">Check-out: Dec 22, 2024</div> <div style="color: #666;">2 Guests • 1 Room</div> </div> <div style="text-align: center;"> <div style="width: 120px; height: 120px; background: white; border: 2px solid #ddd; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: 0 auto; font-size: 80px;">⬛</div> </div> """ elif card_id == "destination_card": base_style = "width: 100%; max-width: 240px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative;" content = f""" <div style="position: absolute; inset: 0; background: linear-gradient(135deg, {primary}, {secondary});"></div> <div style="position: absolute; top: 8px; right: 8px; background: #FF3B30; color: white; padding: 4px 10px; border-radius: 12px; font-size: 9px; font-weight: 700;">HOT DEAL</div> <div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 16px; color: white;"> <div style="font-size: 24px; margin-bottom: 4px;">🗼</div> <div style="font-weight: 700; font-size: 16px; margin-bottom: 2px;">Paris</div> <div style="font-size: 10px; opacity: 0.9;">France • From $599</div> </div> """ elif card_id == "itinerary_day": base_style = "width: 100%; max-width: 300px; min-height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 14px;">Day 2 - Paris</div> <div style="display: flex; flex-direction: column; gap: 12px;"> <div style="display: flex; gap: 10px;"> <div style="font-size: 11px; color: #666; width: 50px;">09:00</div> <div> <div style="font-weight: 600; font-size: 12px; color: #333;">Eiffel Tower</div> <div style="font-size: 10px; color: #666;">📍 Champ de Mars</div> </div> </div> <div style="display: flex; gap: 10px;"> <div style="font-size: 11px; color: #666; width: 50px;">13:00</div> <div> <div style="font-weight: 600; font-size: 12px; color: #333;">Louvre Museum</div> <div style="font-size: 10px; color: #666;">📍 Rue de Rivoli</div> </div> </div> <div style="display: flex; gap: 10px;"> <div style="font-size: 11px; color: #666; width: 50px;">19:00</div> <div> <div style="font-weight: 600; font-size: 12px; color: #333;">Seine River Cruise</div> <div style="font-size: 10px; color: #666;">📍 Port de la Bourdonnais</div> </div> </div> </div> """ elif card_id == "map_location": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; gap: 12px;" content = f""" <div style="width: 72px; height: 72px; border-radius: 10px; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 36px;">📍</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Central Park</div> <div style="font-size: 10px; color: #666; margin-bottom: 6px;">5th Ave, New York, NY</div> <div style="font-size: 11px; color: {primary}; font-weight: 600;">2.5 km away</div> </div> <button style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; color: white; border: none; font-size: 18px;">→</button> """ elif card_id == "travel_review": base_style = "width: 100%; max-width: 280px; min-height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;"> <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 12px; color: #333;">Maria Garcia</div> <div style="color: #FFB800; font-size: 11px;">⭐⭐⭐⭐⭐</div> </div> </div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 8px;">"Amazing experience! The hotel was perfect and the location was great."</div> <div style="font-size: 10px; color: #999;">📷 3 photos • 👍 24 helpful • 2 weeks ago</div> """ elif card_id == "passport_info": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Passport</div> <div style="font-size: 28px;">📘</div> </div> <div style="font-size: 11px; color: #666; margin-bottom: 4px;">Number: <strong>A12345678</strong></div> <div style="font-size: 11px; color: #666; margin-bottom: 4px;">Nationality: United States</div> <div style="font-size: 11px; color: #FF3B30; font-weight: 600;">Expires: Mar 15, 2025</div> """ elif card_id == "menu_item": base_style = "width: 100%; max-width: 280px; min-height: 240px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: #f5f5f5; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 64px;">🍔</div> <div style="padding: 12px;"> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 6px;">Classic Burger</div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 10px;">Beef patty, lettuce, tomato, cheese, special sauce</div> <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="font-weight: 700; font-size: 18px; color: {primary};">$12.99</div> <button style="background: {primary}; color: white; border: none; padding: 8px 16px; border-radius: 8px; font-size: 11px; font-weight: 600;">Add to Cart</button> </div> </div> """ elif card_id == "recipe_card": base_style = "width: 100%; max-width: 280px; min-height: 260px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: linear-gradient(135deg, {primary}, {secondary}); height: 140px; display: flex; align-items: center; justify-content: center; font-size: 64px; color: white;">🍝</div> <div style="padding: 14px;"> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 8px;">Spaghetti Carbonara</div> <div style="display: flex; gap: 16px; font-size: 11px; color: #666; margin-bottom: 10px;"> <div>⏱️ 25 min</div> <div>👨‍🍳 Medium</div> <div>🍽️ 4 servings</div> </div> <div style="display: flex; align-items: center; gap: 6px;"> <div style="color: #FFB800; font-size: 11px;">⭐⭐⭐⭐⭐</div> <div style="font-size: 10px; color: #666;">(2.5K reviews)</div> </div> </div> """ elif card_id == "order_item": base_style = "width: 100%; max-width: 300px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; gap: 12px;" content = f""" <div style="width: 76px; height: 76px; border-radius: 8px; background: #f5f5f5; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 40px;">🍕</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Margherita Pizza</div> <div style="font-size: 10px; color: #666; margin-bottom: 6px;">x2 • Large • Extra cheese</div> <div style="font-weight: 700; font-size: 16px; color: {primary};">$28.00</div> </div> """ elif card_id == "reservation_slot": base_style = "width: 100%; max-width: 240px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; align-items: center; justify-content: space-between;" content = f""" <div> <div style="font-weight: 700; font-size: 18px; color: #333; margin-bottom: 4px;">7:30 PM</div> <div style="font-size: 11px; color: #666;">4 seats available</div> </div> <button style="background: {primary}; color: white; border: none; padding: 10px 20px; border-radius: 8px; font-size: 12px; font-weight: 600;">Book</button> """ elif card_id == "delivery_tracker": base_style = "width: 100%; max-width: 300px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 14px;">Order #5678</div> <div style="background: {primary}20; border-radius: 10px; padding: 12px; margin-bottom: 12px;"> <div style="font-weight: 600; font-size: 13px; color: {primary}; margin-bottom: 6px;">🚗 Out for Delivery</div> <div style="font-size: 11px; color: #666;">Your order will arrive in 15-20 minutes</div> </div> <div style="display: flex; align-items: center; gap: 10px;"> <div style="width: 44px; height: 44px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 22px;">👤</div> <div> <div style="font-weight: 600; font-size: 12px; color: #333;">John Driver</div> <div style="font-size: 10px; color: #666;">⭐ 4.9 • 245 deliveries</div> </div> </div> """ elif card_id == "restaurant_rating": base_style = "width: 100%; max-width: 260px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="text-align: center; margin-bottom: 12px;"> <div style="font-size: 32px; font-weight: 700; color: {primary}; margin-bottom: 4px;">4.5</div> <div style="color: #FFB800; font-size: 14px; margin-bottom: 4px;">⭐⭐⭐⭐⭐</div> <div style="font-size: 10px; color: #666;">Based on 1,234 reviews</div> </div> <div style="display: flex; justify-content: space-around; font-size: 10px;"> <div style="text-align: center;"> <div style="font-weight: 700; color: #333;">4.6</div> <div style="color: #666;">Food</div> </div> <div style="text-align: center;"> <div style="font-weight: 700; color: #333;">4.4</div> <div style="color: #666;">Service</div> </div> <div style="text-align: center;"> <div style="font-weight: 700; color: #333;">4.5</div> <div style="color: #666;">Ambience</div> </div> </div> """ elif card_id == "ingredient_list": base_style = "width: 100%; max-width: 260px; height: 60px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <input type="checkbox" style="width: 20px; height: 20px; accent-color: {primary};"> <div style="flex: 1;"> <div style="font-weight: 600; font-size: 12px; color: #333;">Tomatoes</div> <div style="font-size: 10px; color: #666;">4 medium</div> </div> """ elif card_id == "dietary_tag": base_style = "width: 100%; max-width: 100px; height: 32px; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1); background: #34C759; color: white; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 4px;" content = f""" <span style="font-size: 14px;">🌱</span> <span style="font-size: 11px; font-weight: 600;">Vegan</span> """ elif card_id == "property_listing": base_style = "width: 100%; max-width: 300px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: linear-gradient(135deg, {primary}, {secondary}); height: 160px; display: flex; align-items: center; justify-content: center; font-size: 64px; color: white;">🏠</div> <div style="padding: 14px;"> <div style="font-weight: 700; font-size: 16px; color: {primary}; margin-bottom: 6px;">$425,000</div> <div style="font-weight: 600; font-size: 13px; color: #333; margin-bottom: 6px;">Modern Downtown Apartment</div> <div style="font-size: 11px; color: #666; margin-bottom: 8px;">📍 123 Main St, New York</div> <div style="display: flex; gap: 12px; font-size: 11px; color: #666;"> <div>🛏️ 2 beds</div> <div>🚿 2 baths</div> <div>📐 1,200 sqft</div> </div> </div> """ elif card_id == "agent_card": base_style = "width: 100%; max-width: 240px; min-height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;" content = f""" <div style="width: 80px; height: 80px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 40px;">👤</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 14px; color: #333;">Sarah Johnson</div> <div style="font-size: 11px; color: #666; margin-top: 2px;">Real Estate Agent</div> </div> <div style="font-size: 11px; color: #666; text-align: center;">245 properties sold • ⭐ 4.9</div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600;">Contact</button> """ elif card_id == "virtual_tour": base_style = "width: 100%; max-width: 240px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: linear-gradient(135deg, {primary}, {secondary}); padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: white;" content = f""" <div style="font-size: 48px;">🔄</div> <div style="font-weight: 700; font-size: 14px;">360° Virtual Tour</div> <div style="font-size: 11px; opacity: 0.9;">Living Room</div> <button style="background: white; color: {primary}; border: none; padding: 8px 20px; border-radius: 8px; font-size: 11px; font-weight: 600;">View Tour</button> """ elif card_id == "mortgage_calc": base_style = "width: 100%; max-width: 280px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 14px;">Mortgage Calculator</div> <div style="display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px;"> <div style="display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Loan Amount</span> <span style="font-weight: 700; color: #333;">$340,000</span> </div> <div style="display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Interest Rate</span> <span style="font-weight: 700; color: #333;">6.5%</span> </div> <div style="display: flex; justify-content: space-between; font-size: 11px;"> <span style="color: #666;">Term</span> <span style="font-weight: 700; color: #333;">30 years</span> </div> </div> <div style="background: {primary}10; border-radius: 8px; padding: 12px; text-align: center;"> <div style="font-size: 10px; color: #666; margin-bottom: 4px;">Monthly Payment</div> <div style="font-size: 24px; font-weight: 700; color: {primary};">$2,148</div> </div> """ elif card_id == "property_compare": base_style = "width: 100%; max-width: 320px; min-height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 14px;">Property Comparison</div> <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px;"> <div style="background: #f5f5f5; border-radius: 8px; padding: 10px;"> <div style="font-weight: 600; font-size: 12px; color: #333; margin-bottom: 8px;">Property A</div> <div style="font-size: 10px; color: #666; margin-bottom: 3px;">$425,000</div> <div style="font-size: 10px; color: #666; margin-bottom: 3px;">2 beds • 2 baths</div> <div style="font-size: 10px; color: #666;">1,200 sqft</div> </div> <div style="background: {primary}10; border-radius: 8px; padding: 10px; border: 2px solid {primary};"> <div style="font-weight: 600; font-size: 12px; color: #333; margin-bottom: 8px;">Property B</div> <div style="font-size: 10px; color: #666; margin-bottom: 3px;">$399,000</div> <div style="font-size: 10px; color: #666; margin-bottom: 3px;">2 beds • 1 bath</div> <div style="font-size: 10px; color: #666;">1,100 sqft</div> </div> </div> """ elif card_id == "favorite_property": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; gap: 12px;" content = f""" <div style="width: 76px; height: 76px; border-radius: 8px; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 36px;">🏠</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">$425,000</div> <div style="font-size: 11px; color: #666; margin-bottom: 6px;">123 Main St, NY</div> <div style="font-size: 10px; color: #666;">2 beds • 2 baths</div> </div> <button style="color: #FF3B30; background: transparent; border: none; font-size: 24px;">❤️</button> """ elif card_id == "open_house": base_style = "width: 100%; max-width: 260px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Open House</div> <div style="font-size: 11px; color: #666; margin-top: 4px;">Saturday, Dec 21</div> <div style="font-size: 11px; color: #666;">10:00 AM - 2:00 PM</div> </div> <div style="font-size: 32px;">🏠</div> </div> <div style="font-size: 10px; color: #666;">📍 123 Oak Street, Brooklyn</div> """ elif card_id == "playlist_card": base_style = "width: 100%; max-width: 200px; min-height: 240px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: linear-gradient(135deg, {primary}, {secondary}); height: 160px; display: flex; align-items: center; justify-content: center; font-size: 64px; color: white;">🎵</div> <div style="padding: 12px;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Chill Vibes</div> <div style="font-size: 10px; color: #666; margin-bottom: 8px;">Created by Spotify • 50 songs</div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600;">▶️ Play</button> </div> """ elif card_id == "song_item": base_style = "width: 100%; max-width: 300px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 48px; height: 48px; border-radius: 6px; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">🎵</div> <div style="flex: 1; min-width: 0;"> <div style="font-weight: 700; font-size: 13px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">Blinding Lights</div> <div style="font-size: 10px; color: #666;">The Weeknd</div> </div> <div style="font-size: 11px; color: #666;">3:20</div> <button style="color: #666; background: transparent; border: none; font-size: 18px;">⋮</button> """ elif card_id == "album_cover": base_style = "width: 100%; max-width: 200px; height: 240px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; flex-direction: column; gap: 10px;" content = f""" <div style="width: 176px; height: 176px; border-radius: 8px; background: linear-gradient(135deg, {primary}, {secondary}); display: flex; align-items: center; justify-content: center; color: white; font-size: 64px;">💿</div> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">After Hours</div> <div style="font-size: 11px; color: #666;">The Weeknd • 2020</div> </div> """ elif card_id == "artist_profile": base_style = "width: 100%; max-width: 240px; min-height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;" content = f""" <div style="width: 100px; height: 100px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 48px;">🎤</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 16px; color: #333;">The Weeknd</div> <div style="font-size: 11px; color: #666; margin-top: 4px;">85M monthly listeners</div> </div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 10px; border-radius: 20px; font-size: 12px; font-weight: 600;">Follow</button> """ elif card_id == "podcast_episode": base_style = "width: 100%; max-width: 300px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; gap: 12px;" content = f""" <div style="width: 76px; height: 76px; border-radius: 8px; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 36px;">🎙️</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Episode 42: Future of AI</div> <div style="font-size: 10px; color: #666; margin-bottom: 6px;">Dec 15, 2024 • 45 min</div> <button style="background: {primary}; color: white; border: none; padding: 6px 16px; border-radius: 6px; font-size: 11px; font-weight: 600;">▶️ Play</button> </div> """ elif card_id == "radio_station": base_style = "width: 100%; max-width: 200px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;" content = f""" <div style="width: 60px; height: 60px; border-radius: 50%; background: {primary}; display: flex; align-items: center; justify-content: center; color: white; font-size: 28px;">📻</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 13px; color: #333;">Pop Hits Radio</div> <div style="font-size: 10px; color: #666; margin-top: 2px;">Now: Blinding Lights</div> </div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600;">Tune In</button> """ elif card_id == "equalizer_preset": base_style = "width: 100%; max-width: 240px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 12px;">Bass Boost</div> <div style="display: flex; align-items: end; justify-content: space-around; gap: 4px; height: 60px; margin-bottom: 12px;"> <div style="width: 16px; background: {primary}; height: 100%; border-radius: 8px 8px 0 0;"></div> <div style="width: 16px; background: {primary}; opacity: 0.8; height: 85%; border-radius: 8px 8px 0 0;"></div> <div style="width: 16px; background: {primary}; opacity: 0.6; height: 60%; border-radius: 8px 8px 0 0;"></div> <div style="width: 16px; background: {primary}; opacity: 0.5; height: 50%; border-radius: 8px 8px 0 0;"></div> <div style="width: 16px; background: {primary}; opacity: 0.4; height: 45%; border-radius: 8px 8px 0 0;"></div> <div style="width: 16px; background: {primary}; opacity: 0.5; height: 55%; border-radius: 8px 8px 0 0;"></div> </div> <button style="width: 100%; background: {primary}; color: white; border: none; padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600;">Apply</button> """ elif card_id == "achievement_badge": base_style = "width: 100%; max-width: 160px; height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;" content = f""" <div style="width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #FFD700, #FFA500); display: flex; align-items: center; justify-content: center; font-size: 40px; box-shadow: 0 4px 12px rgba(255,215,0,0.4);">🏆</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 13px; color: #333;">First Victory</div> <div style="font-size: 10px; color: #666; margin-top: 4px;">100 points</div> </div> <div style="font-size: 9px; color: #999;">Unlocked: Dec 15, 2024</div> """ elif card_id == "leaderboard_entry": base_style = "width: 100%; max-width: 300px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 36px; height: 36px; border-radius: 50%; background: {primary}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; font-weight: 700;">1</div> <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px;">👤</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333;">ProGamer123</div> <div style="font-size: 10px; color: #666;">Level 45</div> </div> <div style="font-weight: 700; font-size: 16px; color: {primary};">12,458</div> <div style="font-size: 11px; color: #34C759;">↗ +2</div> """ elif card_id == "character_card": base_style = "width: 100%; max-width: 200px; min-height: 280px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white;" content = f""" <div style="background: linear-gradient(135deg, {primary}, {secondary}); height: 160px; display: flex; align-items: center; justify-content: center; font-size: 80px; color: white;">⚔️</div> <div style="padding: 14px;"> <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 6px;">Warrior</div> <div style="font-size: 11px; color: #666; margin-bottom: 10px;">Level 24 • Epic</div> <div style="display: flex; flex-direction: column; gap: 6px; font-size: 10px; color: #666;"> <div>⚡ Attack: 85</div> <div>🛡️ Defense: 72</div> <div>❤️ Health: 450</div> </div> </div> """ elif card_id == "game_item": base_style = "width: 100%; max-width: 140px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px;" content = f""" <div style="width: 80px; height: 80px; border-radius: 10px; background: linear-gradient(135deg, #9333EA, #C026D3); display: flex; align-items: center; justify-content: center; font-size: 40px;">⚔️</div> <div style="text-align: center;"> <div style="font-weight: 700; font-size: 12px; color: #333;">Legendary Sword</div> <div style="background: #9333EA; color: white; padding: 2px 8px; border-radius: 10px; font-size: 9px; font-weight: 600; margin-top: 4px;">LEGENDARY</div> </div> <div style="font-size: 11px; color: #666;">Quantity: 1</div> """ elif card_id == "quest_card": base_style = "width: 100%; max-width: 280px; min-height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px;" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Defeat the Dragon</div> <div style="font-size: 10px; color: #666;">Slay the ancient dragon in the Dark Cave</div> </div> <div style="font-size: 32px;">🐉</div> </div> <div style="margin-bottom: 8px;"> <div style="display: flex; justify-content: space-between; font-size: 11px; color: #666; margin-bottom: 4px;"> <span>Progress</span> <span style="font-weight: 700; color: #333;">3/5 defeated</span> </div> <div style="height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden;"> <div style="width: 60%; height: 100%; background: {primary}; border-radius: 3px;"></div> </div> </div> <div style="font-size: 11px; color: {primary}; font-weight: 600;">Reward: 500 Gold, Epic Armor</div> """ elif card_id == "player_stats": base_style = "width: 100%; max-width: 260px; min-height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 12px;">Player Stats</div> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;"> <div style="font-size: 11px; color: #666;">Level 45</div> <div style="font-weight: 700; font-size: 14px; color: {primary};">12,458 XP</div> </div> <div style="height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; margin-bottom: 14px;"> <div style="width: 65%; height: 100%; background: {primary}; border-radius: 4px;"></div> </div> <div style="display: flex; justify-content: space-around; font-size: 11px;"> <div style="text-align: center;"> <div style="font-weight: 700; color: #333;">3.5</div> <div style="color: #666;">K/D Ratio</div> </div> <div style="text-align: center;"> <div style="font-weight: 700; color: #333;">68%</div> <div style="color: #666;">Win Rate</div> </div> </div> """ elif card_id == "task_item": base_style = "width: 100%; max-width: 280px; height: 60px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <input type="checkbox" style="width: 20px; height: 20px; accent-color: {primary};"> <div style="flex: 1; min-width: 0;"> <div style="font-weight: 600; font-size: 13px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">Finish project proposal</div> <div style="font-size: 10px; color: #666;">Due: Tomorrow • High priority</div> </div> """ elif card_id == "note_card": base_style = "width: 100%; max-width: 220px; min-height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: #FFF9C4; padding: 14px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 8px;">Meeting Notes</div> <div style="font-size: 11px; color: #666; line-height: 1.4; margin-bottom: 10px;">Discussed Q4 strategy and team goals. Follow up with marketing...</div> <div style="display: flex; gap: 6px; margin-bottom: 8px;"> <div style="background: rgba(0,0,0,0.1); color: #666; padding: 3px 8px; border-radius: 10px; font-size: 9px;">work</div> <div style="background: rgba(0,0,0,0.1); color: #666; padding: 3px 8px; border-radius: 10px; font-size: 9px;">important</div> </div> <div style="font-size: 9px; color: #999;">Dec 15, 2024</div> """ elif card_id == "reminder_alert": base_style = "width: 100%; max-width: 280px; height: 80px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 44px; height: 44px; border-radius: 50%; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 24px;">🔔</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 4px;">Team Meeting</div> <div style="font-size: 10px; color: #666;">in 15 minutes</div> </div> <div style="display: flex; gap: 6px;"> <button style="background: #f5f5f5; color: #666; border: none; padding: 6px 10px; border-radius: 6px; font-size: 10px; font-weight: 600;">Snooze</button> <button style="background: {primary}; color: white; border: none; padding: 6px 10px; border-radius: 6px; font-size: 10px; font-weight: 600;">OK</button> </div> """ elif card_id == "timer_widget": base_style = "width: 100%; max-width: 180px; height: 180px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;" content = f""" <div style="width: 120px; height: 120px; border-radius: 50%; border: 8px solid {primary}20; border-top-color: {primary}; display: flex; align-items: center; justify-content: center;"> <div style="font-size: 28px; font-weight: 700; color: #333;">15:00</div> </div> <div style="display: flex; gap: 10px;"> <button style="width: 40px; height: 40px; border-radius: 50%; background: {primary}; color: white; border: none; font-size: 18px;">▶️</button> <button style="width: 40px; height: 40px; border-radius: 50%; background: #f5f5f5; color: #666; border: none; font-size: 18px;">⟳</button> </div> """ elif card_id == "calendar_event": base_style = "width: 100%; max-width: 280px; height: 90px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 14px; border-left: 4px solid {primary};" content = f""" <div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px;"> <div> <div style="font-weight: 700; font-size: 13px; color: #333;">Product Launch Meeting</div> <div style="font-size: 11px; color: #666; margin-top: 4px;">⏱️ 2:00 PM - 3:30 PM</div> </div> </div> <div style="font-size: 10px; color: #666;">📍 Conference Room A • 👥 8 attendees</div> """ elif card_id == "project_card": base_style = "width: 100%; max-width: 280px; min-height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 14px; color: #333; margin-bottom: 10px;">Website Redesign</div> <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px;"> <div style="display: flex; margin-left: -8px;"> <div style="width: 28px; height: 28px; border-radius: 50%; background: {primary}; border: 2px solid white; display: flex; align-items: center; justify-content: center; font-size: 14px; color: white;">A</div> <div style="width: 28px; height: 28px; border-radius: 50%; background: {secondary}; border: 2px solid white; margin-left: -8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: white;">B</div> <div style="width: 28px; height: 28px; border-radius: 50%; background: #999; border: 2px solid white; margin-left: -8px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: white;">+3</div> </div> <div style="font-size: 10px; color: #666;">5 members</div> </div> <div style="margin-bottom: 8px;"> <div style="display: flex; justify-content: space-between; font-size: 11px; color: #666; margin-bottom: 4px;"> <span>Progress</span> <span style="font-weight: 700; color: {primary};">75%</span> </div> <div style="height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden;"> <div style="width: 75%; height: 100%; background: {primary}; border-radius: 3px;"></div> </div> </div> <div style="font-size: 10px; color: #666;">Deadline: Dec 31, 2024</div> """ elif card_id == "kpi_card": base_style = "width: 100%; max-width: 200px; height: 120px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px; display: flex; flex-direction: column; justify-content: space-between;" content = f""" <div style="font-size: 11px; color: #666; margin-bottom: 4px;">Revenue</div> <div style="font-size: 32px; font-weight: 700; color: #333; margin-bottom: 4px;">$124K</div> <div style="display: flex; align-items: center; gap: 6px;"> <div style="font-size: 18px; color: #34C759;">↗</div> <div style="font-size: 13px; font-weight: 600; color: #34C759;">+12.5%</div> </div> """ elif card_id == "pie_chart": base_style = "width: 100%; max-width: 240px; height: 200px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 12px;">Sales by Category</div> <div style="display: flex; justify-content: center; margin-bottom: 12px;"> <div style="width: 100px; height: 100px; border-radius: 50%; background: conic-gradient({primary} 0% 40%, {secondary} 40% 75%, #FFB800 75% 100%);"></div> </div> <div style="display: flex; flex-direction: column; gap: 6px; font-size: 10px;"> <div style="display: flex; align-items: center; gap: 6px;"> <div style="width: 12px; height: 12px; border-radius: 2px; background: {primary};"></div> <span style="color: #666;">Electronics</span> <span style="margin-left: auto; font-weight: 700; color: #333;">40%</span> </div> <div style="display: flex; align-items: center; gap: 6px;"> <div style="width: 12px; height: 12px; border-radius: 2px; background: {secondary};"></div> <span style="color: #666;">Clothing</span> <span style="margin-left: auto; font-weight: 700; color: #333;">35%</span> </div> <div style="display: flex; align-items: center; gap: 6px;"> <div style="width: 12px; height: 12px; border-radius: 2px; background: #FFB800;"></div> <span style="color: #666;">Others</span> <span style="margin-left: auto; font-weight: 700; color: #333;">25%</span> </div> </div> """ elif card_id == "line_graph": base_style = "width: 100%; max-width: 300px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 12px;">Monthly Revenue</div> <div style="position: relative; height: 80px; margin-bottom: 10px;"> <svg viewBox="0 0 240 80" style="width: 100%; height: 100%;"> <polyline points="0,60 40,45 80,50 120,30 160,35 200,15 240,20" fill="none" stroke="{primary}" stroke-width="3" /> <polyline points="0,80 0,60 40,45 80,50 120,30 160,35 200,15 240,20 240,80" fill="{primary}" fill-opacity="0.1" /> </svg> </div> <div style="display: flex; justify-content: space-between; font-size: 9px; color: #999;"> <span>Jan</span> <span>Feb</span> <span>Mar</span> <span>Apr</span> <span>May</span> <span>Jun</span> </div> """ elif card_id == "bar_chart": base_style = "width: 100%; max-width: 260px; height: 160px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 12px;">Weekly Activity</div> <div style="display: flex; align-items: end; justify-content: space-around; gap: 8px; height: 80px; margin-bottom: 10px;"> <div style="display: flex; flex-direction: column; align-items: center; gap: 4px;"> <div style="width: 24px; background: {primary}; opacity: 0.5; height: 40%; border-radius: 4px 4px 0 0;"></div> <div style="font-size: 9px; color: #666;">Mon</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 4px;"> <div style="width: 24px; background: {primary}; opacity: 0.6; height: 60%; border-radius: 4px 4px 0 0;"></div> <div style="font-size: 9px; color: #666;">Tue</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 4px;"> <div style="width: 24px; background: {primary}; height: 100%; border-radius: 4px 4px 0 0;"></div> <div style="font-size: 9px; color: #666;">Wed</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 4px;"> <div style="width: 24px; background: {primary}; opacity: 0.7; height: 75%; border-radius: 4px 4px 0 0;"></div> <div style="font-size: 9px; color: #666;">Thu</div> </div> <div style="display: flex; flex-direction: column; align-items: center; gap: 4px;"> <div style="width: 24px; background: {primary}; opacity: 0.8; height: 85%; border-radius: 4px 4px 0 0;"></div> <div style="font-size: 9px; color: #666;">Fri</div> </div> </div> """ elif card_id == "metric_alert": base_style = "width: 100%; max-width: 280px; height: 100px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: #FFF3CD; border: 1px solid #FFE69C; padding: 14px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 44px; height: 44px; border-radius: 50%; background: #FFB800; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px;">⚠️</div> <div style="flex: 1;"> <div style="font-weight: 700; font-size: 13px; color: #856404; margin-bottom: 4px;">High CPU Usage</div> <div style="font-size: 11px; color: #856404;">Server load at 92% - exceeds threshold</div> </div> <button style="background: transparent; color: #856404; border: 1px solid #856404; padding: 6px 12px; border-radius: 6px; font-size: 10px; font-weight: 600;">View</button> """ elif card_id == "summary_widget": base_style = "width: 100%; max-width: 300px; min-height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 12px;">Summary • Last 7 days</div> <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px;"> <div> <div style="font-size: 20px; font-weight: 700; color: {primary}; margin-bottom: 2px;">2,458</div> <div style="font-size: 10px; color: #666;">Users</div> </div> <div> <div style="font-size: 20px; font-weight: 700; color: {primary}; margin-bottom: 2px;">$12.5K</div> <div style="font-size: 10px; color: #666;">Revenue</div> </div> <div> <div style="font-size: 20px; font-weight: 700; color: {primary}; margin-bottom: 2px;">98.5%</div> <div style="font-size: 10px; color: #666;">Uptime</div> </div> <div> <div style="font-size: 20px; font-weight: 700; color: {primary}; margin-bottom: 2px;">4.8</div> <div style="font-size: 10px; color: #666;">Rating</div> </div> </div> """ elif card_id == "activity_feed": base_style = "width: 100%; max-width: 300px; height: 72px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 12px; display: flex; align-items: center; gap: 12px;" content = f""" <div style="width: 40px; height: 40px; border-radius: 50%; background: {primary}20; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: {primary}; font-size: 20px;">✓</div> <div style="flex: 1;"> <div style="font-size: 12px; color: #333; margin-bottom: 4px;"><strong>John Doe</strong> completed task <strong>"Design Review"</strong></div> <div style="font-size: 10px; color: #999;">2 hours ago</div> </div> """ elif card_id == "heatmap_widget": base_style = "width: 100%; max-width: 300px; height: 140px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: white; padding: 16px;" content = f""" <div style="font-weight: 700; font-size: 13px; color: #333; margin-bottom: 10px;">Activity Heatmap</div> <div style="display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;"> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.2; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.4; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.6; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.3; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.8; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.5; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.7; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.4; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.9; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.6; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.3; border-radius: 2px;"></div> <div style="width: 14px; height: 14px; background: {primary}; opacity: 0.5; border-radius: 2px;"></div> </div> <div style="font-size: 9px; color: #999; margin-top: 8px;">Less activity ← → More activity</div> """ else: content = "<div style='padding: 20px; color: #333;'>Card Preview</div>" return f""" <div style="{base_style}"> {content} </div> """ def generate_background_gallery(theme_json: str = ""): """ Generate HTML gallery of all 30 backgrounds organized by category Backgrounds are rendered directly with HTML/CSS using theme colors """ from agents.flutter_screen_generator import FlutterScreenGenerator agent = FlutterScreenGenerator() catalog = agent.BACKGROUND_CATALOG # Parse theme or use defaults if theme_json and theme_json.strip(): try: theme = json.loads(theme_json) palette = theme.get("palette", {}) primary = palette.get("primary", "#007AFF") secondary = palette.get("secondary", "#5856D6") accent = palette.get("accent", "#FF9500") theme_name = theme.get("name", "Custom Theme") using_theme = True except: primary = "#007AFF" secondary = "#5856D6" accent = "#FF9500" theme_name = "Default" using_theme = False else: primary = "#007AFF" secondary = "#5856D6" accent = "#FF9500" theme_name = "Default" using_theme = False # Organize by category categories = {} for bg_id, info in catalog.items(): cat = info['category'] if cat not in categories: categories[cat] = [] categories[cat].append((bg_id, info)) theme_indicator = f""" <div style="background: #e7f3ff; padding: 12px; border-radius: 6px; margin-bottom: 16px; border-left: 4px solid {primary};"> <strong>🎨 Tema applicato:</strong> {theme_name}<br/> <div style="display: flex; gap: 8px; margin-top: 8px; align-items: center;"> <span style="font-size: 12px;">Colori:</span> <div style="width: 32px; height: 32px; border-radius: 4px; background: {primary}; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2);"></div> <div style="width: 32px; height: 32px; border-radius: 4px; background: {secondary}; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2);"></div> <div style="width: 32px; height: 32px; border-radius: 4px; background: {accent}; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2);"></div> </div> </div> """ if using_theme else """ <div style="background: #fff3cd; padding: 12px; border-radius: 6px; margin-bottom: 16px; border-left: 4px solid #ffc107;"> <strong>⚠️ Tema non applicato</strong><br/> <span style="font-size: 13px;">Inserisci un tema JSON sopra e clicca "Aggiorna con Tema Corrente" per vedere i background con i tuoi colori!</span> </div> """ html_parts = [f""" <div style="background: #f5f5f5; padding: 20px; border-radius: 12px;"> <h3 style="margin-top: 0;">🎨 Background Knowledge Base (30 Backgrounds)</h3> <p style="color: #666; margin-bottom: 12px;">Esplora tutti i background disponibili con i colori del tuo tema applicati automaticamente!</p> {theme_indicator} """] # Category order and icons category_config = { "gradients": {"icon": "🌈", "name": "Gradients", "desc": "Clean, modern backgrounds with color transitions"}, "waves": {"icon": "🌊", "name": "Waves", "desc": "Dynamic, flowing backgrounds with movement"}, "geometric": {"icon": "◼️", "name": "Geometric", "desc": "Modern patterns with shapes and structure"}, "organic": {"icon": "🎨", "name": "Organic", "desc": "Creative, natural flowing shapes"}, "patterns": {"icon": "📐", "name": "Patterns", "desc": "Structured, repeating design elements"}, "abstract": {"icon": "✨", "name": "Abstract", "desc": "Premium, artistic compositions"} } for cat_key in ["gradients", "waves", "geometric", "organic", "patterns", "abstract"]: if cat_key not in categories: continue config = category_config.get(cat_key, {"icon": "•", "name": cat_key.title(), "desc": ""}) items = categories[cat_key] html_parts.append(f""" <div style="background: white; padding: 16px; margin-bottom: 16px; border-radius: 8px; border-left: 4px solid #007AFF;"> <h4 style="margin: 0 0 8px 0;">{config['icon']} {config['name']} ({len(items)})</h4> <p style="color: #666; font-size: 13px; margin: 0 0 12px 0;">{config['desc']}</p> <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;"> """) for bg_id, info in sorted(items, key=lambda x: x[0]): complexity_colors = { "simple": "#28a745", "medium": "#ffc107", "complex": "#dc3545" } complexity_color = complexity_colors.get(info['complexity'], "#6c757d") # Render background preview bg_preview = render_background_html(bg_id, info, primary, secondary, accent) html_parts.append(f""" <div style="background: white; padding: 12px; border-radius: 8px; border: 1px solid #dee2e6; display: flex; flex-direction: column; align-items: center; gap: 10px;"> {bg_preview} <div style="width: 100%; text-align: center;"> <div style="font-weight: 600; font-size: 13px; margin-bottom: 4px;">{info['name']}</div> <div style="font-size: 11px; color: #6c757d; margin-bottom: 6px;"> <code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 10px;">{bg_id}</code> </div> <span style="background: {complexity_color}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600;"> {info['complexity'].upper()} </span> </div> </div> """) html_parts.append("</div></div>") html_parts.append(""" <div style="margin-top: 20px; padding: 12px; background: #e7f3ff; border-radius: 6px; border-left: 3px solid #007AFF;"> <p style="margin: 0; font-size: 13px; color: #004085;"> <strong>💡 Anteprima Live:</strong> Tutti i 30 background sono renderizzati direttamente con i colori del tuo tema! Ogni preview mostra esattamente come apparirà il background nell'app con il tema selezionato. <br/><br/> <strong>📋 Per testare:</strong> Usa il selettore sotto per generare il codice Flutter/Dart completo di un background specifico e copiarlo su <a href="https://dartpad.dev" target="_blank" style="color: #007AFF; font-weight: 600;">DartPad</a> per vederlo in azione! </p> </div> </div> """) return "".join(html_parts) def generate_header_gallery(theme_json: str = ""): """ Generate HTML gallery of all 20 realistic headers Headers are rendered directly with HTML/CSS using theme colors """ from agents.flutter_screen_generator import FlutterScreenGenerator agent = FlutterScreenGenerator() catalog = agent.HEADER_CATALOG # Parse theme or use defaults if theme_json and theme_json.strip(): try: theme_data = json.loads(theme_json) palette = theme_data.get("palette", {}) primary = palette.get("primary", "#2196F3") secondary = palette.get("secondary", "#FF9800") accent = palette.get("accent", "#4CAF50") except: primary = "#2196F3" secondary = "#FF9800" accent = "#4CAF50" else: primary = "#2196F3" secondary = "#FF9800" accent = "#4CAF50" # Start HTML html_parts = [] html_parts.append(""" <div style="background: #f8f9fa; padding: 24px; border-radius: 12px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;"> <h3 style="margin-top: 0; color: #212529; font-size: 20px;">🎯 Header Catalog (20 Headers)</h3> <p style="color: #6c757d; font-size: 14px; margin-bottom: 24px;"> 20 header realistici con profilo, localizzazione, notifiche, cart e menu - renderizzati con i tuoi colori del tema </p> """) # Grid container html_parts.append(""" <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 20px;"> """) # Render each header for header_id, info in catalog.items(): # Render header preview header_preview = render_header_html(header_id, info, primary, secondary, accent) # Complexity color complexity = info.get('complexity', 'simple') if complexity == "simple": complexity_color = "#28a745" elif complexity == "medium": complexity_color = "#ffc107" else: complexity_color = "#dc3545" html_parts.append(f""" <div style="background: white; padding: 16px; border-radius: 8px; border: 1px solid #dee2e6; display: flex; flex-direction: column; gap: 12px;"> {header_preview} <div style="width: 100%; text-align: center;"> <div style="font-weight: 600; font-size: 14px; margin-bottom: 4px;">{info['name']}</div> <div style="font-size: 11px; color: #6c757d; margin-bottom: 6px;"> <code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 10px;">{header_id}</code> </div> <div style="font-size: 11px; color: #6c757d; margin-bottom: 6px;">{info['description']}</div> <span style="background: {complexity_color}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600;"> {complexity.upper()} </span> </div> </div> """) html_parts.append("</div></div>") return "".join(html_parts) def generate_footer_gallery(theme_json: str = ""): """ Generate HTML gallery of all 30 footer layouts Footers are rendered directly with HTML/CSS using theme colors """ from agents.flutter_screen_generator import FlutterScreenGenerator agent = FlutterScreenGenerator() catalog = agent.FOOTER_CATALOG # Parse theme or use defaults if theme_json and theme_json.strip(): try: theme_data = json.loads(theme_json) palette = theme_data.get("palette", {}) primary = palette.get("primary", "#2196F3") secondary = palette.get("secondary", "#FF9800") accent = palette.get("accent", "#4CAF50") except: primary = "#2196F3" secondary = "#FF9800" accent = "#4CAF50" else: primary = "#2196F3" secondary = "#FF9800" accent = "#4CAF50" # Start HTML html_parts = [] html_parts.append(""" <div style="background: #f8f9fa; padding: 24px; border-radius: 12px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;"> <h3 style="margin-top: 0; color: #212529; font-size: 20px;">🎯 Footer Catalog (30 Footer Layouts)</h3> <p style="color: #6c757d; font-size: 14px; margin-bottom: 24px;"> 30 layout di footer/navigation bar diversi - classic tabs, floating bars, curved designs, pills, minimalist, advanced - renderizzati con i tuoi colori </p> """) # Grid container html_parts.append(""" <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 20px;"> """) # Render each footer for footer_id, info in catalog.items(): # Render footer preview footer_preview = render_footer_html(footer_id, info, primary, secondary, accent) # Complexity color complexity = info.get('complexity', 'simple') if complexity == "simple": complexity_color = "#28a745" elif complexity == "medium": complexity_color = "#ffc107" else: complexity_color = "#dc3545" html_parts.append(f""" <div style="background: white; padding: 16px; border-radius: 8px; border: 1px solid #dee2e6; display: flex; flex-direction: column; gap: 12px;"> {footer_preview} <div style="width: 100%; text-align: center;"> <div style="font-weight: 600; font-size: 14px; margin-bottom: 4px;">{info['name']}</div> <div style="font-size: 11px; color: #6c757d; margin-bottom: 6px;"> <code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 10px;">{footer_id}</code> </div> <div style="font-size: 11px; color: #6c757d; margin-bottom: 6px;">{info['description']}</div> <span style="background: {complexity_color}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600;"> {complexity.upper()} </span> </div> </div> """) html_parts.append("</div></div>") return "".join(html_parts) def generate_card_gallery(theme_json: str = ""): """ Generate HTML gallery of all 30 card types Cards are rendered directly with HTML/CSS using theme colors """ from agents.flutter_screen_generator import FlutterScreenGenerator agent = FlutterScreenGenerator() catalog = agent.CARD_CATALOG # Parse theme or use defaults if theme_json and theme_json.strip(): try: theme_data = json.loads(theme_json) palette = theme_data.get("palette", {}) primary = palette.get("primary", "#2196F3") secondary = palette.get("secondary", "#FF9800") accent = palette.get("accent", "#4CAF50") except: primary = "#2196F3" secondary = "#FF9800" accent = "#4CAF50" else: primary = "#2196F3" secondary = "#FF9800" accent = "#4CAF50" # Start HTML html_parts = [] html_parts.append(""" <div style="background: #f8f9fa; padding: 24px; border-radius: 12px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;"> <h3 style="margin-top: 0; color: #212529; font-size: 20px;">🎴 Card Catalog (130+ Card Types)</h3> <p style="color: #6c757d; font-size: 14px; margin-bottom: 24px;"> 130+ tipologie di cards - e-commerce, social, finance, health, education, travel, food, real estate, music, gaming, productivity, dashboard - tutte renderizzate con i tuoi colori </p> """) # Grid container html_parts.append(""" <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-top: 20px;"> """) # Render each card for card_id, info in catalog.items(): # Render card preview card_preview = render_card_html(card_id, info, primary, secondary, accent) # Complexity color complexity = info.get('complexity', 'simple') if complexity == "simple": complexity_color = "#28a745" elif complexity == "medium": complexity_color = "#ffc107" else: complexity_color = "#dc3545" html_parts.append(f""" <div style="background: white; padding: 16px; border-radius: 8px; border: 1px solid #dee2e6; display: flex; flex-direction: column; gap: 12px; align-items: center;"> {card_preview} <div style="width: 100%; text-align: center;"> <div style="font-weight: 600; font-size: 13px; margin-bottom: 4px;">{info['name']}</div> <div style="font-size: 10px; color: #6c757d; margin-bottom: 6px;"> <code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 9px;">{card_id}</code> </div> <div style="font-size: 10px; color: #6c757d; margin-bottom: 6px;">{info['description']}</div> <span style="background: {complexity_color}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 9px; font-weight: 600;"> {complexity.upper()} </span> </div> </div> """) html_parts.append("</div></div>") return "".join(html_parts) def generate_single_background_preview(bg_id: str): """ Generate preview code for a single background """ if not bg_id: return "", "<p style='color: #999;'>Seleziona un background dalla galleria sopra</p>" # Default theme for preview theme = { "palette": { "primary": "#007AFF", "secondary": "#5856D6", "accent": "#FF9500", "background": "#FFFFFF" } } # Generate background-only code try: code = flutter_screen_generator._generate_background_only(theme, "generic", bg_id) # Get background info bg_info = flutter_screen_generator.BACKGROUND_CATALOG.get(bg_id, {}) bg_name = bg_info.get("name", bg_id) bg_category = bg_info.get("category", "unknown") bg_complexity = bg_info.get("complexity", "unknown") # Create DartPad link import urllib.parse encoded_code = urllib.parse.quote(code) dartpad_link = f"https://dartpad.dev/?id={encoded_code[:100]}" # Simplified preview_html = f""" <div style="background: white; padding: 20px; border-radius: 8px; border: 2px solid #007AFF;"> <h4 style="margin-top: 0; color: #007AFF;">🎨 {bg_name}</h4> <div style="margin-bottom: 12px;"> <span style="background: #e7f3ff; padding: 4px 10px; border-radius: 12px; font-size: 12px; margin-right: 8px;"> 📁 {bg_category} </span> <span style="background: #fff3cd; padding: 4px 10px; border-radius: 12px; font-size: 12px;"> ⚡ {bg_complexity} </span> </div> <p style="color: #666; font-size: 13px; margin-bottom: 12px;"> <strong>ID:</strong> <code style="background: #f8f9fa; padding: 2px 6px; border-radius: 3px;">{bg_id}</code> </p> <div style="background: #f8f9fa; padding: 12px; border-radius: 6px; margin-bottom: 12px;"> <p style="margin: 0; font-size: 13px; color: #495057;"> <strong>📋 Come testare:</strong><br/> 1. Copia il codice Dart qui sotto<br/> 2. Vai su <a href="https://dartpad.dev" target="_blank" style="color: #007AFF; font-weight: 600;">DartPad.dev</a><br/> 3. Incolla e clicca "Run"<br/> 4. Vedi il background in azione! 🚀 </p> </div> <p style="margin: 0; font-size: 12px; color: #28a745; font-weight: 600;"> ✅ Codice generato: {len(code)} caratteri </p> </div> """ return code, preview_html except Exception as e: error_html = f""" <div style="background: #fff3cd; padding: 15px; border-radius: 6px; border-left: 3px solid #ffc107;"> <p style="margin: 0; color: #856404;"> ⚠️ Errore durante la generazione: {str(e)} </p> </div> """ return "", error_html # Gradio interface with gr.Blocks( title="Space AC: Design Variations", theme=gr.themes.Soft( primary_hue="blue", secondary_hue="purple" ) ) as demo: gr.Markdown(""" # 🎨 Space AC: Design Variations **AI-powered design system generation agents** Analyze app design references and extract actionable design insights. """) # State components to store data between tabs ac1_state = gr.State(value=None) # Stores AC1 output JSON ac2_state = gr.State(value=None) # Stores AC2 output JSON (all 4 themes) with gr.Tabs(): # Tab 0: Simple Flutter Generator (NEW!) with gr.Tab("⚡ Simple Generator"): gr.Markdown(""" # ⚡ Simple Flutter Generator **Prompt → DeepSeek → Flutter Code → DartPad Automatico** 🚀 Niente preset, niente theme, niente complicazioni. Scrivi cosa vuoi, l'AI genera il codice Flutter e lo carica automaticamente in DartPad. ✨ **Novità:** Il codice viene automaticamente caricato nel DartPad embedded - clicca "Run" e basta! """) with gr.Row(): with gr.Column(scale=1): simple_prompt = gr.Textbox( label="📝 Cosa vuoi generare?", placeholder="Esempio:\n- Crea una schermata di login con email e password\n- Genera una home page per app fitness con statistiche\n- Fai una todo list app con checkbox e delete button", lines=5, value="Crea una schermata di login moderna con email, password e bottone login" ) generate_simple_btn = gr.Button( "🚀 Genera Codice Flutter", variant="primary", size="lg" ) # Results gr.Markdown("### 📱 Risultato") simple_summary = gr.HTML( value="<p style='text-align: center; color: #999; padding: 20px;'>Clicca 'Genera Codice Flutter' per iniziare...</p>" ) # DartPad Embedded - PRIMO, ben visibile simple_dartpad = gr.HTML( value="<p style='text-align: center; color: #999; padding: 40px;'>Il DartPad embedded apparirà qui...</p>" ) # Code Output - NASCOSTO in Accordion collassabile with gr.Accordion("💻 Codice Sorgente (clicca per espandere)", open=False): simple_code_output = gr.Code( label="Codice Dart generato", language="javascript", lines=25, value="" ) # Examples gr.Examples( examples=[ ["Crea una schermata di login con email, password e social login buttons"], ["Genera una home page per app fitness con cards di statistiche giornaliere"], ["Fai una todo list con checkbox, testo e bottone delete per ogni item"], ["Crea un profilo utente con avatar, nome, bio e bottoni follow/message"], ["Genera una schermata settings con switch, slider e dropdown"], ], inputs=[simple_prompt], label="Prova questi esempi" ) # Connect button generate_simple_btn.click( fn=generate_simple_flutter, inputs=[simple_prompt], outputs=[simple_code_output, simple_summary, simple_dartpad] ) # Tab 1: Moodboard Analyzer with gr.Tab("🖼️ AC1: Moodboard Analyzer"): gr.Markdown(""" ### Analyze Reference Images Provide descriptions of reference app screenshots or design inspirations. The agent will extract color palettes, typography trends, and UI patterns. """) with gr.Row(): with gr.Column(scale=1): image_descriptions = gr.Textbox( label="Reference Image Descriptions", placeholder="""Enter one description per line, for example: Instagram home feed - dark mode, clean cards, bottom navigation Uber driver app - dark theme, green accents, map view Spotify player - dark background, vibrant album art, minimalist controls""", lines=10 ) mood_keywords = gr.Textbox( label="Mood Keywords (comma-separated)", placeholder="energetic, gaming, modern, professional, playful", value="modern, energetic" ) analyze_btn = gr.Button( "🔍 Analyze Moodboard", variant="primary", size="lg" ) # Visual Results Tabs gr.Markdown("### 📊 Analysis Results") with gr.Tabs(): with gr.Tab("🎨 Color Palettes"): color_palettes_html = gr.HTML( label="Color Palettes", value="<p style='text-align: center; color: #999; padding: 40px;'>Click 'Analyze Moodboard' to see color palettes here...</p>" ) with gr.Tab("✍️ Typography"): typography_html = gr.HTML( label="Typography Trends", value="<p style='text-align: center; color: #999; padding: 40px;'>Typography trends will appear here...</p>" ) with gr.Tab("🧩 UI Patterns"): ui_patterns_html = gr.HTML( label="UI Patterns", value="<p style='text-align: center; color: #999; padding: 40px;'>UI patterns will be displayed here...</p>" ) with gr.Tab("📐 Layout & Insights"): layout_markdown = gr.Markdown( value="Layout styles will appear here..." ) insights_markdown = gr.Markdown( value="Design insights will be generated here..." ) with gr.Tab("📄 JSON Data"): json_output = gr.Code( label="Complete Analysis JSON", language="json", lines=20, value="{}" ) # Quick Action Button use_in_ac2_btn = gr.Button( "→ Use in AC2", variant="secondary", size="lg" ) # Examples gr.Markdown("### 📝 Example Inputs") gr.Examples( examples=[ [ """Instagram home feed - dark mode with white text, clean cards with photos Spotify player - dark background, vibrant green accents, minimalist controls Uber driver app - dark theme with green accents, map interface, bold stats""", "gaming, energetic, modern" ], [ """Banking app - white background, blue accents, professional typography LinkedIn feed - white cards, blue buttons, clean layout Notion - minimal design, subtle shadows, organized content""", "professional, modern, clean" ], [ """Duolingo - playful colors, cartoon graphics, gamified interface TikTok - dark mode, vibrant content, engaging animations Snapchat - bright colors, fun filters, youthful design""", "playful, fun, youthful" ] ], inputs=[image_descriptions, mood_keywords], label="Try these examples" ) # Connect button analyze_btn.click( fn=analyze_moodboard, inputs=[image_descriptions, mood_keywords], outputs=[ color_palettes_html, typography_html, ui_patterns_html, layout_markdown, insights_markdown, json_output, ac1_state # Store AC1 output in state ] ) # Note: use_in_ac2_btn click handler is defined after AC2 components are created # Tab 2: Design Variation Generator with gr.Tab("🎨 AC2: Design Variation Generator"): gr.Markdown(""" ### Generate Design Theme Variations Take your moodboard analysis from AC1 and generate 4 complete design theme variations. Each theme will include colors, typography, spacing, and component styles. """) with gr.Row(): with gr.Column(scale=1): gr.Markdown(""" **Step 1:** First, run AC1 to analyze your moodboard **Step 2:** Copy the JSON output from AC1 **Step 3:** Paste it below and add wireframe description **Step 4:** Generate 4 design themes """) ac1_json_input = gr.Code( label="Moodboard Analysis JSON (from AC1)", language="json", lines=10, value='{\n "analysis": {\n "color_palettes": [],\n "typography_trends": [],\n "ui_patterns": []\n }\n}' ) # Connect use_in_ac2 button from AC1 use_in_ac2_btn.click( fn=lambda ac1_data: json.dumps(ac1_data, indent=2) if ac1_data else "{}", inputs=[ac1_state], outputs=[ac1_json_input] ) wireframe_input = gr.Textbox( label="Wireframe Description", placeholder="Describe your app wireframe: e.g., 'E-commerce app with product grid, shopping cart, and checkout flow'", lines=5, value="Mobile app with home screen, navigation bar, and content cards" ) generate_themes_btn = gr.Button( "✨ Generate 4 Design Themes", variant="primary", size="lg" ) # Results Section gr.Markdown("### 🎯 Generated Design Themes") with gr.Tabs(): with gr.Tab("🎨 Visual Themes"): themes_grid_html = gr.HTML( label="Design Themes", value="<p style='text-align: center; color: #999; padding: 40px;'>Click 'Generate 4 Design Themes' to see themes here...</p>" ) with gr.Tab("📄 JSON Data"): themes_json_output = gr.Code( label="Complete Themes JSON", language="json", lines=20, value="{}" ) # Examples gr.Markdown("### 📝 Workflow Example") gr.Markdown(""" **Complete Workflow:** 1. Go to AC1 tab → Analyze moodboard → Copy JSON from "JSON Data" tab 2. Come back to AC2 tab → Paste JSON in the input above 3. Describe your wireframe 4. Click "Generate 4 Design Themes" 5. View 4 different design variations with complete design systems Each theme will include: - **Color Palette** - Primary, secondary, accent, neutral colors - **Typography** - Font families for display and body text - **Spacing System** - Consistent spacing scale - **Component Styles** - Button styles, card styles, etc. - **Animations** - Animation style and timing """) # Quick Action Buttons for each theme with gr.Row(): use_theme1_btn = gr.Button("→ Use Theme 1 in AC3", variant="secondary", size="sm") use_theme2_btn = gr.Button("→ Use Theme 2 in AC3", variant="secondary", size="sm") use_theme3_btn = gr.Button("→ Use Theme 3 in AC3", variant="secondary", size="sm") use_theme4_btn = gr.Button("→ Use Theme 4 in AC3", variant="secondary", size="sm") # Connect button generate_themes_btn.click( fn=generate_design_themes, inputs=[ac1_json_input, wireframe_input], outputs=[themes_grid_html, themes_json_output, ac2_state] ) # Note: use_theme buttons click handlers are defined after AC3 components are created # Tab 3: Flutter Screen Generator with gr.Tab("💻 AC3: Flutter Screen Generator"): gr.Markdown(""" ### Generate Flutter/Dart Screen Code Take one of your design themes from AC2 and generate complete Flutter screens ready to run on **DartPad**! 🎨 """) with gr.Row(): with gr.Column(scale=1): gr.Markdown(""" **Step 1:** Run AC2 to generate design themes **Step 2:** Copy theme JSON from AC2 **Step 3:** Select app type **Step 4:** Generate Flutter code **Step 5:** Copy code to [DartPad](https://dartpad.dev) """) theme_json_input = gr.Code( label="Theme JSON (from AC2)", language="json", lines=8, value='{\n "name": "Bold Energy",\n "palette": {"primary": "#FF6B35"},\n "typography": {}\n}' ) # Connect use_theme buttons from AC2 use_theme1_btn.click( fn=lambda ac2_data: json.dumps(ac2_data["themes"][0], indent=2) if ac2_data and "themes" in ac2_data and len(ac2_data["themes"]) > 0 else "{}", inputs=[ac2_state], outputs=[theme_json_input] ) use_theme2_btn.click( fn=lambda ac2_data: json.dumps(ac2_data["themes"][1], indent=2) if ac2_data and "themes" in ac2_data and len(ac2_data["themes"]) > 1 else "{}", inputs=[ac2_state], outputs=[theme_json_input] ) use_theme3_btn.click( fn=lambda ac2_data: json.dumps(ac2_data["themes"][2], indent=2) if ac2_data and "themes" in ac2_data and len(ac2_data["themes"]) > 2 else "{}", inputs=[ac2_state], outputs=[theme_json_input] ) use_theme4_btn.click( fn=lambda ac2_data: json.dumps(ac2_data["themes"][3], indent=2) if ac2_data and "themes" in ac2_data and len(ac2_data["themes"]) > 3 else "{}", inputs=[ac2_state], outputs=[theme_json_input] ) app_type_dropdown = gr.Dropdown( label="App Type", choices=["fitness", "banking", "rider", "ecommerce", "social", "food", "travel", "health", "education", "generic"], value="fitness" ) custom_prompt = gr.Textbox( label="📝 Prompt Personalizzato (cosa vuoi generare)", placeholder="Esempio: Genera una home page per app fitness con statistiche, Crea una schermata login moderna, etc.", lines=3, value="Genera una home page per l'app con cards, header e footer" ) screens_input = gr.Textbox( label="Screens (comma-separated, max 3)", placeholder="home, detail, profile", lines=1, value="home, detail, profile" ) generate_flutter_btn = gr.Button( "🚀 Generate Flutter Screens", variant="primary", size="lg" ) # Results Section gr.Markdown("### 📱 Generated Flutter Screens") summary_output = gr.HTML( value="<p style='text-align: center; color: #999; padding: 20px;'>Click 'Generate Flutter Screens' to create code...</p>" ) with gr.Tabs(): with gr.Tab("✨ Variant 1"): preview_waves = gr.HTML(value="<p style='text-align: center; padding: 40px;'>Generate to see AI-powered variant...</p>") with gr.Accordion("💻 View Dart Code", open=False): code_waves = gr.Code(label="Dart Code - Variant 1", language="javascript", lines=15, value="") with gr.Tab("✨ Variant 2"): preview_linear = gr.HTML(value="<p style='text-align: center; padding: 40px;'>Generate to see AI-powered variant...</p>") with gr.Accordion("💻 View Dart Code", open=False): code_linear = gr.Code(label="Dart Code - Variant 2", language="javascript", lines=15, value="") with gr.Tab("✨ Variant 3"): preview_radial = gr.HTML(value="<p style='text-align: center; padding: 40px;'>Generate to see AI-powered variant...</p>") with gr.Accordion("💻 View Dart Code", open=False): code_radial = gr.Code(label="Dart Code - Variant 3", language="javascript", lines=15, value="") with gr.Tab("✨ Variant 4"): preview_geometric = gr.HTML(value="<p style='text-align: center; padding: 40px;'>Generate to see AI-powered variant...</p>") with gr.Accordion("💻 View Dart Code", open=False): code_geometric = gr.Code(label="Dart Code - Variant 4", language="javascript", lines=15, value="") # Info Section gr.Markdown("### 💡 How to Use") gr.Markdown(""" **AI-Powered Variants:** - 🤖 **Llama 3.1 70B** analyzes your theme + app type - ✨ Generates **4 unique variants** combining: - **Background** (waves/gradient_linear/gradient_radial/geometric) - **Header** (minimal/avatar_search/tabs/collapsible/stats_header) - **Footer** (minimal_icons/floating_fab/animated_pills/classic_expanded/gesture_bar) - 🎨 Each variant is contextually appropriate for your design **Generated Code:** - ✅ Complete, runnable Dart/Flutter code - ✅ Styled with your theme colors and typography - ✅ App-specific headers and footers - ✅ Mock data included - ✅ Ready for DartPad (~500-700 lines each) **To test:** 1. Click on a variant tab above 2. Copy the Dart code 3. Go to [dartpad.dev](https://dartpad.dev) 4. Paste and click "Run" 5. See your AI-generated screen! 🎉 **Supported App Types:** - **Fitness:** Stats headers, progress tracking, workout cards - **Banking:** Account balance, transaction lists, transfer buttons - **Rider:** Delivery stats, earnings, map previews - **E-commerce:** Product grids, cart, checkout flows - **Social:** Feed layouts, profile headers, post cards - **And more!** """) # Background Gallery Section gr.Markdown("---") with gr.Accordion("🎨 Background Gallery (30 Backgrounds)", open=False): gr.Markdown(""" Esplora tutti i 30 background disponibili organizzati per categoria. Usa questa gallery per analizzare visualmente la knowledge base e testare ogni background. """) # Refresh button to update with new theme refresh_backgrounds_btn = gr.Button("🔄 Aggiorna con Tema Corrente", variant="secondary", size="sm") # Gallery HTML (reactive to theme changes) - show immediately with default theme default_theme_for_gallery = json.dumps({ "name": "Default Theme", "palette": {"primary": "#2196F3", "secondary": "#FF9800", "accent": "#4CAF50"} }) gallery_html = gr.HTML( value=generate_background_gallery(default_theme_for_gallery) ) # Connect refresh button refresh_backgrounds_btn.click( fn=generate_background_gallery, inputs=[theme_json_input], outputs=[gallery_html] ) # Header Gallery Section gr.Markdown("---") with gr.Accordion("🎯 Header Catalog (20 Headers)", open=False): gr.Markdown(""" Tutti i 20 header realistici disponibili con preview renderizzate in HTML/CSS. Gli header includono profilo, localizzazione, notifiche, menu e altri elementi. """) # Refresh button to update with new theme refresh_headers_btn = gr.Button("🔄 Aggiorna Header con Tema Corrente", variant="secondary", size="sm") # Header Gallery HTML - show immediately with default theme header_gallery_html = gr.HTML( value=generate_header_gallery(default_theme_for_gallery) ) # Connect refresh button refresh_headers_btn.click( fn=generate_header_gallery, inputs=[theme_json_input], outputs=[header_gallery_html] ) # Footer Gallery Section gr.Markdown("---") with gr.Accordion("🎯 Footer Catalog (30 Footer Layouts)", open=False): gr.Markdown(""" Tutti i 30 footer/navigation bar con layout diversi renderizzati in HTML/CSS. Classic tabs, floating bars, curved designs, pills, minimalist, advanced interactive. """) # Refresh button to update with new theme refresh_footers_btn = gr.Button("🔄 Aggiorna Footer con Tema Corrente", variant="secondary", size="sm") # Footer Gallery HTML - show immediately with default theme footer_gallery_html = gr.HTML( value=generate_footer_gallery(default_theme_for_gallery) ) # Connect refresh button refresh_footers_btn.click( fn=generate_footer_gallery, inputs=[theme_json_input], outputs=[footer_gallery_html] ) # Card Gallery Section gr.Markdown("---") with gr.Accordion("🎴 Card Catalog (130+ Card Types)", open=False): gr.Markdown(""" Tutte le 130+ tipologie di cards renderizzate in HTML/CSS. E-commerce, Social, Finance, Health, Education, Travel, Food, Real Estate, Music, Gaming, Productivity, Dashboard - tutte con i tuoi colori del tema. """) # Refresh button to update with new theme refresh_cards_btn = gr.Button("🔄 Aggiorna Cards con Tema Corrente", variant="secondary", size="sm") # Card Gallery HTML - show immediately with default theme card_gallery_html = gr.HTML( value=generate_card_gallery(default_theme_for_gallery) ) # Connect refresh button refresh_cards_btn.click( fn=generate_card_gallery, inputs=[theme_json_input], outputs=[card_gallery_html] ) # Connect button generate_flutter_btn.click( fn=generate_flutter_screens, inputs=[theme_json_input, app_type_dropdown, custom_prompt, screens_input], outputs=[ summary_output, preview_waves, code_waves, preview_linear, code_linear, preview_radial, code_radial, preview_geometric, code_geometric ] ) # Tab 4: API Documentation with gr.Tab("📡 API Documentation"): gr.Markdown(""" ## REST API Endpoints ### POST /api/moodboard-analyzer Analyze a moodboard to extract design insights. **Request Body:** ```json { "reference_images": [ { "url": "https://example.com/screenshot.png", "description": "Instagram home feed - dark mode" } ], "mood_keywords": ["energetic", "gaming", "modern"] } ``` **Response:** ```json { "success": true, "agent": "moodboard_analyzer", "output": { "analysis": { "color_palettes": [...], "typography_trends": [...], "ui_patterns": [...], "layout_styles": [...], "insights": "..." } } } ``` ### Example using curl: ```bash curl -X POST https://oneweekapp-space-ac-design.hf.space/api/moodboard-analyzer \\ -H "Content-Type: application/json" \\ -d '{ "reference_images": [ {"description": "Instagram dark mode", "url": ""} ], "mood_keywords": ["energetic", "gaming"] }' ``` ### Example using Python: ```python import requests response = requests.post( "https://oneweekapp-space-ac-design.hf.space/api/moodboard-analyzer", json={ "reference_images": [ {"description": "Instagram dark mode", "url": ""} ], "mood_keywords": ["energetic", "gaming"] } ) result = response.json() print(result["output"]["analysis"]) ``` --- ### POST /api/design-variation-generator Generate 4 design theme variations from moodboard analysis. **Request Body:** ```json { "moodboard_analysis": { "color_palettes": [...], "typography_trends": [...], "ui_patterns": [...] }, "wireframe": "E-commerce app with product grid and checkout", "app_context": { "type": "mobile_app" } } ``` **Response:** ```json { "success": true, "agent": "design_variation_generator", "output": { "themes": [ { "name": "Bold Energy", "style": "bold", "mood": "Energetic and gaming-focused", "palette": {...}, "typography": {...}, "spacing": {...}, "component_style": {...}, "animations": {...} } ] } } ``` ### Example using curl: ```bash curl -X POST https://oneweekapp-space-ac-design.hf.space/api/design-variation-generator \\\\ -H "Content-Type: application/json" \\\\ -d '{ "moodboard_analysis": {...}, "wireframe": "Social media app", "app_context": {"type": "mobile_app"} }' ``` --- ### POST /api/flutter-screen-generator Generate Flutter/Dart code from design themes using AI planning (Llama 3.1 70B). **Request Body:** ```json { "theme": { "name": "Bold Energy", "palette": {...}, "typography": {...}, "spacing": {...} }, "app_type": "fitness", "screens": ["home", "profile", "settings"] } ``` **Response:** ```json { "success": true, "agent": "flutter_screen_generator", "output": { "screens": [ { "name": "home", "code": "import 'package:flutter/material.dart';\\n\\n// Full Dart code...", "lines": 487, "components": ["StatsCard", "HeroBanner"], "status": "generated" } ], "theme_name": "Bold Energy", "app_type": "fitness", "total_lines": 1420 } } ``` **Available app types:** fitness, banking, rider, ecommerce, social, etc. **Available screens:** home, profile, settings, detail, feed, search, cart, chat, onboarding, login **Note:** Requires `HF_TOKEN` environment variable for Llama 3.1 access. Returns fallback code if not configured. ## Health Check ### GET /health Check if the space is healthy. **Response:** ```json { "status": "healthy", "space": "ac-design", "agents": ["moodboard_analyzer"] } ``` """) # Tab 3: About with gr.Tab("ℹ️ About"): gr.Markdown(""" ## About Space AC **Space AC: Design Variations** is part of the AI Software Factory system. ### Agents in this Space: 1. **AC1: Moodboard Analyzer** 🖼️ ✅ LIVE - Analyzes reference images and screenshots - Extracts color palettes with visual previews - Identifies UI patterns and typography trends - Generates design insights 2. **AC2: Design Variation Generator** 🎨 ✅ LIVE - Generates 4 complete design themes - Defines design tokens (colors, typography, spacing) - Creates complete design system specifications - Visual theme cards with preview 3. **AC3: Flutter Screen Generator** 💻 ✅ LIVE - Generates runnable Flutter/Dart code for DartPad - AI-powered planning with Llama 3.1 70B + Jinja2 templates - Creates 3 screens per theme with realistic components - Supports 10 app types (fitness, banking, rider, ecommerce, etc.) - 400-500 lines of production-ready Dart code per screen 4. **AC4: Theme Comparator** 🎯 (Coming soon) - Compares design themes - Generates pros/cons analysis - Recommends best theme ### Technology Stack: - **UI Framework:** Gradio 5.49+ - **API:** FastAPI 0.115+ - **AI Models:** - Llama 3.2 Vision (11B) for image analysis (AC1) - Llama 3.1 (70B) for text generation and synthesis (AC2) - Llama 3.1 (70B) for Flutter code planning (AC3) - Jinja2 Templates for Dart code generation (AC3) ### Part of AI Software Factory This space is part of a larger system that generates complete Flutter applications from Notion wireframes to GitHub PRs in 50-70 minutes. **Learn more:** [GitHub Repository](https://github.com/sabatino81/AISoftwareFactory) --- **🔗 Quick Links:** - Live App: https://oneweekapp-space-ac-design.hf.space - Space Page: https://huggingface.co/spaces/OneWeekApp/space-ac-design - GitHub: https://github.com/sabatino81/AISoftwareFactory """) # Mount Gradio on FastAPI app = gr.mount_gradio_app(app, demo, path="/") if __name__ == "__main__": demo.launch(ssr_mode=False) # Disable SSR for HuggingFace Spaces compatibility
"""
AI Software Factory - Space AC: Design Variations
Enhanced Gradio UI with visual JSON display + FastAPI
"""
import gradio as gr
from fastapi import FastAPI
from agents.moodboard_analyzer import MoodboardAnalyzer
from agents.design_variation_generator import DesignVariationGenerator
from agents.flutter_screen_generator import FlutterScreenGenerator
from agents.simple_flutter_generator import SimpleFlutterGenerator
import json
import os
import requests
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
# Initialize agents
moodboard_analyzer = MoodboardAnalyzer()
design_variation_generator = DesignVariationGenerator()
flutter_screen_generator = FlutterScreenGenerator()
simple_flutter_generator = SimpleFlutterGenerator()
# FastAPI app for orchestrator
app = FastAPI(
title="Space AC: Design Variations",
description="Design system generation agents",
version="1.0.0"
)
@app.get("/health")
async def health():
return {
"status": "healthy",
"space": "ac-design",
"agents": ["moodboard_analyzer", "design_variation_generator", "flutter_screen_generator"]
}
@app.post("/api/moodboard-analyzer")
async def moodboard_analyzer_endpoint(data: dict):
"""
API endpoint for Moodboard Analyzer
Input:
reference_images: List of image URLs/descriptions
mood_keywords: List of mood keywords
Output:
analysis: Color palettes, typography, UI patterns, insights
"""
try:
result = moodboard_analyzer.process(data)
return {
"success": True,
"agent": "moodboard_analyzer",
"output": result
}
except Exception as e:
return {
"success": False,
"error": str(e)
}
@app.post("/api/design-variation-generator")
async def design_variation_generator_endpoint(data: dict):
"""
API endpoint for Design Variation Generator
Input:
moodboard_analysis: Output from AC1
wireframe: Wireframe description
app_context: App context info
Output:
themes: List of 4 design theme variations
"""
try:
result = design_variation_generator.process(data)
return {
"success": True,
"agent": "design_variation_generator",
"output": result
}
except Exception as e:
return {
"success": False,
"error": str(e)
}
@app.post("/api/flutter-screen-generator")
async def flutter_screen_generator_endpoint(data: dict):
"""
API endpoint for Flutter Screen Generator (AC3)