def get_video_script_prompt(synthesis: dict, language: str = "ar",
                            duration_seconds: int = None, user_notes: str = None) -> list:
    # Fast but structured prompt for reliable JSON generation
    lang = "Arabic" if language == "ar" else "English"
    dur = duration_seconds or 30
    num_scenes = max(3, dur // 10)  # Calculate appropriate number of scenes

    # Extract key data
    project = synthesis.get("project_description", "")[:200]
    summary = synthesis.get("executive_summary", "")[:400]

    # Arabic/English instructions
    if language == "ar":
        lang_instruction = "كل النصوص باللغة العربية. visual_prompt بالإنجليزي فقط."
    else:
        lang_instruction = "All content in English. visual_prompt in English."

    # Build scene examples
    scene_examples = []
    for i in range(num_scenes):
        scene_examples.append(
            f'{{"scene_number": {i+1}, "duration": "5s", "visual_prompt": "Scene description", "narration": "{lang} narration", "on_screen_text": "{lang} text", "text_overlays": [{{"text": "Text", "position": "center", "start_time": 1, "end_time": 4}}]}}'
        )

    scenes_json = ",\n    ".join(scene_examples)

    # Create specific example based on actual project data
    specific_example = {
        "title": f"Promotional Video for {project[:50]}",
        "duration_seconds": dur,
        "visual_prompts": {
            "overall_style": "modern",
            "main_subject": project,
            "color_scheme": "professional"
        },
        "scenes": [
            {
                "scene_number": 1,
                "duration": f"{dur//num_scenes}s",
                "visual_prompt": f"Professional {project} business scene, modern office setting",
                "narration": f"Discover {project}",
                "on_screen_text": f"Welcome to {project[:30]}",
                "text_overlays": [{"text": project[:30], "position": "center", "start_time": 1, "end_time": dur//num_scenes}]
            }
        ],
        "voiceover_full_script": f"Promotional content for {project}: {summary}",
        "text_overlay_instructions": {"font": "Cairo", "direction": "rtl" if language == "ar" else "ltr", "color": "white"},
        "music_mood": "upbeat",
        "target_platforms": ["Instagram", "TikTok", "YouTube Shorts"],
        "hashtags": ["business", "promotional", language]
    }

    return [
        {
            "role": "system",
            "content": (
                f"You are a video script generator. Create {dur}s promotional video script in {lang}. "
                f"{lang_instruction} "
                f"Return valid JSON with this exact structure:\n"
                f'{{"title": "Video Title", "duration_seconds": {dur}, "visual_prompts": {{"overall_style": "modern", "main_subject": "specific business description", "color_scheme": "professional"}}, "scenes": [\n'
                f'    {scenes_json}\n'
                f'  ], "voiceover_full_script": "Complete {lang} narration text here", "text_overlay_instructions": {{"font": "Cairo", "direction": "rtl", "color": "white"}}, "music_mood": "upbeat", "target_platforms": ["Instagram", "TikTok", "YouTube Shorts"], "hashtags": ["viral", "business", "{lang}"]}}'
            )
        },
        {
            "role": "user",
            "content": (
                f"Create a {dur}s promotional video script for this specific business: {project}\n\n"
                f"Business Details: {summary}\n"
                f"Target: Social media platforms\n"
                f"IMPORTANT: The visual_prompts.main_subject MUST be: '{project}'\n"
                f"IMPORTANT: All scenes should be about: {project}\n"
                f"IMPORTANT: The narration should describe: {summary}\n"
                f"{'User notes: ' + user_notes if user_notes else ''}\n\n"
                f"Return valid JSON only. No other text."
            ),
        },
    ]