{"id":"68355535439cb9574d910a9f","created_date":"2025-05-27T06:01:25.628000","updated_date":"2026-03-22T16:41:30.276000","organization_id":"67d5c631be5ea69ce7169f3b","app_type":"user_app","game_meta":null,"name":"RePostly AI","user_description":"Generate high-converting marketing content in seconds, in any language.","logo_url":"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/5cea2907f_May27202510_40_12AM.png","social_image_url":null,"avatar_index":null,"pages":{"Dashboard":"\nimport React, { useState, useEffect } from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Conversion } from \"@/entities/Conversion\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Link, useNavigate } from \"react-router-dom\";\nimport { createPageUrl } from \"@/utils\";\nimport { \n  Zap, \n  TrendingUp, \n  Clock, \n  Star,\n  FileText,\n  Calendar,\n  ArrowUpRight,\n  RefreshCw,\n  Mail,\n  Linkedin,\n  Mic,\n  Newspaper,\n  Image as ImageIcon,\n  ArrowRight,\n  AlertCircle,\n  CheckCircle \n} from \"lucide-react\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { format } from \"date-fns\";\nimport { he } from \"date-fns/locale\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport { RUN_MODE_FREE, PLAN_LIMITS } from \"@/components/config\";\n\nconst translations = {\n  he: {\n    welcome: \"ברוך השב,\",\n    newConversion: \"המרה חדשה\", \n    recentConversions: \"המרות האחרונות\",\n    totalConversions: \"סה״כ המרות\",\n    thisMonth: \"החודש\",\n    successRate: \"אחוז הצלחה\",\n    noConversions: \"עדיין לא יצרת המרות\",\n    getStarted: \"בוא נתחיל!\",\n    viewAll: \"צפה בהכל\",\n    processing: \"מעבד...\",\n    completed: \"הושלם\",\n    failed: \"נכשל\",\n    appSubtitle: \"הפוך בלוג בודד למכונת תוכן חכמה\",\n    currentPlan: \"תוכנית נוכחית\",\n    upgradeNow: \"שדרג עכשיו\",\n    unlimited: \"ללא הגבלה\",\n    outOf: \"מתוך\",\n    greatPerformance: \"ביצועים מעולים\",\n    planTypes: {\n        free: \"חינם\",\n        basic: \"בסיסי\",\n        pro: \"מקצועי\",\n        ultra: \"אולטרה\"\n    },\n    formats: {\n      linkedin: \"לינקדאין\",\n      twitter: \"טוויטר\", \n      podcast: \"פודקאסט\",\n      newsletter: \"ניוזלטר\",\n      landing: \"דף נחיתה\",\n      video: \"וידאו קצר\",\n      graphic: \"גרפיקה\"\n    }\n  },\n  en: {\n    welcome: \"Welcome back,\",\n    newConversion: \"New Conversion\", \n    recentConversions: \"Recent Conversions\",\n    totalConversions: \"Total Conversions\",\n    thisMonth: \"This Month\",\n    successRate: \"Success Rate\",\n    noConversions: \"You haven't created any conversions yet\",\n    getStarted: \"Let's get started!\",\n    viewAll: \"View All\",\n    processing: \"Processing...\",\n    completed: \"Completed\",\n    failed: \"Failed\",\n    appSubtitle: \"From One Post to Everywhere\",\n    currentPlan: \"Current Plan\",\n    upgradeNow: \"Upgrade Now\",\n    unlimited: \"Unlimited\",\n    outOf: \"out of\",\n    greatPerformance: \"Great performance\",\n    planTypes: {\n        free: \"Free\",\n        basic: \"Basic\",\n        pro: \"Pro\",\n        ultra: \"Ultra\"\n    },\n    formats: {\n      linkedin: \"LinkedIn\",\n      twitter: \"Twitter\",\n      podcast: \"Podcast\", \n      newsletter: \"Newsletter\",\n      landing: \"Landing Page\",\n      video: \"Short Video\",\n      graphic: \"Graphic\"\n    }\n  },\n  ar: { \n    welcome: \"أهلاً بك,\",\n    newConversion: \"تحويل جديد\",\n    recentConversions: \"التحويلات الأخيرة\",\n    totalConversions: \"إجمالي التحويلات\",\n    thisMonth: \"هذا الشهر\",\n    successRate: \"معدل النجاح\",\n    noConversions: \"لم تقم بإنشاء أي تحويلات حتى الآن\",\n    getStarted: \"هيا بنا نبدأ!\",\n    viewAll: \"عرض الكل\",\n    processing: \"جاري المعالجة...\",\n    completed: \"اكتمل\",\n    failed: \"فشل\",\n    appSubtitle: \"منشور واحد إلى كل مكان\",\n    currentPlan: \"الخطة الحالية\",\n    upgradeNow: \"ترقية الآن\",\n    unlimited: \"غير محدود\",\n    outOf: \"من\",\n    greatPerformance: \"أداء ممتاز\",\n    planTypes: {\n        free: \"مجاني\",\n        basic: \"أساسي\",\n        pro: \"احترافي\",\n        ultra: \"فائق\"\n    },\n    formats: {\n      linkedin: \"لينكد إن\",\n      twitter: \"تويتر\",\n      podcast: \"بودكاست\",\n      newsletter: \"رسالة إخبارية\",\n      landing: \"صفحة هبوط\",\n      video: \"فيديو قصير\",\n      graphic: \"جرافيك\"\n    }\n   }, \n  es: { \n    welcome: \"Bienvenido de nuevo,\",\n    newConversion: \"Nueva conversión\",\n    recentConversions: \"Conversiones recientes\",\n    totalConversions: \"Conversiones totales\",\n    thisMonth: \"Este mes\",\n    successRate: \"Tasa de éxito\",\n    noConversions: \"Aún no has creado ninguna conversión\",\n    getStarted: \"¡Empecemos!\",\n    viewAll: \"Ver todo\",\n    processing: \"Procesando...\",\n    completed: \"Completado\",\n    failed: \"Fallido\",\n    appSubtitle: \"De una publicación a todas partes\",\n    currentPlan: \"Plan actual\",\n    upgradeNow: \"Actualizar ahora\",\n    unlimited: \"Ilimitado\",\n    outOf: \"de\",\n    greatPerformance: \"Gran rendimiento\",\n    planTypes: {\n        free: \"Gratis\",\n        basic: \"Básico\",\n        pro: \"Pro\",\n        ultra: \"Ultra\"\n    },\n    formats: {\n      linkedin: \"LinkedIn\",\n      twitter: \"Twitter\",\n      podcast: \"Podcast\",\n      newsletter: \"Boletín informativo\",\n      landing: \"Página de aterrizaje\",\n      video: \"Vídeo corto\",\n      graphic: \"Gráfico\"\n    }\n   }, \n  fr: { \n    welcome: \"Bienvenue,\",\n    newConversion: \"Nouvelle conversion\",\n    recentConversions: \"Conversions récentes\",\n    totalConversions: \"Conversions totales\",\n    thisMonth: \"Ce mois-ci\",\n    successRate: \"Taux de succès\",\n    noConversions: \"Vous n'avez pas encore créé de conversions\",\n    getStarted: \"Commençons !\",\n    viewAll: \"Voir tout\",\n    processing: \"En traitement...\",\n    completed: \"Terminé\",\n    failed: \"Échoué\",\n    appSubtitle: \"D'un post à partout\",\n    currentPlan: \"Plan actuel\",\n    upgradeNow: \"Mettre à niveau maintenant\",\n    unlimited: \"Illimité\",\n    outOf: \"de\",\n    greatPerformance: \"Excellente performance\",\n    planTypes: {\n        free: \"Gratuit\",\n        basic: \"Basique\",\n        pro: \"Pro\",\n        ultra: \"Ultra\"\n    },\n    formats: {\n      linkedin: \"LinkedIn\",\n      twitter: \"Twitter\",\n      podcast: \"Podcast\",\n      newsletter: \"Newsletter\",\n      landing: \"Page de destination\",\n      video: \"Courte vidéo\",\n      graphic: \"Graphique\"\n    }\n   }, \n  zh: { \n    welcome: \"欢迎回来,\",\n    newConversion: \"新的转换\",\n    recentConversions: \"最近的转换\",\n    totalConversions: \"总转换量\",\n    thisMonth: \"这个月\",\n    successRate: \"成功率\",\n    noConversions: \"您尚未创建任何转换\",\n    getStarted: \"让我们开始吧！\",\n    viewAll: \"查看全部\",\n    processing: \"处理中...\",\n    completed: \"已完成\",\n    failed: \"失败\",\n    appSubtitle: \"从一个帖子到所有地方\",\n    currentPlan: \"当前计划\",\n    upgradeNow: \"立即升级\",\n    unlimited: \"无限\",\n    outOf: \"出\",\n    greatPerformance: \"出色的表现\",\n    planTypes: {\n        free: \"免费\",\n        basic: \"基本\",\n        pro: \"专业\",\n        ultra: \"超级\"\n    },\n    formats: {\n      linkedin: \"领英\",\n      twitter: \"推特\",\n      podcast: \"播客\",\n      newsletter: \"新闻通讯\",\n      landing: \"着陆页\",\n      video: \"短片\",\n      graphic: \"图形\"\n    }\n   },\n  it: {\n     welcome: \"Bentornato,\",\n    newConversion: \"Nuova conversione\",\n    recentConversions: \"Conversioni recenti\",\n    totalConversions: \"Conversioni totali\",\n    thisMonth: \"Questo mese\",\n    successRate: \"Tasso di successo\",\n    noConversions: \"Non hai ancora creato conversioni\",\n    getStarted: \"Iniziamo!\",\n    viewAll: \"Visualizza tutto\",\n    processing: \"In elaborazione...\",\n    completed: \"Completato\",\n    failed: \"Fallito\",\n    appSubtitle: \"Da un post a ovunque\",\n    currentPlan: \"Piano attuale\",\n    upgradeNow: \"Aggiorna ora\",\n    unlimited: \"Illimitato\",\n    outOf: \"di\",\n    greatPerformance: \"Ottime prestazioni\",\n    planTypes: {\n        free: \"Gratuito\",\n        basic: \"Base\",\n        pro: \"Pro\",\n        ultra: \"Ultra\"\n    },\n    formats: {\n      linkedin: \"LinkedIn\",\n      twitter: \"Twitter\",\n      podcast: \"Podcast\",\n      newsletter: \"Newsletter\",\n      landing: \"Pagina di destinazione\",\n      video: \"Breve video\",\n      graphic: \"Grafica\"\n    }\n  }\n};\n\nconst planLimits = PLAN_LIMITS; \n\nexport default function Dashboard({ effectiveLanguage, appTranslations }) {\n  const [user, setUser] = useState(null);\n  const [conversions, setConversions] = useState([]);\n  const [loading, setLoading] = useState(true);\n  const [currentLang, setCurrentLang] = useState('en');\n  const navigate = useNavigate();\n\n  useEffect(() => {\n    const init = async () => {\n      try {\n        const userData = await User.me();\n        setUser(userData);\n        setCurrentLang(userData.user_language || effectiveLanguage || 'en');\n        const conversionsData = await Conversion.list(\"-created_date\", 10);\n        setConversions(conversionsData);\n      } catch (error) {\n        console.error(\"Error loading data:\", error);\n        setCurrentLang(effectiveLanguage || 'en');\n      }\n      setLoading(false);\n    };\n    init();\n  }, [effectiveLanguage]);\n\n  if (loading) {\n    return (\n      <div className=\"flex items-center justify-center min-h-[400px] w-full bg-gray-50 p-4\">\n        <div className=\"animate-pulse space-y-6 w-full max-w-6xl\">\n          <div className=\"h-8 bg-gray-200 rounded w-1/3\"></div>\n          <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4\">\n            {[...Array(4)].map((_, i) => (\n              <div key={i} className=\"h-32 bg-gray-200 rounded-xl\"></div>\n            ))}\n          </div>\n          <div className=\"h-64 bg-gray-200 rounded-xl\"></div>\n        </div>\n      </div>\n    );\n  }\n\n  const t = translations[currentLang] || translations.en;\n  const isRTL = currentLang === 'he' || currentLang === 'ar';\n  \n  const monthlyLimit = RUN_MODE_FREE\n    ? Infinity\n    : (user?.email === 'yaronpm.eng@gmail.com' || user?.special_access || user?.is_admin \n        ? Infinity \n        : (planLimits[user?.plan_type] || planLimits.free));\n    \n  const currentUsage = user?.monthly_conversions || 0;\n  const usagePercentage = monthlyLimit === Infinity ? 0 : (currentUsage / monthlyLimit) * 100;\n  const isNearLimit = !RUN_MODE_FREE && monthlyLimit !== Infinity && usagePercentage >= 80 && usagePercentage < 100;\n  const isAtLimit = !RUN_MODE_FREE && monthlyLimit !== Infinity && usagePercentage >= 100;\n\n  const completedConversions = conversions.filter(c => c.status === 'completed');\n  const successRate = conversions.length > 0 ? (completedConversions.length / conversions.length) * 100 : 0;\n\n  return (\n    <div className={`w-full ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <style jsx>{`\n        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');\n        \n        body {\n          font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;\n          overflow-x: hidden;\n        }\n\n        * {\n          box-sizing: border-box;\n        }\n        \n        .dashboard-wrapper {\n          width: 100%;\n          max-width: 100%;\n          margin: 0 auto;\n          padding: 0;\n          overflow-x: hidden;\n          background-color: #f9fafb; \n        }\n        \n        .dashboard-content {\n          max-width: 1200px;\n          margin: 0 auto;\n          padding: 0 16px;\n          width: 100%;\n        }\n        \n        @media (min-width: 640px) {\n          .dashboard-content {\n            padding: 0 24px;\n          }\n        }\n        \n        @media (min-width: 1024px) {\n          .dashboard-content {\n            padding: 0 32px;\n          }\n        }\n        \n        .stats-grid {\n          display: grid;\n          grid-template-columns: 1fr;\n          gap: 16px;\n          margin: 24px 0;\n          width: 100%;\n        }\n        \n        @media (min-width: 640px) {\n          .stats-grid {\n            grid-template-columns: repeat(2, 1fr);\n            gap: 20px;\n          }\n        }\n        \n        @media (min-width: 1024px) {\n          .stats-grid {\n            grid-template-columns: repeat(4, 1fr);\n            gap: 24px;\n          }\n        }\n        \n        .stat-card {\n          background: white;\n          border-radius: 16px;\n          padding: 20px;\n          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n          border: 1px solid #e2e8f0;\n          transition: all 0.2s ease;\n          width: 100%;\n          min-width: 0;\n        }\n        \n        .stat-card:hover {\n          box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n          transform: translateY(-1px);\n        }\n        \n        .conversions-section {\n          background: white;\n          border-radius: 16px;\n          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n          border: 1px solid #e2e8f0;\n          overflow: hidden;\n          width: 100%;\n          margin-top: 24px;\n        }\n        \n        .conversion-item {\n          padding: 16px 20px;\n          border-bottom: 1px solid #f1f5f9;\n          transition: background-color 0.2s ease;\n          width: 100%;\n        }\n        \n        .conversion-item:hover {\n          background-color: #f8fafc;\n        }\n        \n        .conversion-item:last-child {\n          border-bottom: none;\n        }\n        \n        @media (max-width: 640px) {\n          .mobile-cta {\n            position: fixed;\n            bottom: 20px;\n            left: 16px;\n            right: 16px;\n            z-index: 30;\n          }\n        }\n      `}</style>\n\n      <div className=\"dashboard-wrapper\">\n        <div className=\"dashboard-content\">\n          {/* Header Section */}\n          <div className=\"mb-6 pt-6 lg:pt-8\"> \n            <div className=\"flex flex-col lg:flex-row justify-between items-start lg:items-center gap-4\">\n              <div className=\"flex-1\">\n                <h1 className=\"text-2xl lg:text-3xl font-bold bg-gradient-to-r from-teal-600 to-emerald-600 bg-clip-text text-transparent mb-2\">\n                  {t.welcome} {user?.full_name?.split(' ')[0]}! 👋\n                </h1>\n                <p className=\"text-sm lg:text-base text-gray-600\">{t.appSubtitle}</p>\n              </div>\n              <div className=\"w-full lg:w-auto\">\n                <Link to={createPageUrl(\"Convert\")} className=\"block\">\n                  <Button \n                    disabled={user && isAtLimit && !(user.email === 'yaronpm.eng@gmail.com' || user.special_access || user.is_admin)}\n                    size=\"lg\"\n                    className={`w-full lg:w-auto ${\n                      user && isAtLimit && !(user.email === 'yaronpm.eng@gmail.com' || user.special_access || user.is_admin)\n                        ? 'bg-gray-400 cursor-not-allowed' \n                        : 'bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700'\n                    } text-white px-6 py-3 rounded-xl font-medium transition-all duration-300 shadow-lg hover:shadow-xl`}\n                  >\n                    <Zap className=\"w-5 h-5 mr-2\" />\n                    {t.newConversion}\n                  </Button>\n                </Link>\n              </div>\n            </div>\n          </div>\n\n          {/* Usage Limit Alerts - don't show for special users */}\n          {user && isAtLimit && user.email !== 'yaronpm.eng@gmail.com' && !user.special_access && !user.is_admin && (\n            <div className=\"mb-6\">\n              <Alert className=\"border-red-200 bg-red-50\">\n                <AlertCircle className=\"h-5 w-5 text-red-600\" />\n                <AlertDescription className=\"text-red-800\">\n                  <div className=\"space-y-3\">\n                    <p className=\"font-medium\">\n                      You've reached your monthly limit of {monthlyLimit} conversions. Upgrade your plan to continue.\n                    </p>\n                    <Button \n                      variant=\"destructive\" \n                      size=\"sm\"\n                      className=\"bg-red-600 hover:bg-red-700\"\n                      onClick={() => navigate(createPageUrl(\"Pricing\"))}\n                    >\n                      Upgrade Now\n                    </Button>\n                  </div>\n                </AlertDescription>\n              </Alert>\n            </div>\n          )}\n\n          {user && isNearLimit && !isAtLimit && user.email !== 'yaronpm.eng@gmail.com' && !user.special_access && !user.is_admin && (\n            <div className=\"mb-6\">\n              <Alert className=\"border-orange-200 bg-orange-50\">\n                <AlertCircle className=\"h-5 w-5 text-orange-600\" />\n                <AlertDescription className=\"text-orange-800\">\n                  <p>\n                    You're approaching your monthly limit ({currentUsage}/{monthlyLimit} conversions used). \n                    <Link to={createPageUrl(\"Pricing\")} className=\"underline ml-1 hover:text-orange-900 font-medium\">\n                      Consider upgrading\n                    </Link> to avoid interruption.\n                  </p>\n                </AlertDescription>\n              </Alert>\n            </div>\n          )}\n\n          {/* Special indicator for admin users */}\n          {user && (user.email === 'yaronpm.eng@gmail.com' || user.special_access || user.is_admin) && (\n            <div className=\"mb-6\">\n              <Alert className=\"border-green-200 bg-green-50\">\n                <CheckCircle className=\"h-5 w-5 text-green-600\" />\n                <AlertDescription className=\"text-green-800\">\n                  <p className=\"font-medium\">\n                    🎉 Admin Access Active - Unlimited conversions and all features unlocked!\n                  </p>\n                </AlertDescription>\n              </Alert>\n            </div>\n          )}\n\n          {/* Stats Cards */}\n          <div className=\"stats-grid\">\n            <div className=\"stat-card\">\n              <div className=\"flex justify-between items-center mb-4\">\n                <div className=\"text-sm font-medium text-gray-500 uppercase tracking-wide\">{t.totalConversions}</div>\n                <div className=\"w-10 h-10 bg-teal-100 rounded-lg flex items-center justify-center\">\n                  <FileText className=\"w-5 h-5 text-teal-600\" />\n                </div>\n              </div>\n              <div>\n                <div className=\"text-2xl lg:text-3xl font-bold text-gray-900 mb-1\">{conversions.length}</div>\n                <div className=\"text-sm text-gray-600\">\n                  {completedConversions.length} {t.completed?.toLowerCase()}\n                </div>\n              </div>\n            </div>\n\n            <div className=\"stat-card\">\n              <div className=\"flex justify-between items-center mb-4\">\n                <div className=\"text-sm font-medium text-gray-500 uppercase tracking-wide\">{t.thisMonth}</div>\n                <div className=\"w-10 h-10 bg-emerald-100 rounded-lg flex items-center justify-center\">\n                  <Calendar className=\"w-5 h-5 text-emerald-600\" />\n                </div>\n              </div>\n              <div>\n                <div className=\"text-2xl lg:text-3xl font-bold text-gray-900 mb-1\">{currentUsage}</div>\n                <div className=\"text-sm text-gray-600 mb-2\">\n                  {monthlyLimit === Infinity ? t.unlimited : `${currentUsage} ${t.outOf} ${monthlyLimit}`}\n                </div>\n                {monthlyLimit !== Infinity && (\n                  <div className=\"w-full h-2 bg-gray-200 rounded-full overflow-hidden\">\n                    <div \n                      className=\"h-full bg-gradient-to-r from-teal-500 to-emerald-600 rounded-full transition-all duration-500\"\n                      style={{ width: `${Math.min(usagePercentage, 100)}%` }}\n                    ></div>\n                  </div>\n                )}\n              </div>\n            </div>\n\n            <div className=\"stat-card\">\n              <div className=\"flex justify-between items-center mb-4\">\n                <div className=\"text-sm font-medium text-gray-500 uppercase tracking-wide\">{t.successRate}</div>\n                <div className=\"w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center\">\n                  <TrendingUp className=\"w-5 h-5 text-green-600\" />\n                </div>\n              </div>\n              <div>\n                <div className=\"text-2xl lg:text-3xl font-bold text-gray-900 mb-1\">{successRate.toFixed(0)}%</div>\n                <div className=\"text-sm text-green-600 font-medium\">\n                  {t.greatPerformance}\n                </div>\n              </div>\n            </div>\n\n            <div className=\"stat-card\">\n              <div className=\"flex justify-between items-center mb-4\">\n                <div className=\"text-sm font-medium text-gray-500 uppercase tracking-wide\">{t.currentPlan}</div>\n                <div className=\"w-10 h-10 bg-amber-100 rounded-lg flex items-center justify-center\">\n                  <Star className=\"w-5 h-5 text-amber-600\" />\n                </div>\n              </div>\n              <div>\n                <div className=\"text-lg font-bold text-gray-900 mb-1 capitalize\">\n                  {t.planTypes[user?.plan_type] || user?.plan_type || t.planTypes.free}\n                </div>\n                <Link to={createPageUrl(\"Pricing\")}>\n                  <div className=\"text-sm text-teal-600 hover:text-teal-700 cursor-pointer font-medium transition-colors\">\n                    {t.upgradeNow} →\n                  </div>\n                </Link>\n              </div>\n            </div>\n          </div>\n\n          {/* Recent Conversions */}\n          <div className=\"conversions-section\">\n            <div className=\"p-6 border-b border-gray-100\">\n              <div className=\"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4\">\n                <h2 className=\"text-xl font-bold text-gray-900\">{t.recentConversions}</h2>\n                <Link to={createPageUrl(\"MyConversions\")}>\n                  <Button variant=\"ghost\" size=\"sm\" className=\"text-teal-600 hover:text-teal-700 hover:bg-teal-50\">\n                    {t.viewAll}\n                    <ArrowUpRight className=\"w-4 h-4 ml-1\" />\n                  </Button>\n                </Link>\n              </div>\n            </div>\n\n            {conversions.length === 0 ? (\n              <div className=\"text-center py-16 px-6\">\n                <div className=\"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4\">\n                  <RefreshCw className=\"w-8 h-8 text-gray-400\" />\n                </div>\n                <h3 className=\"text-lg font-semibold text-gray-900 mb-2\">{t.noConversions}</h3>\n                <p className=\"text-gray-500 mb-6\">{t.getStarted}</p>\n                <Link to={createPageUrl(\"Convert\")}>\n                  <Button \n                    disabled={user && isAtLimit && !(user.email === 'yaronpm.eng@gmail.com' || user.special_access || user.is_admin)}\n                    className={`${\n                      user && isAtLimit && !(user.email === 'yaronpm.eng@gmail.com' || user.special_access || user.is_admin)\n                        ? 'bg-gray-400 cursor-not-allowed' \n                        : 'bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700'\n                    } text-white px-6 py-3 rounded-lg font-medium`}\n                  >\n                    <Zap className=\"w-4 h-4 mr-2\" />\n                    {t.newConversion}\n                  </Button>\n                </Link>\n              </div>\n            ) : (\n              <div className=\"pb-4\"> \n                {conversions.slice(0, 5).map((conversion) => (\n                  <div key={conversion.id} className=\"conversion-item\">\n                    <div className=\"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3\">\n                      <div className=\"flex-1 min-w-0\">\n                        <h4 className=\"font-medium text-gray-900 truncate mb-2\" title={conversion.input_text}>\n                          {conversion.input_text}\n                        </h4>\n                        <div className=\"flex items-center gap-2 flex-wrap\">\n                          <Badge variant=\"outline\" className=\"border-teal-200 text-teal-700 bg-teal-50\">\n                            {t.formats[conversion.selected_formats?.[0]] || conversion.selected_formats?.[0]}\n                          </Badge>\n                          {conversion.selected_formats?.length > 1 && (\n                            <Badge variant=\"outline\" className=\"border-gray-300\">\n                              +{conversion.selected_formats.length - 1}\n                            </Badge>\n                          )}\n                        </div>\n                      </div>\n                      <div className=\"text-right w-full sm:w-auto\">\n                        <Badge \n                          className={`px-3 py-1 mb-2 ${\n                            conversion.status === 'completed' ? 'bg-green-100 text-green-800' :\n                            conversion.status === 'processing' ? 'bg-teal-100 text-teal-800' :\n                            'bg-red-100 text-red-800'\n                          }`}\n                        >\n                          {t[conversion.status]}\n                        </Badge>\n                        <p className=\"text-sm text-gray-500\">\n                          {format(new Date(conversion.created_date), 'dd/MM/yyyy', { locale: currentLang === 'he' ? he : undefined })}\n                        </p>\n                      </div>\n                    </div>\n                  </div>\n                ))}\n              </div>\n            )}\n          </div>\n\n          {/* Mobile CTA Button - don't show for users at limit unless they have special access */}\n          {user && (!isAtLimit || user.email === 'yaronpm.eng@gmail.com' || user.special_access || user.is_admin) && (\n            <div className=\"mobile-cta block sm:hidden\">\n              <Link to={createPageUrl(\"Convert\")}>\n                <Button className=\"w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white py-4 rounded-xl font-medium shadow-2xl\">\n                  <Zap className=\"w-5 h-5 mr-2\" />\n                  {t.newConversion}\n                </Button>\n              </Link>\n            </div>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n}\n","Convert":"\nimport React, { useState, useEffect } from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Conversion } from \"@/entities/Conversion\";\nimport { InvokeLLM } from \"@/integrations/Core\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport {\n  Sparkles,\n  Globe,\n  Download,\n  Copy,\n  Edit3,\n  RefreshCw,\n  CheckCircle,\n  Loader2,\n  FileText,\n  AlertCircle,\n  Wand2,\n  Brain,\n  ToggleLeft,\n  ToggleRight,\n  Info\n} from \"lucide-react\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { useNavigate } from \"react-router-dom\";\nimport { createPageUrl } from \"@/utils\";\nimport SocialShareButtons from \"../components/sharing/SocialShareButtons\";\nimport PostAnalyzerCard from \"../components/ai/PostAnalyzerCard\";\nimport { RUN_MODE_FREE, PLAN_LIMITS } from \"@/components/config\";\n\nconst translations = {\n  he: {\n    title: \"המרה חדשה\",\n    subtitle: \"הפוך בלוג בודד למכונת תוכן חכמה\",\n    inputLabel: \"הטקסט למרה\",\n    inputPlaceholder: \"הדבק כאן את הפוסט או המאמר שלך...\",\n    urlLabel: \"או הכנס URL\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"ייבא מURL\",\n    selectFormats: \"בחר פורמטים\",\n    writingTone: \"טון כתיבה\",\n    outputLanguage: \"שפת הפלט\",\n    contentDepth: \"רמת עומק התוכן\",\n    generateContent: \"צור תוכן\",\n    processing: \"מעבד...\",\n    completed: \"הושלם!\",\n    copyToClipboard: \"העתק ללוח\",\n    downloadPdf: \"הורד PDF\",\n    editContent: \"ערוך תוכן\",\n    regenerate: \"צור מחדש\",\n    limitReached: \"הגעת למגבלת ההמרות החודשית\",\n    upgradeNow: \"שדרג עכשיו\",\n    importingFromUrl: \"מייבא מURL...\",\n    expandFurther: \"הרחב עוד\",\n    makeMoreDetailed: \"הפוך למפורט יותר\",\n    addExamples: \"הוסף דוגמאות מהחיים\",\n    savingEdit: \"שומר עריכה...\",\n    regeneratingFormat: \"מייצר מחדש...\",\n    outputsTitle: \"התוצרים שלך\",\n    save: \"שמור\",\n    cancel: \"ביטול\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"עברית\",\n    confirmChangeLanguage: \"שינוי שפה יאפס את הטופס. האם להמשיך?\",\n    formats: {\n      linkedin: \"פוסט לינקדאין\",\n      x_post: \"X פוסט / ת'רד\",\n      podcast: \"תסריט פודקאסט\",\n      newsletter: \"סיכום ניוזלטר\",\n      landing: \"מבוא לדף נחיתה\",\n      video: \"תסריט וידאו קצר\",\n      graphic: \"הנחיה לגרפיקה\",\n      facebook: \"פוסט פייסבוק\",\n      instagram: \"כיתוב אינסטגרם + האשטגים\",\n      tiktok: \"תסריט TikTok\",\n      reddit: \"פוסט Reddit\"\n    },\n    tones: {\n      professional: \"מקצועי\",\n      casual: \"חברותי\",\n      marketing: \"שיווקי\",\n      funny: \"משעשע\"\n    },\n    languages: {\n      he: \"עברית\",\n      en: \"אנגלית\",\n      ar: \"ערבית\",\n      es: \"ספרדית\",\n      fr: \"צרפתית\",\n      zh: \"סינית\",\n      it: \"איטלקית\"\n    },\n    depths: {\n      quick_summary: \"סיכום מהיר\",\n      standard: \"סטנדרטי\",\n      enriched: \"מועשר (ברירת מחדל)\",\n      deep_dive: \"צלילה לעומק\"\n    }\n  },\n  en: {\n    title: \"New Conversion\",\n    subtitle: \"From One Post to Everywhere\",\n    inputLabel: \"Text to Convert\",\n    inputPlaceholder: \"Paste your post or article here...\",\n    urlLabel: \"Or enter URL\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"Import from URL\",\n    selectFormats: \"Select Formats\",\n    writingTone: \"Writing Tone\",\n    outputLanguage: \"Output Language\",\n    contentDepth: \"Content Depth\",\n    generateContent: \"Generate Content\",\n    processing: \"Processing...\",\n    completed: \"Completed!\",\n    copyToClipboard: \"Copy to Clipboard\",\n    downloadPdf: \"Download PDF\",\n    editContent: \"Edit Content\",\n    regenerate: \"Regenerate\",\n    limitReached: \"You've reached your monthly conversion limit\",\n    upgradeNow: \"Upgrade Now\",\n    importingFromUrl: \"Importing from URL...\",\n    expandFurther: \"Expand Further\",\n    makeMoreDetailed: \"Make More Detailed\",\n    addExamples: \"Add Real-world Examples\",\n    savingEdit: \"Saving edit...\",\n    regeneratingFormat: \"Regenerating format...\",\n    outputsTitle: \"Your Outputs\",\n    save: \"Save\",\n    cancel: \"Cancel\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"עברית\",\n    confirmChangeLanguage: \"Changing language will reset the form. Continue?\",\n    formats: {\n      linkedin: \"LinkedIn Post\",\n      x_post: \"X Post / Thread\",\n      podcast: \"Podcast Script\",\n      newsletter: \"Newsletter Summary\",\n      landing: \"Landing Page Intro\",\n      video: \"Short Video Script\",\n      graphic: \"Graphic Prompt\",\n      facebook: \"Facebook Post\",\n      instagram: \"Instagram Caption + Hashtags\",\n      tiktok: \"TikTok Video Script\",\n      reddit: \"Reddit Post\"\n    },\n    tones: {\n      professional: \"Professional\",\n      casual: \"Casual\",\n      marketing: \"Marketing\",\n      funny: \"Funny\"\n    },\n    languages: {\n      he: \"Hebrew\",\n      en: \"English\",\n      ar: \"Arabic\",\n      es: \"Spanish\",\n      fr: \"French\",\n      zh: \"Chinese\",\n      it: \"Italian\"\n    },\n    depths: {\n      quick_summary: \"Quick Summary\",\n      standard: \"Standard\",\n      enriched: \"Enriched (Default)\",\n      deep_dive: \"Deep Dive\"\n    }\n  },\n  ar: {\n    title: \"تحويل جديد\",\n    subtitle: \"منشور واحد إلى كل مكان\",\n    inputLabel: \"النص المراد تحويله\",\n    inputPlaceholder: \"ألصق منشورك أو مقالتك هنا...\",\n    urlLabel: \"أو أدخل عنوان URL\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"استيراد من عنوان URL\",\n    selectFormats: \"اختر التنسيقات\",\n    writingTone: \"أسلوب الكتابة\",\n    outputLanguage: \"لغة الإخراج\",\n    contentDepth: \"عمق المحتوى\",\n    generateContent: \"إنشاء محتوى\",\n    processing: \"جارٍ المعالجة...\",\n    completed: \"اكتمل!\",\n    copyToClipboard: \"نسخ إلى الحافظة\",\n    downloadPdf: \"تنزيل PDF\",\n    editContent: \"تحرير المحتوى\",\n    regenerate: \"إعادة إنشاء\",\n    limitReached: \"لقد وصلت إلى الحد الأقصى للتحويلات الشهرية\",\n    upgradeNow: \"ترقية الآن\",\n    importingFromUrl: \"جارٍ الاستيراد من عنوان URL...\",\n    expandFurther: \"توسيع أكبر\",\n    makeMoreDetailed: \"اجعلها أكثر تفصيلاً\",\n    addExamples: \"إضافة أمثلة من العالم الحقيقي\",\n    savingEdit: \"جاري حفظ التعديل...\",\n    regeneratingFormat: \"جاري إعادة إنشاء التنسيق...\",\n    outputsTitle: \"مخرجاتك\",\n    save: \"حفظ\",\n    cancel: \"إلغاء\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"عبري\",\n    confirmChangeLanguage: \"سيؤدي تغيير اللغة إلى إعادة تعيين النموذج. هل تريد المتابعة؟\",\n    formats: {\n      linkedin: \"منشور LinkedIn\",\n      x_post: \"X منشور / سلسلة\",\n      podcast: \"نص البودكاست\",\n      newsletter: \"ملخص الرسالة الإخبارية\",\n      landing: \"مقدمة الصفحة المقصودة\",\n      video: \"نص فيديو قصير\",\n      graphic: \"موجه رسومات\",\n      facebook: \"منشور فيسبوك\",\n      instagram: \"تسمية توضيحية إنستغرام + هاشتاقات\",\n      tiktok: \"نص فيديو TikTok\",\n      reddit: \"منشور Reddit\"\n    },\n    tones: {\n      professional: \"احترافي\",\n      casual: \"عادي\",\n      marketing: \"تسويقي\",\n      funny: \"مضحك\"\n    },\n    languages: {\n      he: \"عبري\",\n      en: \"إنجليزي\",\n      ar: \"عربي\",\n      es: \"إسباني\",\n      fr: \"فرنسي\",\n      zh: \"صيني\",\n      it: \"إيطالي\"\n    },\n    depths: {\n      quick_summary: \"ملخص سريع\",\n      standard: \"قياسي\",\n      enriched: \"مثرية (افتراضي)\",\n      deep_dive: \"الغوص العميق\"\n    }\n  },\n  es: {\n    title: \"Nueva Conversión\",\n    subtitle: \"De una publicación a todas partes\",\n    inputLabel: \"Texto para Convertir\",\n    inputPlaceholder: \"Pega tu publicación o artículo aquí...\",\n    urlLabel: \"O ingresa la URL\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"Importar desde URL\",\n    selectFormats: \"Seleccionar Formatos\",\n    writingTone: \"Tono de Escritura\",\n    outputLanguage: \"Idioma de Salida\",\n    contentDepth: \"Profundidad del Contenido\",\n    generateContent: \"Generar Contenido\",\n    processing: \"Procesando...\",\n    completed: \"¡Completado!\",\n    copyToClipboard: \"Copiar al Portapapeles\",\n    downloadPdf: \"Descargar PDF\",\n    editContent: \"Editar Contenido\",\n    regenerate: \"Regenerar\",\n    limitReached: \"Has alcanzado tu límite mensual de conversiones\",\n    upgradeNow: \"Actualizar Ahora\",\n    importingFromUrl: \"Importando desde URL...\",\n    expandFurther: \"Expandir Más\",\n    makeMoreDetailed: \"Hacer Más Detallado\",\n    addExamples: \"Agregar Ejemplos del Mundo Real\",\n    savingEdit: \"Guardando edición...\",\n    regeneratingFormat: \"Regenerando formato...\",\n    outputsTitle: \"Tus Resultados\",\n    save: \"Guardar\",\n    cancel: \"Cancelar\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"עברית\",\n    confirmChangeLanguage: \"Cambiar el idioma reiniciará el formulario. ¿Continuar?\",\n    formats: {\n      linkedin: \"Publicación de LinkedIn\",\n      x_post: \"Publicación / Hilo de X\",\n      podcast: \"Guion de Podcast\",\n      newsletter: \"Resumen de Newsletter\",\n      landing: \"Introducción de Página de Aterrizaje\",\n      video: \"Guion de Video Corto\",\n      graphic: \"Indicación Gráfica\",\n      facebook: \"Publicación de Facebook\",\n      instagram: \"Subtítulo de Instagram + Hashtags\",\n      tiktok: \"Guion de Video TikTok\",\n      reddit: \"Publicación de Reddit\"\n    },\n    tones: {\n      professional: \"Profesional\",\n      casual: \"Casual\",\n      marketing: \"Marketing\",\n      funny: \"Divertido\"\n    },\n    languages: {\n      he: \"Hebreo\",\n      en: \"Inglés\",\n      ar: \"Árabe\",\n      es: \"Español\",\n      fr: \"Francés\",\n      zh: \"Chino\",\n      it: \"Italiano\"\n    },\n    depths: {\n      quick_summary: \"Resumen Rápido\",\n      standard: \"Estándar\",\n      enriched: \"Enriquecido (Predeterminado)\",\n      deep_dive: \"Inmersión Profunda\"\n    }\n  },\n  fr: {\n    title: \"Nouvelle Conversion\",\n    subtitle: \"D'un post à partout\",\n    inputLabel: \"Texte à Convertir\",\n    inputPlaceholder: \"Collez votre publication ou votre article ici...\",\n    urlLabel: \"Ou entrez l'URL\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"Importer depuis l'URL\",\n    selectFormats: \"Sélectionner les Formats\",\n    writingTone: \"Ton d'Écriture\",\n    contentDepth: \"Profondeur du Contenu\",\n    generateContent: \"Générer du Contenu\",\n    processing: \"En traitement...\",\n    completed: \"Terminé !\",\n    copyToClipboard: \"Copier dans le Presse-papiers\",\n    downloadPdf: \"Télécharger le PDF\",\n    editContent: \"Modifier le Contenu\",\n    regenerate: \"Régénérer\",\n    limitReached: \"Vous avez atteint votre limite mensuelle de conversions\",\n    upgradeNow: \"Mettre à niveau maintenant\",\n    importingFromUrl: \"Importation depuis l'URL...\",\n    expandFurther: \"Développer davantage\",\n    makeMoreDetailed: \"Rendre plus détaillé\",\n    addExamples: \"Ajouter des exemples concrets\",\n    savingEdit: \"Enregistrement de la modification...\",\n    regeneratingFormat: \"Régénération du format...\",\n    outputsTitle: \"Vos Sorties\",\n    save: \"Enregistrer\",\n    cancel: \"Annuler\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"עברית\",\n    confirmChangeLanguage: \"Changer de langue réinitialisera le formulaire. Continuer?\",\n    formats: {\n      linkedin: \"Publication LinkedIn\",\n      x_post: \"Publication / Fil X\",\n      podcast: \"Script de Podcast\",\n      newsletter: \"Résumé de Newsletter\",\n      landing: \"Introduction de Page de Destination\",\n      video: \"Script de Courte Vidéo\",\n      graphic: \"Invite Graphique\",\n      facebook: \"Publication Facebook\",\n      instagram: \"Légende Instagram + Hashtags\",\n      tiktok: \"Script Vidéo TikTok\",\n      reddit: \"Publication Reddit\"\n    },\n    tones: {\n      professional: \"Professionnel\",\n      casual: \"Décontracté\",\n      marketing: \"Marketing\",\n      funny: \"Drôle\"\n    },\n    languages: {\n      he: \"Hébreu\",\n      en: \"Anglais\",\n      ar: \"Arabe\",\n      es: \"Espagnol\",\n      fr: \"Français\",\n      zh: \"Chinois\",\n      it: \"Italiano\"\n    },\n    depths: {\n      quick_summary: \"Résumé Rapide\",\n      standard: \"Standard\",\n      enriched: \"Enrichi (Par Défaut)\",\n      deep_dive: \"Exploration Approfondie\"\n    }\n  },\n  zh: {\n    title: \"新转换\",\n    subtitle: \"从一个帖子到所有地方\",\n    inputLabel: \"要转换的文本\",\n    inputPlaceholder: \"在此粘贴您的帖子或文章...\",\n    urlLabel: \"或输入网址\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"从网址导入\",\n    selectFormats: \"选择格式\",\n    writingTone: \"写作语气\",\n    outputLanguage: \"输出语言\",\n    contentDepth: \"内容深度\",\n    generateContent: \"生成内容\",\n    processing: \"处理中...\",\n    completed: \"已完成！\",\n    copyToClipboard: \"复制到剪贴板\",\n    downloadPdf: \"下载PDF\",\n    editContent: \"编辑内容\",\n    regenerate: \"重新生成\",\n    limitReached: \"您已达到每月转换限制\",\n    upgradeNow: \"立即升级\",\n    importingFromUrl: \"正在从网址导入...\",\n    expandFurther: \"进一步扩展\",\n    makeMoreDetailed: \"使其更详细\",\n    addExamples: \"添加真实世界的例子\",\n    savingEdit: \"保存编辑...\",\n    regeneratingFormat: \"重新生成格式...\",\n    outputsTitle: \"您的输出\",\n    save: \"保存\",\n    cancel: \"取消\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"עברית\",\n    confirmChangeLanguage: \"更改语言将重置表单。继续吗？\",\n    formats: {\n      linkedin: \"LinkedIn 帖子\",\n      x_post: \"X 帖子/主题\",\n      podcast: \"播客脚本\",\n      newsletter: \"时事通讯摘要\",\n      landing: \"着陆页介绍\",\n      video: \"短视频脚本\",\n      graphic: \"图形提示\",\n      facebook: \"Facebook 帖子\",\n      instagram: \"Instagram 标题 + 标签\",\n      tiktok: \"TikTok 视频脚本\",\n      reddit: \"Reddit 帖子\"\n    },\n    tones: {\n      professional: \"专业\",\n      casual: \"休闲\",\n      marketing: \"营销\",\n      funny: \"有趣\"\n    },\n    languages: {\n      he: \"希伯来语\",\n      en: \"英语\",\n      ar: \"阿拉伯语\",\n      es: \"西班牙语\",\n      fr: \"法语\",\n      zh: \"中文\",\n      it: \"意大利语\"\n    },\n    depths: {\n      quick_summary: \"快速摘要\",\n      standard: \"标准\",\n      enriched: \"丰富（默认）\",\n      deep_dive: \"深度挖掘\"\n    }\n  },\n  it: {\n    title: \"Nuova Conversione\",\n    subtitle: \"Da un Post a Ovunque\",\n    inputLabel: \"Testo da Convertire\",\n    inputPlaceholder: \"Incolla qui il tuo post o articolo...\",\n    urlLabel: \"Oppure inserisci l'URL\",\n    urlPlaceholder: \"https://example.com/blog-post\",\n    importFromUrl: \"Importa da URL\",\n    selectFormats: \"Seleziona Formati\",\n    writingTone: \"Tono di Scrittura\",\n    outputLanguage: \"Lingua di Output\",\n    contentDepth: \"Profondità del Contenuto\",\n    generateContent: \"Genera Contenuto\",\n    processing: \"Elaborazione...\",\n    completed: \"Completato!\",\n    copyToClipboard: \"Copia negli Appunti\",\n    downloadPdf: \"Scarica PDF\",\n    editContent: \"Modifica Contenuto\",\n    regenerate: \"Rigenera\",\n    limitReached: \"Hai raggiunto il limite mensile di conversioni\",\n    upgradeNow: \"Aggiorna Ora\",\n    importingFromUrl: \"Importazione da URL...\",\n    expandFurther: \"Espandi Ulteriormente\",\n    makeMoreDetailed: \"Rendi Più Dettagliato\",\n    addExamples: \"Aggiungi Esempi Reali\",\n    savingEdit: \"Salvataggio modifiche...\",\n    regeneratingFormat: \"Rigenerazione formato...\",\n    outputsTitle: \"I Tuoi Output\",\n    save: \"Salva\",\n    cancel: \"Annulla\",\n    switchToEnglish: \"English\",\n    switchToHebrew: \"עברית\",\n    confirmChangeLanguage: \"Cambiare lingua reimposterà il modulo. Continuare?\",\n    formats: {\n      linkedin: \"Post di LinkedIn\",\n      x_post: \"Post/Thread di X\",\n      podcast: \"Script di Podcast\",\n      newsletter: \"Riepilogo Newsletter\",\n      landing: \"Introduzione Pagina di Destinazione\",\n      video: \"Script di Breve Video\",\n      graphic: \"Richiesta Grafica\",\n      facebook: \"Post di Facebook\",\n      instagram: \"Didascalia Instagram + Hashtag\",\n      tiktok: \"Script Video TikTok\",\n      reddit: \"Post di Reddit\"\n    },\n    tones: {\n      professional: \"Professionale\",\n      casual: \"Informale\",\n      marketing: \"Marketing\",\n      funny: \"Divertente\"\n    },\n    languages: {\n      he: \"Ebraico\",\n      en: \"Inglese\",\n      ar: \"Arabo\",\n      es: \"Spagnolo\",\n      fr: \"Francese\",\n      zh: \"Cinese\",\n      it: \"Italiano\"\n    },\n    depths: {\n      quick_summary: \"Riepilogo Rapido\",\n      standard: \"Standard\",\n      enriched: \"Arricchito (Predefinito)\",\n      deep_dive: \"Analisi Approfondita\"\n    }\n  }\n};\n\ntranslations.he.formats = {\n  linkedin: \"פוסט לינקדאין\", x_post: \"X פוסט / ת'רד\", podcast: \"תסריט פודקאסט\", newsletter: \"סיכום ניוזלטר\", landing: \"מבוא לדף נחיתה\", video: \"תסריט וידאו קצר\", graphic: \"הנחיה לגרפיקה\", facebook: \"פוסט פייסבוק\", instagram: \"כיתוב אינסטגרם + האשטגים\", tiktok: \"תסריט TikTok\", reddit: \"פוסט Reddit\"\n};\ntranslations.en.formats = {\n  linkedin: \"LinkedIn Post\", x_post: \"X Post / Thread\", podcast: \"Podcast Script\", newsletter: \"Newsletter Summary\", landing: \"Landing Page Intro\", video: \"Short Video Script\", graphic: \"Graphic Prompt\", facebook: \"Facebook Post\", instagram: \"Instagram Caption + Hashtags\", tiktok: \"TikTok Video Script\", reddit: \"Reddit Post\"\n};\ntranslations.he.tones = { professional: \"מקצועי\", casual: \"חברותי\", marketing: \"שיווקי\", funny: \"משעשע\" };\ntranslations.en.tones = { professional: \"Professional\", casual: \"Casual\", marketing: \"Marketing\", funny: \"Funny\" };\ntranslations.he.languages = { he: \"עברית\", en: \"אנגלית\", ar: \"ערבית\", es: \"ספרדית\", fr: \"צרפתית\", zh: \"סינית\", it: \"איטלקית\" };\ntranslations.en.languages = { he: \"Hebrew\", en: \"English\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" };\ntranslations.he.depths = { quick_summary: \"סיכום מהיר\", standard: \"סטנדרטי\", enriched: \"מועשר (ברירת מחדל)\", deep_dive: \"צלילה לעומק\" };\ntranslations.en.depths = { quick_summary: \"Quick Summary\", standard: \"Standard\", enriched: \"Enriched (Default)\", deep_dive: \"Deep Dive\" };\n\n['ar', 'es', 'fr', 'zh', 'it'].forEach(lang => {\n  translations[lang] = JSON.parse(JSON.stringify(translations.en)); // Deep copy English as placeholder\n});\n\nconst XIcon = () => (\n  <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" className=\"w-5 h-5\">\n    <path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\"></path>\n  </svg>\n);\n\n\nconst planLimits = PLAN_LIMITS;\n\nconst formatOptions = [\n  { id: 'linkedin', icon: '💼' },\n  { id: 'x_post', icon: <XIcon /> },\n  { id: 'podcast', icon: '🎙️' },\n  { id: 'newsletter', icon: '📧' },\n  { id: 'landing', icon: '🚀' },\n  { id: 'video', icon: '🎬' },\n  { id: 'graphic', icon: '🎨' },\n  { id: 'facebook', icon: '📘' },\n  { id: 'instagram', icon: '📷' },\n  { id: 'tiktok', icon: '🎵' },\n  { id: 'reddit', icon: '👽' }\n];\n\nexport default function Convert({ effectiveLanguage, appTranslations }) {\n  const navigate = useNavigate();\n  const [user, setUser] = useState(null);\n  const [inputText, setInputText] = useState(\"\");\n  const [inputUrl, setInputUrl] = useState(\"\");\n  const [selectedFormats, setSelectedFormats] = useState([]);\n  const [writingTone, setWritingTone] = useState(\"professional\");\n\n  const [pageLanguage, setPageLanguage] = useState('en');\n  const [contentDepth, setContentDepth] = useState(\"enriched\");\n  const [outputs, setOutputs] = useState({});\n  const [processing, setProcessing] = useState(false);\n  const [formatProcessing, setFormatProcessing] = useState({});\n  const [importingUrl, setImportingUrl] = useState(false);\n  const [currentConversion, setCurrentConversion] = useState(null);\n  const [editingFormat, setEditingFormat] = useState(null);\n  const [editedContent, setEditedContent] = useState(\"\");\n  const [loading, setLoading] = useState(true);\n\n  // New states for layout and suggestions\n  const [layoutMode, setLayoutMode] = useState('wide'); // 'wide' | 'compact'\n  const [formatSuggestions, setFormatSuggestions] = useState([]);\n  const [suggestionsLoading, setSuggestionsLoading] = useState(false);\n\n\n  useEffect(() => {\n    const loadInitialData = async () => {\n      setLoading(true);\n      try {\n        const userData = await User.me();\n        setUser(userData);\n        setPageLanguage(userData.user_language || effectiveLanguage || 'en');\n      } catch (error) {\n        setPageLanguage(effectiveLanguage || 'en');\n      } finally {\n        setLoading(false);\n      }\n    };\n    loadInitialData();\n  }, [effectiveLanguage]);\n\n  // Suggest best formats automatically from input text\n  useEffect(() => {\n    const content = (inputText || \"\").trim();\n    if (content.length < 80) { setFormatSuggestions([]); return; }\n    setSuggestionsLoading(true);\n    const timer = setTimeout(async () => {\n      try {\n        const res = await InvokeLLM({\n          prompt: `\nFrom the content below, suggest the top 3 most suitable formats for distribution.\nAllowed ids: [\"linkedin\",\"x_post\",\"podcast\",\"newsletter\",\"landing\",\"video\",\"graphic\",\"facebook\",\"instagram\",\"tiktok\",\"reddit\"].\nReturn JSON: { \"formats\": [\"id1\",\"id2\",\"id3\"] }\n\nContent:\n${content}`.trim(),\n          response_json_schema: {\n            type: \"object\",\n            properties: { formats: { type: \"array\", items: { type: \"string\" } } },\n            required: [\"formats\"]\n          }\n        });\n        setFormatSuggestions(Array.isArray(res.formats) ? res.formats.slice(0, 3) : []);\n      } catch (e) {\n        setFormatSuggestions([]);\n      }\n      setSuggestionsLoading(false);\n    }, 600);\n    return () => clearTimeout(timer);\n  }, [inputText]);\n\n  const t = translations[pageLanguage] || translations.en;\n  const isRTL = pageLanguage === 'he' || pageLanguage === 'ar';\n\n  const getLocalizedText = (objKey, itemKey) => {\n    if (t[objKey] && t[objKey][itemKey]) {\n      return t[objKey][itemKey];\n    }\n    return translations.en[objKey]?.[itemKey] || itemKey;\n  };\n\n  const generatePrompt = (format, text, tone, language, depth) => {\n    const currentOutputLangT = translations[language] || translations.en;\n\n    let basePrompt = `You are an expert content strategist and copywriter.\nPlease rewrite the following blog post content into a ${currentOutputLangT.formats[format] || format} in ${currentOutputLangT.languages[language] || language}, using a ${currentOutputLangT.tones[tone] || tone} tone and adapting it to fit the conventions, best practices, and expectations of this format.\nEnsure: Rich and persuasive language, Clear structure (intro, body, conclusion), Hooks, call-to-actions, and relatable examples, Natural transitions and logical flow, Language adapted to the platform.`;\n\n    let formatInstructions = \"\";\n     switch (format) {\n      case 'newsletter':\n      case 'landing':\n      case 'linkedin':\n        formatInstructions = `- Ensure the content is at least 300-500 words.`;\n        break;\n      case 'podcast':\n        formatInstructions = `- Ensure the script is at least 500 words. Include speaker cues (e.g., Host:, Guest:), sound effects suggestions, and clear narrative structure.`;\n        break;\n      case 'x_post':\n        formatInstructions = `- Create a comprehensive thread of 10 posts for X (formerly Twitter).\n        - Start with a strong hook/teaser in the first post that grabs attention immediately.\n        - Each post should be between 250-280 characters to maximize engagement while staying within limits.\n        - Structure the thread as follows:\n          1. Hook/Attention grabber with a promise of value\n          2-3. Context and problem identification\n          4-6. Main content/solution with specific details\n          7-8. Examples, data, or case studies\n          9. Key takeaway or summary\n          10. Strong call-to-action and engagement prompt\n        - Use thread indicators (1/10, 2/10, etc.) at the start of each post.\n        - Include emojis strategically for visual appeal.\n        - End with engagement questions or calls-to-action to encourage replies and shares.\n        - Make each post valuable on its own while building a cohesive narrative.`;\n        break;\n      case 'video':\n        formatInstructions = `- Create a script for a short video (under 60 seconds). Include scene descriptions, voiceover text, and visual suggestions for each part of the script. Structure it for engagement (hook, main points, CTA).`;\n        break;\n      case 'facebook':\n        formatInstructions = `- Create a Facebook post (max 300 words). Use engaging storytelling, include 1-2 relevant hashtags, and end with a clear call-to-action. Make it conversational and shareable. Consider visual elements suggestions.`;\n        break;\n      case 'instagram':\n        formatInstructions = `- Create an Instagram caption (max 2,000 characters). Start with a hook in the first line. Include storytelling elements, encourage engagement with questions. Add 5-10 relevant hashtags at the end. Include \"Link in bio\" call-to-action if relevant.`;\n        break;\n      case 'tiktok':\n        formatInstructions = `- Create a TikTok video script (30-60 seconds). Structure: Hook (first 3 seconds), Value/Entertainment (middle), Strong CTA (end). Include timing cues, visual directions, and text overlay suggestions. Make it trend-worthy and engaging.`;\n        break;\n      case 'reddit':\n        formatInstructions = `- Create a Reddit post with Title (max 120 characters) and Body. Title should be discussion-starter. Body should provide value, encourage discussion, and follow Reddit etiquette. Be authentic and community-focused. Suggest relevant subreddits (r/marketing, r/ai, etc.).`;\n        break;\n      case 'graphic':\n        basePrompt = `You are an expert visual content strategist.\nGenerate a detailed prompt for an AI image generator (like Midjourney or DALL-E) to create a compelling visual that represents the following blog content.\nThe prompt should be in ${currentOutputLangT.languages[language] || language} and aim for a ${currentOutputLangT.tones[tone] || tone} visual style.\nConsider: Key themes and messages, Target audience, Desired mood, Specific visual elements, colors, composition, and artistic style.\nProvide a concise but comprehensive prompt.`;\n        formatInstructions = \"\";\n        break;\n    }\n\n    let depthInstructions = \"\";\n     switch (depth) {\n      case 'quick_summary':\n        depthInstructions = `- ${currentOutputLangT.depths.quick_summary || 'Provide a concise summary, highlighting only the most critical points. Keep it brief.'}`;\n        break;\n      case 'standard':\n        depthInstructions = `- ${currentOutputLangT.depths.standard || 'Provide a well-rounded piece covering the main aspects of the original content.'}`;\n        break;\n      case 'enriched':\n        depthInstructions = `- ${currentOutputLangT.depths.enriched || 'Elaborate on key concepts, provide richer descriptions, and ensure comprehensive coverage. Aim for insightful and engaging content.'}`;\n        break;\n      case 'deep_dive':\n        depthInstructions = `- ${currentOutputLangT.depths.deep_dive || 'Conduct a thorough exploration of the topic, including nuanced details, multiple perspectives, and in-depth analysis. This should be a substantial piece of content.'}`;\n        break;\n    }\n\n    const finalPrompt = `${basePrompt}\\n${formatInstructions}\\n${depthInstructions}\\nOriginal blog content:\\n${text}`;\n    return finalPrompt.trim();\n  };\n\n  const handleImportFromUrl = async () => {\n    if (!inputUrl.trim()) return;\n\n    setImportingUrl(true);\n    try {\n      const result = await InvokeLLM({\n        prompt: `Extract the main content from this webpage URL: ${inputUrl}. Return only the clean text content, removing navigation, ads, and other non-content elements.`,\n        add_context_from_internet: true\n      });\n\n      setInputText(result);\n      setInputUrl(\"\");\n    } catch (error) {\n      console.error(\"Error importing from URL:\", error);\n    }\n    setImportingUrl(false);\n  };\n\n  const handleFormatToggle = (formatId) => {\n    setSelectedFormats(prev => {\n      const newFormats = prev.includes(formatId)\n        ? prev.filter(f => f !== formatId)\n        : [...prev, formatId];\n      return newFormats;\n    });\n  };\n\n  const checkLimit = () => {\n    if (RUN_MODE_FREE) return true; // Free run mode bypass\n    if (user?.email === 'yaronpm.eng@gmail.com' || user?.special_access || user?.is_admin) {\n      return true;\n    }\n    const limit = planLimits[user?.plan_type] || planLimits.free;\n    const currentUsage = user?.monthly_conversions || 0;\n    if (limit === Infinity) return true;\n    if (currentUsage >= limit) {\n      const isHebrew = pageLanguage === 'he';\n      const message = isHebrew\n        ? \"הגעת למגבלת התוכנית החינמית שלך. אנא שדרג כדי להמשיך.\"\n        : \"You've reached the limit of your free plan. Please upgrade to continue.\";\n      alert(message);\n      if (user?.plan_type === 'free') {\n        window.location.href = \"https://paypal.me/yaron513/5.9\";\n      }\n      return false;\n    }\n    return true;\n  };\n\n  const handleGenerate = async () => {\n    if (!inputText.trim() || selectedFormats.length === 0) return;\n\n    if (!checkLimit()) {\n      return;\n    }\n\n    setProcessing(true);\n    setOutputs({});\n    setFormatProcessing({});\n\n    try {\n      const conversion = await Conversion.create({\n        input_text: inputText,\n        input_url: inputUrl,\n        selected_formats: selectedFormats,\n        writing_tone: writingTone,\n        output_language: pageLanguage,\n        content_depth: contentDepth,\n        outputs: {},\n        status: \"processing\"\n      });\n\n      setCurrentConversion(conversion);\n\n      const newOutputs = {};\n      for (const format of selectedFormats) {\n        setFormatProcessing(prev => ({ ...prev, [format]: true }));\n        try {\n          const prompt = generatePrompt(format, inputText, writingTone, pageLanguage, contentDepth);\n          const result = await InvokeLLM({ prompt });\n          newOutputs[format] = result;\n        } catch (error) {\n          newOutputs[format] = `שגיאה ביצירת תוכן עבור ${format}: ${error.message}`;\n        }\n        setFormatProcessing(prev => ({ ...prev, [format]: false }));\n      }\n\n      setOutputs(newOutputs);\n\n      await Conversion.update(conversion.id, {\n        outputs: newOutputs,\n        status: \"completed\"\n      });\n\n      if (!RUN_MODE_FREE) { // Only update usage if not in free run mode\n        await User.updateMyUserData({\n          monthly_conversions: (user.monthly_conversions || 0) + 1\n        });\n\n        setUser(prevUser => ({\n          ...prevUser,\n          monthly_conversions: (prevUser.monthly_conversions || 0) + 1\n        }));\n      }\n\n    } catch (error) {\n      console.error(\"Error generating content:\", error);\n      if(currentConversion && currentConversion.id){\n        await Conversion.update(currentConversion.id, { status: \"failed\" });\n      }\n    }\n    setProcessing(false);\n  };\n\n  const handleCopyToClipboard = async (content) => {\n    try {\n      await navigator.clipboard.writeText(content);\n    } catch (error) {\n      console.error(\"Failed to copy to clipboard:\", error);\n    }\n  };\n\n  const handleEdit = (format) => {\n    setEditingFormat(format);\n    setEditedContent(outputs[format]);\n  };\n\n  const handleSaveEdit = async () => {\n    if (!currentConversion || !editingFormat) return;\n    setFormatProcessing(prev => ({ ...prev, [editingFormat]: \"Saving edit...\" }));\n    try {\n      const updatedOutputs = {\n        ...outputs,\n        [editingFormat]: editedContent\n      };\n      await Conversion.update(currentConversion.id, { outputs: updatedOutputs });\n      setOutputs(updatedOutputs);\n      setEditingFormat(null);\n      setEditedContent(\"\");\n    } catch (error) {\n      console.error(\"Error saving edit:\", error);\n    }\n    setFormatProcessing(prev => ({ ...prev, [editingFormat]: false }));\n  };\n\n  const handleRegenerate = async (format) => {\n    if (!checkLimit()) return;\n\n    setFormatProcessing(prev => ({ ...prev, [format]: \"Regenerating format...\" }));\n    try {\n      const prompt = generatePrompt(format, inputText, writingTone, pageLanguage, contentDepth);\n      const result = await InvokeLLM({ prompt });\n      setOutputs(prev => ({\n        ...prev,\n        [format]: result\n      }));\n      if (currentConversion && currentConversion.id) {\n         await Conversion.update(currentConversion.id, { outputs: { ...outputs, [format]: result } });\n      }\n\n      if (!RUN_MODE_FREE) { // Only update usage if not in free run mode\n        await User.updateMyUserData({\n          monthly_conversions: (user.monthly_conversions || 0) + 1\n        });\n\n        setUser(prevUser => ({\n          ...prevUser,\n          monthly_conversions: (prevUser.monthly_conversions || 0) + 1\n        }));\n      }\n\n    } catch (error) {\n      console.error(\"Error regenerating content:\", error);\n      setOutputs(prev => ({ ...prev, [format]: `שגיאה ביצירת תוכן מחדש: ${error.message}` }));\n    }\n    setFormatProcessing(prev => ({ ...prev, [format]: false }));\n  };\n\n  const handlePostGenerationAction = async (format, actionType) => {\n    if (!outputs[format] || !checkLimit()) return;\n\n    setFormatProcessing(prev => ({ ...prev, [format]: true }));\n    let actionPrompt = \"\";\n    const currentOutput = outputs[format];\n\n    switch (actionType) {\n      case 'expand':\n        actionPrompt = `Take the following text for a ${getLocalizedText('formats', format, pageLanguage)} and expand upon it. Add more details, explanations, or sections while maintaining the original tone (${getLocalizedText('tones', writingTone, pageLanguage)}) and core message. Ensure it is still suitable for the ${getLocalizedText('formats', format, pageLanguage)} format in ${getLocalizedText('languages', pageLanguage, pageLanguage)}.\\n\\nOriginal Text:\\n${currentOutput}`;\n        break;\n      case 'detail':\n        actionPrompt = `Make the following text for a ${getLocalizedText('formats', format, pageLanguage)} more detailed. Elaborate on existing points, provide specific examples or data if appropriate, and deepen the explanations. Maintain the ${getLocalizedText('tones', writingTone, pageLanguage)} tone and ${getLocalizedText('languages', pageLanguage, pageLanguage)} language.\\n\\nOriginal Text:\\n${currentOutput}`;\n        break;\n      case 'examples':\n        actionPrompt = `Add relevant real-world examples to the following text for a ${getLocalizedText('formats', format, pageLanguage)}. The examples should illustrate the key points and make the content more relatable and practical. Maintain the ${getLocalizedText('tones', writingTone, pageLanguage)} tone and ${getLocalizedText('languages', pageLanguage, pageLanguage)} language.\\n\\nOriginal Text:\\n${currentOutput}`;\n        break;\n      default:\n        setFormatProcessing(prev => ({ ...prev, [format]: false }));\n        return;\n    }\n\n    try {\n      const result = await InvokeLLM({ prompt: actionPrompt });\n      const newOutputs = { ...outputs, [format]: result };\n      setOutputs(newOutputs);\n      if (currentConversion && currentConversion.id) {\n        await Conversion.update(currentConversion.id, { outputs: newOutputs });\n      }\n\n      if (!RUN_MODE_FREE) { // Only update usage if not in free run mode\n        await User.updateMyUserData({\n          monthly_conversions: (user.monthly_conversions || 0) + 1\n        });\n\n        setUser(prevUser => ({\n          ...prevUser,\n          monthly_conversions: (prevUser.monthly_conversions || 0) + 1\n        }));\n      }\n\n    } catch (error) {\n      console.error(`Error with ${actionType} action:`, error);\n      setOutputs(prev => ({ ...prev, [format]: `${prev[format]}\\n\\nשגיאה בפעולת \"${actionType}\": ${error.message}` }));\n    }\n    setFormatProcessing(prev => ({ ...prev, [format]: false }));\n  };\n\n  if (!user && loading) {\n    return (\n      <div className=\"p-8 flex items-center justify-center\">\n        <Loader2 className=\"w-8 h-8 animate-spin\" />\n      </div>\n    );\n  }\n\n  const canGenerate = RUN_MODE_FREE ? true : (user ? (\n    user.email === 'yaronpm.eng@gmail.com' ||\n    user.special_access ||\n    user.is_admin ||\n    user.monthly_conversions < (planLimits[user.plan_type] || planLimits.free)\n  ) : true);\n\n\n  return (\n    <div className=\"min-h-screen bg-gray-50\" dir={isRTL ? 'rtl' : 'ltr'}>\n      <style>{`\n        /* Panels & cards emphasis */\n        .panel-card { background: white; border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 6px 16px rgba(16,24,40,0.06); }\n        .soft-card { background: white; border: 1px solid #e5e7eb; border-radius: 14px; }\n        .sticky-panel { position: sticky; top: 88px; }\n        .section-title { font-weight: 700; color: #0f766e; }\n        /* Format item */\n        .format-checkbox-container { display:flex; align-items:center; padding:12px 14px; border:2px solid #e2e8f0; border-radius:12px; background:white; transition:all .2s ease; width:100%; min-height:48px; }\n        .format-checkbox-container:hover { border-color:#14b8a6; background-color:#f0fdfa; }\n        .format-checkbox-container.selected { border-color:#14b8a6; background-color:#f0fdfa; }\n        .format-checkbox { width:18px; height:18px; margin-inline-end:12px; accent-color:#14b8a6; cursor: pointer; }\n        .format-icon { width:24px; height:24px; margin-inline-end:8px; display:flex; align-items:center; justify-content:center; }\n        .format-label { flex:1; font-weight:500; font-size:14px; color:#374151; cursor: pointer; }\n        .rtl .format-checkbox { margin-inline-end:0; margin-inline-start:12px; }\n        .rtl .format-icon { margin-inline-end:0; margin-inline-start:8px; }\n\n        @media (max-width: 640px) {\n          .format-checkbox-container {\n            padding: 10px 12px;\n            min-height: 44px;\n          }\n\n          .format-label {\n            font-size: 13px;\n          }\n        }\n      `}</style>\n\n      <div className={`${layoutMode === 'wide' ? 'max-w-7xl' : 'max-w-5xl'} mx-auto p-4 sm:p-6`}>\n        {/* Header with layout toggle */}\n        <div className=\"mb-4 sm:mb-6 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3\">\n          <div>\n            <h1 className=\"text-xl sm:text-2xl lg:text-3xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-1\">\n              {t.title}\n            </h1>\n            <p className=\"text-sm text-gray-600\">{t.subtitle}</p>\n          </div>\n\n          <div className=\"flex items-center gap-2\">\n            <Button variant={layoutMode === 'compact' ? 'default' : 'outline'} size=\"sm\" onClick={() => setLayoutMode('compact')}>\n              <ToggleLeft className=\"w-4 h-4 mr-1\" /> {isRTL ? 'מצב קומפקטי' : 'Compact View'}\n            </Button>\n            <Button variant={layoutMode === 'wide' ? 'default' : 'outline'} size=\"sm\" onClick={() => setLayoutMode('wide')}>\n              <ToggleRight className=\"w-4 h-4 mr-1\" /> {isRTL ? 'מצב נרחב' : 'Wide View'}\n            </Button>\n          </div>\n        </div>\n\n        {/* 2-column desktop layout: left sticky controls, right content */}\n        <div className=\"grid grid-cols-1 lg:grid-cols-12 gap-6\">\n          {/* LEFT: Sticky Controls Panel */}\n          <div className=\"lg:col-span-4\">\n            <div className=\"sticky-panel space-y-4\">\n              {/* Group: Style Settings */}\n              <div className=\"panel-card p-4\">\n                <div className=\"flex items-center justify-between mb-2\">\n                  <h3 className=\"section-title text-base\">{isRTL ? 'הגדרות סגנון' : 'Style Settings'}</h3>\n                  <Info className=\"w-4 h-4 text-teal-600 opacity-70\" />\n                </div>\n                <div className=\"grid grid-cols-1 gap-3\">\n                  {/* Language */}\n                  <div>\n                    <Label htmlFor=\"outputLanguage\" className=\"text-sm font-medium mb-1 block\">{t.outputLanguage}</Label>\n                    <Select value={pageLanguage} onValueChange={setPageLanguage}>\n                      <SelectTrigger id=\"outputLanguage\"><SelectValue /></SelectTrigger>\n                      <SelectContent>\n                        {Object.entries(t.languages).map(([key, value]) => (\n                          <SelectItem key={key} value={key}>{value}</SelectItem>\n                        ))}\n                      </SelectContent>\n                    </Select>\n                  </div>\n                  {/* Tone */}\n                  <div>\n                    <Label htmlFor=\"writingTone\" className=\"text-sm font-medium mb-1 block\">{t.writingTone}</Label>\n                    <Select value={writingTone} onValueChange={setWritingTone}>\n                      <SelectTrigger id=\"writingTone\"><SelectValue /></SelectTrigger>\n                      <SelectContent>\n                        {Object.entries(t.tones).map(([key, value]) => (\n                          <SelectItem key={key} value={key}>{value}</SelectItem>\n                        ))}\n                      </SelectContent>\n                    </Select>\n                  </div>\n                  {/* Depth */}\n                  <div>\n                    <Label htmlFor=\"contentDepth\" className=\"text-sm font-medium mb-1 block\">{t.contentDepth}</Label>\n                    <Select value={contentDepth} onValueChange={setContentDepth}>\n                      <SelectTrigger id=\"contentDepth\"><SelectValue /></SelectTrigger>\n                      <SelectContent>\n                        {Object.entries(t.depths).map(([key, value]) => (\n                          <SelectItem key={key} value={key}>{value}</SelectItem>\n                        ))}\n                      </SelectContent>\n                    </Select>\n                  </div>\n                </div>\n              </div>\n\n              {/* Group: Formats (with auto-suggestions) */}\n              <div className=\"panel-card p-4\">\n                <div className=\"flex items-center justify-between mb-2\">\n                  <h3 className=\"section-title text-base\">{t.selectFormats}</h3>\n                  <span className=\"text-xs text-gray-500\">{isRTL ? 'נבחרו:' : 'Selected:'} {selectedFormats.length}</span>\n                </div>\n\n                {/* Suggestions */}\n                <div className=\"mb-3\">\n                  <div className=\"flex flex-wrap gap-2 items-center\">\n                    <span className=\"text-xs text-gray-600\">{isRTL ? 'הצעות:' : 'Suggestions:'}</span>\n                    {suggestionsLoading ? (\n                      <Badge variant=\"outline\" className=\"text-gray-500\">\n                        <Loader2 className=\"w-3 h-3 animate-spin mr-1\" /> {isRTL ? 'טוען...' : 'Loading...'}\n                      </Badge>\n                    ) : (\n                      formatSuggestions.map((f) => (\n                        <Badge key={`sug-${f}`} onClick={() => handleFormatToggle(f)} className={`cursor-pointer ${selectedFormats.includes(f) ? 'bg-teal-600 text-white' : 'bg-teal-50 text-teal-700'}`}>\n                          {getLocalizedText('formats', f)}\n                        </Badge>\n                      ))\n                    )}\n                    {!!formatSuggestions.length && (\n                      <Button\n                        size=\"xs\"\n                        variant=\"outline\"\n                        onClick={() => setSelectedFormats(formatSuggestions)}\n                        className=\"ml-auto\"\n                      >\n                        {isRTL ? 'החל הכל' : 'Apply All'}\n                      </Button>\n                    )}\n                  </div>\n                </div>\n\n                <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n                  {formatOptions.map((format) => (\n                    <div\n                      key={format.id}\n                      className={`format-checkbox-container ${selectedFormats.includes(format.id) ? 'selected' : ''}`}\n                      onClick={() => handleFormatToggle(format.id)}\n                    >\n                      <input\n                        type=\"checkbox\"\n                        className=\"format-checkbox\"\n                        checked={selectedFormats.includes(format.id)}\n                        onChange={() => handleFormatToggle(format.id)}\n                        onClick={(e) => e.stopPropagation()}\n                      />\n                      <div className=\"format-icon\">\n                        {typeof format.icon === 'string' ? <span className=\"text-lg\">{format.icon}</span> : format.icon}\n                      </div>\n                      <span className=\"format-label\">{getLocalizedText('formats', format.id)}</span>\n                    </div>\n                  ))}\n                </div>\n              </div>\n\n              {/* CTA primary inside sticky panel */}\n              <div className=\"panel-card p-4\">\n                {user && !canGenerate && (\n                  <Alert className=\"border-red-300 bg-red-50 text-red-700 p-3 mb-4\">\n                    <AlertCircle className=\"h-4 w-4 text-red-600\" />\n                    <AlertDescription>\n                      <div className=\"space-y-2\">\n                        <p className=\"font-medium text-sm\">\n                          {t.limitReached || \"You've reached the limit of your free plan. Upgrade to continue using RePostly AI.\"}\n                        </p>\n                        <div className=\"flex flex-col sm:flex-row gap-2\">\n                          <Button\n                            variant=\"destructive\"\n                            size=\"sm\"\n                            className=\"bg-red-600 hover:bg-red-700 text-white text-xs px-3 py-1\"\n                            onClick={() => navigate(createPageUrl(\"Pricing\"))}\n                          >\n                            {t.upgradeNow || \"Upgrade Plan\"}\n                          </Button>\n                          <span className=\"text-xs text-red-600\">\n                            {user.monthly_conversions || 0}/{planLimits[user.plan_type] || planLimits.free} conversions used this month\n                          </span>\n                        </div>\n                      </div>\n                    </AlertDescription>\n                  </Alert>\n                )}\n                <Button\n                  onClick={handleGenerate}\n                  disabled={!inputText.trim() || selectedFormats.length === 0 || processing || !canGenerate}\n                  className=\"w-full py-3 rounded-lg font-medium bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white shadow-lg\"\n                >\n                  {processing ? (<><Loader2 className=\"w-4 h-4 mr-2 animate-spin\" />{t.processing}</>) : (<><Sparkles className=\"w-4 h-4 mr-2\" />{t.generateContent}</>)}\n                </Button>\n              </div>\n            </div>\n          </div>\n\n          {/* RIGHT: Source content + analysis + outputs */}\n          <div className=\"lg:col-span-8 space-y-4\">\n            {/* Group: Source Content */}\n            <div className=\"panel-card\">\n              <div className=\"p-4 border-b border-gray-200\">\n                <h3 className=\"section-title text-base\">{isRTL ? 'תוכן מקור' : 'Source Content'}</h3>\n              </div>\n              <div className=\"p-4 space-y-4\">\n                <div>\n                  <Card className=\"soft-card shadow-none border-0\">\n                    <CardHeader className=\"pb-3\">\n                      <CardTitle className=\"flex items-center gap-2 text-lg\">\n                        <FileText className=\"w-5 h-5 text-teal-600\" />\n                        {t.inputLabel}\n                      </CardTitle>\n                    </CardHeader>\n                    <CardContent className=\"space-y-4 p-4\">\n                      <Textarea\n                        placeholder={t.inputPlaceholder}\n                        value={inputText}\n                        onChange={(e) => setInputText(e.target.value)}\n                        rows={8}\n                        className=\"resize-none\"\n                      />\n                      <div className=\"flex gap-2\">\n                        <Input\n                          placeholder={t.urlPlaceholder}\n                          value={inputUrl}\n                          onChange={(e) => setInputUrl(e.target.value)}\n                          className=\"flex-1\"\n                        />\n                        <Button\n                          onClick={handleImportFromUrl}\n                          disabled={!inputUrl.trim() || importingUrl}\n                          variant=\"outline\"\n                          title={t.importFromUrl}\n                          size=\"sm\"\n                        >\n                          {importingUrl ? <Loader2 className=\"w-4 h-4 animate-spin\" /> : <Globe className=\"w-4 h-4\" />}\n                        </Button>\n                      </div>\n                    </CardContent>\n                  </Card>\n                </div>\n              </div>\n            </div>\n\n            {/* Analyzer stays next to content */}\n            <PostAnalyzerCard\n              inputText={inputText}\n              language={pageLanguage}\n              tone={writingTone}\n              onApplyRewrite={(newText) => setInputText(newText)}\n            />\n\n            {/* Outputs */}\n            {Object.keys(outputs).length > 0 && (\n              <div className=\"panel-card p-4\">\n                <div className=\"flex items-center gap-2 mb-4\">\n                  <CheckCircle className=\"w-5 h-5 text-green-500\" />\n                  <h3 className=\"text-lg font-bold\">{t.outputsTitle}</h3>\n                </div>\n                <div className=\"space-y-4\">\n                  {selectedFormats.map((format) => (\n                    <Card key={format} className=\"bg-white shadow-sm border-gray-200\">\n                      <CardHeader className=\"pb-3\">\n                        <div className=\"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2\">\n                          <CardTitle className=\"flex items-center gap-2 text-base\">\n                            <span className=\"text-lg\">\n                              {formatOptions.find(f => f.id === format)?.icon}\n                            </span>\n                            {getLocalizedText('formats', format)}\n                          </CardTitle>\n                          <div className=\"flex gap-1 flex-wrap\">\n                            <Button size=\"sm\" variant=\"outline\" onClick={() => handleCopyToClipboard(outputs[format])} disabled={!!formatProcessing[format]} title={t.copyToClipboard}>\n                              <Copy className=\"w-3 h-3\" />\n                            </Button>\n                            <Button size=\"sm\" variant=\"outline\" onClick={() => handleEdit(format)} disabled={!!formatProcessing[format]} title={t.editContent}>\n                              <Edit3 className=\"w-3 h-3\" />\n                            </Button>\n                            <Button size=\"sm\" variant=\"outline\" onClick={() => handleRegenerate(format)} disabled={!canGenerate || !!formatProcessing[format]} title={t.regenerate}>\n                              {formatProcessing[format] === \"Regenerating format...\" ? <Loader2 className=\"w-3 h-3 animate-spin\" /> : <RefreshCw className=\"w-3 h-3\" />}\n                            </Button>\n                            <SocialShareButtons\n                              content={outputs[format]}\n                              format={format}\n                              effectiveLanguage={pageLanguage}\n                            />\n                          </div>\n                        </div>\n                      </CardHeader>\n                      <CardContent className=\"p-4\">\n                        {editingFormat === format ? (\n                          <div className=\"space-y-3\">\n                            <Textarea\n                              value={editedContent}\n                              onChange={(e) => setEditedContent(e.target.value)}\n                              rows={8}\n                              className=\"resize-none\"\n                            />\n                            <div className=\"flex gap-2\">\n                              <Button size=\"sm\" onClick={handleSaveEdit} disabled={!!formatProcessing[format]}>\n                                {formatProcessing[format] === \"Saving edit...\" ? <Loader2 className=\"w-3 h-3 animate-spin mr-1\" /> : null}\n                                {t.save}\n                              </Button>\n                              <Button size=\"sm\" variant=\"outline\" onClick={() => setEditingFormat(null)} disabled={!!formatProcessing[format]}>\n                                {t.cancel}\n                              </Button>\n                            </div>\n                          </div>\n                        ) : (\n                          <div className={`whitespace-pre-wrap text-sm bg-gray-50 p-4 rounded-lg min-h-[120px] ${formatProcessing[format] ? 'opacity-70' : ''}`}>\n                            {formatProcessing[format] && typeof formatProcessing[format] === 'boolean' ? (\n                              <div className=\"flex items-center gap-2 text-gray-500\">\n                                <Loader2 className=\"w-4 h-4 animate-spin\" />\n                                {t.processing}\n                              </div>\n                            ) : (\n                              outputs[format] || (\n                                <div className=\"flex items-center gap-2 text-gray-500\">\n                                  <Loader2 className=\"w-4 h-4 animate-spin\" />\n                                  {t.processing}\n                                </div>\n                              )\n                            )}\n                          </div>\n                        )}\n                        {!editingFormat && outputs[format] && !formatProcessing[format] && (\n                          <div className=\"mt-3 flex flex-wrap gap-2\">\n                            <Button size=\"sm\" variant=\"ghost\" className=\"text-blue-600 hover:bg-blue-50 text-xs\" onClick={() => handlePostGenerationAction(format, 'expand')} disabled={!canGenerate || !!formatProcessing[format]}>\n                              {t.expandFurther}\n                            </Button>\n                            <Button size=\"sm\" variant=\"ghost\" className=\"text-blue-600 hover:bg-blue-50 text-xs\" onClick={() => handlePostGenerationAction(format, 'detail')} disabled={!canGenerate || !!formatProcessing[format]}>\n                              {t.makeMoreDetailed}\n                            </Button>\n                            <Button size=\"sm\" variant=\"ghost\" className=\"text-blue-600 hover:bg-blue-50 text-xs\" onClick={() => handlePostGenerationAction(format, 'examples')} disabled={!canGenerate || !!formatProcessing[format]}>\n                              {t.addExamples}\n                            </Button>\n                          </div>\n                        )}\n                      </CardContent>\n                    </Card>\n                  ))}\n                </div>\n              </div>\n            )}\n          </div>\n        </div>\n      </div>\n\n      {/* Floating CTA (desktop) */}\n      <div className=\"hidden lg:flex fixed bottom-24 right-6 z-40\">\n        <Button\n          onClick={handleGenerate}\n          disabled={!inputText.trim() || selectedFormats.length === 0 || processing || !canGenerate}\n          className=\"rounded-full px-5 py-3 shadow-2xl bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white\"\n          title={t.generateContent}\n        >\n          {processing ? <Loader2 className=\"w-4 h-4 mr-2 animate-spin\" /> : <Sparkles className=\"w-4 h-4 mr-2\" />}\n          {processing ? t.processing : t.generateContent}\n        </Button>\n      </div>\n    </div>\n  );\n}\n","Pricing":"\nimport React from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport {\n  Zap,\n  Star,\n  Diamond,\n  RefreshCw,\n  Loader2,\n  CheckCircle,\n  AlertCircle\n} from \"lucide-react\";\nimport { useNavigate } from 'react-router-dom';\nimport PayPalSubscriptionButton from '../components/payments/PayPalSubscriptionButton';\nimport { RUN_MODE_FREE } from \"@/components/config\"; // Updated import for RUN_MODE_FREE\n\n// Define PayPal Plan IDs for actual subscriptions\n// These are placeholder IDs and should be replaced with your actual PayPal Subscription Plan IDs\n// obtained from your PayPal Developer Dashboard.\nconst PAYPAL_SUBSCRIPTION_PLAN_IDS = {\n  basic: \"P-6DN55179DP995293ENBEUZVQ\",   // Example PayPal Plan ID for 'basic' plan\n  pro: \"P-5AY18892AT0712446NBEU3DY\",     // Example PayPal Plan ID for 'pro' plan\n  ultra: \"P-94N45978Y3751092WNBEUTOI\",   // Example PayPal Plan ID for 'ultra' plan\n};\n\nconst translations = {\n  he: {\n    title: \"תוכניות תמחור\",\n    subtitle: \"שדרג כדי לפתוח יכולות מתקדמות ויצירת תוכן ללא הגבלה\",\n    currentPlan: \"התוכנית הנוכחית שלך\",\n    mostPopular: \"הפופולרי ביותר\",\n    processing: \"בטיפול...\",\n    downgrade: \"שנמך\",\n    selectPlan: \"בחר תוכנית\",\n    planUpdatedSuccessfully: \"התוכנית עודכנה בהצלחה!\",\n    errorUpdatingPlan: \"שגיאה בעדכון התוכנית\",\n    paymentError: \"שגיאה ביצירת תשלום. אנא נסה שוב.\",\n    month: \"חודש\",\n    faqTitle: \"שאלות נפוצות\",\n    faqs: [\n      {\n        question: \"האם אוכל לשנות את התוכנית שלי מאוחר יותר?\",\n        answer: \"כן, תוכל לשדרג או לשנמך את התוכנית שלך בכל עת מהגדרות החשבון שלך.\"\n      },\n      {\n        question: \"אילו שיטות תשלום אתם מקבלים?\",\n        answer: \"אנו מקבלים כרגע תשלומים באמצעות PayPal, התומך בכרטיסי אשראי מרכזיים.\"\n      },\n      {\n        question: \"האם קיימת מדיניות החזר כספי?\",\n        answer: \"אנו מציעים אחריות להחזר כספי תוך 7 ימים עבור כל התוכניות בתשלום. אנא צור קשר עם התמיכה לפרטים נוספים.\"\n      },\n      {\n        question: \"כיצד אוכל לבטל את המנוי שלי?\",\n        answer: \"באפשרותך לבטל את המנוי שלך בכל עת מהגדרות החשבון שלך. התוכנית שלך תישאר פעילה עד תום מחזור החיוב הנוכחי.\"\n      },\n      {\n        question: \"איך מקבלים תמיכה?\",\n        answer: \"התמיכה לכל התוכניות היא באימייל בלבד תוך 24 שעות בכתובת: repostlyai@gmail.com\"\n      }\n    ],\n    plans: {\n      free: { \n        name: \"חינם\", \n        price: \"$0\", \n        description: \"מושלם להתנסות\", \n        features: [ \n          \"עד 5 המרות לחודש\", \n          \"כל הפורמטים הבסיסיים\", \n          \"תמיכה בעברית ואנגלית\", \n          \"תמיכה באימייל (מענה עד 24 שעות)\" \n        ] \n      },\n      basic: { \n        name: \"בסיסי\", \n        price: \"$5.90\", \n        description: \"לשימוש קבוע\", \n        features: [ \n          \"עד 50 המרות לחודש\", \n          \"כל הפורמטים\", \n          \"תמיכה בכל השפות\", \n          \"היסטוריית המרות\", \n          \"תמיכה באימייל (מענה עד 24 שעות)\" \n        ] \n      },\n      pro: { \n        name: \"מקצועי\", \n        price: \"$12.90\", \n        description: \"לעסקים קטנים\", \n        features: [ \n          \"עד 200 המרות לחודש\", \n          \"כל הפורמטים המתקדמים\", \n          \"תמיכה באימייל (מענה עד 24 שעות)\" \n        ] \n      },\n      ultra: { \n        name: \"אולטרה\", \n        price: \"$19.90\", \n        description: \"לעסקים גדולים\", \n        features: [ \n          \"המרות ללא הגבלה\", \n          \"כל התכונות\", \n          \"תמיכה באימייל (מענה עד 24 שעות)\" \n        ] \n      }\n    }\n  },\n  en: {\n    title: \"Pricing Plans\",\n    subtitle: \"Upgrade to unlock advanced features and unlimited content creation\",\n    currentPlan: \"Your Current Plan\",\n    mostPopular: \"Most Popular\",\n    processing: \"Processing...\",\n    downgrade: \"Downgrade\",\n    selectPlan: \"Select Plan\",\n    planUpdatedSuccessfully: \"Plan updated successfully!\",\n    errorUpdatingPlan: \"Error updating plan\",\n    paymentError: \"Error creating payment. Please try again.\",\n    month: \"month\",\n    faqTitle: \"Frequently Asked Questions\",\n    faqs: [\n      {\n        question: \"Can I change my plan later?\",\n        answer: \"Yes, you can upgrade or downgrade your plan at any time from your account settings.\"\n      },\n      {\n        question: \"What payment methods do you accept?\",\n        answer: \"We currently accept payments via PayPal, supporting major credit cards.\"\n      },\n      {\n        question: \"Is there a refund policy?\",\n        answer: \"We offer a 7-day money-back guarantee for all paid plans. Please contact support for more details.\"\n      },\n      {\n        question: \"How do I cancel my subscription?\",\n        answer: \"You can cancel your subscription at any time from your account settings. Your plan remains active until the end of the current billing cycle.\"\n      },\n      {\n        question: \"How do I get support?\",\n        answer: \"Support for all plans is email-only within 24 hours at: repostlyai@gmail.com\"\n      }\n    ],\n    plans: {\n      free: { \n        name: \"Free\", \n        price: \"$0\", \n        description: \"Perfect for trying out\", \n        features: [ \n          \"Up to 5 conversions per month\", \n          \"All basic formats\", \n          \"Hebrew & English support\", \n          \"Email support (response within 24 hours)\" \n        ] \n      },\n      basic: { \n        name: \"Basic\", \n        price: \"$5.90\", \n        description: \"For regular use\", \n        features: [ \n          \"Up to 50 conversions per month\", \n          \"All formats\", \n          \"All language support\", \n          \"Conversion history\", \n          \"Email support (response within 24 hours)\" \n        ] \n      },\n      pro: { \n        name: \"Pro\", \n        price: \"$12.90\", \n        description: \"For small businesses\", \n        features: [ \n          \"Up to 200 conversions per month\", \n          \"All advanced formats\", \n          \"Email support (response within 24 hours)\" \n        ] \n      },\n      ultra: { \n        name: \"Ultra\", \n        price: \"$19.90\", \n        description: \"For large businesses\", \n        features: [ \n          \"Unlimited conversions\", \n          \"All features\", \n          \"Email support (response within 24 hours)\" \n        ] \n      }\n    }\n  }\n};\n\nconst planIcons = {\n  free: RefreshCw,\n  basic: Zap,\n  pro: Star,\n  ultra: Diamond\n};\n\nconst planColors = {\n  free: \"from-gray-400 to-gray-600\",\n  basic: \"from-teal-500 to-teal-700\",\n  pro: \"from-emerald-500 to-emerald-700\",\n  ultra: \"from-amber-400 to-orange-500\"\n};\n\nexport default function Pricing({ effectiveLanguage, appTranslations }) {\n  const navigate = useNavigate();\n  const [user, setUser] = React.useState(null);\n  const [loading, setLoading] = React.useState(true);\n  const [processingPayment, setProcessingPayment] = React.useState(null);\n  const [paymentError, setPaymentError] = React.useState(null);\n\n  React.useEffect(() => {\n    const loadUser = async () => {\n      try {\n        const userData = await User.me();\n        setUser(userData);\n      } catch (error) {\n        console.log(\"User not authenticated or error loading user:\", error);\n      }\n      setLoading(false);\n    };\n    loadUser();\n  }, []);\n\n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  const handleSubscriptionSuccess = (subscriptionId, planType) => {\n    console.log(`Subscription ${subscriptionId} created for plan ${planType}`);\n    \n    // Update local user state\n    setUser(prev => ({\n      ...prev,\n      plan_type: planType,\n      monthly_conversions: 0, // Reset monthly conversions on new subscription\n      paypal_subscription_id: subscriptionId\n    }));\n\n    // Show success message\n    const message = effectiveLanguage === 'he'\n      ? `המנוי שלך הופעל בהצלחה! תוכנית: ${t.plans[planType]?.name}`\n      : `Your subscription has been activated! Plan: ${t.plans[planType]?.name}`;\n    \n    alert(message);\n    setPaymentError(null); // Clear any previous errors\n  };\n\n  const handleSubscriptionError = (error) => {\n    console.error('Subscription error:', error);\n    setPaymentError(error); // Set payment error state\n  };\n\n  const handlePlanSelection = async (planKey) => {\n    setPaymentError(null);\n\n    if (!user) {\n      try {\n        await User.login(); // Attempt to log in if user is not authenticated\n        return; // After login, the component should re-render and user state will be updated\n      } catch (error) {\n        console.error('Login failed:', error);\n        setPaymentError(t.errorUpdatingPlan || 'Login failed. Please try again.');\n        return;\n      }\n    }\n\n    // In free run mode, simply set the plan without any payment flow\n    if (RUN_MODE_FREE) {\n      try {\n        setProcessingPayment(planKey); // Indicate processing\n        await User.updateMyUserData({ plan_type: planKey, monthly_conversions: 0 });\n        setUser(prev => ({ ...prev, plan_type: planKey, monthly_conversions: 0 }));\n        alert(effectiveLanguage === 'he' ? 'החבילה עודכנה! (מצב חינמי)' : 'Plan updated! (Free run mode)');\n      } catch (error) {\n        console.error('Error updating plan:', error);\n        setPaymentError(t.errorUpdatingPlan);\n      } finally {\n        setProcessingPayment(null); // Clear processing state\n      }\n      return; // Exit after handling in free mode\n    }\n\n    // Existing logic for when not in free run mode:\n    // Handle downgrade to free plan\n    if (planKey === 'free') {\n      try {\n        setProcessingPayment(planKey); // Indicate processing for downgrade\n        await User.updateMyUserData({ plan_type: 'free' });\n        setUser(prev => ({ ...prev, plan_type: 'free' }));\n        alert(t.planUpdatedSuccessfully);\n      } catch (error) {\n        console.error('Error updating plan:', error);\n        setPaymentError(t.errorUpdatingPlan);\n      } finally {\n        setProcessingPayment(null); // Clear processing state\n      }\n      return;\n    }\n\n    // For paid plans (when not in free run mode), the PayPalSubscriptionButton component will handle the subscription flow.\n    // No action needed here for paid plans as the button component initiates the process.\n  };\n\n  if (loading) {\n    return (\n      <div className=\"p-8 flex items-center justify-center min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50\">\n        <Loader2 className=\"w-8 h-8 animate-spin text-teal-600\" />\n      </div>\n    );\n  }\n\n  return (\n    <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 p-4 sm:p-6 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <div className=\"max-w-7xl mx-auto\">\n        {/* Header */}\n        <div className=\"text-center mb-8 sm:mb-12\">\n          <h1 className=\"text-2xl sm:text-3xl md:text-4xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-3 sm:mb-4\">\n            {t.title}\n          </h1>\n          <p className=\"text-sm sm:text-base md:text-lg text-gray-600 max-w-2xl mx-auto\">\n            {RUN_MODE_FREE ? (effectiveLanguage === 'he'\n              ? \"מצב ריצה: כל החבילות חינמיות וזמינות ללא תשלום.\"\n              : \"Run mode: All plans are free and available without payment.\") : t.subtitle}\n          </p>\n        </div>\n\n        {/* Payment Error Alert */}\n        {!RUN_MODE_FREE && paymentError && (\n          <div className=\"mb-6 sm:mb-8\">\n            <Alert className=\"border-red-200 bg-red-50\">\n              <AlertCircle className=\"h-5 w-5 text-red-600\" />\n              <AlertDescription className=\"text-red-800\">\n                <p className=\"font-medium\">{t.paymentError}:</p>\n                <p>{paymentError instanceof Error ? paymentError.message : paymentError}</p>\n                <Button\n                  variant=\"outline\"\n                  size=\"sm\"\n                  className=\"mt-2\"\n                  onClick={() => setPaymentError(null)}\n                >\n                  Dismiss\n                </Button>\n              </AlertDescription>\n            </Alert>\n          </div>\n        )}\n\n        {/* Current Plan Display */}\n        {user && (\n          <div className=\"mb-6 sm:mb-8 text-center\">\n            <div className=\"inline-flex items-center gap-2 px-4 py-2 bg-white/80 backdrop-blur-md rounded-full border border-white/30 shadow-sm\">\n              <span className=\"text-sm text-gray-600\">{t.currentPlan}:</span>\n              <span className={`px-3 py-1 rounded-full text-sm font-medium bg-gradient-to-r ${planColors[user.plan_type || 'free']} text-white`}>\n                {t.plans[user.plan_type || 'free']?.name}\n              </span>\n            </div>\n          </div>\n        )}\n\n        {/* Pricing Cards */}\n        <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 sm:gap-6\">\n          {Object.entries(t.plans).map(([planKey, plan]) => {\n            const Icon = planIcons[planKey];\n            const isCurrentPlan = user?.plan_type === planKey;\n            const isProcessing = processingPayment === planKey;\n\n            return (\n              <Card\n                key={planKey}\n                className={`relative bg-white/90 backdrop-blur-xl border-2 transition-all duration-300 hover:shadow-xl\n                  ${isCurrentPlan\n                    ? 'border-teal-500 shadow-lg'\n                    : planKey === 'pro'\n                      ? 'border-purple-200 hover:border-purple-300'\n                      : 'border-white/30 hover:border-teal-200'\n                  }`}\n              >\n                {planKey === 'pro' && (\n                  <div className=\"absolute -top-3 left-1/2 transform -translate-x-1/2\">\n                    <Badge className=\"bg-gradient-to-r from-purple-500 to-pink-500 text-white px-3 py-1 rounded-full text-xs font-medium border-0\">\n                      {t.mostPopular}\n                    </Badge>\n                  </div>\n                )}\n\n                <CardHeader className=\"text-center p-4 sm:p-6\">\n                  <div className={`w-12 h-12 sm:w-16 sm:h-16 mx-auto mb-3 sm:mb-4 bg-gradient-to-r ${planColors[planKey]} rounded-xl flex items-center justify-center`}>\n                    <Icon className=\"w-6 h-6 sm:w-8 sm:h-8 text-white\" />\n                  </div>\n                  <CardTitle className=\"text-lg sm:text-xl font-bold mb-1 sm:mb-2\">{plan.name}</CardTitle>\n                  <div className=\"mb-2 sm:mb-3\">\n                    <span className=\"text-2xl sm:text-3xl font-bold text-teal-600\">\n                      {RUN_MODE_FREE ? \"$0\" : plan.price}\n                    </span>\n                    {planKey !== 'free' && <span className=\"text-sm text-gray-500\">/{t.month}</span>}\n                  </div>\n                  <p className=\"text-xs sm:text-sm text-gray-600\">\n                    {RUN_MODE_FREE ? (effectiveLanguage === 'he' ? 'זמין ללא תשלום בתקופת הרצה' : 'Available free during run period') : plan.description}\n                  </p>\n                </CardHeader>\n\n                <CardContent className=\"p-4 sm:p-6 pt-0\">\n                  <ul className=\"space-y-2 sm:space-y-3 mb-4 sm:mb-6\">\n                    {plan.features.map((feature, index) => (\n                      <li key={index} className=\"flex items-start gap-2 text-xs sm:text-sm text-gray-700\">\n                        <CheckCircle className=\"w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0\" />\n                        <span>{feature}</span>\n                      </li>\n                    ))}\n                  </ul>\n\n                  {/* Payment Button Logic */}\n                  {RUN_MODE_FREE ? (\n                    <Button\n                      onClick={() => handlePlanSelection(planKey)}\n                      disabled={isCurrentPlan || isProcessing}\n                      className={`w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white py-2 sm:py-2.5 text-sm font-medium transition-all duration-300 rounded-lg\n                        ${isCurrentPlan ? 'opacity-70 cursor-not-allowed from-gray-300 to-gray-400 hover:from-gray-300 hover:to-gray-400' : ''}\n                      `}\n                    >\n                      {isProcessing ? (\n                        <>\n                          <Loader2 className=\"w-4 h-4 animate-spin mr-2\" />\n                          {t.processing}\n                        </>\n                      ) : isCurrentPlan ? (\n                        t.currentPlan\n                      ) : (\n                        effectiveLanguage === 'he' ? 'בחר חינם' : 'Choose Free'\n                      )}\n                    </Button>\n                  ) : (\n                    <>\n                      {planKey === 'free' ? (\n                        <Button\n                          onClick={() => handlePlanSelection(planKey)}\n                          disabled={isCurrentPlan || isProcessing}\n                          className=\"w-full bg-gray-100 text-gray-700 hover:bg-gray-200 py-2 sm:py-2.5 text-sm font-medium transition-all duration-300 rounded-lg\"\n                        >\n                          {isProcessing ? (\n                            <>\n                              <Loader2 className=\"w-4 h-4 animate-spin mr-2\" />\n                              {t.processing}\n                            </>\n                          ) : isCurrentPlan ? (\n                            t.currentPlan\n                          ) : (\n                            t.downgrade\n                          )}\n                        </Button>\n                      ) : isCurrentPlan ? (\n                        <Button\n                          disabled={true}\n                          className=\"w-full bg-gray-100 text-gray-500 cursor-not-allowed py-2 sm:py-2.5 text-sm font-medium rounded-lg\"\n                        >\n                          {t.currentPlan}\n                        </Button>\n                      ) : (\n                        <PayPalSubscriptionButton\n                          paypalPlanId={PAYPAL_SUBSCRIPTION_PLAN_IDS[planKey]}\n                          planTypeForCallback={planKey}\n                          planName={plan.name}\n                          onSubscriptionSuccess={handleSubscriptionSuccess}\n                          onSubscriptionError={handleSubscriptionError}\n                          effectiveLanguage={effectiveLanguage}\n                        />\n                      )}\n                    </>\n                  )}\n                </CardContent>\n              </Card>\n            );\n          })}\n        </div>\n\n        {/* FAQ Section */}\n        <div className=\"mt-12 sm:mt-16\">\n          <h2 className=\"text-xl sm:text-2xl font-bold text-center mb-6 sm:mb-8 text-gray-800\">{t.faqTitle}</h2>\n          <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6 max-w-4xl mx-auto\">\n            {t.faqs.map((faq, index) => (\n              <Card key={index} className=\"bg-white/80 backdrop-blur-md border border-white/30 shadow-sm\">\n                <CardContent className=\"p-4 sm:p-6\">\n                  <h3 className=\"font-semibold mb-2 text-sm sm:text-base text-gray-800\">{faq.question}</h3>\n                  <p className=\"text-xs sm:text-sm text-gray-600\">{faq.answer}</p>\n                </CardContent>\n              </Card>\n            ))}\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n","Settings":"\nimport React, { useState, useEffect } from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Label } from \"@/components/ui/label\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport { \n  Settings as SettingsIcon,\n  Globe,\n  User as UserIcon,\n  CheckCircle,\n  AlertCircle,\n  Crown\n} from \"lucide-react\";\n\nconst translations = {\n  he: {\n    title: \"הגדרות\",\n    subtitle: \"נהל את החשבון וההעדפות שלך\",\n    accountInfo: \"פרטי החשבון\",\n    preferences: \"העדפות\", \n    language: \"שפת הממשק\",\n    currentPlan: \"התוכנית הנוכחית\",\n    monthlyUsage: \"שימוש חודשי\",\n    saveSettings: \"שמור הגדרות\",\n    settingsSaved: \"ההגדרות נשמרו בהצלחה\",\n    errorSaving: \"שגיאה בשמירת ההגדרות\",\n    saving: \"שומר...\",\n    languageChangeNote: \"שינוי השפה יחל את הדף\",\n    questionsSuggestions: \"יש לך שאלות או הצעות לשיפור?\",\n    contactUs: \"צרו קשר:\",\n    languages: { en: \"אנגלית\", he: \"עברית\", ar: \"ערבית\", es: \"ספרדית\", fr: \"צרפתית\", zh: \"סינית\", it: \"איטלקית\" },\n    plans: { free: \"חינם\", basic: \"בסיסי\", pro: \"מקצועי\", ultra: \"אולטרה\" }\n  },\n  en: {\n    title: \"Settings\",\n    subtitle: \"Manage your account and preferences\",\n    accountInfo: \"Account Information\",\n    preferences: \"Preferences\", \n    language: \"Interface Language\",\n    currentPlan: \"Current Plan\",\n    monthlyUsage: \"Monthly Usage\",\n    saveSettings: \"Save Settings\",\n    settingsSaved: \"Settings saved successfully\",\n    errorSaving: \"Error saving settings\",\n    saving: \"Saving...\",\n    languageChangeNote: \"Changing language will reload the page\",\n    questionsSuggestions: \"Have questions or suggestions for improvement?\",\n    contactUs: \"Contact us:\",\n    languages: { en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" },\n    plans: { free: \"Free\", basic: \"Basic\", pro: \"Pro\", ultra: \"Ultra\" }\n  },\n  ar: {\n    title: \"الإعدادات\",\n    subtitle: \"إدارة حسابك وتفضيلاتك\",\n    accountInfo: \"معلومات الحساب\",\n    preferences: \"تفضيلات\",\n    language: \"لغة الواجهة\",\n    currentPlan: \"الخطة الحالية\",\n    monthlyUsage: \"الاستخدام الشهري\",\n    saveSettings: \"حفظ الإعدادات\",\n    settingsSaved: \"تم حفظ الإعدادات بنجاح\",\n    errorSaving: \"خطأ في حفظ الإعدادات\",\n    saving: \"جارٍ الحفظ...\",\n    languageChangeNote: \"سيؤدي تغيير اللغة إلى إعادة تحميل الصفحة\",\n    questionsSuggestions: \"هل لديك أسئلة أو اقتراحات للتحسين؟\",\n    contactUs: \"اتصل بنا:\",\n    languages: { en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" },\n    plans: { free: \"Free\", basic: \"Basic\", pro: \"Pro\", ultra: \"Ultra\" }\n  },\n  es: {\n    title: \"Configuración\",\n    subtitle: \"Administra tu cuenta y preferencias\",\n    accountInfo: \"Información de la cuenta\",\n    preferences: \"Preferencias\",\n    language: \"Idioma de la interfaz\",\n    currentPlan: \"Plan actual\",\n    monthlyUsage: \"Uso mensual\",\n    saveSettings: \"Guardar configuración\",\n    settingsSaved: \"Configuración guardada exitosamente\",\n    errorSaving: \"Error al guardar la configuración\",\n    saving: \"Guardando...\",\n    languageChangeNote: \"Cambiar el idioma recargará la página\",\n    questionsSuggestions: \"¿Tiene preguntas o sugerencias de mejora?\",\n    contactUs: \"Contáctenos:\",\n    languages: { en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" },\n    plans: { free: \"Free\", basic: \"Basic\", pro: \"Pro\", ultra: \"Ultra\" }\n  },\n  fr: {\n    title: \"Paramètres\",\n    subtitle: \"Gérez votre compte et vos préférences\",\n    accountInfo: \"Informations sur le compte\",\n    preferences: \"Préférences\",\n    language: \"Langue de l'interface\",\n    currentPlan: \"Plan actuel\",\n    monthlyUsage: \"Utilisation mensuelle\",\n    saveSettings: \"Enregistrer les paramètres\",\n    settingsSaved: \"Paramètres enregistrés avec succès\",\n    errorSaving: \"Erreur lors de l'enregistrement des paramètres\",\n    saving: \"Enregistrement...\",\n    languageChangeNote: \"Changer de langue rechargera la page\",\n    questionsSuggestions: \"Vous avez des questions ou des suggestions d'amélioration ?\",\n    contactUs: \"Contactez nous:\",\n    languages: { en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" },\n    plans: { free: \"Free\", basic: \"Basic\", pro: \"Pro\", ultra: \"Ultra\" }\n  },\n  zh: {\n    title: \"设置\",\n    subtitle: \"管理您的帐户和偏好设置\",\n    accountInfo: \"帐户信息\",\n    preferences: \"偏好\",\n    language: \"界面语言\",\n    currentPlan: \"当前计划\",\n    monthlyUsage: \"每月用量\",\n    saveSettings: \"保存设置\",\n    settingsSaved: \"设置已成功保存\",\n    errorSaving: \"保存设置时出错\",\n    saving: \"保存中...\",\n    languageChangeNote: \"更改语言将重新加载页面\",\n    questionsSuggestions: \"有任何问题或改进建议吗？\",\n    contactUs: \"联系我们：\",\n    languages: { en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" },\n    plans: { free: \"Free\", basic: \"Basic\", pro: \"Pro\", ultra: \"Ultra\" }\n  },\n  it: {\n    title: \"Impostazioni\",\n    subtitle: \"Gestisci il tuo account e le preferenze\",\n    accountInfo: \"Informazioni account\",\n    preferences: \"Preferenze\",\n    language: \"Lingua dell'interfaccia\",\n    currentPlan: \"Piano attuale\",\n    monthlyUsage: \"Utilizzo mensile\",\n    saveSettings: \"Salva impostazioni\",\n    settingsSaved: \"Impostazioni salvate correttamente\",\n    errorSaving: \"Errore durante il salvataggio delle impostazioni\",\n    saving: \"Salvataggio...\",\n    languageChangeNote: \"La modifica della lingua ricaricherà la pagina\",\n    questionsSuggestions: \"Hai domande o suggerimenti per migliorare?\",\n    contactUs: \"Contattaci:\",\n    languages: { en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" },\n    plans: { free: \"Free\", basic: \"Basic\", pro: \"Pro\", ultra: \"Ultra\" }\n  }\n};\n\nconst planLimits = {\n  free: 2,\n  basic: 15,\n  pro: 100,\n  ultra: Infinity\n};\n\nconst planColors = {\n  free: \"bg-gray-100 text-gray-800\",\n  basic: \"bg-teal-100 text-teal-800\",\n  pro: \"bg-emerald-100 text-emerald-800\",\n  ultra: \"bg-gradient-to-r from-amber-400 to-orange-500 text-white\"\n};\n\nexport default function Settings({ effectiveLanguage }) {\n  const [user, setUser] = useState(null);\n  const [pageLanguage, setPageLanguage] = useState(effectiveLanguage || 'en'); \n  const [loading, setLoading] = useState(true);\n  const [saving, setSavingState] = useState(false);\n  const [message, setMessage] = useState(null);\n\n  useEffect(() => {\n    const init = async () => {\n      try {\n        const userData = await User.me();\n        setUser(userData);\n        setPageLanguage(userData.user_language || effectiveLanguage || 'en');\n      } catch (error) {\n        console.error(\"Error loading user:\", error);\n        setPageLanguage(effectiveLanguage || 'en');\n      }\n      setLoading(false);\n    };\n    init();\n  }, [effectiveLanguage]);\n\n  const t = translations[pageLanguage] || translations.en;\n  const isRTL = pageLanguage === 'he' || pageLanguage === 'ar';\n\n  const handleSaveSettings = async () => {\n    setSavingState(true);\n    setMessage(null);\n    \n    try {\n      await User.updateMyUserData({\n        user_language: pageLanguage\n      });\n      \n      setMessage({ type: 'success', text: t.settingsSaved });\n      \n      setTimeout(() => {\n        window.location.reload();\n      }, 1000);\n      \n    } catch (error) {\n      setMessage({ type: 'error', text: t.errorSaving });\n      console.error(\"Error saving settings:\", error);\n    }\n    setSavingState(false);\n  };\n\n  if (loading) {\n    return (\n      <div className=\"p-8 animate-pulse\">\n        <div className=\"h-8 bg-gray-200 rounded w-1/3 mb-6\"></div>\n        <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n          <div className=\"h-64 bg-gray-200 rounded-xl\"></div>\n          <div className=\"h-64 bg-gray-200 rounded-xl\"></div>\n        </div>\n      </div>\n    );\n  }\n  \n  const currentLimit = planLimits[user?.plan_type] || planLimits.free;\n  const currentUsage = user?.monthly_conversions || 0;\n  const usagePercentage = currentLimit === Infinity ? 0 : (currentUsage / currentLimit) * 100;\n\n  return (\n    <div className=\"p-6 md:p-8 min-h-screen\" dir={isRTL ? 'rtl' : 'ltr'}>\n      {/* Header */}\n      <div className=\"mb-8\">\n        <h1 className=\"text-3xl md:text-4xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-2\">\n          {t.title}\n        </h1>\n        <p className=\"text-gray-600\">{t.subtitle}</p>\n      </div>\n\n      {/* Message Alert */}\n      {message && (\n        <Alert className={`mb-6 ${message.type === 'success' ? 'border-green-200 bg-green-50' : 'border-red-200 bg-red-50'}`}>\n          {message.type === 'success' ? (\n            <CheckCircle className=\"h-4 w-4 text-green-600\" />\n          ) : (\n            <AlertCircle className=\"h-4 w-4 text-red-600\" />\n          )}\n          <AlertDescription className={message.type === 'success' ? 'text-green-800' : 'text-red-800'}>\n            {message.text}\n          </AlertDescription>\n        </Alert>\n      )}\n\n      <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-8\">\n        {/* Account Information */}\n        <Card className=\"bg-white/90 backdrop-blur-xl border-white/30 shadow-lg\">\n          <CardHeader>\n            <CardTitle className=\"flex items-center gap-2\">\n              <UserIcon className=\"w-5 h-5 text-teal-600\" />\n              {t.accountInfo}\n            </CardTitle>\n          </CardHeader>\n          <CardContent className=\"space-y-6\">\n            <div className=\"flex items-center gap-4\">\n              <div className=\"w-16 h-16 bg-gradient-to-r from-teal-500 to-emerald-600 rounded-full flex items-center justify-center\">\n                <span className=\"text-white font-bold text-xl\">\n                  {user?.full_name?.charAt(0) || 'U'}\n                </span>\n              </div>\n              <div>\n                <h3 className=\"font-semibold text-lg\">{user?.full_name}</h3>\n                <p className=\"text-gray-600\">{user?.email}</p>\n              </div>\n            </div>\n\n            <div className=\"space-y-4\">\n              <div>\n                <Label className=\"text-sm font-medium text-gray-700\">{t.currentPlan}</Label>\n                <div className=\"mt-1\">\n                  <Badge className={`${planColors[user?.plan_type]} border-0 px-3 py-1 text-sm font-medium`}>\n                    <Crown className=\"w-4 h-4 mr-1\" />\n                    {t.plans[user?.plan_type] || t.plans.free}\n                  </Badge>\n                </div>\n              </div>\n\n              <div>\n                <Label className=\"text-sm font-medium text-gray-700\">{t.monthlyUsage}</Label>\n                <div className=\"mt-2\">\n                  <div className=\"flex justify-between text-sm mb-1\">\n                    <span>{currentUsage}</span>\n                    <span>{currentLimit === Infinity ? '∞' : currentLimit}</span>\n                  </div>\n                  <div className=\"w-full bg-gray-200 rounded-full h-2\">\n                    <div \n                      className=\"bg-gradient-to-r from-teal-500 to-emerald-600 h-2 rounded-full transition-all duration-500\"\n                      style={{ width: `${Math.min(usagePercentage, 100)}%` }}\n                    ></div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </CardContent>\n        </Card>\n\n        {/* Preferences */}\n        <Card className=\"bg-white/90 backdrop-blur-xl border-white/30 shadow-lg\">\n          <CardHeader>\n            <CardTitle className=\"flex items-center gap-2\">\n              <SettingsIcon className=\"w-5 h-5 text-teal-600\" />\n              {t.preferences}\n            </CardTitle>\n          </CardHeader>\n          <CardContent className=\"space-y-6\">\n            <div>\n              <Label htmlFor=\"languageSelectSettings\" className=\"text-sm font-medium text-gray-700 mb-2 block\">\n                <Globe className=\"w-4 h-4 inline mr-2 text-teal-600\" />\n                {t.language}\n              </Label>\n              <Select value={pageLanguage} onValueChange={setPageLanguage}>\n                <SelectTrigger id=\"languageSelectSettings\" className=\"focus:ring-teal-500 focus:border-teal-500\">\n                  <SelectValue />\n                </SelectTrigger>\n                <SelectContent>\n                  {Object.entries(t.languages).map(([key, value]) => (\n                    <SelectItem key={key} value={key}>{value}</SelectItem>\n                  ))}\n                </SelectContent>\n              </Select>\n              <p className=\"text-xs text-gray-500 mt-1\">\n                {t.languageChangeNote}\n              </p>\n            </div>\n\n            <Button\n              onClick={handleSaveSettings}\n              disabled={saving || pageLanguage === user?.user_language}\n              className=\"w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white py-3 rounded-xl font-medium transition-all duration-300\"\n            >\n              {saving ? (\n                <>\n                  <div className=\"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2\"></div>\n                  {t.saving}\n                </>\n              ) : (\n                <>\n                  <CheckCircle className=\"w-4 h-4 mr-2\" />\n                  {t.saveSettings}\n                </>\n              )}\n            </Button>\n          </CardContent>\n        </Card>\n      </div>\n\n      {/* Footer */}\n      <div className=\"mt-12 text-center p-6 bg-teal-50 rounded-2xl\">\n        <p className=\"text-gray-600 mb-2\">\n          💡 {t.questionsSuggestions}\n        </p>\n        <p className=\"text-sm text-gray-500\">\n          {t.contactUs} \n          <a href=\"mailto:repostlyai@gmail.com\" className=\"text-teal-600 hover:underline mx-1\">\n            repostlyai@gmail.com\n          </a>\n        </p>\n      </div>\n    </div>\n  );\n}\n","MyConversions":"\nimport React, { useState, useEffect, useMemo } from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Conversion } from \"@/entities/Conversion\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from \"@/components/ui/table\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { Calendar } from \"@/components/ui/calendar\";\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogClose, DialogDescription } from \"@/components/ui/dialog\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { useNavigate } from \"react-router-dom\";\nimport { createPageUrl } from \"@/utils\";\nimport { format, parseISO, isValid, startOfDay, endOfDay } from \"date-fns\";\nimport { he, ar, es, fr, zhCN, it } from \"date-fns/locale\";\nimport { \n  FileText, \n  Search, \n  Filter, \n  Download, \n  Copy, \n  Edit3, \n  Eye, \n  Calendar as CalendarIcon,\n  RotateCcw, \n  Star as StarIcon, \n  X,\n  BookOpen,\n  Loader2 \n} from \"lucide-react\";\nimport { InvokeLLM } from \"@/integrations/Core\"; \nimport SocialShareButtons from \"../components/sharing/SocialShareButtons\";\n\nconst translations = {\n  he: {\n    title: \"ההמרות שלי\",\n    subtitle: \"עיין, סנן ונהל את כל התוכן שיצרת\",\n    searchPlaceholder: \"חפש לפי טקסט מקורי...\",\n    filterByDate: \"סנן לפי תאריך\",\n    filterByFormat: \"סנן לפי פורמט\",\n    filterByLanguage: \"סנן לפי שפה\",\n    date: \"תאריך\",\n    formats: \"פורמטים\",\n    originalInput: \"קלט מקורי\",\n    actions: \"פעולות\",\n    showContent: \"הצג תוכן\",\n    openConversion: \"פתח\",\n    download: \"הורד\",\n    copy: \"העתק\",\n    rewrite: \"שכתב מחדש\",\n    reconvert: \"המר שוב\",\n    noConversionsFound: \"לא נמצאו המרות התואמות את החיפוש/סינון.\",\n    loadingConversions: \"טוען המרות...\",\n    outputFor: \"פלט עבור\",\n    close: \"סגור\",\n    allLanguages: \"כל השפות\",\n    allFormats: \"כל הפורמטים\",\n    viewingContentFor: \"פרטי המרה:\",\n    copiedToClipboard: \"הועתק ללוח!\",\n    error: \"שגיאה\",\n    from: \"מ-\",\n    to: \"עד-\",\n    clearFilters: \"נקה סינונים\",\n    favorite: \"מועדף\",\n    unfavorite: \"הסר ממועדפים\",\n    filtersAndSearch: \"סינון וחיפוש\",\n    toggleLanguage: \"שפה\",\n    originalInputLabelModal: \"קלט מקורי:\",\n\n    myConversions: \"ההמרות שלי\",\n    manageAndReview: \"עיין, סנן ונהל את כל התוכן שיצרת\",\n    search: \"חיפוש\",\n    dateRange: \"טווח תאריכים\",\n    pickDateRange: \"בחר טווח תאריכים\",\n    formatsConverted: \"פורמטים מומרים\",\n    language: \"שפה\",\n    status: \"סטטוס\",\n    dateCreated: \"תאריך יצירה\",\n    tryAdjustingFilters: \"נסה לשנות את המסננים או את מונחי החיפוש.\",\n    conversionDetails: \"פרטי המרה\",\n    edit: \"ערוך\",\n    regenerate: \"צור מחדש\",\n    saveChanges: \"שמור שינויים\",\n    cancel: \"ביטול\",\n\n    formatLabels: { \n      linkedin: \"לינקדאין\", x_post: \"X\", podcast: \"פודקאסט\", newsletter: \"ניוזלטר\", landing: \"דף נחיתה\", video: \"וידאו קצר\", graphic: \"גרפיקה\",\n      facebook: \"פייסבוק\", instagram: \"אינסטגרם\", tiktok: \"TikTok\", reddit: \"רדיט\"\n    },\n    languageLabels: { \n      en: \"אנגלית\", he: \"עברית\", ar: \"ערבית\", es: \"ספרדית\", fr: \"צרפתית\", zh: \"סינית\", it: \"איטלקית\" \n    },\n    statuses: {\n        completed: \"הושלם\",\n        processing: \"בטיפול\",\n        failed: \"נכשל\"\n    }\n  },\n  en: {\n    title: \"My Conversions\",\n    subtitle: \"Browse, filter, and manage all your created content\",\n    searchPlaceholder: \"Search by original text...\",\n    filterByDate: \"Filter by Date\",\n    filterByFormat: \"Filter by Format\",\n    filterByLanguage: \"Filter by Language\",\n    date: \"Date\",\n    formats: \"Formats\",\n    originalInput: \"Original Input\",\n    actions: \"Actions\",\n    showContent: \"Show Content\",\n    openConversion: \"Open\",\n    download: \"Download\",\n    copy: \"Copy\",\n    rewrite: \"Rewrite\",\n    reconvert: \"Re-convert\",\n    noConversionsFound: \"No conversions found matching your search/filters.\",\n    loadingConversions: \"Loading conversions...\",\n    outputFor: \"Output for\",\n    close: \"Close\",\n    allLanguages: \"All Languages\",\n    allFormats: \"All Formats\",\n    viewingContentFor: \"Conversion Details:\",\n    copiedToClipboard: \"Copied to clipboard!\",\n    error: \"Error\",\n    from: \"From\",\n    to: \"To\",\n    clearFilters: \"Clear Filters\",\n    favorite: \"Favorite\",\n    unfavorite: \"Unfavorite\",\n    filtersAndSearch: \"Filter & Search\",\n    toggleLanguage: \"Language\",\n    originalInputLabelModal: \"Original Input:\",\n\n    myConversions: \"My Conversions\",\n    manageAndReview: \"Browse, filter, and manage all your created content\",\n    search: \"Search\",\n    dateRange: \"Date Range\",\n    pickDateRange: \"Pick a date range\",\n    formatsConverted: \"Formats Converted\",\n    language: \"Language\",\n    status: \"Status\",\n    dateCreated: \"Date Created\",\n    tryAdjustingFilters: \"Try adjusting filters or search terms.\",\n    conversionDetails: \"Conversion Details\",\n    edit: \"Edit\",\n    regenerate: \"Regenerate\",\n    saveChanges: \"Save Changes\",\n    cancel: \"Cancel\",\n\n    formatLabels: { \n      linkedin: \"LinkedIn\", x_post: \"X\", podcast: \"Podcast\", newsletter: \"Newsletter\", landing: \"Landing Page\", video: \"Short Video\", graphic: \"Graphic Prompt\",\n      facebook: \"Facebook\", instagram: \"Instagram\", tiktok: \"TikTok\", reddit: \"Reddit\"\n    },\n    languageLabels: { \n      en: \"English\", he: \"Hebrew\", ar: \"Arabic\", es: \"Spanish\", fr: \"French\", zh: \"Chinese\", it: \"Italian\" \n    },\n    statuses: {\n        completed: \"Completed\",\n        processing: \"Processing\",\n        failed: \"Failed\"\n    }\n  },\n  ar: {\n    title: \"تحويلاتي\",\n    subtitle: \"تصفح ، قم بتصفية وإدارة كل المحتوى الذي أنشأته\",\n    searchPlaceholder: \"ابحث بالنص الأصلي ...\",\n    filterByDate: \"تصفية حسب التاريخ\",\n    filterByFormat: \"تصفية حسب التنسيق\",\n    filterByLanguage: \"تصفية حسب اللغة\",\n    date: \"تاريخ\",\n    formats: \"التنسيقات\",\n    originalInput: \"الإدخال الأصلي\",\n    actions: \"الإجراءات\",\n    showContent: \"إظهار المحتوى\",\n    openConversion: \"فتح\",\n    download: \"تحميل\",\n    copy: \"نسخ\",\n    rewrite: \"إعادة كتابة\",\n    reconvert: \"إعادة التحويل\",\n    noConversionsFound: \"لم يتم العثور على تحويلات تطابق بحثك / عوامل التصفية.\",\n    loadingConversions: \"جار تحميل التحويلات ...\",\n    outputFor: \"إخراج لـ\",\n    close: \"إغلاق\",\n    allLanguages: \"كل اللغات\",\n    allFormats: \"جميع التنسيقات\",\n    viewingContentFor: \"تفاصيل التحويل:\",\n    copiedToClipboard: \"تم النسخ إلى الحافظة!\",\n    error: \"خطأ\",\n    from: \"من\",\n    to: \"إلى\",\n    clearFilters: \"مسح عوامل التصفية\",\n    favorite: \"مفضل\",\n    unfavorite: \"إزالة من المفضلة\",\n    filtersAndSearch: \"تصفية وبحث\",\n    toggleLanguage: \"لغة\",\n    originalInputLabelModal: \"المدخل الأصلي:\",\n\n    myConversions: \"تحويلاتي\",\n    manageAndReview: \"تصفح، قم بتصفية وإدارة كل المحتوى الذي أنشأته\",\n    search: \"بحث\",\n    dateRange: \"النطاق الزمني\",\n    pickDateRange: \"اختر نطاقًا زمنيًا\",\n    formatsConverted: \"التنسيقات المحولة\",\n    language: \"اللغة\",\n    status: \"الحالة\",\n    dateCreated: \"تاريخ الإنشاء\",\n    tryAdjustingFilters: \"حاول تعديل عوامل التصفية أو مصطلحات البحث.\",\n    conversionDetails: \"تفاصيل التحويل\",\n    edit: \"تعديل\",\n    regenerate: \"إعادة إنشاء\",\n    saveChanges: \"حفظ التغييرات\",\n    cancel: \"إلغاء\",\n\n    formatLabels: { \n      linkedin: \"لينكد إن\", x_post: \"X\", podcast: \"بودكاست\", newsletter: \"رسالة إخبارية\", landing: \"صفحة هبوط\", video: \"فيديو قصير\", graphic: \"موجه رسومي\",\n      facebook: \"فيسبوك\", instagram: \"انستغرام\", tiktok: \"تيك توك\", reddit: \"رديت\"\n    },\n    languageLabels: { \n      en: \"الإنجليزية\", he: \"العبرية\", ar: \"العربية\", es: \"الإسبانية\", fr: \"الفرنسية\", zh: \"الصينية\", it: \"الإيطالية\" \n    },\n    statuses: {\n        completed: \"مكتمل\",\n        processing: \"جاري المعالجة\",\n        failed: \"فشل\"\n    }\n  },\n  es: {\n    title: \"Mis Conversiones\",\n    subtitle: \"Navega, filtra y gestiona todo tu contenido creado\",\n    searchPlaceholder: \"Buscar por texto original...\",\n    filterByDate: \"Filtrar por Fecha\",\n    filterByFormat: \"Filtrar por Formato\",\n    filterByLanguage: \"Filtrar por Idioma\",\n    date: \"Fecha\",\n    formats: \"Formatos\",\n    originalInput: \"Entrada Original\",\n    actions: \"Acciones\",\n    showContent: \"Mostrar Contenido\",\n    openConversion: \"Abrir\",\n    download: \"Descargar\",\n    copy: \"Copiar\",\n    rewrite: \"Reescribir\",\n    reconvert: \"Reconvertir\",\n    noConversionsFound: \"No se encontraron conversiones que coincidan con tu búsqueda/filtros.\",\n    loadingConversions: \"Cargando conversiones...\",\n    outputFor: \"Salida para\",\n    close: \"Cerrar\",\n    allLanguages: \"Todos los Idiomas\",\n    allFormats: \"Todos los Formatos\",\n    viewingContentFor: \"Detalles de la Conversión:\",\n    copiedToClipboard: \"¡Copiado al portapapeles!\",\n    error: \"Error\",\n    from: \"Desde\",\n    to: \"Hasta\",\n    clearFilters: \"Limpiar Filtros\",\n    favorite: \"Favorito\",\n    unfavorite: \"Desmarcar Favorito\",\n    filtersAndSearch: \"Filtrar y Buscar\",\n    toggleLanguage: \"Idioma\",\n    originalInputLabelModal: \"Entrada Original:\",\n\n    myConversions: \"Mis Conversiones\",\n    manageAndReview: \"Navega, filtra y gestiona todo tu contenido creado\",\n    search: \"Buscar\",\n    dateRange: \"Rango de Fechas\",\n    pickDateRange: \"Seleccionar rango de fechas\",\n    formatsConverted: \"Formatos Convertidos\",\n    language: \"Idioma\",\n    status: \"Estado\",\n    dateCreated: \"Fecha de Creación\",\n    tryAdjustingFilters: \"Intenta ajustar los filtros o los términos de búsqueda.\",\n    conversionDetails: \"Detalles de Conversión\",\n    edit: \"Editar\",\n    regenerate: \"Regenerar\",\n    saveChanges: \"Guardar Cambios\",\n    cancel: \"Cancelar\",\n\n    formatLabels: { \n      linkedin: \"LinkedIn\", x_post: \"X\", podcast: \"Podcast\", newsletter: \"Boletín\", landing: \"Página de Destino\", video: \"Video Corto\", graphic: \"Prompt Gráfico\",\n      facebook: \"Facebook\", instagram: \"Instagram\", tiktok: \"TikTok\", reddit: \"Reddit\"\n    },\n    languageLabels: { \n      en: \"Inglés\", he: \"Hebreo\", ar: \"Árabe\", es: \"Español\", fr: \"Francés\", zh: \"Chino\", it: \"Italiano\" \n    },\n    statuses: {\n        completed: \"Completado\",\n        processing: \"Procesando\",\n        failed: \"Fallido\"\n    }\n  },\n  fr: {\n    title: \"Mes Conversions\",\n    subtitle: \"Parcourez, filtrez et gérez tout votre contenu créé\",\n    searchPlaceholder: \"Rechercher par texte original...\",\n    filterByDate: \"Filtrer par Date\",\n    filterByFormat: \"Filtrer par Formato\",\n    filterByLanguage: \"Filtrer par Langue\",\n    date: \"Date\",\n    formats: \"Formats\",\n    originalInput: \"Entrée Originale\",\n    actions: \"Actions\",\n    showContent: \"Afficher le Contenu\",\n    openConversion: \"Ouvrir\",\n    download: \"Télécharger\",\n    copy: \"Copier\",\n    rewrite: \"Réécrire\",\n    reconvert: \"Reconvertir\",\n    noConversionsFound: \"Aucune conversion trouvée correspondant à votre recherche/filtres.\",\n    loadingConversions: \"Chargement des conversions...\",\n    outputFor: \"Sortie pour\",\n    close: \"Fermer\",\n    allLanguages: \"Toutes les Langues\",\n    allFormats: \"Tous les Formats\",\n    viewingContentFor: \"Détails de la Conversion:\",\n    copiedToClipboard: \"Copié dans le presse-papiers !\",\n    error: \"Erreur\",\n    from: \"De\",\n    to: \"À\",\n    clearFilters: \"Effacer les Filtres\",\n    favorite: \"Favori\",\n    unfavorite: \"Retirer des favoris\",\n    filtersAndSearch: \"Filtrer et Rechercher\",\n    toggleLanguage: \"Langue\",\n    originalInputLabelModal: \"Entrée Originale:\",\n\n    myConversions: \"Mes Conversions\",\n    manageAndReview: \"Parcourez, filtrez et gérez tout votre contenu créé\",\n    search: \"Rechercher\",\n    dateRange: \"Plage de Dates\",\n    pickDateRange: \"Sélectionner une plage de dates\",\n    formatsConverted: \"Formats Convertis\",\n    language: \"Langue\",\n    status: \"Statut\",\n    dateCreated: \"Date de Création\",\n    tryAdjustingFilters: \"Essayez d'ajuster les filtres ou les termes de recherche.\",\n    conversionDetails: \"Détails de la Conversion\",\n    edit: \"Éditer\",\n    regenerate: \"Regénérer\",\n    saveChanges: \"Enregistrer les modifications\",\n    cancel: \"Annuler\",\n\n    formatLabels: { \n      linkedin: \"LinkedIn\", x_post: \"X\", podcast: \"Podcast\", newsletter: \"Newsletter\", landing: \"Page de Destination\", video: \"Vidéo Courte\", graphic: \"Prompt Graphique\",\n      facebook: \"Facebook\", instagram: \"Instagram\", tiktok: \"TikTok\", reddit: \"Reddit\"\n    },\n    languageLabels: { \n      en: \"Anglais\", he: \"Hébreu\", ar: \"Arabe\", es: \"Espagnol\", fr: \"Français\", zh: \"Chinois\", it: \"Italiano\" \n    },\n    statuses: {\n        completed: \"Terminé\",\n        processing: \"En cours\",\n        failed: \"Échoué\"\n    }\n  },\n  zh: {\n    title: \"我的转换\",\n    subtitle: \"浏览、筛选和管理您创建的所有内容\",\n    searchPlaceholder: \"按原始文本搜索...\",\n    filterByDate: \"按日期筛选\",\n    filterByFormat: \"按格式筛选\",\n    filterByLanguage: \"按语言筛选\",\n    date: \"日期\",\n    formats: \"格式\",\n    originalInput: \"原始输入\",\n    actions: \"操作\",\n    showContent: \"显示内容\",\n    openConversion: \"打开\",\n    download: \"下载\",\n    copy: \"复制\",\n    rewrite: \"重写\",\n    reconvert: \"重新转换\",\n    noConversionsFound: \"未找到与您的搜索/筛选条件匹配的转换。\",\n    loadingConversions: \"正在加载转换...\",\n    outputFor: \"输出为\",\n    close: \"关闭\",\n    allLanguages: \"所有语言\",\n    allFormats: \"所有格式\",\n    viewingContentFor: \"转换详情:\",\n    copiedToClipboard: \"已复制到剪贴板！\",\n    error: \"错误\",\n    from: \"从\",\n    to: \"到\",\n    clearFilters: \"清除筛选器\",\n    favorite: \"收藏\",\n    unfavorite: \"取消收藏\",\n    filtersAndSearch: \"筛选与搜索\",\n    toggleLanguage: \"语言\",\n    originalInputLabelModal: \"原始输入:\",\n\n    myConversions: \"我的转换\",\n    manageAndReview: \"浏览、筛选和管理您创建的所有内容\",\n    search: \"搜索\",\n    dateRange: \"日期范围\",\n    pickDateRange: \"选择日期范围\",\n    formatsConverted: \"已转换格式\",\n    language: \"语言\",\n    status: \"状态\",\n    dateCreated: \"创建日期\",\n    tryAdjustingFilters: \"尝试调整筛选器或搜索词。\",\n    conversionDetails: \"转换详情\",\n    edit: \"编辑\",\n    regenerate: \"重新生成\",\n    saveChanges: \"保存更改\",\n    cancel: \"取消\",\n\n    formatLabels: { \n      linkedin: \"领英\", x_post: \"X\", podcast: \"播客\", newsletter: \"通讯\", landing: \"登陆页面\", video: \"短视频\", graphic: \"图形提示\",\n      facebook: \"脸书\", instagram: \"照片墙\", tiktok: \"抖音\", reddit: \"Reddit\"\n    },\n    languageLabels: { \n      en: \"英语\", he: \"希伯来语\", ar: \"阿拉伯语\", es: \"西班牙语\", fr: \"法语\", zh: \"中文\", it: \"意大利语\" \n    },\n    statuses: {\n        completed: \"已完成\",\n        processing: \"处理中\",\n        failed: \"失败\"\n    }\n  },\n  it: {\n    title: \"Le Mie Conversioni\",\n    subtitle: \"Sfoglia, filtra e gestisci tutti i tuoi contenuti creati\",\n    searchPlaceholder: \"Cerca per testo originale...\",\n    filterByDate: \"Filtra per Data\",\n    filterByFormat: \"Filtra per Formato\",\n    filterByLanguage: \"Filtra per Lingua\",\n    date: \"Data\",\n    formats: \"Formati\",\n    originalInput: \"Input Originale\",\n    actions: \"Azioni\",\n    showContent: \"Mostra Contenuto\",\n    openConversion: \"Apri\",\n    download: \"Scarica\",\n    copy: \"Copia\",\n    rewrite: \"Riscrivi\",\n    reconvert: \"Riconverti\",\n    noConversionsFound: \"Nessuna conversione trovata corrispondente alla tua ricerca/filtri.\",\n    loadingConversions: \"Caricamento conversioni...\",\n    outputFor: \"Output per\",\n    close: \"Chiudi\",\n    allLanguages: \"Tutte le Lingue\",\n    allFormats: \"Tutti i Formati\",\n    viewingContentFor: \"Dettagli Conversione:\",\n    copiedToClipboard: \"Copiato negli appunti!\",\n    error: \"Errore\",\n    from: \"Da\",\n    to: \"A\",\n    clearFilters: \"Cancella Filtri\",\n    favorite: \"Preferito\",\n    unfavorite: \"Rimuovi dai Preferiti\",\n    filtersAndSearch: \"Filtra e Cerca\",\n    toggleLanguage: \"Lingua\",\n    originalInputLabelModal: \"Input Originale:\",\n\n    myConversions: \"Le Mie Conversioni\",\n    manageAndReview: \"Sfoglia, filtra e gestisci tutti i tuoi contenuti creati\",\n    search: \"Cerca\",\n    dateRange: \"Intervallo di Date\",\n    pickDateRange: \"Seleziona un intervallo di date\",\n    formatsConverted: \"Formati Convertiti\",\n    language: \"Lingua\",\n    status: \"Stato\",\n    dateCreated: \"Data di Creazione\",\n    tryAdjustingFilters: \"Prova ad aggiustare i filtri o i termini di ricerca.\",\n    conversionDetails: \"Dettagli Conversione\",\n    edit: \"Modifica\",\n    regenerate: \"Rigenera\",\n    saveChanges: \"Salva Modifiche\",\n    cancel: \"Annulla\",\n\n    formatLabels: { \n      linkedin: \"LinkedIn\", x_post: \"X\", podcast: \"Podcast\", newsletter: \"Newsletter\", landing: \"Pagina di Destinazione\", video: \"Video Breve\", graphic: \"Prompt Grafico\",\n      facebook: \"Facebook\", instagram: \"Instagram\", tiktok: \"TikTok\", reddit: \"Reddit\"\n    },\n    languageLabels: { \n      en: \"Inglese\", he: \"Ebraico\", ar: \"Arabo\", es: \"Spagnolo\", fr: \"Francese\", zh: \"Cinese\", it: \"Italiano\" \n    },\n    statuses: {\n        completed: \"Completato\",\n        processing: \"In elaborazione\",\n        failed: \"Fallito\"\n    }\n  }\n};\n\nconst formatOptionsList = [\n    { value: \"linkedin\", label: \"LinkedIn\" },\n    { value: \"x_post\", label: \"X\" },\n    { value: \"podcast\", label: \"Podcast\" },\n    { value: \"newsletter\", label: \"Newsletter\" },\n    { value: \"landing\", label: \"Landing Page\" },\n    { value: \"video\", label: \"Short Video\" },\n    { value: \"graphic\", label: \"Graphic Prompt\" },\n    { value: \"facebook\", label: \"Facebook\" },\n    { value: \"instagram\", label: \"Instagram\" },\n    { value: \"tiktok\", label: \"TikTok\" },\n    { value: \"reddit\", label: \"Reddit\" }\n];\nconst languageOptionsList = [\n    { value: \"en\", label: \"English\" },\n    { value: \"he\", label: \"Hebrew\" },\n    { value: \"ar\", label: \"Arabic\" },\n    { value: \"es\", label: \"Spanish\" },\n    { value: \"fr\", label: \"French\" },\n    { value: \"zh\", label: \"Chinese\" },\n    { value: \"it\", label: \"Italian\" }\n];\n\nconst planStorageLimits = {\n  free: 5, \n  basic: 50,\n  pro: 200,\n  ultra: Infinity, \n};\n\nconst dateLocales = { he, ar, es, fr, zh: zhCN, it, en: undefined };\n\n\nexport default function MyConversionsPage({ effectiveLanguage, appTranslations }) {\n  const navigate = useNavigate();\n  const [user, setUser] = useState(null);\n  const [allConversions, setAllConversions] = useState([]);\n  const [filteredConversions, setFilteredConversions] = useState([]);\n  const [loading, setLoading] = useState(true); \n  const [searchTerm, setSearchTerm] = useState(\"\");\n  const [selectedDateRange, setSelectedDateRange] = useState({ from: null, to: null });\n  const [selectedFormatsFilter, setSelectedFormatsFilter] = useState([]); \n  const [selectedLanguageFilter, setSelectedLanguageFilter] = useState(\"\");\n  \n  const [isModalOpen, setIsModalOpen] = useState(false);\n  const [modalContent, setModalContent] = useState(null);\n  const [activeConversionForModal, setActiveConversionForModal] = useState(null);\n  const [pageLanguage, setPageLanguage] = useState(effectiveLanguage || 'en');\n\n  const [favorites, setFavorites] = useState({});\n\n  const [editingOutput, setEditingOutput] = useState(null); \n  const [savingEdit, setSavingEdit] = useState(false);\n  const [regeneratingOutputFor, setRegeneratingOutputFor] = useState(null);\n\n  useEffect(() => {\n    setPageLanguage(effectiveLanguage || 'en');\n  }, [effectiveLanguage]);\n  \n  const t = useMemo(() => {\n    const currentTranslations = translations[pageLanguage] || translations.en;\n    currentTranslations.formats = currentTranslations.formatLabels; \n    currentTranslations.languages = currentTranslations.languageLabels;\n    return currentTranslations;\n  }, [pageLanguage]);\n\n  useEffect(() => {\n    const loadInitialData = async () => {\n      setLoading(true); \n      try {\n        const userData = await User.me();\n        setUser(userData);\n        \n        const storedFavorites = userData.favorites || JSON.parse(localStorage.getItem(`repostly_favorites_${userData.id}`) || '{}');\n        setFavorites(storedFavorites);\n\n        const conversionsData = await Conversion.filter({ created_by: userData.email }, \"-created_date\");\n        \n        const userPlan = userData.plan_type || 'free';\n        const limit = planStorageLimits[userPlan] || planStorageLimits.free;\n        \n        if (limit !== Infinity && conversionsData.length > limit) {\n          setAllConversions(conversionsData.slice(0, limit));\n        } else {\n          setAllConversions(conversionsData);\n        }\n\n      } catch (error) {\n        console.error(\"Error loading data:\", error);\n      }\n      setLoading(false);\n    };\n    \n    loadInitialData(); \n  }, []);\n\n  useEffect(() => {\n    let result = allConversions;\n\n    if (searchTerm) {\n      result = result.filter(c => \n        c.input_text?.toLowerCase().includes(searchTerm.toLowerCase())\n      );\n    }\n\n    if (selectedDateRange.from) {\n      result = result.filter(c => {\n        const conversionDate = parseISO(c.created_date);\n        return isValid(conversionDate) && conversionDate >= startOfDay(selectedDateRange.from);\n      });\n    }\n    if (selectedDateRange.to) {\n      result = result.filter(c => {\n        const conversionDate = parseISO(c.created_date);\n        return isValid(conversionDate) && conversionDate <= endOfDay(selectedDateRange.to);\n      });\n    }\n\n    if (selectedFormatsFilter.length > 0) {\n      result = result.filter(c => \n        c.selected_formats?.some(format => selectedFormatsFilter.includes(format))\n      );\n    }\n\n    if (selectedLanguageFilter) {\n      result = result.filter(c => c.output_language === selectedLanguageFilter);\n    }\n    \n    result.sort((a, b) => {\n        const aIsFavorite = favorites[a.id] === true;\n        const bIsFavorite = favorites[b.id] === true;\n        if (aIsFavorite && !bIsFavorite) return -1;\n        if (!aIsFavorite && bIsFavorite) return 1;\n        return new Date(b.created_date) - new Date(a.created_date);\n    });\n    setFilteredConversions(result);\n  }, [searchTerm, selectedDateRange, selectedFormatsFilter, selectedLanguageFilter, allConversions, favorites]);\n\n  const handleOpenModal = (outputs, conversion) => {\n    setModalContent(outputs);\n    setActiveConversionForModal(conversion);\n    setIsModalOpen(true);\n    setEditingOutput(null);\n  };\n\n  const handleCopyContent = async (text) => {\n    try {\n      await navigator.clipboard.writeText(text);\n      alert(`${t.copiedToClipboard}`);\n    } catch (err) {\n      alert(`${t.error}: ${err.message}`);\n    }\n  };\n  \n  const handleDownloadContent = (content, formatKey, originalInput) => {\n    const contentToDownload = `Original Input:\\n${originalInput}\\n\\n--- ${t.formats[formatKey] || formatKey} ---\\n\\n${content}\\n\\n`;\n    \n    const blob = new Blob([contentToDownload], { type: 'text/plain;charset=utf-8' });\n    const link = document.createElement(\"a\");\n    link.href = URL.createObjectURL(blob);\n    link.download = `Repostly_Conversion_${activeConversionForModal?.id?.substring(0, 8) || 'output'}_${formatKey}.txt`;\n    document.body.appendChild(link);\n    link.click();\n    document.body.removeChild(link);\n  };\n\n  const handleEditOutput = (conversionId, format, currentText) => {\n    setEditingOutput({ conversionId, format, text: currentText });\n  };\n\n  const handleSaveEditedOutput = async () => {\n    if (!editingOutput || !user) return;\n\n    setSavingEdit(true);\n    try {\n      const conversionToUpdate = allConversions.find(c => c.id === editingOutput.conversionId);\n      if (!conversionToUpdate) {\n        console.error(\"Conversion not found for editing.\");\n        return;\n      }\n\n      const updatedOutputs = { ...conversionToUpdate.outputs, [editingOutput.format]: editingOutput.text };\n\n      const updatedConversion = await Conversion.update(editingOutput.conversionId, { outputs: updatedOutputs });\n      \n      setAllConversions(prev => \n        prev.map(c => c.id === updatedConversion.id ? updatedConversion : c)\n      );\n      if (activeConversionForModal?.id === updatedConversion.id) {\n          setModalContent(updatedOutputs);\n          setActiveConversionForModal(updatedConversion);\n      }\n      setEditingOutput(null);\n    } catch (err) {\n      console.error(\"Error saving edited output:\", err);\n      alert(`${t.error}: ${err.message}`);\n    } finally {\n      setSavingEdit(false);\n    }\n  };\n\n  const buildRegeneratePrompt = (conversion, formatKey) => {\n    const { input_text, writing_tone, output_language, content_depth } = conversion || {};\n    const tone = writing_tone || \"professional\";\n    const language = output_language || \"en\";\n    const depth = content_depth || \"enriched\";\n\n    let basePrompt = `You are an expert content strategist and copywriter.\nRewrite the given source content as a ${formatKey} in ${language}, using a ${tone} tone, following best practices of the chosen platform.\nEnsure: clear structure, a compelling hook, natural transitions, and an appropriate call-to-action.`;\n\n    let formatInstructions = \"\";\n    switch (formatKey) {\n      case \"newsletter\":\n      case \"landing\":\n      case \"linkedin\":\n        formatInstructions = `- Aim for 300–500 words with an engaging intro, body, and conclusion, plus a clear CTA.`;\n        break;\n      case \"podcast\":\n        formatInstructions = `- Produce a ≥500-word script. Include speaker cues (Host:, Guest:), pacing, and sound effect notes.`;\n        break;\n      case \"x_post\":\n        formatInstructions = `- Create a 10-post X (Twitter) thread.\n- Each post 250–280 characters.\n- Structure:\n  1/10 Hook with value promise\n  2–3/10 Context/problem\n  4–6/10 Solution/details\n  7–8/10 Examples/data\n  9/10 Key takeaway\n  10/10 Strong CTA\n- Use 1/10, 2/10... markers. Encourage replies/shares.`;\n        break;\n      case \"video\":\n        formatInstructions = `- Short video (≤60s). Provide scenes, voiceover copy, and visual suggestions. Hook → value → CTA.`;\n        break;\n      case \"facebook\":\n        formatInstructions = `- Up to 300 words. Conversational, engaging, 1–2 relevant hashtags, and a clear CTA.`;\n        break;\n      case \"instagram\":\n        formatInstructions = `- Caption up to 2,000 characters. Strong first-line hook, storytelling, engagement question, and 5–10 hashtags. Include \"Link in bio\" if relevant.`;\n        break;\n      case \"tiktok\":\n        formatInstructions = `- 30–60s script. Hook in first 3s, then value, then a strong CTA. Include timing cues and on-screen text ideas.`;\n        break;\n      case \"reddit\":\n        formatInstructions = `- Provide a Title (≤120 chars) and Body. Authentic, community-first tone. Suggest 2–3 relevant subreddits.`;\n        break;\n      case \"graphic\":\n        basePrompt = `You are a visual content strategist.\nCreate a detailed prompt for an AI image generator (e.g., Midjourney/DALL·E) in ${language}, aligned to a ${tone} style.\nInclude: core theme, mood, colors, composition, and style guidance.`;\n        formatInstructions = ``;\n        break;\n      default:\n        formatInstructions = ``;\n    }\n\n    let depthInstructions = \"\";\n    switch (depth) {\n      case \"quick_summary\":\n        depthInstructions = `- Keep it concise and focused on the essentials (quick summary).`;\n        break;\n      case \"standard\":\n        depthInstructions = `- Provide a balanced, well-rounded coverage of the key points.`;\n        break;\n      case \"enriched\":\n        depthInstructions = `- Enrich with examples and context for more depth and engagement.`;\n        break;\n      case \"deep_dive\":\n        depthInstructions = `- Deep exploration: nuanced details, multiple perspectives, and comprehensive analysis.`;\n        break;\n      default:\n        depthInstructions = ``;\n    }\n\n    const finalPrompt = `${basePrompt}\n${formatInstructions}\n${depthInstructions}\n\nSource content:\n${input_text || \"\"}`.trim();\n\n    return finalPrompt;\n  };\n\n  const handleRegenerateOutput = async (conversionId, formatKey) => {\n    if (!user) return;\n\n    setRegeneratingOutputFor(`${conversionId}-${formatKey}`);\n    try {\n      const conversionToRegenerate = allConversions.find(c => c.id === conversionId);\n      if (!conversionToRegenerate) {\n        console.error(\"Conversion not found for regeneration.\");\n        return;\n      }\n\n      const prompt = buildRegeneratePrompt(conversionToRegenerate, formatKey);\n      const res = await InvokeLLM({ prompt });\n      const regeneratedText = typeof res === \"string\"\n        ? res\n        : (res?.generated_text || res?.text || JSON.stringify(res));\n\n      if (!regeneratedText) {\n        throw new Error(\"No regenerated content returned from AI.\");\n      }\n\n      const updatedOutputs = { ...conversionToRegenerate.outputs, [formatKey]: regeneratedText };\n\n      const updatedConversion = await Conversion.update(conversionId, { outputs: updatedOutputs });\n\n      setAllConversions(prev => \n        prev.map(c => c.id === updatedConversion.id ? updatedConversion : c)\n      );\n      if (activeConversionForModal?.id === updatedConversion.id) {\n          setModalContent(updatedOutputs);\n          setActiveConversionForModal(updatedConversion);\n      }\n    } catch (err) {\n      console.error(\"Error regenerating output:\", err);\n      alert(`${t.error}: ${err.message}`);\n    } finally {\n      setRegeneratingOutputFor(null);\n    }\n  };\n  \n  const handleToggleFavorite = async (conversionId) => {\n    const newFavorites = { ...favorites, [conversionId]: !favorites[conversionId] };\n    setFavorites(newFavorites);\n    try {\n      if(user) { \n        await User.updateMyUserData({ favorites: newFavorites });\n        localStorage.setItem(`repostly_favorites_${user.id}`, JSON.stringify(newFavorites));\n      }\n    } catch (err) {\n      console.error(\"Error saving favorites:\", err);\n      alert(`${t.error}: ${err.message}`);\n    }\n  };\n\n  const handleReconvert = (conversion) => {\n    navigate(createPageUrl(`Convert?inputText=${encodeURIComponent(conversion.input_text)}&formats=${conversion.selected_formats.join(',')}&tone=${conversion.writing_tone}&lang=${conversion.output_language}&depth=${conversion.content_depth}`));\n  };\n\n  const clearAllFilters = () => {\n    setSearchTerm(\"\");\n    setSelectedDateRange({ from: null, to: null });\n    setSelectedFormatsFilter([]);\n    setSelectedLanguageFilter(\"\");\n  };\n\n  if (loading) { \n    return (\n      <div className=\"p-4 sm:p-6 flex items-center justify-center min-h-[calc(100vh-150px)]\"> \n        <div className=\"flex flex-col items-center\">\n          <Loader2 className=\"w-10 h-10 sm:w-12 sm:h-12 text-teal-600 animate-spin mb-3 sm:mb-4\" /> \n          <p className=\"text-sm sm:text-base text-gray-600\">{t.loadingConversions}</p>\n        </div>\n      </div>\n    );\n  }\n  \n  const isRTL = pageLanguage === 'he' || pageLanguage === 'ar';\n  const currentCalLocale = dateLocales[pageLanguage] || dateLocales.en;\n\n\n  return (\n    <div className=\"p-4 sm:p-6 min-h-screen\" dir={isRTL ? 'rtl' : 'ltr'}> \n      <div className=\"max-w-7xl mx-auto\">\n        <div className=\"flex flex-col md:flex-row justify-between items-start md:items-center mb-4 sm:mb-6 gap-3\">\n          <div>\n            <h1 className=\"text-xl sm:text-2xl md:text-3xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent\">\n              {t.myConversions}\n            </h1>\n            <p className=\"text-xs sm:text-sm text-gray-500\">\n              {t.manageAndReview}\n            </p>\n          </div>\n        </div>\n\n        <div className=\"mb-4 sm:mb-6 p-3 sm:p-4 bg-white/80 backdrop-blur-md rounded-xl shadow-sm border border-white/30\">\n          <div className=\"grid grid-cols-1 md:grid-cols-3 gap-3 sm:gap-4 items-end\">\n            <div className=\"md:col-span-2\"> \n              <Label htmlFor=\"searchTerm\" className=\"text-xs sm:text-sm font-medium text-gray-700\">{t.search}</Label>\n              <Input\n                id=\"searchTerm\"\n                type=\"text\"\n                placeholder={t.searchPlaceholder}\n                value={searchTerm}\n                onChange={(e) => setSearchTerm(e.target.value)}\n                className=\"mt-1 text-sm h-9\" \n              />\n            </div>\n            <div>\n              <Button onClick={clearAllFilters} variant=\"outline\" className=\"w-full text-xs sm:text-sm py-1.5 sm:py-2 h-9\"> \n                <X className=\"w-3 h-3 sm:w-4 sm:h-4 mr-1 sm:mr-2\"/> {t.clearFilters}\n              </Button>\n            </div>\n            \n            <div className=\"md:col-span-1\"> \n              <Label htmlFor=\"dateRange\" className=\"text-xs sm:text-sm font-medium text-gray-700\">{t.dateRange}</Label>\n              <Popover>\n                <PopoverTrigger asChild>\n                  <Button\n                    id=\"dateRange\"\n                    variant={\"outline\"}\n                    className={`w-full justify-start text-left font-normal mt-1 text-xs sm:text-sm h-9 ${ \n                      !selectedDateRange.from && \"text-muted-foreground\"\n                    }`}\n                  >\n                    <CalendarIcon className=\"mr-2 h-3.5 w-3.5\" /> \n                    {selectedDateRange.from ? (\n                      selectedDateRange.to ? (\n                        <>\n                          {format(selectedDateRange.from, \"LLL dd, y\", { locale: currentCalLocale })} -{\" \"}\n                          {format(selectedDateRange.to, \"LLL dd, y\", { locale: currentCalLocale })}\n                        </>\n                      ) : (\n                        format(selectedDateRange.from, \"LLL dd, y\", { locale: currentCalLocale })\n                      )\n                    ) : (\n                      <span>{t.pickDateRange}</span>\n                    )}\n                  </Button>\n                </PopoverTrigger>\n                <PopoverContent className=\"w-auto p-0\" align=\"start\">\n                  <Calendar\n                    initialFocus\n                    mode=\"range\"\n                    defaultMonth={selectedDateRange?.from}\n                    selected={selectedDateRange}\n                    onSelect={setSelectedDateRange}\n                    numberOfMonths={2}\n                    locale={currentCalLocale}\n                  />\n                </PopoverContent>\n              </Popover>\n            </div>\n            <div className=\"flex flex-col sm:flex-row gap-2 sm:gap-3 md:col-span-2\"> \n              <div className=\"flex-1\">\n                <Label htmlFor=\"formatFilter\" className=\"text-xs sm:text-sm font-medium text-gray-700\">{t.filterByFormat}</Label>\n                 <Select\n                    value={selectedFormatsFilter.join(\",\")} \n                    onValueChange={(value) => setSelectedFormatsFilter(value ? value.split(\",\") : [])} \n                  >\n                  <SelectTrigger id=\"formatFilter\" className=\"mt-1 text-xs sm:text-sm h-9\">\n                      <SelectValue placeholder={t.allFormats} />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value={null} className=\"text-xs sm:text-sm\">{t.allFormats}</SelectItem> \n                    {formatOptionsList.map((opt) => (\n                      <SelectItem key={opt.value} value={opt.value} className=\"text-xs sm:text-sm\">\n                        {t.formats[opt.value] || opt.label}\n                      </SelectItem>\n                    ))}\n                  </SelectContent>\n                </Select>\n              </div>\n               <div className=\"flex-1\">\n                <Label htmlFor=\"languageFilter\" className=\"text-xs sm:text-sm font-medium text-gray-700\">{t.filterByLanguage}</Label>\n                <Select value={selectedLanguageFilter} onValueChange={setSelectedLanguageFilter}>\n                    <SelectTrigger id=\"languageFilter\" className=\"mt-1 text-xs sm:text-sm h-9\">\n                        <SelectValue placeholder={t.allLanguages} />\n                    </SelectTrigger>\n                    <SelectContent>\n                        <SelectItem value={null} className=\"text-xs sm:text-sm\">{t.allLanguages}</SelectItem> \n                        {languageOptionsList.map((opt) => (\n                            <SelectItem key={opt.value} value={opt.value} className=\"text-xs sm:text-sm\">\n                                {t.languages[opt.value] || opt.label}\n                            </SelectItem>\n                        ))}\n                    </SelectContent>\n                </Select>\n              </div>\n            </div>\n          </div>\n        </div>\n\n        {filteredConversions.length === 0 && !loading ? (\n          <div className=\"text-center py-10 sm:py-16\">\n            <BookOpen className=\"mx-auto h-12 w-12 sm:h-16 sm:h-16 text-gray-300 mb-3 sm:mb-4\" /> \n            <p className=\"text-sm sm:text-lg text-gray-600\">{t.noConversionsFound}</p>\n            <p className=\"text-xs sm:text-sm text-gray-500 mt-1\">{t.tryAdjustingFilters}</p>\n          </div>\n        ) : (\n          <div className=\"overflow-x-auto rounded-xl shadow-sm border border-white/30 bg-white/80 backdrop-blur-md\"> \n            <Table className=\"min-w-full text-xs sm:text-sm\"> \n              <TableHeader>\n                <TableRow>\n                  <TableHead className=\"w-[50px] hidden sm:table-cell\"></TableHead> \n                  <TableHead>{t.originalInput}</TableHead>\n                  <TableHead className=\"hidden md:table-cell\">{t.formatsConverted}</TableHead>\n                  <TableHead className=\"hidden lg:table-cell\">{t.language}</TableHead>\n                  <TableHead>{t.status}</TableHead>\n                  <TableHead className=\"hidden sm:table-cell\">{t.dateCreated}</TableHead>\n                  <TableHead className={`text-right ${isRTL ? 'text-left' : ''}`}>{t.actions}</TableHead> \n                </TableRow>\n              </TableHeader>\n              <TableBody>\n                {filteredConversions.map((conv) => (\n                  <TableRow key={conv.id} className=\"hover:bg-slate-50/50\">\n                    <TableCell className=\"w-[50px] hidden sm:table-cell\">\n                      <Button variant=\"ghost\" size=\"icon\" onClick={() => handleToggleFavorite(conv.id)} className=\"h-7 w-7 sm:h-8 sm:w-8 p-1\"> \n                        <StarIcon className={`w-4 h-4 sm:w-5 sm:h-5 ${favorites[conv.id] ? 'text-amber-400 fill-amber-400' : 'text-gray-300'}`} />\n                      </Button>\n                    </TableCell>\n                    <TableCell className=\"font-medium max-w-[150px] sm:max-w-xs truncate\" title={conv.input_text}>{conv.input_text}</TableCell>\n                    <TableCell className=\"hidden md:table-cell\">\n                      <div className=\"flex flex-wrap gap-1\">\n                        {conv.selected_formats?.map(f => <Badge key={f} variant=\"outline\" className=\"px-1.5 py-0.5 text-xs\">{t.formats[f] || f}</Badge>)}\n                      </div>\n                    </TableCell>\n                    <TableCell className=\"hidden lg:table-cell\">{t.languages[conv.output_language] || conv.output_language}</TableCell>\n                    <TableCell>\n                      <Badge className={`text-xs px-1.5 py-0.5 ${\n                        conv.status === 'completed' ? 'bg-green-100 text-green-800' :\n                        conv.status === 'processing' ? 'bg-blue-100 text-blue-800' :\n                        'bg-red-100 text-red-800'\n                      }`}>{t.statuses[conv.status] || conv.status}</Badge>\n                    </TableCell>\n                    <TableCell className=\"hidden sm:table-cell\">{format(parseISO(conv.created_date), 'dd/MM/yy HH:mm', { locale: currentCalLocale })}</TableCell>\n                    <TableCell className={`text-right ${isRTL ? 'text-left' : ''}`}> \n                       <Button variant=\"ghost\" size=\"sm\" onClick={() => handleOpenModal(conv.outputs, conv)} className=\"h-7 px-2 py-1 text-xs sm:h-8 sm:px-3\"> \n                         <Eye className=\"w-3.5 h-3.5 sm:w-4 sm:h-4 text-gray-500\" />\n                       </Button>\n                       <Button variant=\"ghost\" size=\"sm\" onClick={() => handleReconvert(conv)} className=\"h-7 px-2 py-1 text-xs sm:h-8 sm:px-3 sm:hidden\">\n                            <RotateCcw className=\"w-3.5 h-3.5 sm:w-4 sm:h-4 text-purple-600\" />\n                        </Button>\n                    </TableCell>\n                  </TableRow>\n                ))}\n              </TableBody>\n            </Table>\n          </div>\n        )}\n        \n      <Dialog open={isModalOpen} onOpenChange={setIsModalOpen}>\n          <DialogContent className=\"max-w-[90vw] sm:max-w-lg md:max-w-2xl lg:max-w-4xl max-h-[85vh] flex flex-col p-4 sm:p-6\" dir={isRTL ? 'rtl' : 'ltr'}> \n            <DialogHeader>\n              <DialogTitle className=\"text-base sm:text-lg md:text-xl\">{t.conversionDetails} - {activeConversionForModal?.input_text?.substring(0,30)}{activeConversionForModal?.input_text?.length > 30 ? \"...\" : \"\"}</DialogTitle>\n                {activeConversionForModal?.input_text && (\n                    <DialogDescription className=\"pt-1 text-xs sm:text-sm\">\n                       <span className=\"font-semibold\">{t.originalInputLabelModal}</span> {activeConversionForModal.input_text.substring(0,80)}{activeConversionForModal.input_text.length > 80 ? \"...\" : \"\"}\n                    </DialogDescription>\n                )}\n            </DialogHeader>\n            <div className=\"overflow-y-auto flex-grow space-y-3 sm:space-y-4 pr-1 sm:pr-2\"> \n                {modalContent && activeConversionForModal && (\n                  <div className=\"space-y-3 sm:space-y-4\">\n                    {Object.entries(modalContent).map(([formatKey, text]) => (\n                      <Card key={formatKey} className=\"shadow-none border bg-slate-50/50\">\n                        <CardHeader className=\"p-2.5 sm:p-3\"> \n                          <div className=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-1.5 sm:gap-2\">\n                            <CardTitle className=\"text-sm sm:text-base font-semibold text-teal-700\">{t.formats[formatKey] || formatKey}</CardTitle>\n                            <div className=\"flex gap-1.5 sm:gap-2\">\n                              <Button size=\"xs\" variant=\"ghost\" onClick={() => handleCopyContent(text || \"\")} className=\"p-1 h-6 w-6 sm:h-7 sm:w-7\" title={t.copy}><Copy className=\"w-3 h-3 sm:w-3.5 sm:h-3.5\" /></Button>\n                              <Button size=\"xs\" variant=\"ghost\" onClick={() => handleDownloadContent(text || \"\", formatKey, activeConversionForModal.input_text || \"\")} className=\"p-1 h-6 w-6 sm:h-7 sm:w-7\" title={t.download}><Download className=\"w-3 h-3 sm:w-3.5 sm:h-3.5\" /></Button>\n                              <Button size=\"xs\" variant=\"ghost\" onClick={() => handleEditOutput(activeConversionForModal.id, formatKey, text || \"\")} className=\"p-1 h-6 w-6 sm:h-7 sm:w-7\" title={t.edit}><Edit3 className=\"w-3 h-3 sm:w-3.5 sm:h-3.5\" /></Button>\n                              <Button size=\"xs\" variant=\"ghost\" onClick={() => handleRegenerateOutput(activeConversionForModal.id, formatKey)} title={t.regenerate} className=\"p-1 h-6 w-6 sm:h-7 sm:w-7\" disabled={regeneratingOutputFor === `${activeConversionForModal.id}-${formatKey}`}>\n                                {regeneratingOutputFor === `${activeConversionForModal.id}-${formatKey}` ? <Loader2 className=\"w-3 h-3 sm:w-3.5 sm:h-3.5 animate-spin\" /> : <RotateCcw className=\"w-3 h-3 sm:w-3.5 sm:h-3.5\" />}\n                              </Button>\n                              <div className=\"flex items-center\">\n                                <SocialShareButtons \n                                  content={text || \"\"} \n                                  format={formatKey}\n                                  effectiveLanguage={pageLanguage}\n                                />\n                              </div>\n                            </div>\n                          </div>\n                        </CardHeader>\n                        <CardContent className=\"p-2.5 sm:p-3\"> \n                          {editingOutput?.conversionId === activeConversionForModal.id && editingOutput?.format === formatKey ? (\n                            <div className=\"space-y-2\">\n                              <Textarea \n                                value={editingOutput.text} \n                                onChange={(e) => setEditingOutput(prev => ({...prev, text: e.target.value}))} \n                                rows={6} \n                                className=\"w-full text-xs sm:text-sm\" \n                              />\n                              <div className=\"flex gap-2\">\n                                <Button size=\"xs\" onClick={handleSaveEditedOutput} disabled={savingEdit} className=\"text-xs px-2 py-1\">\n                                  {savingEdit ? <Loader2 className=\"w-3 h-3 animate-spin mr-1\" /> : null}\n                                  {t.saveChanges}\n                                </Button>\n                                <Button size=\"xs\" variant=\"outline\" onClick={() => setEditingOutput(null)} className=\"text-xs px-2 py-1\">{t.cancel}</Button>\n                              </div>\n                            </div>\n                          ) : (\n                            <div className=\"whitespace-pre-wrap text-xs sm:text-sm p-2 sm:p-3 bg-white rounded-md border min-h-[50px]\">{text}</div> \n                          )}\n                        </CardContent>\n                      </Card>\n                    ))}\n                  </div>\n                )}\n            </div>\n            <DialogFooter className=\"mt-4 sm:mt-6 p-0\"> \n              <DialogClose asChild>\n                <Button type=\"button\" variant=\"outline\" size=\"sm\" className=\"text-xs sm:text-sm\">{t.close}</Button>\n              </DialogClose>\n            </DialogFooter>\n          </DialogContent>\n        </Dialog>\n      </div>\n    </div>\n  );\n}\n","About":"\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport { createPageUrl } from '@/utils';\nimport { Info, Brain, Settings2, Users, ShieldCheck, FileText, Copyright, AlertTriangle } from 'lucide-react';\n\nconst translations = {\n  he: {\n    title: \"אודות – RePostly AI\",\n    subtitle: \"הפלטפורמה החכמה והמהירה למחזור תוכן, שכתוב מותאם והפצה אפקטיבית בכל פלטפורמה.\",\n    platformIntro: \"ברוכים הבאים ל־RePostly AI – הפלטפורמה החכמה והמהירה למחזור תוכן, שכתוב מותאם והפצה אפקטיבית בכל פלטפורמה.\",\n    goal: \"RePostly AI פותחה על ידי Yaron.H. Handasa LTD כדי להעניק ליוצרים, עסקים וקהילות את הכוח להפיק את המקסימום מכל פוסט – בעבר, בהווה ובעתיד.\",\n    supportsTitle: \"מה מייחד אותנו?\",\n    features: [\n      \"Recycle AI – המרת פוסטים ישנים לגרסה חדשה, רלוונטית וייחודית\",\n      \"שכתוב לפי פלטפורמה – הומוריסטי לטיקטוק, מקצועי ללינקדאין, חדשותי לטוויטר\",\n      \"ניתוח סנטימנט ונושא – להבין מראש מה יתאים איפה\",\n      \"Content Vault – ארכיון חכם לפי תגים, תאריכים ונושאים\",\n      \"תפריט נגישות – התאמה מלאה לחוויית שימוש נגישה\"\n    ],\n    technology: \"המערכת פותחה והותאמה ע\\\"י Yaron.H. Handasa LTD כפתרון מהיר, מדויק ונוח לעבודה שוטפת עם תוכן.\",\n    privacyTitle: \"🔐 תנאי פרטיות (תקציר)\",\n    privacyPoints: [\n      \"מה נאסף: מידע אנונימי לצורכי תפעול, נתוני שימוש, תכנים שאתה מזין\",\n      \"מה לא נעשה: לא נמכור או נעביר מידע אישי לצדדים שלישיים ללא רשות\",\n      \"אבטחה: שרתים ותשתיות מאובטחים ברמה גבוהה (GDPR, ISO 27001)\",\n      \"עוגיות (Cookies): לצורכי תפקוד, אנליטיקה וחוויית משתמש בלבד\",\n      \"זכויותיך: ניתן לבקש לעיין/למחוק/לערוך את הנתונים – RepostlyAi@gmail.com\"\n    ],\n    copyrightTitle: \"📜 זכויות יוצרים\",\n    copyrightPoints: [\n      \"כל הקוד, הממשק, המיתוג והפונקציונליות – קניין בלעדי של Yaron.H. Handasa LTD\",\n      \"חל איסור להעתיק, לשכפל, לשווק או לשלב מרכיבים מהפלטפורמה ללא אישור\",\n      \"המשתמש שומר על כל הזכויות בתכנים שהוא מזין\",\n      \"תכנים שנוצרים באמצעות AI – באחריות המשתמש בלבד\"\n    ],\n    disclaimerTitle: \"⚠️ דיסקליימר\",\n    disclaimerPoints: [\n      \"התכנים אינם מהווים ייעוץ מכל סוג – לא שיווקי, משפטי או עסקי\",\n      \"כל התוכן שנוצר מבוסס על קלט המשתמש – האחריות לתוצאות על המשתמש\",\n      \"Yaron.H. Handasa LTD לא תישא באחריות לנזק ישיר או עקיף משימוש במערכת\"\n    ],\n    backToHome: \"חזור לדשבורד\",\n    legalPages: \"עמודים משפטיים\",\n    terms: \"תנאי שימוש\",\n    privacy: \"מדיניות פרטיות\",\n    copyrightDisclaimer: \"זכויות יוצרים ודיסקליימר\"\n  },\n  en: {\n    title: \"About RePostly AI\",\n    subtitle: \"Smart, fast content repurposing, platform‑adaptive rewriting, and effective distribution.\",\n    platformIntro: \"Welcome to RePostly AI – the smart and fast platform for repurposing content, adaptive rewriting, and multi‑platform distribution.\",\n    goal: \"Built by Yaron.H. Handasa LTD to help creators, businesses, and communities get the most out of every post – past, present, and future.\",\n    supportsTitle: \"What makes us different?\",\n    features: [\n      \"Recycle AI – turn old posts into fresh, relevant versions\",\n      \"Platform‑adaptive rewriting – TikTok fun, LinkedIn professional, Twitter newsy\",\n      \"Sentiment & topic analysis – know what fits where\",\n      \"Content Vault – smart archive by tags, dates, topics\",\n      \"Accessibility Menu – fully accessible experience\"\n    ],\n    technology: \"Engineered by Yaron.H. Handasa LTD as a fast, precise, and user‑friendly content workflow solution.\",\n    privacyTitle: \"🔐 Privacy (Summary)\",\n    privacyPoints: [\n      \"Collected: anonymous ops data, usage, content you submit\",\n      \"We do not: sell/transfer personal data to third parties without consent\",\n      \"Security: encrypted and compliant infrastructure (GDPR, ISO 27001)\",\n      \"Cookies: for functionality, analytics, and UX only\",\n      \"Your rights: access/delete/edit via RepostlyAi@gmail.com\"\n    ],\n    copyrightTitle: \"📜 Copyright\",\n    copyrightPoints: [\n      \"All code, UI, branding, and functionality are IP of Yaron.H. Handasa LTD\",\n      \"No copying, reselling, or embedding without permission\",\n      \"Users retain rights to content they submit\",\n      \"AI‑generated outputs are the user's responsibility\"\n    ],\n    disclaimerTitle: \"⚠️ Disclaimer\",\n    disclaimerPoints: [\n      \"Outputs are not advice (marketing, legal, or business)\",\n      \"All content is based on user input – user is responsible for results\",\n      \"Yaron.H. Handasa LTD is not liable for direct/indirect damages\"\n    ],\n    backToHome: \"Back to Dashboard\",\n    legalPages: \"Legal Pages\",\n    terms: \"Terms of Use\",\n    privacy: \"Privacy Policy\",\n    copyrightDisclaimer: \"Copyright & Disclaimer\"\n  }\n};\n\nexport default function AboutPage({ effectiveLanguage }) {\n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  return (\n    <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 p-6 md:p-10 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <div className=\"max-w-4xl mx-auto bg-white/90 backdrop-blur-xl p-8 md:p-12 rounded-2xl shadow-xl border border-white/30\">\n        <header className=\"text-center mb-10\">\n          <Info className=\"w-16 h-16 text-teal-600 mx-auto mb-4\" />\n          <h1 className=\"text-4xl md:text-5xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-3\">\n            {t.title}\n          </h1>\n          <p className=\"text-lg text-gray-600\">{t.subtitle}</p>\n        </header>\n\n        {/* פתיח + יעד */}\n        <section className=\"mb-8\">\n          <p className=\"text-lg text-gray-700 leading-relaxed mb-4\">{t.platformIntro}</p>\n          <p className=\"text-lg text-gray-700 leading-relaxed\">{t.goal}</p>\n        </section>\n\n        {/* מה מייחד אותנו */}\n        <section className=\"mb-8\">\n          <h2 className=\"text-2xl font-semibold text-teal-700 mb-4 flex items-center\">\n            <Settings2 className=\"w-6 h-6 mr-2\" /> {t.supportsTitle}\n          </h2>\n          <ul className=\"list-disc list-inside space-y-2 text-gray-700 pl-4\">\n            {t.features.map((feature, index) => (\n              <li key={index} className=\"text-lg\">{feature}</li>\n            ))}\n          </ul>\n        </section>\n\n        {/* טכנולוגיה / מי פיתח */}\n        <section className=\"mb-10\">\n          <h2 className=\"text-2xl font-semibold text-teal-700 mb-4 flex items-center\">\n            <Brain className=\"w-6 h-6 mr-2\" /> {effectiveLanguage === 'he' ? \"על הפיתוח\" : \"About the build\"}\n          </h2>\n          <p className=\"text-lg text-gray-700 leading-relaxed\">{t.technology}</p>\n        </section>\n        \n        <hr className=\"my-8 border-teal-200\"/>\n\n        {/* תקציר פרטיות */}\n        <section className=\"mb-8\">\n          <h2 className=\"text-2xl font-semibold text-teal-700 mb-4 flex items-center\">\n            <ShieldCheck className=\"w-6 h-6 mr-2\" /> {t.privacyTitle}\n          </h2>\n          <ul className=\"list-disc list-inside space-y-2 text-gray-700 pl-4\">\n            {t.privacyPoints.map((p, i) => <li key={i}>{p}</li>)}\n          </ul>\n        </section>\n\n        {/* זכויות יוצרים */}\n        <section className=\"mb-8\">\n          <h2 className=\"text-2xl font-semibold text-teal-700 mb-4 flex items-center\">\n            <Copyright className=\"w-6 h-6 mr-2\" /> {t.copyrightTitle}\n          </h2>\n          <ul className=\"list-disc list-inside space-y-2 text-gray-700 pl-4\">\n            {t.copyrightPoints.map((p, i) => <li key={i}>{p}</li>)}\n          </ul>\n        </section>\n\n        {/* דיסקליימר */}\n        <section className=\"mb-10\">\n          <h2 className=\"text-2xl font-semibold text-teal-700 mb-4 flex items-center\">\n            <AlertTriangle className=\"w-6 h-6 mr-2\" /> {t.disclaimerTitle}\n          </h2>\n          <ul className=\"list-disc list-inside space-y-2 text-gray-700 pl-4\">\n            {t.disclaimerPoints.map((p, i) => <li key={i}>{p}</li>)}\n          </ul>\n        </section>\n\n        <hr className=\"my-8 border-teal-200\"/>\n\n        <section className=\"mb-8\">\n          <h2 className=\"text-2xl font-semibold text-teal-700 mb-4 flex items-center\">\n            <FileText className=\"w-6 h-6 mr-2\" /> {t.legalPages}\n          </h2>\n          <div className=\"grid grid-cols-1 md:grid-cols-3 gap-4 text-center\">\n            <Link to={createPageUrl(\"TermsOfUse\")} className=\"text-teal-600 hover:text-teal-800 hover:underline p-3 bg-teal-50 rounded-lg transition-colors\">\n              {t.terms}\n            </Link>\n            <Link to={createPageUrl(\"PrivacyPolicy\")} className=\"text-teal-600 hover:text-teal-800 hover:underline p-3 bg-teal-50 rounded-lg transition-colors\">\n              {t.privacy}\n            </Link>\n            <Link to={createPageUrl(\"CopyrightDisclaimer\")} className=\"text-teal-600 hover:text-teal-800 hover:underline p-3 bg-teal-50 rounded-lg transition-colors\">\n              {t.copyrightDisclaimer}\n            </Link>\n          </div>\n        </section>\n\n        <div className=\"text-center mt-12\">\n          <Link to={createPageUrl(\"Dashboard\")} className=\"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-xl text-white bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700\">\n            {t.backToHome}\n          </Link>\n        </div>\n      </div>\n    </div>\n  );\n}\n","TermsOfUse":"\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport { createPageUrl } from '@/utils';\nimport { FileText, ShieldCheck, UserCheck, XCircle, AlertTriangle, Info, Users, Copyright, Settings2 } from 'lucide-react'; // Added missing icons\n\nconst translations = {\n  he: {\n    title: \"תנאי שימוש\",\n    lastUpdated: \"עדכון אחרון: 28 במאי 2024\",\n    introduction: \"ברוכים הבאים ל-RePostly AI (להלן \\\"הפלטפורמה\\\"). השימוש בפלטפורמה כפוף לתנאים המפורטים להלן. אנא קרא אותם בעיון.\",\n    acceptanceTitle: \"1. הסכמה לתנאים\",\n    acceptanceContent: \"בעצם השימוש בפלטפורמה, אתה מאשר שקראת, הבנת והסכמת לתנאי שימוש אלה ולמדיניות הפרטיות שלנו. אם אינך מסכים לתנאים אלה, אינך רשאי להשתמש בפלטפורמה.\",\n    serviceDescriptionTitle: \"2. תיאור השירות\",\n    serviceDescriptionContent: \"RePostly AI מספקת פלטפורמת SaaS להמרת תוכן בלוג לפורמטים שיווקיים שונים. השירות כולל יצירת תוכן אוטומטית על בסיס קלט המשתמש ולוגיקה פנימית. הפלטפורמה אינה משתמשת במנועי AI חיצוניים או בטכנולוגיות צד שלישי ליצירת התוכן.\",\n    userAccountsTitle: \"3. חשבונות משתמשים\",\n    userAccountsContent: [\n      \"ליצירת חשבון, תידרש לספק מידע אישי מסוים, כגון שם וכתובת אימייל.\",\n      \"אתה אחראי לשמירה על סודיות פרטי החשבון שלך ולכל הפעולות המתבצעות תחתיו.\",\n      \"עליך לעדכן אותנו מיידית על כל שימוש לא מורשה בחשבונך.\"\n    ],\n    userConductTitle: \"4. התנהגות משתמשים\",\n    userConductContent: [\n      \"הנך מתחייב להשתמש בפלטפורמה אך ורק למטרות חוקיות.\",\n      \"חל איסור להעלות תוכן פוגעני, בלתי חוקי, מפר זכויות יוצרים, או כזה המכיל וירוסים או קוד זדוני.\",\n      \"RePostly AI שומרת לעצמה את הזכות להשעות או לחסום חשבונות המפרים תנאים אלו.\"\n    ],\n    intellectualPropertyTitle: \"5. קניין רוחני\",\n    intellectualPropertyContent: \"כל הזכויות על הפלטפורMA, כולל הקוד, העיצוב, הלוגו והלוגיקה הפנימית, שייכות ל-Yaron.H Handasa LTD. התוכן שנוצר על ידי המשתמשים באמצעות הפלטפורמה שייך למשתמשים, אך הם מעניקים ל-RePostly AI רישיון שימוש לא בלעדי להפעלת השירות, שיפורו וניתוחו (באופן אנונימי ומצטבר).\",\n    limitationOfLiabilityTitle: \"6. הגבלת אחריות\",\n    limitationOfLiabilityContent: \"הפלטפורמה מסופקת \\\"כפי שהיא\\\" (AS IS). RePostly AI אינה מתחייבת לאיכות, דיוק, או מהימנות התוכן הנוצר. השימוש בפלטפורמה ובתוכן הנוצר הוא באחריותך הבלעדית. RePostly AI לא תהיה אחראית לכל נזק ישיר או עקיף הנובע מהשימוש בפלטפורMA.\",\n    modificationsTitle: \"7. שינויים בתנאים\",\n    modificationsContent: \"RePostly AI שומרת לעצמה את הזכות לשנות תנאי שימוש אלה מעת לעת. הודעה על שינויים תפורסם בפלטפורמה. המשך שימושך בפלטפורמה לאחר פרסום השינויים מהווה הסכמה לתנאים המעודכנים.\",\n    terminationTitle: \"8. סיום שימוש\",\n    terminationContent: \"RePostly AI רשאית להשעות או לסיים את גישתך לפלטפורמה בכל עת, מכל סיבה שהיא, ללא הודעה מוקדמת, במיוחד במקרים של הפרת תנאים אלו.\",\n    governingLawTitle: \"9. דין חל וסמכות שיפוט\",\n    governingLawContent: \"תנאי שימוש אלו יפורשו וייאכפו בהתאם לחוקי מדינת ישראל. סמכות השיפוט הבלעדית בכל מחלוקת הנוגעת לתנאים אלו תהיה לבתי המשפט המוסמכים במחוז תל אביב-יפו.\",\n    contactTitle: \"10. יצירת קשר\",\n    contactContent: \"לשאלות בנוגע לתנאי שימוש אלה, אנא פנה אלינו בכתובת: repostlyai@gmail.com\",\n    backToHome: \"חזור לדף הבית\"\n  },\n  en: {\n    title: \"Terms of Use\",\n    lastUpdated: \"Last Updated: May 28, 2024\",\n    introduction: \"Welcome to RePostly AI (hereinafter \\\"the Platform\\\"). Use of the Platform is subject to the terms detailed below. Please read them carefully.\",\n    acceptanceTitle: \"1. Acceptance of Terms\",\n    acceptanceContent: \"By using the Platform, you confirm that you have read, understood, and agree to these Terms of Use and our Privacy Policy. If you do not agree to these terms, you may not use the Platform.\",\n    serviceDescriptionTitle: \"2. Service Description\",\n    serviceDescriptionContent: \"RePostly AI provides a SaaS platform for converting blog content into various marketing formats. The service includes automatic content generation based on user input and internal logic. The Platform does not use external AI engines or third-party technologies for content creation.\",\n    userAccountsTitle: \"3. User Accounts\",\n    userAccountsContent: [\n      \"To create an account, you will be required to provide certain personal information, such as name and email address.\",\n      \"You are responsible for maintaining the confidentiality of your account details and for all activities that occur under your account.\",\n      \"You must notify us immediately of any unauthorized use of your account.\"\n    ],\n    userConductTitle: \"4. User Conduct\",\n    userConductContent: [\n      \"You undertake to use the Platform solely for lawful purposes.\",\n      \"It is prohibited to upload offensive, illegal, copyright-infringing content, or content containing viruses or malicious code.\",\n      \"RePostly AI reserves the right to suspend or block accounts that violate these terms.\"\n    ],\n    intellectualPropertyTitle: \"5. Intellectual Property\",\n    intellectualPropertyContent: \"All rights to the Platform, including the code, design, logo, and internal logic, belong to Yaron.H Handasa LTD. Content generated by users via the Platform belongs to the users, but they grant RePostly AI a non-exclusive license to use it for operating the service, improving it, and analyzing it (anonymously and in aggregate).\",\n    limitationOfLiabilityTitle: \"6. Limitation of Liability\",\n    limitationOfLiabilityContent: \"The Platform is provided \\\"AS IS\\\". RePostly AI does not guarantee the quality, accuracy, or reliability of the generated content. Use of the Platform and the generated content is at your sole risk. RePostly AI shall not be liable for any direct or indirect damages resulting from the use of the Platform.\",\n    modificationsTitle: \"7. Modifications to Terms\",\n    modificationsContent: \"RePostly AI reserves the right to change these Terms of Use from time to time. Notice of changes will be posted on the Platform. Your continued use of the Platform after the posting of changes constitutes acceptance of the updated terms.\",\n    terminationTitle: \"8. Termination of Use\",\n    terminationContent: \"RePostly AI may suspend or terminate your access to the Platform at any time, for any reason, without prior notice, especially in cases of violation of these terms.\",\n    governingLawTitle: \"9. Governing Law and Jurisdiction\",\n    governingLawContent: \"These Terms of Use shall be interpreted and enforced in accordance with the laws of the State of Israel. The exclusive jurisdiction in any dispute concerning these terms shall be with the competent courts in the Tel Aviv-Jaffa district.\",\n    contactTitle: \"10. Contact Us\",\n    contactContent: \"For questions regarding these Terms of Use, please contact us at: repostlyai@gmail.com\",\n    backToHome: \"Back to Home\"\n  }\n};\n\nconst Section = ({ title, content, Icon, isList = false }) => (\n  <section className=\"mb-6\">\n    <h2 className=\"text-xl font-semibold text-teal-700 mb-3 flex items-center\">\n      {Icon && <Icon className=\"w-5 h-5 mr-2\" />}\n      {title}\n    </h2>\n    {isList ? (\n      <ul className=\"list-disc list-inside space-y-1 text-gray-700 leading-relaxed pl-4\">\n        {content.map((item, index) => <li key={index}>{item}</li>)}\n      </ul>\n    ) : (\n      <p className=\"text-gray-700 leading-relaxed\">{content}</p>\n    )}\n  </section>\n);\n\nexport default function TermsOfUsePage({ effectiveLanguage }) {\n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  return (\n    <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 p-6 md:p-10 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <div className=\"max-w-4xl mx-auto bg-white/90 backdrop-blur-xl p-8 md:p-12 rounded-2xl shadow-xl border border-white/30\">\n        <header className=\"text-center mb-10\">\n          <FileText className=\"w-16 h-16 text-teal-600 mx-auto mb-4\" />\n          <h1 className=\"text-4xl md:text-5xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-2\">\n            {t.title}\n          </h1>\n          <p className=\"text-sm text-gray-500\">{t.lastUpdated}</p>\n        </header>\n\n        <p className=\"text-gray-700 leading-relaxed mb-8\">{t.introduction}</p>\n\n        <Section title={t.acceptanceTitle} content={t.acceptanceContent} Icon={UserCheck} />\n        <Section title={t.serviceDescriptionTitle} content={t.serviceDescriptionContent} Icon={Info} />\n        <Section title={t.userAccountsTitle} content={t.userAccountsContent} Icon={Users} isList={true} />\n        <Section title={t.userConductTitle} content={t.userConductContent} Icon={XCircle} isList={true} />\n        <Section title={t.intellectualPropertyTitle} content={t.intellectualPropertyContent} Icon={Copyright} />\n        <Section title={t.limitationOfLiabilityTitle} content={t.limitationOfLiabilityContent} Icon={AlertTriangle} />\n        <Section title={t.modificationsTitle} content={t.modificationsContent} Icon={Settings2} />\n        <Section title={t.terminationTitle} content={t.terminationContent} Icon={XCircle} />\n        <Section title={t.governingLawTitle} content={t.governingLawContent} Icon={FileText} />\n        <Section title={t.contactTitle} content={t.contactContent} Icon={Info} />\n\n        <div className=\"text-center mt-12\">\n          <Link to={createPageUrl(\"Dashboard\")} className=\"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-xl text-white bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700\">\n            {t.backToHome}\n          </Link>\n        </div>\n      </div>\n    </div>\n  );\n}\n","PrivacyPolicy":"\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport { createPageUrl } from '@/utils';\nimport { ShieldCheck, Database, UserCircle, Server, Users, Info, UserCheck, Settings2 } from 'lucide-react'; // Added missing icons\n\nconst translations = {\n  he: {\n    title: \"מדיניות פרטיות\",\n    lastUpdated: \"עדכון אחרון: 28 במאי 2024\",\n    introduction: \"RePostly AI (להלן \\\"הפלטפורמה\\\") מחויבת להגנה על פרטיותך. מדיניות זו מתארת את סוגי המידע שאנו אוספים וכיצד אנו משתמשים בו. הפלטפורמה אוספת אך ורק מידע חיוני להפעלת השירות, לצורך שיפור חוויית המשתמש, ולניהול חשבונות המשתמשים.\",\n    collectedInfoTitle: \"1. איזה מידע נאסף?\",\n    collectedInfoItems: [\n      \"מידע אישי: שם, כתובת אימייל ומספר זיהוי ייחודי (ID) של המשתמש לצורך זיהוי וניהול חשבון.\",\n      \"תוכן משתמש: כל טקסט או קלט אחר שהמשתמש מזין לפלטפורמה לצורך המרה. תוכן זה נשמר כדי לאפשר למשתמש גישה להיסטוריית ההמרות שלו.\",\n      \"נתוני שימוש: מידע אנונימי ומצטבר על אופן השימוש בפלטפורמה, כגון מספר המרות שבוצעו, סוגי פורמטים מועדפים, ותדירות שימוש. נתונים אלה משמשים אך ורק לצרכים תפעוליים ולשיפור השירות.\"\n    ],\n    usageOfInfoTitle: \"2. השימוש במידע\",\n    usageOfInfoItems: [\n      \"הפעלת השירות: המידע חיוני כדי לספק לך את פונקציונליות הליבה של הפלטפורמה, כולל יצירת תוכן ושמירת היסטוריית המרות.\",\n      \"שיפור השירות: נתוני שימוש אנונימיים מסייעים לנו להבין כיצד משתמשים מקיימים אינטראקציה עם הפלטפורמה, מה שמאפשר לנו לשפר את ממשק המשתמש, להוסיף תכונות רלוונטיות ולייעל ביצועים.\",\n      \"תקשורת: אנו עשויים להשתמש בכתובת האימייל שלך כדי לשלוח עדכונים חשובים לגבי השירות, כגון שינויים בתנאי השימוש או הודעות תחזוקה.\"\n    ],\n    dataSecurityTitle: \"3. אבטחת מידע\",\n    dataSecurityContent: \"אנו מייחסים חשיבות עליונה לאבטחת המידע שלך. המידע מאוחסן ומאובטח במערכות סגורות ופרטיות, ללא שימוש בשירותי ענן ציבוריים לאחסון נתוני משתמשים קריטיים. אנו נוקטים באמצעים טכניים וארגוניים סבירים כדי להגן על המידע מפני גישה בלתי מורשית, שינוי, חשיפה או השמדה.\",\n    noThirdPartyTitle: \"4. אי-העברת מידע לצדדים שלישיים\",\n    noThirdPartyContent: \"RePostly AI אינה מוכרת, משכירה או מעבירה את המידע האישי שלך או את התוכן שהזנת לצדדים שלישיים בשום צורה ואופן, למעט במקרים הנדרשים על פי חוק.\",\n    cookiesTitle: \"5. קובצי Cookie\",\n    cookiesContent: \"הפלטפורמה משתמשת בקובצי Cookie חיוניים בלבד לצורך ניהול התחברות (session management) ושמירת העדפות משתמש בסיסיות (כגון שפה). איננו משתמשים בקובצי Cookie למטרות מעקב או פרסום.\",\n    userRightsTitle: \"6. זכויות המשתמש\",\n    userRightsContent: \"באפשרותך לבקש גישה למידע האישי שלך המוחזק אצלנו, וכן לבקש את תיקונו או מחיקתו, בכפוף למגבלות החוק ולצורך התפעולי של שמירת היסטוריית ההמרות שלך. למחיקת חשבון ונתונים קשורים, אנא פנה אלינו.\",\n    policyChangesTitle: \"7. שינויים במדיניות הפרטיות\",\n    policyChangesContent: \"אנו עשויים לעדכן מדיניות פרטיות זו מעת לעת. הגרסה המעודכנת תפורסם בפלטפורמה. המשך שימושך בפלטפורמה לאחר פרסום השינויים מהווה הסכמה למדיניות המעודכנת.\",\n    contactTitle: \"8. יצירת קשר\",\n    contactContent: \"לשאלות או הבהרות בנוגע למדיניות פרטיות זו, אנא פנה אלינו בכתובת: repostlyai@gmail.com\",\n    backToHome: \"חזור לדף הבית\"\n  },\n  en: {\n    title: \"Privacy Policy\",\n    lastUpdated: \"Last Updated: May 28, 2024\",\n    introduction: \"RePostly AI (hereinafter \\\"the Platform\\\") is committed to protecting your privacy. This policy describes the types of information we collect and how we use it. The Platform collects only essential information for operating the service, improving user experience, and managing user accounts.\",\n    collectedInfoTitle: \"1. What Information is Collected?\",\n    collectedInfoItems: [\n      \"Personal Information: Name, email address, and unique user ID for identification and account management.\",\n      \"User Content: Any text or other input the user enters into the Platform for conversion. This content is saved to allow the user access to their conversion history.\",\n      \"Usage Data: Anonymous and aggregated information about how the Platform is used, such as the number of conversions performed, preferred format types, and frequency of use. This data is used solely for operational purposes and service improvement.\"\n    ],\n    usageOfInfoTitle: \"2. Use of Information\",\n    usageOfInfoItems: [\n      \"Service Operation: The information is essential to provide you with the core functionality of the Platform, including content creation and saving conversion history.\",\n      \"Service Improvement: Anonymous usage data helps us understand how users interact with the Platform, allowing us to improve the user interface, add relevant features, and optimize performance.\",\n      \"Communication: We may use your email address to send important updates about the service, such as changes to the terms of use or maintenance notices.\"\n    ],\n    dataSecurityTitle: \"3. Data Security\",\n    dataSecurityContent: \"We attach utmost importance to the security of your information. Data is stored and secured in closed and private systems, without the use of public cloud services for storing critical user data. We take reasonable technical and organizational measures to protect information from unauthorized access, alteration, disclosure, or destruction.\",\n    noThirdPartyTitle: \"4. No Transfer of Information to Third Parties\",\n    noThirdPartyContent: \"RePostly AI does not sell, rent, or transfer your personal information or the content you have entered to third parties in any way, shape, or form, except where required by law.\",\n    cookiesTitle: \"5. Cookies\",\n    cookiesContent: \"The Platform uses essential cookies only for session management and storing basic user preferences (such as language). We do not use cookies for tracking or advertising purposes.\",\n    userRightsTitle: \"6. User Rights\",\n    userRightsContent: \"You may request access to your personal information held by us, as well as request its correction or deletion, subject to legal limitations and the operational need to maintain your conversion history. To delete your account and associated data, please contact us.\",\n    policyChangesTitle: \"7. Changes to the Privacy Policy\",\n    policyChangesContent: \"We may update this Privacy Policy from time to time. The updated version will be posted on the Platform. Your continued use of the Platform after the posting of changes constitutes acceptance of the updated policy.\",\n    contactTitle: \"8. Contact Us\",\n    contactContent: \"For questions or clarifications regarding this Privacy Policy, please contact us at: repostlyai@gmail.com\",\n    backToHome: \"Back to Home\"\n  }\n};\n\nconst Section = ({ title, content, Icon, isList = false, items = [] }) => (\n  <section className=\"mb-6\">\n    <h2 className=\"text-xl font-semibold text-teal-700 mb-3 flex items-center\">\n      {Icon && <Icon className=\"w-5 h-5 mr-2\" />}\n      {title}\n    </h2>\n    {content && <p className=\"text-gray-700 leading-relaxed\">{content}</p>}\n    {isList && items.length > 0 && (\n      <ul className=\"list-disc list-inside space-y-2 text-gray-700 leading-relaxed pl-4\">\n        {items.map((item, index) => <li key={index}>{item}</li>)}\n      </ul>\n    )}\n  </section>\n);\n\nexport default function PrivacyPolicyPage({ effectiveLanguage }) {\n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  return (\n    <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 p-6 md:p-10 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <div className=\"max-w-4xl mx-auto bg-white/90 backdrop-blur-xl p-8 md:p-12 rounded-2xl shadow-xl border border-white/30\">\n        <header className=\"text-center mb-10\">\n          <ShieldCheck className=\"w-16 h-16 text-teal-600 mx-auto mb-4\" />\n          <h1 className=\"text-4xl md:text-5xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-2\">\n            {t.title}\n          </h1>\n          <p className=\"text-sm text-gray-500\">{t.lastUpdated}</p>\n        </header>\n\n        <p className=\"text-gray-700 leading-relaxed mb-8\">{t.introduction}</p>\n\n        <Section title={t.collectedInfoTitle} Icon={UserCircle} isList={true} items={t.collectedInfoItems} />\n        <Section title={t.usageOfInfoTitle} Icon={Database} isList={true} items={t.usageOfInfoItems} />\n        <Section title={t.dataSecurityTitle} content={t.dataSecurityContent} Icon={Server} />\n        <Section title={t.noThirdPartyTitle} content={t.noThirdPartyContent} Icon={Users} />\n        <Section title={t.cookiesTitle} content={t.cookiesContent} Icon={Info}/>\n        <Section title={t.userRightsTitle} content={t.userRightsContent} Icon={UserCheck}/>\n        <Section title={t.policyChangesTitle} content={t.policyChangesContent} Icon={Settings2} />\n        <Section title={t.contactTitle} content={t.contactContent} Icon={Info} />\n\n        <div className=\"text-center mt-12\">\n          <Link to={createPageUrl(\"Dashboard\")} className=\"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-xl text-white bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700\">\n            {t.backToHome}\n          </Link>\n        </div>\n      </div>\n    </div>\n  );\n}\n","CopyrightDisclaimer":"\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport { createPageUrl } from '@/utils';\nimport { Copyright, AlertTriangle, UserSquare, FileWarning, Info } from 'lucide-react';\n\nconst translations = {\n  he: {\n    title: \"זכויות יוצרים ודיסקליימר\",\n    lastUpdated: \"עדכון אחרון: 28 במאי 2024\",\n    ownershipTitle: \"1. בעלות על הפלטפורמה\",\n    ownershipContent: \"הקוד, העיצוב, המבנה, הלוגיקה הפנימית והלוגו של RePostly AI (להלן \\\"הפלטפורמה\\\") הם קניינה הבלעדי של Yaron.H Handasa LTD. כל שימוש מסחרי, העתקה, שכפול, הפצה או יצירת עבודות נגזרות מהפלטפורמה או מרכיביה אסורים בהחלט ללא אישור מפורש בכתב מאת Yaron.H Handasa LTD.\",\n    userContentTitle: \"2. תכנים המוזנים ונוצרים על ידי המשתמשים\",\n    userContentItems: [\n      \"אחריות המשתמש: המשתמש בפלטפורמה (להלן \\\"המשתמש\\\") אחראי באופן בלעדי לכל מידע, טקסט או חומר אחר (להלן \\\"תוכן\\\") שהוא מזין, מעלה או מפיק באמצעות הפלטפורמה.\",\n      \"בעלות המשתמש: התוכן שהמשתמש מזין נשאר בבעלותו. עם זאת, לצורך הפעלת השירות, המשתמש מעניק ל-RePostly AI רישיון עולמי, לא בלעדי, ובלתי חוזר להשתמש, לאחסן ולעבד את התוכן אך ורק במסגרת הפעלת הפלטפורמה ומתן השירותים למשתמש.\",\n      \"אי-בדיקת תוכן: RePostly AI אינה סוקרת, מאשרת, עורכת או נושאת באחריות כלשהי לתוכן שהמשתמשים מזינים או יוצרים באמצעות הפלטפורמה. הפלטפורמה פועלת ככלי אוטומטי בלבד.\"\n    ],\n    generalDisclaimerTitle: \"3. דיסקליימר כללי\",\n    generalDisclaimerItems: [\n      \"\\\"AS IS\\\": הפלטפורמה והשירותים ניתנים \\\"כפי שהם\\\" (AS IS) ו-\\\"ככל שזמינים\\\" (AS AVAILABLE), ללא כל התחייבות או מצג מכל סוג שהוא, בין אם מפורש או משתמע.\",\n      \"אין אחריות לאיכות: RePostly AI אינה מתחייבת לאיכות, לדיוק, למהימנות, לשלמות, להתאמה למטרה מסוימת, או לעמידה בתקנים כלשהם של התוכן הנוצר באמצעות הפלטפורמה. התוכן נוצר באופן אוטומטי על בסיס קלט המשתמש והלוגיקה הפנימית של המערכת.\",\n      \"לא ייעוץ מקצועי: אין לראות בתוכן הנוצר באמצעות הפלטפורמה ייעוץ מקצועי, שיווקי, משפטי, פיננסי או אחר. על המשתמש לבדוק ולאמת כל תוכן לפני השימוש בו, ולהתייעץ עם אנשי מקצוע מתאימים במידת הצורך.\",\n      \"סיכון המשתמש: השימוש בפלטפורמה ובתוכן הנוצר הוא באחריותו הבלעדית של המשתמש. RePostly AI, בעליה ועובדיה לא יישאו באחריות לכל נזק, הפסד או הוצאה, ישירים או עקיפים, שייגרמו כתוצאה מהשימוש בפלטפורמה או מהסתמכות על התוכן הנוצר.\"\n    ],\n    thirdPartyLinksTitle: \"4. קישורים לצדדים שלישיים\",\n    thirdPartyLinksContent: \"הפלטפורמה עשויה להכיל קישורים לאתרים או שירותים של צדדים שלישיים. קישורים אלו ניתנים לנוחות המשתמש בלבד. ל-RePostly AI אין שליטה על אתרים אלו, והיא אינה אחראית לתוכנם, לזמינותם או למדיניות הפרטיות שלהם.\",\n    contactTitle: \"5. יצירת קשר\",\n    contactContent: \"לשאלות בנוגע להודעת זכויות יוצרים ודיסקליימר זו, אנא פנה אלינו בכתובת: repostlyai@gmail.com\",\n    backToHome: \"חזור לדף הבית\"\n  },\n  en: {\n    title: \"Copyright & Disclaimer\",\n    lastUpdated: \"Last Updated: May 28, 2024\",\n    ownershipTitle: \"1. Platform Ownership\",\n    ownershipContent: \"The code, design, structure, internal logic, and logo of RePostly AI (hereinafter \\\"the Platform\\\") are the exclusive property of Yaron.H Handasa LTD. Any commercial use, copying, reproduction, distribution, or creation of derivative works from the Platform or its components is strictly prohibited without express written permission from Yaron.H Handasa LTD.\",\n    userContentTitle: \"2. Content Input and Generated by Users\",\n    userContentItems: [\n      \"User Responsibility: The user of the Platform (hereinafter \\\"the User\\\") is solely responsible for all information, text, or other material (hereinafter \\\"Content\\\") that they input, upload, or generate using the Platform.\",\n      \"User Ownership: The Content input by the User remains their property. However, for the purpose of operating the service, the User grants RePostly AI a worldwide, non-exclusive, irrevocable license to use, store, and process the Content solely within the scope of operating the Platform and providing services to the User.\",\n      \"No Content Review: RePostly AI does not review, approve, edit, or assume any responsibility for the Content that users input or create using the Platform. The Platform operates as an automated tool only.\"\n    ],\n    generalDisclaimerTitle: \"3. General Disclaimer\",\n    generalDisclaimerItems: [\n      \"\\\"AS IS\\\": The Platform and services are provided \\\"AS IS\\\" and \\\"AS AVAILABLE\\\", without any warranty or representation of any kind, whether express or implied.\",\n      \"No Warranty of Quality: RePostly AI does not warrant the quality, accuracy, reliability, completeness, fitness for a particular purpose, or compliance with any standards of the Content generated through the Platform. The Content is generated automatically based on user input and the system's internal logic.\",\n      \"Not Professional Advice: The Content generated via the Platform should not be considered professional, marketing, legal, financial, or other advice. The User must review and verify all Content before using it and consult with appropriate professionals if necessary.\",\n      \"User's Risk: Use of the Platform and the generated Content is at the User's sole risk. RePostly AI, its owners, and employees shall not be liable for any damage, loss, or expense, direct or indirect, incurred as a result of using the Platform or relying on the generated Content.\"\n    ],\n    thirdPartyLinksTitle: \"4. Third-Party Links\",\n    thirdPartyLinksContent: \"The Platform may contain links to third-party websites or services. These links are provided for User convenience only. RePostly AI has no control over these sites and is not responsible for their content, availability, or privacy policies.\",\n    contactTitle: \"5. Contact Us\",\n    contactContent: \"For questions regarding this Copyright & Disclaimer notice, please contact us at: repostlyai@gmail.com\",\n    backToHome: \"Back to Home\"\n  }\n};\n\nconst Section = ({ title, content, Icon, isList = false, items = [] }) => (\n  <section className=\"mb-6\">\n    <h2 className=\"text-xl font-semibold text-teal-700 mb-3 flex items-center\">\n      {Icon && <Icon className=\"w-5 h-5 mr-2\" />}\n      {title}\n    </h2>\n    {content && <p className=\"text-gray-700 leading-relaxed\">{content}</p>}\n    {isList && items.length > 0 && (\n      <ul className=\"list-disc list-inside space-y-2 text-gray-700 leading-relaxed pl-4\">\n        {items.map((item, index) => <li key={index}>{item}</li>)}\n      </ul>\n    )}\n  </section>\n);\n\n\nexport default function CopyrightDisclaimerPage({ effectiveLanguage }) {\n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  return (\n    <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 p-6 md:p-10 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <div className=\"max-w-4xl mx-auto bg-white/90 backdrop-blur-xl p-8 md:p-12 rounded-2xl shadow-xl border border-white/30\">\n        <header className=\"text-center mb-10\">\n          <FileWarning className=\"w-16 h-16 text-teal-600 mx-auto mb-4\" />\n          <h1 className=\"text-4xl md:text-5xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent mb-2\">\n            {t.title}\n          </h1>\n          <p className=\"text-sm text-gray-500\">{t.lastUpdated}</p>\n        </header>\n\n        <Section title={t.ownershipTitle} content={t.ownershipContent} Icon={Copyright} />\n        <Section title={t.userContentTitle} Icon={UserSquare} isList={true} items={t.userContentItems} />\n        <Section title={t.generalDisclaimerTitle} Icon={AlertTriangle} isList={true} items={t.generalDisclaimerItems} />\n        <Section title={t.thirdPartyLinksTitle} content={t.thirdPartyLinksContent} Icon={Info} />\n        <Section title={t.contactTitle} content={t.contactContent} Icon={Info} />\n\n        <div className=\"text-center mt-12\">\n          <Link to={createPageUrl(\"Dashboard\")} className=\"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-xl text-white bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700\">\n            {t.backToHome}\n          </Link>\n        </div>\n      </div>\n    </div>\n  );\n}\n","SupportChat":"\nimport React, { useState, useEffect, useRef } from 'react';\nimport { User } from '@/entities/User';\nimport { InvokeLLM } from '@/integrations/Core';\nimport { Button } from '@/components/ui/button';\nimport { Textarea } from '@/components/ui/textarea';\nimport { Card, CardContent, CardHeader, CardTitle, CardFooter } from '@/components/ui/card';\nimport { Loader2, Send, AlertCircle, Mail, ExternalLink } from 'lucide-react';\nimport { Link } from 'react-router-dom';\nimport { createPageUrl } from '@/utils';\n\nconst translations = {\n  he: {\n    title: \"צ'אט תמיכה\",\n    subtitle: \"זמין למשתמשים במסלולים בתשלום.\",\n    placeholder: \"הקלד את שאלתך כאן...\",\n    send: \"שלח\",\n    loadingAnswer: \"חושב על תשובה...\",\n    aiName: \"RePostly AI תמיכה\",\n    userName: \"אתה\",\n    notAvailableTitle: \"צ'אט תמיכה אינו זמין למסלול החינמי\",\n    notAvailableInfo: \"כדי לקבל גישה לתמיכה בצ'אט, אנא שדרג את התוכנית שלך. בינתיים, ניתן לפנות לתמיכה במייל.\",\n    upgradeButton: \"שדרג תוכנית\",\n    contactSupportEmail: \"צור קשר באימייל\",\n    initialGreeting: \"שלום! אני כאן כדי לעזור לך עם שאלות על RePostly AI. איך אני יכול לעזור היום?\",\n    llmError: \"אני מצטער, נתקלתי בבעיה בעיבוד הבקשה שלך. אנא נסה שוב מאוחר יותר או פנה לתמיכה במייל.\",\n  },\n  en: {\n    title: \"Support Chat\",\n    subtitle: \"Available for paying subscribers.\",\n    placeholder: \"Type your question here...\",\n    send: \"Send\",\n    loadingAnswer: \"Thinking of an answer...\",\n    aiName: \"RePostly AI Support\",\n    userName: \"You\",\n    notAvailableTitle: \"Support Chat Not Available for Free Plan\",\n    notAvailableInfo: \"To access support chat, please upgrade your plan. In the meantime, you can contact support via email.\",\n    upgradeButton: \"Upgrade Plan\",\n    contactSupportEmail: \"Contact Support via Email\",\n    initialGreeting: \"Hello! I'm here to help you with your questions about RePostly AI. How can I assist you today?\",\n    llmError: \"I'm sorry, I encountered an issue processing your request. Please try again later or contact support via email.\",\n  },\n  // Add other languages similarly if needed\n};\n\nexport default function SupportChatPage({ effectiveLanguage }) {\n  const [user, setUser] = useState(null);\n  const [loadingUser, setLoadingUser] = useState(true);\n  const [messages, setMessages] = useState([]);\n  const [inputMessage, setInputMessage] = useState('');\n  const [isSending, setIsSending] = useState(false);\n  const messagesEndRef = useRef(null);\n  const [isChatVisible, setIsChatVisible] = useState(false); // New state for widget visibility\n\n  const pageLang = effectiveLanguage || 'en';\n  const t = translations[pageLang] || translations.en;\n\n  useEffect(() => {\n    const fetchUser = async () => {\n      try {\n        const userData = await User.me();\n        setUser(userData);\n        if (userData.plan_type !== 'free') {\n          setMessages([{ sender: 'ai', text: t.initialGreeting, id: Date.now() }]);\n        }\n      } catch (error) {\n        console.error(\"Error fetching user:\", error);\n      }\n      setLoadingUser(false);\n    };\n    fetchUser();\n  }, [t.initialGreeting]);\n\n  useEffect(() => {\n    messagesEndRef.current?.scrollIntoView({ behavior: \"smooth\" });\n  }, [messages]);\n\n  const handleSendMessage = async () => {\n    if (!inputMessage.trim()) return;\n\n    const newUserMessage = { sender: 'user', text: inputMessage, id: Date.now() };\n    setMessages(prev => [...prev, newUserMessage]);\n    setInputMessage('');\n    setIsSending(true);\n\n    try {\n      const prompt = `You are a helpful and friendly support chatbot for RePostly AI.\nRePostly AI is a SaaS platform that converts blog content into multiple marketing formats automatically (LinkedIn posts, X posts/threads, podcast scripts, newsletter summaries, landing page intros, short video scripts, graphic prompts).\nThe user is a paying customer and has the following question. Please answer clearly and concisely in ${pageLang === 'he' ? 'Hebrew' : 'English'}. If the question is about account management, billing, or requires accessing user-specific data, please politely inform them that you cannot access that information and advise them to contact support via email at repostlyai@gmail.com for assistance with such matters.\nIf the question is technical or about how to use a feature, try to provide helpful information based on the RePostly AI context.\n\nUser's question: \"${newUserMessage.text}\"`;\n\n      const response = await InvokeLLM({ prompt });\n      const aiResponse = { sender: 'ai', text: typeof response === 'string' ? response : JSON.stringify(response), id: Date.now() + 1 };\n      setMessages(prev => [...prev, aiResponse]);\n    } catch (error) {\n      console.error(\"Error calling LLM:\", error);\n      const errorResponse = { sender: 'ai', text: t.llmError, id: Date.now() + 1 };\n      setMessages(prev => [...prev, errorResponse]);\n    }\n    setIsSending(false);\n  };\n\n  if (loadingUser) {\n    return (\n      <div className=\"flex justify-center items-center h-screen\">\n        <Loader2 className=\"h-8 w-8 animate-spin text-teal-600\" />\n      </div>\n    );\n  }\n\n  const isRTL = pageLang === 'he';\n\n  if (!user || user.plan_type === 'free') {\n    return (\n      <div className=\"p-6 md:p-10 min-h-screen flex flex-col items-center justify-center text-center bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50\" dir={isRTL ? 'rtl' : 'ltr'}>\n        <Card className=\"w-full max-w-lg bg-white/90 backdrop-blur-xl p-8 rounded-xl shadow-xl\">\n          <CardHeader>\n            <AlertCircle className=\"w-16 h-16 text-orange-500 mx-auto mb-4\" />\n            <CardTitle className=\"text-2xl font-bold text-gray-800\">{t.notAvailableTitle}</CardTitle>\n          </CardHeader>\n          <CardContent>\n            <p className=\"text-gray-600 mb-6\">{t.notAvailableInfo}</p>\n            <div className=\"flex flex-col sm:flex-row gap-4 justify-center\">\n              <Link to={createPageUrl(\"Pricing\")} className=\"w-full sm:w-auto\">\n                <Button className=\"w-full bg-teal-600 hover:bg-teal-700 text-white\">\n                  <ExternalLink className=\"mr-2 h-4 w-4\" /> {t.upgradeButton}\n                </Button>\n              </Link>\n              <a href=\"mailto:repostlyai@gmail.com\" className=\"w-full sm:w-auto\">\n                <Button variant=\"outline\" className=\"w-full\">\n                  <Mail className=\"mr-2 h-4 w-4\" /> {t.contactSupportEmail}\n                </Button>\n              </a>\n            </div>\n          </CardContent>\n        </Card>\n      </div>\n    );\n  }\n\n  // Floating Widget Implementation\n  return (\n    <>\n      {isChatVisible && (\n        <div className=\"fixed bottom-6 right-6 z-50 max-w-3xl\" dir={isRTL ? 'rtl' : 'ltr'}>\n          <style>{`\n            :root { --header-height: 60px; /* Adjust if your header height is different */ }\n          `}</style>\n          <Card className=\"flex-1 flex flex-col shadow-xl bg-white/95 backdrop-blur-lg border-white/30 max-h-[600px] h-[600px]\">\n            <CardHeader className=\"border-b\">\n              <CardTitle className=\"text-2xl font-bold text-teal-700\">{t.title}</CardTitle>\n              <p className=\"text-sm text-gray-500\">{t.subtitle}</p>\n            </CardHeader>\n            <CardContent className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n              {messages.map((msg) => (\n                <div\n                  key={msg.id}\n                  className={`flex ${msg.sender === 'user' ? (isRTL ? 'justify-start' : 'justify-end') : (isRTL ? 'justify-end' : 'justify-start')}`}\n                >\n                  <div\n                    className={`max-w-[75%] p-3 rounded-xl whitespace-pre-wrap ${\n                      msg.sender === 'user'\n                        ? 'bg-teal-500 text-white' + (isRTL ? ' rounded-br-none' : ' rounded-bl-none')\n                        : 'bg-slate-100 text-gray-800' + (isRTL ? ' rounded-bl-none' : ' rounded-br-none')\n                    }`}\n                  >\n                    <p className=\"font-semibold text-xs mb-1\">{msg.sender === 'user' ? t.userName : t.aiName}</p>\n                    {msg.text}\n                  </div>\n                </div>\n              ))}\n              <div ref={messagesEndRef} />\n            </CardContent>\n            <CardFooter className=\"p-4 border-t\">\n              <div className=\"flex w-full items-center space-x-2 dir-aware-children\">\n                <Textarea\n                  placeholder={t.placeholder}\n                  value={inputMessage}\n                  onChange={(e) => setInputMessage(e.target.value)}\n                  onKeyPress={(e) => {\n                    if (e.key === 'Enter' && !e.shiftKey && !isSending) {\n                      e.preventDefault();\n                      handleSendMessage();\n                    }\n                  }}\n                  rows={1}\n                  className=\"flex-1 resize-none min-h-[40px]\"\n                  disabled={isSending}\n                />\n                <Button onClick={handleSendMessage} disabled={isSending || !inputMessage.trim()} className=\"bg-teal-600 hover:bg-teal-700\">\n                  {isSending ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <Send className=\"h-4 w-4\" />}\n                  <span className=\"sr-only\">{t.send}</span>\n                </Button>\n              </div>\n            </CardFooter>\n          </Card>\n        </div>\n      )}\n\n      {/* Widget Toggle Button */}\n      <button\n        onClick={() => setIsChatVisible(!isChatVisible)}\n        className=\"fixed bottom-6 left-6 bg-teal-600 hover:bg-teal-700 text-white rounded-full p-3 shadow-lg z-50\"\n      >\n        {isChatVisible ? 'X' : '?'} {/* Change icon as needed */}\n      </button>\n    </>\n  );\n}\n","HomePage":"\nimport React, { useState, useEffect } from 'react';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { User } from '@/entities/User';\nimport { Button } from '@/components/ui/button';\nimport { createPageUrl } from '@/utils';\nimport { PlayCircle, Zap, CheckCircle, Users, TrendingUp, ShieldCheck, ArrowRight, LogIn, Globe, Menu } from 'lucide-icon';\nimport { Card, CardContent } from '@/components/ui/card';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\n\nconst translations = {\n  en: {\n    headline: \"Turn your blog into 5 powerful content formats – in seconds.\",\n    subheadline: \"RePostly AI automatically converts your blog into multiple content formats. No more manual repurposing.\",\n    getStarted: \"Try RePostly Free\",\n    howItWorksTitle: \"How It Works\",\n    step1: \"Paste Blog\",\n    step1Desc: \"Paste your blog post or provide a link.\",\n    step2: \"Choose Formats\", \n    step2Desc: \"Select your desired output formats.\",\n    step3: \"Generate Content\",\n    step3Desc: \"Get amazing outputs ready to publish.\",\n    supportedFormatsTitle: \"Supported Formats\",\n    testimonialTitle: \"What our users say\",\n    testimonial1: \"An absolute game changer for content repurposing!\",\n    testimonial1Author: \"Sarah M.\",\n    testimonial2: \"Saves me hours every week. Highly recommended!\",\n    testimonial2Author: \"David L.\",\n    testimonial3: \"The quality of outputs is impressive. Love it!\",\n    testimonial3Author: \"Emma R.\",\n    pricingPreview: \"Simple, transparent pricing\",\n    home: \"Home\",\n    pricing: \"Pricing\",\n    about: \"About\",\n    dashboard: \"Dashboard\",\n    signIn: \"Sign In\",\n    privacy: \"Privacy\",\n    terms: \"Terms\",\n    support: \"Support\",\n    languages: {\n      en: \"English\",\n      he: \"עברית\",\n      ar: \"العربية\",\n      es: \"Español\",\n      fr: \"Français\",\n      zh: \"中文\",\n      it: \"Italiano\"\n    },\n    loginTitle: \"Sign In\",\n    loginDescription: \"Sign in to your RePostly account to continue.\",\n    loginWithGoogle: \"Continue with Google\",\n    close: \"Close\",\n  },\n  he: {\n    headline: \"הפוך את הבלוג שלך ל-5 פורמטי תוכן עוצמתיים - בשניות.\",\n    subheadline: \"RePostly AI ממיר אוטומטית את הבלוג שלך למגוון פורמטי תוכן. לא עוד התאמה ידנית.\",\n    getStarted: \"נסה את RePostly בחינם\",\n    howItWorksTitle: \"איך זה עובד\",\n    step1: \"הדבק בלוג\",\n    step1Desc: \"הדבק את פוסט הבלוג שלך או ספק קישור.\",\n    step2: \"בחר פורמטים\",\n    step2Desc: \"בחר את פורמטי הפלט הרצויים.\",\n    step3: \"צור תוכן\",\n    step3Desc: \"קבל תוצרים מדהימים מוכנים לפרסום.\",\n    supportedFormatsTitle: \"פורמטים נתמכים\",\n    testimonialTitle: \"מה המשתמשים שלנו אומרים\",\n    testimonial1: \"משנה חיים לגמרי בהתאמת תוכן!\",\n    testimonial1Author: \"שרה מ.\",\n    testimonial2: \"חוסך לי שעות כל שבוע. מומלץ בחום!\",\n    testimonial2Author: \"דוד ל.\",\n    testimonial3: \"איכות התוצרים מרשימה. אוהב את זה!\",\n    testimonial3Author: \"אמה ר.\",\n    pricingPreview: \"תמחור פשוט ושקוף\",\n    home: \"בית\",\n    pricing: \"תמחור\",\n    about: \"אודות\",\n    dashboard: \"דשבורד\",\n    signIn: \"התחבר\",\n    privacy: \"פרטיות\",\n    terms: \"תנאים\",\n    support: \"תמיכה\",\n    languages: {\n      en: \"English\",\n      he: \"עברית\",\n      ar: \"العربية\",\n      es: \"Español\",\n      fr: \"Français\",\n      zh: \"中文\",\n      it: \"Italiano\"\n    },\n    loginTitle: \"התחבר\",\n    loginDescription: \"התחבר לחשבון ה-RePostly שלך כדי להמשיך.\",\n    loginWithGoogle: \"המשך עם גוגל\",\n    close: \"סגור\",\n  }\n  // Add other languages as needed\n};\n\nconst XIcon = () => (\n  <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" className=\"w-8 h-8\">\n    <path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\"></path>\n  </svg>\n);\n\nconst supportedLanguages = [\"en\", \"he\", \"ar\", \"es\", \"fr\", \"zh\", \"it\"];\n\nconst LoginModal = ({ isOpen, onClose, effectiveLanguage, onLanguageChange, onSuccessfulLogin }) => {\n  if (!isOpen) return null;\n\n  const tModal = translations[effectiveLanguage] || translations.en;\n\n  const handleLogin = async () => {\n    try {\n      await User.login();\n      onSuccessfulLogin(); // Notify parent of successful login\n      onClose(); // Close the modal\n    } catch (error) {\n      console.error(\"Login failed:\", error);\n      // Optionally, display an error message in the modal\n    }\n  };\n\n  return (\n    <div className=\"fixed inset-0 z-[100] flex items-center justify-center bg-black bg-opacity-50 p-4\">\n      <div className=\"bg-white rounded-lg p-8 shadow-lg max-w-sm w-full mx-auto animate-in fade-in-0 zoom-in-95 data-[state=open]:slide-in-from-bottom-2 data-[state=open]:ease-out data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-bottom-2\">\n        <h2 className=\"text-2xl font-bold mb-4 text-gray-900\">{tModal.loginTitle}</h2>\n        <p className=\"text-gray-600 mb-6\">{tModal.loginDescription}</p>\n        <Button \n          className=\"w-full bg-teal-600 hover:bg-teal-700 text-white py-2 rounded-lg font-medium flex items-center justify-center gap-2\"\n          onClick={handleLogin}\n        >\n          <svg className=\"w-5 h-5\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\n            <path d=\"M12.24 10.24h3.2c-.13 1.4-1.28 3.06-3.2 3.06-1.92 0-3.47-1.57-3.47-3.49s1.55-3.49 3.47-3.49c1.05 0 1.98.44 2.66 1.16l2.3-2.3C15.82 2.67 14.12 2 12.24 2 7.74 2 4.01 5.72 4.01 10.22s3.73 8.22 8.23 8.22c4.49 0 7.97-3.24 7.97-8.1 0-.6-.08-1.2-.2-1.78zm0 0\"></path>\n          </svg>\n          {tModal.loginWithGoogle}\n        </Button>\n        <Button variant=\"ghost\" onClick={onClose} className=\"mt-4 w-full\">\n          {tModal.close}\n        </Button>\n      </div>\n    </div>\n  );\n};\n\n\nexport default function HomePage({ effectiveLanguage }) {\n  const navigate = useNavigate();\n  const [user, setUser] = useState(null);\n  const [loadingUser, setLoadingUser] = useState(true);\n  const [currentLang, setCurrentLang] = useState('en');\n  const [mobileMenuOpen, setMobileMenuOpen] = useState(false);\n  const [showLoginModal, setShowLoginModal] = useState(false);\n\n  const t = translations[currentLang] || translations.en;\n  const isRTL = currentLang === 'he' || currentLang === 'ar';\n\n  useEffect(() => {\n    const fetchUser = async () => {\n      try {\n        const currentUser = await User.me();\n        setUser(currentUser);\n        setCurrentLang(currentUser.user_language || effectiveLanguage || 'en');\n      } catch (error) {\n        setUser(null);\n        setCurrentLang(effectiveLanguage || 'en');\n      }\n      setLoadingUser(false);\n    };\n    fetchUser();\n  }, [effectiveLanguage]);\n\n  const handleGetStarted = async () => {\n    if (user) {\n      navigate(createPageUrl(\"Convert\"));\n    } else {\n      setShowLoginModal(true);\n    }\n  };\n  \n  const handleNavigation = (page) => {\n    if (user && page === 'signIn') {\n      navigate(createPageUrl(\"Dashboard\"));\n    } else if (page === 'signIn') {\n      setShowLoginModal(true);\n    } else {\n      navigate(createPageUrl(page.charAt(0).toUpperCase() + page.slice(1)));\n    }\n  };\n\n  const handleLanguageChange = (lang) => {\n    setCurrentLang(lang);\n    localStorage.setItem('repostly_lang', lang);\n    // If user is logged in, update their language preference\n    if (user) {\n      User.updateMyUserData({ user_language: lang }).catch(console.error);\n    }\n  };\n\n  const handleSuccessfulLogin = async () => {\n    setLoadingUser(true); // Indicate loading while refetching user data\n    try {\n      const currentUser = await User.me();\n      setUser(currentUser);\n      // Optionally, navigate to dashboard immediately after login\n      navigate(createPageUrl(\"Dashboard\"));\n    } catch (error) {\n      console.error(\"Failed to fetch user after login:\", error);\n      setUser(null);\n    } finally {\n      setLoadingUser(false);\n    }\n  };\n\n  return (\n    <div className={`min-h-screen bg-white text-gray-900 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      {/* Header */}\n      <header className=\"sticky top-0 z-50 bg-white/95 backdrop-blur-md border-b border-gray-100\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\n          <div className=\"flex justify-between items-center h-16\">\n            {/* Logo */}\n            <div className=\"flex items-center gap-2\">\n              <img\n                src=\"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/54c656121_5cea2907f_May27202510_40_12AM.png\"\n                alt=\"RePostly Logo\"\n                className=\"w-8 h-8 rounded-lg object-contain bg-white/10\"\n                onError={(e)=>{e.currentTarget.onerror=null; e.currentTarget.src='https://images.unsplash.com/photo-1515879218367-8466d910aaa4?w=64&q=80&auto=format&fit=crop';}}\n              />\n              <span className=\"text-xl font-bold text-gray-900\">RePostly</span>\n            </div>\n\n            {/* Desktop Navigation */}\n            <nav className=\"hidden md:flex items-center space-x-8\">\n              <Link to={createPageUrl(\"HomePage\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium\">\n                {t.home}\n              </Link>\n              <Link to={createPageUrl(\"Pricing\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium\">\n                {t.pricing}\n              </Link>\n              <Link to={createPageUrl(\"About\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium\">\n                {t.about}\n              </Link>\n              {user && (\n                <Link to={createPageUrl(\"Dashboard\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium\">\n                  {t.dashboard}\n                </Link>\n              )}\n            </nav>\n\n            {/* Desktop Right Section */}\n            <div className=\"hidden md:flex items-center space-x-4\">\n              {/* Language Dropdown */}\n              <DropdownMenu>\n                <DropdownMenuTrigger asChild>\n                  <Button variant=\"ghost\" size=\"sm\" className=\"flex items-center gap-2\">\n                    <Globe className=\"w-4 h-4\" />\n                    <span className=\"text-sm\">{t.languages[currentLang]}</span>\n                  </Button>\n                </DropdownMenuTrigger>\n                <DropdownMenuContent align={isRTL ? \"start\" : \"end\"}>\n                  {supportedLanguages.map(lang => (\n                    <DropdownMenuItem key={lang} onClick={() => handleLanguageChange(lang)} disabled={currentLang === lang}>\n                      {t.languages[lang]}\n                    </DropdownMenuItem>\n                  ))}\n                </DropdownMenuContent>\n              </DropdownMenu>\n\n              {!user ? (\n                <Button \n                  onClick={() => setShowLoginModal(true)}\n                  className=\"bg-teal-600 hover:bg-teal-700 text-white px-6 py-2 rounded-xl font-medium transition-all\"\n                >\n                  {t.signIn}\n                </Button>\n              ) : (\n                <Button \n                  onClick={() => navigate(createPageUrl(\"Dashboard\"))}\n                  className=\"bg-teal-600 hover:bg-teal-700 text-white px-6 py-2 rounded-xl font-medium transition-all\"\n                >\n                  {t.dashboard}\n                </Button>\n              )}\n            </div>\n\n            {/* Mobile Menu Button */}\n            <Button\n              variant=\"ghost\"\n              size=\"sm\"\n              className=\"md:hidden\"\n              onClick={() => setMobileMenuOpen(!mobileMenuOpen)}\n            >\n              <Menu className=\"w-5 h-5\" />\n            </Button>\n          </div>\n\n          {/* Mobile Menu */}\n          {mobileMenuOpen && (\n            <div className=\"md:hidden py-4 border-t border-gray-100\">\n              <div className=\"flex flex-col space-y-3\">\n                <Link to={createPageUrl(\"HomePage\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium px-2 py-1\">\n                  {t.home}\n                </Link>\n                <Link to={createPageUrl(\"Pricing\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium px-2 py-1\">\n                  {t.pricing}\n                </Link>\n                <Link to={createPageUrl(\"About\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium px-2 py-1\">\n                  {t.about}\n                </Link>\n                {user && (\n                  <Link to={createPageUrl(\"Dashboard\")} className=\"text-gray-700 hover:text-teal-600 transition-colors font-medium px-2 py-1\">\n                    {t.dashboard}\n                  </Link>\n                )}\n                <div className=\"flex items-center justify-between pt-3 border-t border-gray-100\">\n                  <DropdownMenu>\n                    <DropdownMenuTrigger asChild>\n                      <Button variant=\"ghost\" size=\"sm\" className=\"flex items-center gap-2\">\n                        <Globe className=\"w-4 h-4\" />\n                        <span className=\"text-sm\">{t.languages[currentLang]}</span>\n                      </Button>\n                    </DropdownMenuTrigger>\n                    <DropdownMenuContent>\n                      {supportedLanguages.map(lang => (\n                        <DropdownMenuItem key={lang} onClick={() => handleLanguageChange(lang)} disabled={currentLang === lang}>\n                          {t.languages[lang]}\n                        </DropdownMenuItem>\n                      ))}\n                    </DropdownMenuContent>\n                  </DropdownMenu>\n                  {!user ? (\n                    <Button \n                      onClick={() => setShowLoginModal(true)}\n                      className=\"bg-teal-600 hover:bg-teal-700 text-white px-4 py-2 rounded-lg font-medium\"\n                    >\n                      {t.signIn}\n                    </Button>\n                  ) : (\n                    <Button \n                      onClick={() => navigate(createPageUrl(\"Dashboard\"))}\n                      className=\"bg-teal-600 hover:bg-teal-700 text-white px-4 py-2 rounded-lg font-medium\"\n                    >\n                      {t.dashboard}\n                    </Button>\n                  )}\n                </div>\n              </div>\n            </div>\n          )}\n        </div>\n      </header>\n\n      {/* Hero Section */}\n      <section className=\"py-16 md:py-24 bg-gradient-to-br from-gray-50 to-white\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\n          <div className=\"text-center max-w-4xl mx-auto\">\n            <h1 className=\"text-4xl md:text-6xl font-bold text-gray-900 mb-6 leading-tight\">\n              {t.headline}\n            </h1>\n            <p className=\"text-lg md:text-xl text-gray-600 mb-8 max-w-2xl mx-auto\">\n              {t.subheadline}\n            </p>\n            <Button\n              size=\"lg\"\n              onClick={handleGetStarted}\n              disabled={loadingUser}\n              className=\"bg-teal-600 hover:bg-teal-700 text-white px-8 py-4 text-lg rounded-xl font-semibold shadow-lg hover:shadow-xl transition-all duration-300\"\n            >\n              {loadingUser ? \"Loading...\" : t.getStarted}\n            </Button>\n          </div>\n        </div>\n      </section>\n\n      {/* How It Works Section */}\n      <section className=\"py-16 md:py-20 bg-white\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\n          <h2 className=\"text-3xl md:text-4xl font-bold text-center text-gray-900 mb-12\">{t.howItWorksTitle}</h2>\n          <div className=\"grid md:grid-cols-3 gap-8 md:gap-12\">\n            {[\n              { \n                step: \"1\", \n                title: t.step1, \n                desc: t.step1Desc, \n                icon: <div className=\"w-12 h-12 bg-teal-100 rounded-full flex items-center justify-center\">\n                        <svg className=\"w-6 h-6 text-teal-600\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n                          <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z\" />\n                        </svg>\n                      </div>\n              },\n              { \n                step: \"2\", \n                title: t.step2, \n                desc: t.step2Desc, \n                icon: <div className=\"w-12 h-12 bg-emerald-100 rounded-full flex items-center justify-center\">\n                        <CheckCircle className=\"w-6 h-6 text-emerald-600\" />\n                      </div>\n              },\n              { \n                step: \"3\", \n                title: t.step3, \n                desc: t.step3Desc, \n                icon: <div className=\"w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center\">\n                        <Zap className=\"w-6 h-6 text-blue-600\" />\n                      </div>\n              }\n            ].map((step, index) => (\n              <div key={index} className=\"text-center\">\n                <div className=\"mb-4 flex justify-center\">{step.icon}</div>\n                <h3 className=\"text-xl font-semibold mb-2 text-gray-900\">{step.title}</h3>\n                <p className=\"text-gray-600\">{step.desc}</p>\n              </div>\n            ))}\n          </div>\n        </div>\n      </section>\n\n      {/* Supported Formats Section */}\n      <section className=\"py-16 md:py-20 bg-gray-50\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\n          <h2 className=\"text-3xl md:text-4xl font-bold text-center text-gray-900 mb-12\">{t.supportedFormatsTitle}</h2>\n          <div className=\"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-6\">\n            {[\n              { name: \"LinkedIn\", icon: \"💼\", color: \"bg-blue-100 text-blue-700\" },\n              { name: \"X (Twitter)\", icon: <XIcon />, color: \"bg-gray-100 text-gray-700\" },\n              { name: \"Podcast\", icon: \"🎙️\", color: \"bg-purple-100 text-purple-700\" },\n              { name: \"Newsletter\", icon: \"📧\", color: \"bg-green-100 text-green-700\" },\n              { name: \"Landing Page\", icon: \"🚀\", color: \"bg-orange-100 text-orange-700\" },\n              { name: \"Graphics\", icon: \"🎨\", color: \"bg-pink-100 text-pink-700\" }\n            ].map((format, index) => (\n              <Card key={index} className=\"border-0 shadow-sm hover:shadow-md transition-shadow\">\n                <CardContent className=\"p-6 text-center\">\n                  <div className={`w-16 h-16 ${format.color} rounded-2xl flex items-center justify-center mx-auto mb-3`}>\n                    {typeof format.icon === 'string' ? (\n                      <span className=\"text-2xl\">{format.icon}</span>\n                    ) : (\n                      <div className=\"w-8 h-8\">{format.icon}</div>\n                    )}\n                  </div>\n                  <h3 className=\"font-semibold text-sm text-gray-900\">{format.name}</h3>\n                </CardContent>\n              </Card>\n            ))}\n          </div>\n        </div>\n      </section>\n\n      {/* Testimonials Section */}\n      <section className=\"py-16 md:py-20 bg-white\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\n          <h2 className=\"text-3xl md:text-4xl font-bold text-center text-gray-900 mb-12\">{t.testimonialTitle}</h2>\n          <div className=\"grid md:grid-cols-3 gap-8\">\n            {[\n              { quote: t.testimonial1, author: t.testimonial1Author },\n              { quote: t.testimonial2, author: t.testimonial2Author },\n              { quote: t.testimonial3, author: t.testimonial3Author }\n            ].map((testimonial, index) => (\n              <Card key={index} className=\"border-0 shadow-sm\">\n                <CardContent className=\"p-6\">\n                  <p className=\"text-gray-700 mb-4 italic\">\"{testimonial.quote}\"</p>\n                  <div className=\"flex items-center\">\n                    <div className=\"w-10 h-10 bg-gradient-to-r from-teal-500 to-emerald-600 rounded-full flex items-center justify-center mr-3\">\n                      <span className=\"text-white font-semibold text-sm\">{testimonial.author.charAt(0)}</span>\n                    </div>\n                    <span className=\"font-semibold text-gray-900\">{testimonial.author}</span>\n                  </div>\n                </CardContent>\n              </Card>\n            ))}\n          </div>\n        </div>\n      </section>\n\n      {/* Pricing Preview */}\n      <section className=\"py-16 md:py-20 bg-gradient-to-br from-teal-50 to-emerald-50\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center\">\n          <h2 className=\"text-3xl md:text-4xl font-bold text-gray-900 mb-4\">{t.pricingPreview}</h2>\n          <p className=\"text-lg text-gray-600 mb-8\">Start free, scale as you grow</p>\n          <Link to={createPageUrl(\"Pricing\")}>\n            <Button className=\"bg-teal-600 hover:bg-teal-700 text-white px-8 py-3 rounded-xl font-semibold\">\n              View Pricing Plans\n            </Button>\n          </Link>\n        </div>\n      </section>\n\n      {/* Footer */}\n      <footer className=\"bg-gray-900 text-gray-300 py-12\">\n        <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\n          <div className=\"grid md:grid-cols-4 gap-8\">\n            <div className=\"md:col-span-2\">\n              <div className=\"flex items-center gap-2 mb-4\">\n                <img\n                  src=\"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/54c656121_5cea2907f_May27202510_40_12AM.png\"\n                  alt=\"RePostly Logo\"\n                  className=\"w-8 h-8 rounded-lg object-contain bg-white/10\"\n                  onError={(e)=>{e.currentTarget.onerror=null; e.currentTarget.src='https://images.unsplash.com/photo-1515879218367-8466d910aaa4?w=64&q=80&auto=format&fit=crop';}}\n                />\n                <span className=\"text-xl font-bold text-white\">RePostly</span>\n              </div>\n              <p className=\"text-gray-400 max-w-md\">\n                Transform your blog content into multiple formats effortlessly with AI-powered automation.\n              </p>\n            </div>\n            <div>\n              <h3 className=\"font-semibold text-white mb-4\">Product</h3>\n              <ul className=\"space-y-2\">\n                <li><Link to={createPageUrl(\"Pricing\")} className=\"hover:text-white transition-colors\">{t.pricing}</Link></li>\n                <li><Link to={createPageUrl(\"About\")} className=\"hover:text-white transition-colors\">{t.about}</Link></li>\n              </ul>\n            </div>\n            <div>\n              <h3 className=\"font-semibold text-white mb-4\">Legal</h3>\n              <ul className=\"space-y-2\">\n                <li><Link to={createPageUrl(\"PrivacyPolicy\")} className=\"hover:text-white transition-colors\">{t.privacy}</Link></li>\n                <li><Link to={createPageUrl(\"TermsOfUse\")} className=\"hover:text-white transition-colors\">{t.terms}</Link></li>\n              </ul>\n            </div>\n          </div>\n          <div className=\"border-t border-gray-800 mt-8 pt-8 flex flex-col md:flex-row justify-between items-center\">\n            <p className=\"text-gray-400 text-sm\">&copy; {new Date().getFullYear()} RePostly. All rights reserved.</p>\n            <DropdownMenu>\n              <DropdownMenuTrigger asChild>\n                <Button variant=\"ghost\" size=\"sm\" className=\"text-gray-400 hover:text-white\">\n                  <Globe className=\"w-4 h-4 mr-2\" />\n                  {t.languages[currentLang]}\n                </Button>\n              </DropdownMenuTrigger>\n              <DropdownMenuContent>\n                {supportedLanguages.map(lang => (\n                  <DropdownMenuItem key={lang} onClick={() => handleLanguageChange(lang)} disabled={currentLang === lang}>\n                    {t.languages[lang]}\n                  </DropdownMenuItem>\n                ))}\n              </DropdownMenuContent>\n            </DropdownMenu>\n          </div>\n        </div>\n      </footer>\n      \n      {/* Login Modal */}\n      <LoginModal \n        isOpen={showLoginModal}\n        onClose={() => setShowLoginModal(false)}\n        effectiveLanguage={currentLang}\n        onLanguageChange={handleLanguageChange}\n        onSuccessfulLogin={handleSuccessfulLogin}\n      />\n    </div>\n  );\n}\n","PaymentSuccess":"import React, { useEffect, useState } from 'react';\nimport { useNavigate, useSearchParams } from 'react-router-dom';\nimport { User } from '@/entities/User';\nimport { executePayment } from '@/functions/executePayment';\nimport { Button } from '@/components/ui/button';\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';\nimport { CheckCircle, Loader2, AlertCircle, ArrowRight } from 'lucide-react';\nimport { createPageUrl } from '@/utils';\n\nconst translations = {\n  en: {\n    processing: \"Processing your payment...\",\n    success: \"Payment Successful!\",\n    failed: \"Payment Failed\",\n    successMessage: \"Your plan has been upgraded successfully. You can now enjoy all the premium features.\",\n    failedMessage: \"There was an issue processing your payment. Please try again or contact support.\",\n    goToDashboard: \"Go to Dashboard\",\n    tryAgain: \"Try Again\",\n    planUpgraded: \"Plan Upgraded\",\n    enjoyFeatures: \"Enjoy your new features!\"\n  },\n  he: {\n    processing: \"מעבד את התשלום שלך...\",\n    success: \"התשלום בוצע בהצלחה!\",\n    failed: \"התשלום נכשל\",\n    successMessage: \"התוכנית שלך שודרגה בהצלחה. כעת תוכל ליהנות מכל התכונות הפרימיום.\",\n    failedMessage: \"הייתה בעיה בעיבוד התשלום שלך. אנא נסה שוב או פנה לתמיכה.\",\n    goToDashboard: \"עבור לדשבורד\",\n    tryAgain: \"נסה שוב\",\n    planUpgraded: \"התוכנית שודרגה\",\n    enjoyFeatures: \"תהנה מהתכונות החדשות שלך!\"\n  }\n};\n\nexport default function PaymentSuccess({ effectiveLanguage = 'en' }) {\n  const [searchParams] = useSearchParams();\n  const navigate = useNavigate();\n  const [status, setStatus] = useState('processing'); // processing, success, failed\n  const [message, setMessage] = useState('');\n  \n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  useEffect(() => {\n    const processPayment = async () => {\n      const paymentId = searchParams.get('paymentId');\n      const payerId = searchParams.get('PayerID');\n      const planType = searchParams.get('plan');\n\n      if (!paymentId || !payerId) {\n        setStatus('failed');\n        setMessage('Missing payment information');\n        return;\n      }\n\n      try {\n        const response = await executePayment({ paymentId, payerId });\n        \n        if (response.status === 200 && response.data?.success) {\n          setStatus('success');\n          setMessage(`Successfully upgraded to ${planType} plan!`);\n          \n          // Reload user data to reflect the new plan\n          setTimeout(() => {\n            window.location.reload();\n          }, 3000);\n        } else {\n          setStatus('failed');\n          setMessage(response.data?.error || 'Payment execution failed');\n        }\n      } catch (error) {\n        console.error('Payment execution error:', error);\n        setStatus('failed');\n        setMessage('Payment processing failed');\n      }\n    };\n\n    processPayment();\n  }, [searchParams]);\n\n  return (\n    <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 flex items-center justify-center p-4 ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n      <Card className=\"max-w-md w-full bg-white/90 backdrop-blur-xl shadow-2xl border border-white/30\">\n        <CardHeader className=\"text-center pb-4\">\n          <div className=\"mx-auto mb-4 flex justify-center\">\n            {status === 'processing' && (\n              <div className=\"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center\">\n                <Loader2 className=\"w-8 h-8 text-blue-600 animate-spin\" />\n              </div>\n            )}\n            {status === 'success' && (\n              <div className=\"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center\">\n                <CheckCircle className=\"w-8 h-8 text-green-600\" />\n              </div>\n            )}\n            {status === 'failed' && (\n              <div className=\"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center\">\n                <AlertCircle className=\"w-8 h-8 text-red-600\" />\n              </div>\n            )}\n          </div>\n          <CardTitle className=\"text-xl font-bold\">\n            {status === 'processing' && t.processing}\n            {status === 'success' && t.success}\n            {status === 'failed' && t.failed}\n          </CardTitle>\n        </CardHeader>\n        \n        <CardContent className=\"text-center space-y-4\">\n          <p className=\"text-gray-600\">\n            {status === 'processing' && t.processing}\n            {status === 'success' && t.successMessage}\n            {status === 'failed' && (message || t.failedMessage)}\n          </p>\n          \n          {status === 'success' && (\n            <div className=\"space-y-3\">\n              <div className=\"bg-green-50 border border-green-200 rounded-lg p-3\">\n                <p className=\"text-green-800 font-medium\">{t.planUpgraded}</p>\n                <p className=\"text-green-600 text-sm\">{t.enjoyFeatures}</p>\n              </div>\n              <Button \n                onClick={() => navigate(createPageUrl('Dashboard'))}\n                className=\"w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white\"\n              >\n                {t.goToDashboard}\n                <ArrowRight className={`w-4 h-4 ${isRTL ? 'mr-2' : 'ml-2'}`} />\n              </Button>\n            </div>\n          )}\n          \n          {status === 'failed' && (\n            <div className=\"space-y-3\">\n              <Button \n                onClick={() => navigate(createPageUrl('Pricing'))}\n                className=\"w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white\"\n              >\n                {t.tryAgain}\n              </Button>\n              <Button \n                variant=\"outline\"\n                onClick={() => navigate(createPageUrl('Dashboard'))}\n                className=\"w-full\"\n              >\n                {t.goToDashboard}\n              </Button>\n            </div>\n          )}\n        </CardContent>\n      </Card>\n    </div>\n  );\n}","RecycleEngine":"import React from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Conversion } from \"@/entities/Conversion\";\nimport { InvokeLLM } from \"@/integrations/Core\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardHeader, CardTitle, CardContent } from \"@/components/ui/card\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { Input } from \"@/components/ui/input\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Loader2, RefreshCw, Wand2, Globe, RotateCcw, History } from \"lucide-react\";\nimport SimilarityList from \"@/components/recycle/SimilarityList\";\nimport TwistControls from \"@/components/recycle/TwistControls\";\nimport { differenceInMonths, parseISO } from \"date-fns\";\n\nfunction tokenize(text) {\n  return (text || \"\")\n    .toLowerCase()\n    .replace(/[^a-zA-Z0-9\\u0590-\\u05FF\\s]/g, \" \")\n    .split(/\\s+/)\n    .filter(Boolean);\n}\nfunction vectorize(tokens) {\n  const map = {};\n  tokens.forEach(t => (map[t] = (map[t] || 0) + 1));\n  return map;\n}\nfunction cosineSim(a, b) {\n  let dot = 0, na = 0, nb = 0;\n  const keys = new Set([...Object.keys(a), ...Object.keys(b)]);\n  keys.forEach(k => {\n    const va = a[k] || 0;\n    const vb = b[k] || 0;\n    dot += va * vb;\n    na += va * va;\n    nb += vb * vb;\n  });\n  if (!na || !nb) return 0;\n  return dot / (Math.sqrt(na) * Math.sqrt(nb));\n}\n\nconst platformHints = {\n  facebook: \"- Create a Facebook post (max 300 words). Use engaging storytelling, include 1-2 relevant hashtags, and end with a clear call-to-action. Conversational and shareable.\",\n  instagram: '- Create an Instagram caption (max 2,000 characters). Start with a hook. Storytelling. Encourage engagement with a question. Add 5-10 relevant hashtags. Include \"Link in bio\" if relevant.',\n  tiktok: \"- Create a TikTok short video script (30-60s). Structure: Hook (first 3s) → Value → Strong CTA. Include timing cues, visuals, and on-screen text ideas.\",\n  reddit: \"- Create a Reddit post: Title (<=120 chars) + Body. Be authentic, community-driven, and discussion-oriented. Suggest relevant subreddits when appropriate.\",\n  x_post: `- Create a comprehensive 10-post X thread:\n  1/10 Hook; 2-3/10 Context; 4-6/10 Main value; 7-8/10 Examples/data; 9/10 Key takeaway; 10/10 CTA.\n  250-280 chars per post, use emojis strategically, numbered posts.`,\n  linkedin: \"- LinkedIn post 300-500 words, value-driven, with CTA.\",\n  newsletter: \"- Newsletter style summary, scannable sections and CTA.\",\n  video: \"- Short video script with scene and VO notes.\",\n  landing: \"- Landing page intro, benefits bullets and CTA.\",\n  graphic: \"- AI image prompt describing key visual, style, composition.\"\n};\n\nexport default function RecycleEnginePage({ effectiveLanguage }) {\n  const [user, setUser] = React.useState(null);\n  const [allConversions, setAllConversions] = React.useState([]);\n  const [inputText, setInputText] = React.useState(\"\");\n  const [search, setSearch] = React.useState(\"\");\n  const [similar, setSimilar] = React.useState([]);\n  const [recycleList, setRecycleList] = React.useState([]);\n  const [selectedBase, setSelectedBase] = React.useState(null);\n  const [twistOptions, setTwistOptions] = React.useState({\n    platform: \"linkedin\",\n    language: effectiveLanguage || \"en\",\n    tone: \"professional\",\n    audience: \"General\",\n    twistCurrentEvent: false,\n    twistNewPerspective: false,\n    timeAnchor: false,\n    rewriteEvergreen: true\n  });\n  const [generating, setGenerating] = React.useState(false);\n  const [result, setResult] = React.useState(\"\");\n\n  React.useEffect(() => {\n    const init = async () => {\n      try {\n        const u = await User.me();\n        setUser(u);\n        const rows = await Conversion.filter({ created_by: u.email }, \"-created_date\");\n        setAllConversions(rows);\n\n        // Time-to-Recycle: older than 3 months and not recycled yet\n        const byId = Object.fromEntries(rows.map(r => [r.id, r]));\n        const recycledIds = new Set(rows.filter(r => r.recycled_from_id).map(r => r.recycled_from_id));\n        const list = rows\n          .filter(r => {\n            const months = r.created_date ? differenceInMonths(new Date(), parseISO(r.created_date)) : 0;\n            return months >= 3 && !recycledIds.has(r.id);\n          })\n          .slice(0, 8);\n        setRecycleList(list);\n      } catch {\n        // ignore\n      }\n    };\n    init();\n  }, []);\n\n  // Similarity scan on input\n  React.useEffect(() => {\n    if (!inputText || !allConversions.length) {\n      setSimilar([]);\n      return;\n    }\n    const baseVec = vectorize(tokenize(inputText));\n    const scores = allConversions.map(c => ({\n      conversion: c,\n      score: cosineSim(baseVec, vectorize(tokenize(c.input_text || \"\")))\n    }));\n    const top = scores\n      .filter(s => s.score >= 0.35)\n      .sort((a, b) => b.score - a.score)\n      .slice(0, 5);\n    setSimilar(top);\n  }, [inputText, allConversions]);\n\n  const handleUseSuggestion = (conv) => {\n    setSelectedBase(conv);\n    setInputText(conv.input_text || \"\");\n  };\n\n  const buildPrompt = () => {\n    const base = inputText || \"\";\n    const plat = twistOptions.platform;\n    const lang = twistOptions.language;\n    const tone = twistOptions.tone;\n    const audience = twistOptions.audience;\n\n    const twistLines = [];\n    if (twistOptions.twistCurrentEvent)\n      twistLines.push(\"- Tie the narrative to a current event or trend (briefly and tastefully).\");\n    if (twistOptions.twistNewPerspective)\n      twistLines.push('- Add a fresh perspective section (e.g., \"what I learned since then\").');\n    if (twistOptions.timeAnchor)\n      twistLines.push('- Consider an \"On this day last year\" angle if relevant.');\n    if (twistOptions.rewriteEvergreen)\n      twistLines.push(\"- Ensure the piece is evergreen: timeless, not news-bound.\");\n\n    const duplicateGuard = `Avoid repeating sentences verbatim from the original or previously generated posts. Rephrase and restructure to create a distinct version while preserving the core message.`;\n\n    return `\nYou are a senior content strategist. Recycle the following content into a fresh, evergreen piece adapted for ${plat} in ${lang}, using a ${tone} tone, targeted at ${audience}.\n${platformHints[plat] || \"\"}\n${twistLines.join(\"\\n\")}\n${duplicateGuard}\nOutput only the final content, no meta explanations.\n\nOriginal content:\n${base}\n    `.trim();\n  };\n\n  const handleGenerate = async () => {\n    if (!user || !inputText) return;\n    setGenerating(true);\n    setResult(\"\");\n    try {\n      const prompt = buildPrompt();\n      const output = await InvokeLLM({ prompt });\n\n      setResult(output);\n\n      // Persist as a new conversion record\n      const created = await Conversion.create({\n        input_text: inputText,\n        input_url: \"\",\n        selected_formats: [twistOptions.platform],\n        writing_tone: twistOptions.tone,\n        output_language: twistOptions.language,\n        content_depth: \"standard\",\n        outputs: { [twistOptions.platform]: output },\n        status: \"completed\",\n        recycled_from_id: selectedBase ? selectedBase.id : \"\",\n        recycle_notes: `audience=${twistOptions.audience}; twistCurrentEvent=${twistOptions.twistCurrentEvent}; twistNewPerspective=${twistOptions.twistNewPerspective}; timeAnchor=${twistOptions.timeAnchor}; evergreen=${twistOptions.rewriteEvergreen}`\n      });\n\n      // Update recycles list if relevant\n      if (selectedBase && created) {\n        setRecycleList(prev => prev.filter(r => r.id !== selectedBase.id));\n      }\n    } finally {\n      setGenerating(false);\n    }\n  };\n\n  const copyResult = async () => {\n    if (!result) return;\n    await navigator.clipboard.writeText(result);\n  };\n\n  const platformEmoji = (p) => ({\n    facebook: \"📘\",\n    instagram: \"📷\",\n    tiktok: \"🎵\",\n    reddit: \"👽\",\n    x_post: \"✖️\",\n    linkedin: \"💼\",\n    newsletter: \"📧\",\n    video: \"🎬\",\n    landing: \"🚀\",\n    graphic: \"🎨\"\n  }[p] || \"📝\");\n\n  return (\n    <div className=\"min-h-screen bg-gray-50 p-4\">\n      <div className=\"max-w-7xl mx-auto\">\n        <div className=\"mb-6 flex items-center justify-between\">\n          <div className=\"flex items-center gap-2\">\n            <RefreshCw className=\"w-5 h-5 text-teal-600\" />\n            <h1 className=\"text-2xl font-bold text-gray-900\">Recycle Engine</h1>\n          </div>\n          <Badge variant=\"outline\" className=\"gap-1\">\n            <Globe className=\"w-3.5 h-3.5\" /> {twistOptions.language.toUpperCase()}\n          </Badge>\n        </div>\n\n        <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-4\">\n          {/* Left: Input + Controls */}\n          <div className=\"lg:col-span-2 space-y-4\">\n            <Card className=\"bg-white\">\n              <CardHeader>\n                <CardTitle className=\"text-base\">Base content</CardTitle>\n              </CardHeader>\n              <CardContent className=\"space-y-3\">\n                <Input\n                  placeholder=\"Search your past content to reuse...\"\n                  value={search}\n                  onChange={(e) => setSearch(e.target.value)}\n                />\n                <Textarea\n                  placeholder=\"Paste or write the content you want to recycle...\"\n                  rows={8}\n                  value={inputText}\n                  onChange={(e) => setInputText(e.target.value)}\n                />\n              </CardContent>\n            </Card>\n\n            <Card className=\"bg-white\">\n              <CardHeader>\n                <CardTitle className=\"text-base\">Smart Twist</CardTitle>\n              </CardHeader>\n              <CardContent>\n                <TwistControls options={twistOptions} setOptions={setTwistOptions} />\n                <div className=\"mt-4\">\n                  <Button\n                    onClick={handleGenerate}\n                    disabled={!inputText || generating}\n                    className=\"bg-gradient-to-r from-teal-500 to-emerald-600 text-white\"\n                  >\n                    {generating ? (\n                      <>\n                        <Loader2 className=\"w-4 h-4 mr-2 animate-spin\" /> Generating...\n                      </>\n                    ) : (\n                      <>\n                        <Wand2 className=\"w-4 h-4 mr-2\" /> Recycle Now\n                      </>\n                    )}\n                  </Button>\n                </div>\n              </CardContent>\n            </Card>\n\n            {result && (\n              <Card className=\"bg-white\">\n                <CardHeader>\n                  <CardTitle className=\"text-base\">Recycled Output {platformEmoji(twistOptions.platform)}</CardTitle>\n                </CardHeader>\n                <CardContent>\n                  <div className=\"bg-gray-50 p-3 rounded-lg whitespace-pre-wrap text-sm\">{result}</div>\n                  <div className=\"mt-3 flex gap-2\">\n                    <Button variant=\"outline\" onClick={copyResult}>Copy</Button>\n                  </div>\n                </CardContent>\n              </Card>\n            )}\n          </div>\n\n          {/* Right: Duplicates + Time to Recycle */}\n          <div className=\"space-y-4\">\n            <SimilarityList\n              items={\n                similar\n                  .filter(({ conversion }) =>\n                    (search ? (conversion.input_text || \"\").toLowerCase().includes(search.toLowerCase()) : true)\n                  )\n              }\n              onUse={handleUseSuggestion}\n            />\n\n            <Card className=\"bg-white/90\">\n              <CardHeader className=\"flex items-center gap-2\">\n                <CardTitle className=\"text-base flex items-center gap-2\">\n                  <History className=\"w-4 h-4 text-teal-600\" /> Time-to-Recycle\n                </CardTitle>\n              </CardHeader>\n              <CardContent className=\"space-y-3\">\n                {recycleList.length === 0 ? (\n                  <p className=\"text-sm text-gray-600\">No candidates older than 3 months.</p>\n                ) : (\n                  recycleList.map(c => (\n                    <div key={c.id} className=\"p-3 rounded-lg border bg-white\">\n                      <div className=\"flex items-center justify-between mb-1\">\n                        <Badge variant=\"secondary\" className=\"gap-1\">\n                          {platformEmoji((c.selected_formats || [])[0])} {(c.selected_formats || [])[0] || \"post\"}\n                        </Badge>\n                        <Button size=\"sm\" variant=\"outline\" onClick={() => handleUseSuggestion(c)}>\n                          Recycle this\n                        </Button>\n                      </div>\n                      <p className=\"text-sm text-gray-700 line-clamp-2\">{c.input_text}</p>\n                    </div>\n                  ))\n                )}\n              </CardContent>\n            </Card>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}","ContentVault":"import React, { useEffect, useMemo, useState } from \"react\";\nimport { User } from \"@/entities/User\";\nimport { Conversion } from \"@/entities/Conversion\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { useNavigate } from \"react-router-dom\";\nimport { createPageUrl } from \"@/utils\";\nimport { differenceInDays, isValid, parseISO } from \"date-fns\";\nimport { Loader2 } from \"lucide-react\";\nimport { InvokeLLM } from \"@/integrations/Core\";\nimport VaultFilters from \"../components/vault/VaultFilters\";\nimport VaultCard from \"../components/vault/VaultCard\";\n\nconst t = {\n  title: \"Content Vault – ארכיון חכם\",\n  subtitle: \"ארגן, חפש ומחזר תכנים קודמים בעזרת AI\",\n  search: \"חיפוש\",\n  actions: \"פעולות\",\n};\n\nexport default function ContentVault({ user: userFromLayout }) {\n  const navigate = useNavigate();\n  const [user, setUser] = useState(userFromLayout || null);\n  const [items, setItems] = useState([]);\n  const [filtered, setFiltered] = useState([]);\n  const [loading, setLoading] = useState(true);\n  const [analyzingId, setAnalyzingId] = useState(null);\n\n  // Filters\n  const [search, setSearch] = useState(\"\");\n  const [dateRange, setDateRange] = useState({ from: null, to: null });\n  const [topic, setTopic] = useState(\"\");\n  const [tag, setTag] = useState(\"\");\n  const [status, setStatus] = useState(\"all\");\n  const [onlySuggestions, setOnlySuggestions] = useState(false);\n\n  // Tag dialog\n  const [tagDialogOpen, setTagDialogOpen] = useState(false);\n  const [tagTarget, setTagTarget] = useState(null);\n  const [newTag, setNewTag] = useState(\"\");\n\n  useEffect(() => {\n    const init = async () => {\n      setLoading(true);\n      try {\n        let u = userFromLayout;\n        if (!u) {\n          u = await User.me();\n          setUser(u);\n        }\n        const data = await Conversion.filter({ created_by: u.email }, \"-created_date\");\n        setItems(data);\n      } finally {\n        setLoading(false);\n      }\n    };\n    init();\n  }, [userFromLayout]);\n\n  // mark recycle candidates (>=60 days without recycle)\n  const withCandidates = useMemo(() => {\n    const now = new Date();\n    return (items || []).map((c) => {\n      const refDate = c.last_recycled_date || c.updated_date || c.created_date;\n      let isCandidate = false;\n      if (refDate) {\n        const d = parseISO(refDate);\n        if (isValid(d)) {\n          const days = differenceInDays(now, d);\n          isCandidate = days >= 60 || (c.evergreen && days >= 30);\n        }\n      }\n      return { ...c, __isRecycleCandidate: isCandidate };\n    });\n  }, [items]);\n\n  // apply filters\n  useEffect(() => {\n    let res = withCandidates;\n    if (search) {\n      const s = search.toLowerCase();\n      res = res.filter((c) => c.input_text?.toLowerCase().includes(s));\n    }\n    if (topic) {\n      res = res.filter((c) => (c.topic || \"\").toLowerCase().includes(topic.toLowerCase()));\n    }\n    if (tag) {\n      res = res.filter((c) => [...(c.auto_tags || []), ...(c.user_tags || [])].some((tt) => tt.toLowerCase().includes(tag.toLowerCase())));\n    }\n    if (status !== \"all\") {\n      if (status === \"candidate\") res = res.filter((c) => c.__isRecycleCandidate);\n      if (status === \"recycled\") res = res.filter((c) => (c.recycle_count || 0) > 0);\n      if (status === \"new\") res = res.filter((c) => (c.recycle_count || 0) === 0);\n    }\n    if (dateRange?.from) {\n      res = res.filter((c) => {\n        const d = parseISO(c.created_date);\n        return isValid(d) && d >= dateRange.from;\n      });\n    }\n    if (dateRange?.to) {\n      res = res.filter((c) => {\n        const d = parseISO(c.created_date);\n        return isValid(d) && d <= dateRange.to;\n      });\n    }\n    if (onlySuggestions) {\n      res = res.filter((c) => c.__isRecycleCandidate);\n    }\n    setFiltered(res);\n  }, [withCandidates, search, topic, tag, status, dateRange, onlySuggestions]);\n\n  const analyzeAndTag = async (conversion) => {\n    setAnalyzingId(conversion.id);\n    try {\n      const prompt = `\nAnalyze the following post and return JSON with:\n- topic: short phrase (e.g., \"Content Marketing\")\n- tags: 4-8 lowercase tags (no spaces, use hyphen if needed)\n- evergreen: boolean\n- suggested_platforms: array of best-fitting platforms (subset of: linkedin, x_post, instagram, tiktok, facebook, reddit, newsletter, video, landing, podcast, graphic)\n\nText:\n${conversion.input_text}\n      `.trim();\n\n      const res = await InvokeLLM({\n        prompt,\n        response_json_schema: {\n          type: \"object\",\n          properties: {\n            topic: { type: \"string\" },\n            tags: { type: \"array\", items: { type: \"string\" } },\n            evergreen: { type: \"boolean\" },\n            suggested_platforms: { type: \"array\", items: { type: \"string\" } }\n          },\n          required: [\"topic\", \"tags\", \"evergreen\", \"suggested_platforms\"]\n        }\n      });\n\n      const updated = await Conversion.update(conversion.id, {\n        topic: res.topic || conversion.topic,\n        auto_tags: Array.isArray(res.tags) ? res.tags.slice(0, 12) : conversion.auto_tags,\n        evergreen: typeof res.evergreen === \"boolean\" ? res.evergreen : conversion.evergreen,\n        suggested_platforms: Array.isArray(res.suggested_platforms) ? res.suggested_platforms.slice(0, 5) : conversion.suggested_platforms\n      });\n\n      setItems((prev) => prev.map((c) => (c.id === conversion.id ? updated : c)));\n    } finally {\n      setAnalyzingId(null);\n    }\n  };\n\n  const addUserTag = async (conversion) => {\n    setTagTarget(conversion);\n    setNewTag(\"\");\n    setTagDialogOpen(true);\n  };\n\n  const saveUserTag = async () => {\n    if (!tagTarget || !newTag.trim()) {\n      setTagDialogOpen(false);\n      return;\n    }\n    const tags = Array.from(new Set([...(tagTarget.user_tags || []), newTag.trim()]));\n    const updated = await Conversion.update(tagTarget.id, { user_tags: tags });\n    setItems((prev) => prev.map((c) => (c.id === tagTarget.id ? updated : c)));\n    setTagDialogOpen(false);\n  };\n\n  const recycle = (conversion) => {\n    const formats = (conversion.suggested_platforms && conversion.suggested_platforms.length)\n      ? conversion.suggested_platforms\n      : (conversion.selected_formats || []);\n    const url = createPageUrl(\n      `Convert?inputText=${encodeURIComponent(conversion.input_text || \"\")}&formats=${(formats || []).join(\",\")}&tone=${conversion.writing_tone || \"professional\"}&lang=${conversion.output_language || \"en\"}&depth=${conversion.content_depth || \"enriched\"}`\n    );\n    navigate(url);\n  };\n\n  if (loading) {\n    return (\n      <div className=\"min-h-[50vh] flex items-center justify-center\">\n        <Loader2 className=\"w-8 h-8 animate-spin text-teal-600\" />\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"min-h-screen\">\n      <div className=\"max-w-6xl mx-auto\">\n        <div className=\"mb-6\">\n          <h1 className=\"text-2xl md:text-3xl font-bold bg-gradient-to-r from-teal-600 to-emerald-600 bg-clip-text text-transparent\">\n            {t.title}\n          </h1>\n          <p className=\"text-gray-600\">{t.subtitle}</p>\n        </div>\n\n        <VaultFilters\n          search={search}\n          onSearch={setSearch}\n          dateRange={dateRange}\n          onDateRange={setDateRange}\n          topic={topic}\n          onTopic={setTopic}\n          tag={tag}\n          onTag={setTag}\n          status={status}\n          onStatus={setStatus}\n          onlySuggestions={onlySuggestions}\n          onOnlySuggestions={setOnlySuggestions}\n        />\n\n        <div className=\"grid gap-3\">\n          {filtered.map((c) => (\n            <div key={c.id} className=\"relative\">\n              {analyzingId === c.id ? (\n                <div className=\"absolute inset-0 bg-white/70 backdrop-blur-sm z-10 flex items-center justify-center rounded-lg\">\n                  <Loader2 className=\"w-6 h-6 animate-spin text-teal-600\" />\n                </div>\n              ) : null}\n              <VaultCard\n                conversion={c}\n                onAnalyze={analyzeAndTag}\n                onRecycle={recycle}\n                onAddTag={addUserTag}\n              />\n            </div>\n          ))}\n          {filtered.length === 0 && (\n            <div className=\"text-center text-gray-500 py-16\">לא נמצאו פריטים תואמים</div>\n          )}\n        </div>\n      </div>\n\n      <Dialog open={tagDialogOpen} onOpenChange={setTagDialogOpen}>\n        <DialogContent>\n          <DialogHeader>\n            <DialogTitle>הוספת תגית</DialogTitle>\n          </DialogHeader>\n          <Input value={newTag} onChange={(e) => setNewTag(e.target.value)} placeholder=\"לדוגמה: content-marketing\" />\n          <DialogFooter>\n            <Button variant=\"outline\" onClick={() => setTagDialogOpen(false)}>ביטול</Button>\n            <Button onClick={saveUserTag}>שמור</Button>\n          </DialogFooter>\n        </DialogContent>\n      </Dialog>\n    </div>\n  );\n}","InspireNow":"import React from \"react\";\nimport { User } from \"@/entities/User\";\nimport { InvokeLLM, GenerateImage } from \"@/integrations/Core\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Input } from \"@/components/ui/input\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Lightbulb, Sparkles, RefreshCw, Image as ImageIcon, Copy, Check, Loader2 } from \"lucide-react\";\n\nconst t = {\n  he: {\n    title: \"השראה עכשיו\",\n    subtitle: \"רעיון מוכן לפוסט – בלחיצה אחת.\",\n    topic: \"תחום / נושא\",\n    topicPh: \"לדוגמה: שיווק דיגיטלי, AI, בריאות...\",\n    platform: \"פלטפורמה\",\n    tone: \"טון כתיבה\",\n    language: \"שפה\",\n    mood: \"תחושה\",\n    moods: { inspiration: \"השראה\", humor: \"הומור\", dramatic: \"דרמטי\" },\n    generate: \"צור רעיון\",\n    another: \"תן לי משהו אחר\",\n    createGraphic: \"צור גרפיקה\",\n    ideaTitle: \"רעיון מוצע\",\n    copy: \"העתק\",\n    copied: \"הועתק!\",\n    hashtags: \"האשטגים\",\n    imageReady: \"תמונה נוצרה\",\n    imageGenerating: \"יוצר תמונה...\",\n  },\n  en: {\n    title: \"Inspire Now\",\n    subtitle: \"A ready-to-post idea – in one click.\",\n    topic: \"Topic / Domain\",\n    topicPh: \"e.g., Digital Marketing, AI, Wellness...\",\n    platform: \"Platform\",\n    tone: \"Tone\",\n    language: \"Language\",\n    mood: \"Mood\",\n    moods: { inspiration: \"Inspiration\", humor: \"Humor\", dramatic: \"Dramatic\" },\n    generate: \"Generate Idea\",\n    another: \"Give me another\",\n    createGraphic: \"Create Graphic\",\n    ideaTitle: \"Suggested Idea\",\n    copy: \"Copy\",\n    copied: \"Copied!\",\n    hashtags: \"Hashtags\",\n    imageReady: \"Image generated\",\n    imageGenerating: \"Generating image...\",\n  }\n};\n\nconst platforms = [\n  { id: \"linkedin\", label: \"LinkedIn\" },\n  { id: \"x_post\", label: \"X\" },\n  { id: \"instagram\", label: \"Instagram\" },\n  { id: \"tiktok\", label: \"TikTok\" },\n  { id: \"facebook\", label: \"Facebook\" },\n];\n\nconst tones = [\n  { id: \"professional\", label: \"Professional\" },\n  { id: \"casual\", label: \"Casual\" },\n  { id: \"marketing\", label: \"Marketing\" },\n  { id: \"funny\", label: \"Funny\" },\n];\n\nconst languages = [\n  { id: \"he\", label: \"עברית\" },\n  { id: \"en\", label: \"English\" },\n  { id: \"ar\", label: \"العربية\" },\n  { id: \"es\", label: \"Español\" },\n  { id: \"fr\", label: \"Français\" },\n  { id: \"zh\", label: \"中文\" },\n  { id: \"it\", label: \"Italiano\" },\n];\n\nexport default function InspireNow({ effectiveLanguage = \"en\" }) {\n  const tr = t[effectiveLanguage] || t.en;\n  const isRTL = effectiveLanguage === \"he\" || effectiveLanguage === \"ar\";\n\n  const [user, setUser] = React.useState(null);\n  const [topic, setTopic] = React.useState(\"\");\n  const [platform, setPlatform] = React.useState(\"linkedin\");\n  const [tone, setTone] = React.useState(\"professional\");\n  const [language, setLanguage] = React.useState(effectiveLanguage || \"en\");\n  const [mood, setMood] = React.useState(\"inspiration\");\n\n  const [loading, setLoading] = React.useState(false);\n  const [idea, setIdea] = React.useState(null); // {title, text, hashtags[], platform, image_prompt}\n  const [copied, setCopied] = React.useState(false);\n  const [imgUrl, setImgUrl] = React.useState(\"\");\n  const [imgLoading, setImgLoading] = React.useState(false);\n\n  React.useEffect(() => {\n    const init = async () => {\n      try {\n        const u = await User.me();\n        setUser(u);\n        if (u.user_language) setLanguage(u.user_language);\n      } catch {\n        // public OK\n      }\n    };\n    init();\n  }, []);\n\n  const buildPrompt = () => `\nYou're an elite social media strategist and copywriter.\nGenerate one ready-to-post idea as JSON with keys:\n- title (short, catchy)\n- text (well-written post body for the chosen platform)\n- hashtags (array of up to 8 relevant hashtags, without '#')\n- platform (echo input)\n- image_prompt (concise prompt for an AI image generator, matching the idea's mood and platform)\n\nConstraints:\n- Platform: ${platform}\n- Tone: ${tone}\n- Mood: ${mood}\n- Language: ${language}\n- Topic/domain: ${topic || \"general creator economy\"}\n\nEnsure the output text fits ${platform} best practices (hooks, scannability, CTA).\nReturn ONLY JSON.`.trim();\n\n  const generateIdea = async () => {\n    setLoading(true);\n    setImgUrl(\"\");\n    try {\n      const res = await InvokeLLM({\n        prompt: buildPrompt(),\n        response_json_schema: {\n          type: \"object\",\n          properties: {\n            title: { type: \"string\" },\n            text: { type: \"string\" },\n            hashtags: { type: \"array\", items: { type: \"string\" } },\n            platform: { type: \"string\" },\n            image_prompt: { type: \"string\" }\n          },\n          required: [\"title\", \"text\"]\n        },\n        add_context_from_internet: true\n      });\n\n      const ideaObj = {\n        title: res.title || \"\",\n        text: res.text || \"\",\n        hashtags: Array.isArray(res.hashtags) ? res.hashtags.slice(0, 8) : [],\n        platform: res.platform || platform,\n        image_prompt: res.image_prompt || `Minimalist flat illustration related to ${topic || \"content creation\"}`\n      };\n      setIdea(ideaObj);\n\n      // Optional: count as a usage\n      if (user) {\n        await User.updateMyUserData({\n          monthly_conversions: (user.monthly_conversions || 0) + 1\n        });\n        setUser((prev) => prev ? ({ ...prev, monthly_conversions: (prev.monthly_conversions || 0) + 1 }) : prev);\n      }\n    } catch (e) {\n      console.error(\"Idea generation failed:\", e);\n    }\n    setLoading(false);\n  };\n\n  const doGenerateImage = async () => {\n    if (!idea?.image_prompt) return;\n    setImgLoading(true);\n    try {\n      const { url } = await GenerateImage({ prompt: `${idea.image_prompt}. Style: clean, modern, high-contrast, social graphic.` });\n      if (url) setImgUrl(url);\n    } catch (e) {\n      console.error(\"Image generation failed:\", e);\n    }\n    setImgLoading(false);\n  };\n\n  const copyAll = async () => {\n    if (!idea) return;\n    const text = `${idea.title}\\n\\n${idea.text}\\n\\n${(idea.hashtags || []).map(h => `#${h}`).join(\" \")}`;\n    try {\n      await navigator.clipboard.writeText(text);\n      setCopied(true);\n      setTimeout(() => setCopied(false), 1500);\n    } catch (e) {\n      console.error(\"Copy failed:\", e);\n    }\n  };\n\n  return (\n    <div className=\"min-h-screen bg-gray-50\" dir={isRTL ? \"rtl\" : \"ltr\"}>\n      <div className=\"max-w-6xl mx-auto p-4 sm:p-6\">\n        <div className=\"mb-6 flex items-start justify-between gap-4\">\n          <div>\n            <h1 className=\"text-2xl sm:text-3xl font-bold bg-gradient-to-r from-teal-500 to-emerald-600 bg-clip-text text-transparent flex items-center gap-2\">\n              <Lightbulb className=\"w-6 h-6 text-amber-500\" />\n              {tr.title}\n            </h1>\n            <p className=\"text-gray-600\">{tr.subtitle}</p>\n          </div>\n          <Button onClick={generateIdea} disabled={loading} className=\"bg-gradient-to-r from-teal-500 to-emerald-600 text-white\">\n            {loading ? <Loader2 className=\"w-4 h-4 animate-spin mr-2\" /> : <Sparkles className=\"w-4 h-4 mr-2\" />}\n            {tr.generate}\n          </Button>\n        </div>\n\n        {/* Controls */}\n        <Card className=\"mb-6\">\n          <CardContent className=\"p-4 grid grid-cols-1 md:grid-cols-5 gap-3\">\n            <div className=\"md:col-span-2\">\n              <label className=\"text-sm font-medium\">{tr.topic}</label>\n              <Input value={topic} onChange={(e) => setTopic(e.target.value)} placeholder={tr.topicPh} className=\"mt-1\" />\n            </div>\n\n            <div>\n              <label className=\"text-sm font-medium\">{tr.platform}</label>\n              <Select value={platform} onValueChange={setPlatform}>\n                <SelectTrigger className=\"mt-1\"><SelectValue /></SelectTrigger>\n                <SelectContent>\n                  {platforms.map(p => <SelectItem key={p.id} value={p.id}>{p.label}</SelectItem>)}\n                </SelectContent>\n              </Select>\n            </div>\n\n            <div>\n              <label className=\"text-sm font-medium\">{tr.tone}</label>\n              <Select value={tone} onValueChange={setTone}>\n                <SelectTrigger className=\"mt-1\"><SelectValue /></SelectTrigger>\n                <SelectContent>\n                  {tones.map(tn => <SelectItem key={tn.id} value={tn.id}>{tn.label}</SelectItem>)}\n                </SelectContent>\n              </Select>\n            </div>\n\n            <div>\n              <label className=\"text-sm font-medium\">{tr.language}</label>\n              <Select value={language} onValueChange={setLanguage}>\n                <SelectTrigger className=\"mt-1\"><SelectValue /></SelectTrigger>\n                <SelectContent>\n                  {languages.map(l => <SelectItem key={l.id} value={l.id}>{l.label}</SelectItem>)}\n                </SelectContent>\n              </Select>\n            </div>\n\n            <div className=\"md:col-span-2\">\n              <label className=\"text-sm font-medium\">{tr.mood}</label>\n              <Select value={mood} onValueChange={setMood}>\n                <SelectTrigger className=\"mt-1\"><SelectValue /></SelectTrigger>\n                <SelectContent>\n                  <SelectItem value=\"inspiration\">{tr.moods.inspiration}</SelectItem>\n                  <SelectItem value=\"humor\">{tr.moods.humor}</SelectItem>\n                  <SelectItem value=\"dramatic\">{tr.moods.dramatic}</SelectItem>\n                </SelectContent>\n              </Select>\n            </div>\n\n            <div className=\"flex items-end gap-2\">\n              <Button variant=\"outline\" onClick={generateIdea} disabled={loading}>\n                <RefreshCw className=\"w-4 h-4 mr-2\" />\n                {tr.another}\n              </Button>\n            </div>\n          </CardContent>\n        </Card>\n\n        {/* Output */}\n        <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n          <Card>\n            <CardHeader className=\"pb-2\">\n              <CardTitle className=\"flex items-center gap-2\">\n                <Sparkles className=\"w-5 h-5 text-teal-600\" />\n                {tr.ideaTitle}\n              </CardTitle>\n            </CardHeader>\n            <CardContent className=\"space-y-3\">\n              {!idea ? (\n                <div className=\"text-gray-500 text-sm\">← {tr.generate}</div>\n              ) : (\n                <>\n                  <h3 className=\"text-lg font-semibold\">{idea.title}</h3>\n                  <Textarea value={idea.text} readOnly rows={10} className=\"bg-gray-50\" />\n                  {!!(idea.hashtags && idea.hashtags.length) && (\n                    <div className=\"flex flex-wrap gap-2\">\n                      <Badge variant=\"outline\">{tr.hashtags}:</Badge>\n                      {idea.hashtags.map((h, i) => (\n                        <Badge key={`${h}-${i}`} className=\"bg-blue-50 text-blue-700\">#{h}</Badge>\n                      ))}\n                    </div>\n                  )}\n                  <div className=\"flex gap-2\">\n                    <Button onClick={copyAll} variant=\"outline\">\n                      {copied ? <Check className=\"w-4 h-4 mr-1 text-green-600\" /> : <Copy className=\"w-4 h-4 mr-1\" />}\n                      {copied ? tr.copied : tr.copy}\n                    </Button>\n                    <Button onClick={doGenerateImage} disabled={!idea || imgLoading} className=\"bg-indigo-600 hover:bg-indigo-700 text-white\">\n                      {imgLoading ? <Loader2 className=\"w-4 h-4 mr-2 animate-spin\" /> : <ImageIcon className=\"w-4 h-4 mr-2\" />}\n                      {tr.createGraphic}\n                    </Button>\n                  </div>\n                </>\n              )}\n            </CardContent>\n          </Card>\n\n          <Card className=\"overflow-hidden\">\n            <CardHeader className=\"pb-2\">\n              <CardTitle className=\"flex items-center gap-2\">\n                <ImageIcon className=\"w-5 h-5 text-indigo-600\" />\n                {imgUrl ? tr.imageReady : tr.imageGenerating}\n              </CardTitle>\n            </CardHeader>\n            <CardContent>\n              {imgUrl ? (\n                <img src={imgUrl} alt=\"Idea Visual\" className=\"w-full rounded-lg border\" />\n              ) : (\n                <div className=\"h-64 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400\">\n                  <ImageIcon className=\"w-10 h-10\" />\n                </div>\n              )}\n            </CardContent>\n          </Card>\n        </div>\n      </div>\n    </div>\n  );\n}"},"page_names":[],"discovered_routes":null,"components":{"layout/ChatWidget":"\nimport React, { useState, useEffect, useRef } from 'react';\nimport { User } from '@/entities/User'; // Assuming User entity is accessible\nimport { InvokeLLM } from '@/integrations/Core';\nimport { Button } from '@/components/ui/button';\nimport { Textarea } from '@/components/ui/textarea';\nimport { Card, CardContent, CardHeader, CardTitle, CardFooter } from '@/components/ui/card';\nimport { Loader2, Send, MessageSquare, X as CloseIcon, AlertCircle, ExternalLink } from 'lucide-react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { createPageUrl } from '@/utils';\n\nconst translations = {\n  he: {\n    widgetTitle: \"תמיכה בצ'אט\",\n    placeholder: \"שאל משהו...\",\n    send: \"שלח\",\n    loadingAnswer: \"חושב...\",\n    aiName: \"RePostly AI\",\n    userName: \"אתה\",\n    notAvailableTitle: \"צ'אט תמיכה למנויים בלבד\",\n    notAvailableInfo: \"לגישה לצ'אט, אנא שדרג את התוכנית שלך.\",\n    upgradeButton: \"שדרג תוכנית\",\n    initialGreeting: \"שלום! אני כאן כדי לעזור לך עם שאלות על RePostly AI. איך אני יכול לעזור היום?\",\n    llmError: \"אני מצטער, נתקלתי בבעיה. אנא נסה שוב מאוחר יותר או פנה לתמיכה במייל.\",\n  },\n  en: {\n    widgetTitle: \"Support Chat\",\n    placeholder: \"Ask something...\",\n    send: \"Send\",\n    loadingAnswer: \"Thinking...\",\n    aiName: \"RePostly AI\",\n    userName: \"You\",\n    notAvailableTitle: \"Chat Support for Subscribers Only\",\n    notAvailableInfo: \"To access chat support, please upgrade your plan.\",\n    upgradeButton: \"Upgrade Plan\",\n    initialGreeting: \"Hi! I'm here to help with your RePostly AI questions. How can I assist you today?\",\n    llmError: \"I'm sorry, I encountered an issue. Please try again later or contact email support.\",\n  },\n  // Add other languages as needed\n};\n\n\nexport default function ChatWidget({ currentUser, effectiveLanguage }) {\n  const navigate = useNavigate();\n  const [isOpen, setIsOpen] = useState(false);\n  const [messages, setMessages] = useState([]);\n  const [inputValue, setInputValue] = useState('');\n  const [isLoading, setIsLoading] = useState(false);\n  const messagesEndRef = useRef(null);\n  \n  // New state for page language, replacing direct use of effectiveLanguage for translations\n  const [pageLanguage, setPageLanguage] = useState(effectiveLanguage || 'en');\n\n  // Update page language when effectiveLanguage prop changes\n  useEffect(() => {\n    setPageLanguage(effectiveLanguage || 'en');\n  }, [effectiveLanguage]);\n\n  // Use pageLanguage for translations\n  const t = translations[pageLanguage] || translations.en;\n  const isRTL = pageLanguage === 'he' || pageLanguage === 'ar';\n\n  // Modified useEffect for initial greeting: now also checks plan_type and special access\n  useEffect(() => {\n    // Determine if the user should have chat access\n    const hasChatAccess = currentUser && !(currentUser.plan_type === 'free' && currentUser.email !== 'yaronpm.eng@gmail.com' && !currentUser.special_access && !currentUser.is_admin);\n\n    // Only set initial greeting if chat is open, no messages exist, and user has chat access\n    if (isOpen && messages.length === 0 && hasChatAccess) {\n      setMessages([{ sender: 'ai', text: t.initialGreeting }]);\n    }\n  }, [isOpen, messages.length, currentUser, t]);\n\n  // Scroll to bottom effect (remains the same)\n  useEffect(() => {\n    if (messagesEndRef.current) {\n      messagesEndRef.current.scrollIntoView({ behavior: 'smooth' });\n    }\n  }, [messages]);\n\n  // Renamed from handleToggleChat to toggleChat, simplified logic\n  const toggleChat = () => {\n    setIsOpen(!isOpen);\n    // The upgrade modal logic is now handled by conditional rendering inside the chat widget itself\n  };\n\n  const handleSendMessage = async (e) => {\n    e.preventDefault(); // Prevent default form submission behavior\n\n    if (inputValue.trim() === '' || isLoading) return;\n\n    const newUserMessage = { sender: 'user', text: inputValue };\n    setMessages(prevMessages => [...prevMessages, newUserMessage]);\n    setInputValue('');\n    setIsLoading(true);\n\n    try {\n      // Preserve the LLM prompt with email address\n      const llmPrompt = `The user is asking the following question about RePostly AI: \"${newUserMessage.text}\". Provide a helpful and concise answer. If the question is about account specific details, billing, or requires actions you cannot perform, politely state your limitations and suggest contacting email support at repostlyai@gmail.com. Keep answers focused on how to use the platform or general information.`;\n      const response = await InvokeLLM({ prompt: llmPrompt });\n      const aiResponse = { sender: 'ai', text: response };\n      setMessages(prevMessages => [...prevMessages, aiResponse]);\n    } catch (error) {\n      console.error(\"Error sending message to LLM:\", error);\n      const errorResponse = { sender: 'ai', text: t.llmError };\n      setMessages(prevMessages => [...prevMessages, errorResponse]);\n    } finally {\n      setIsLoading(false);\n    }\n  };\n\n  return (\n    <>\n      {/* Chat toggle button with motion */}\n      <motion.div\n        className={`fixed bottom-4 right-4 z-50`}\n        initial={{ opacity: 0, y: 20 }}\n        animate={{ opacity: 1, y: 0 }}\n        transition={{ delay: 0.5 }}\n      >\n        <Button\n          onClick={toggleChat}\n          className=\"rounded-full w-12 h-12 sm:w-14 sm:h-14 bg-gradient-to-r from-teal-500 to-emerald-600 text-white shadow-lg hover:scale-105 transition-transform\"\n          aria-label={t.widgetTitle}\n        >\n          {isOpen ? <CloseIcon className=\"w-5 h-5 sm:w-6 sm:h-6\" /> : <MessageSquare className=\"w-5 h-5 sm:w-6 sm:h-6\" />}\n        </Button>\n      </motion.div>\n\n      <AnimatePresence>\n        {/* Chat widget itself */}\n        {isOpen && (\n          <motion.div\n            className={`fixed bottom-20 right-4 z-40 w-[calc(100%-2rem)] max-w-sm sm:w-96`} // Responsive width\n            initial={{ opacity: 0, y: 20, height: 0 }}\n            animate={{ opacity: 1, y: 0, height: 'auto' }}\n            exit={{ opacity: 0, y: 20, height: 0 }}\n            transition={{ type: 'spring', stiffness: 300, damping: 30 }}\n            dir={isRTL ? 'rtl' : 'ltr'} // Ensure RTL direction for the whole chat widget\n          >\n            <Card className=\"shadow-xl border-white/30 bg-white/90 backdrop-blur-xl flex flex-col max-h-[60vh] sm:max-h-[70vh]\"> {/* Max height */}\n              <CardHeader className=\"flex flex-row items-center justify-between p-3 sm:p-4 border-b\"> {/* Responsive padding */}\n                <CardTitle className=\"text-sm sm:text-base font-semibold text-teal-700\">{t.widgetTitle}</CardTitle>\n                <Button variant=\"ghost\" size=\"icon\" onClick={toggleChat} className=\"h-7 w-7 sm:h-8 sm:w-8 p-1\"> {/* Adjusted size */}\n                  <CloseIcon className=\"w-4 h-4\" />\n                </Button>\n              </CardHeader>\n              {/* Conditional rendering based on user plan type - BUT allow access for special users */}\n              {currentUser && currentUser.plan_type === 'free' && currentUser.email !== 'yaronpm.eng@gmail.com' && !currentUser.special_access && !currentUser.is_admin ? (\n                <CardContent className=\"p-4 sm:p-6 text-center flex-grow flex flex-col items-center justify-center\">\n                  <AlertCircle className=\"w-10 h-10 sm:w-12 sm:h-12 text-amber-500 mb-3 sm:mb-4\" />\n                  <h3 className=\"text-sm sm:text-base font-semibold mb-1 sm:mb-2\">{t.notAvailableTitle}</h3>\n                  <p className=\"text-xs sm:text-sm text-gray-600 mb-3 sm:mb-4\">{t.notAvailableInfo}</p>\n                  <Button\n                    onClick={() => {\n                      navigate(createPageUrl(\"Pricing\"));\n                      setIsOpen(false);\n                    }}\n                    size=\"sm\"\n                    className=\"bg-amber-500 hover:bg-amber-600 text-white text-xs sm:text-sm\"\n                  >\n                    {t.upgradeButton} <ExternalLink className={`w-3 h-3 ${isRTL ? 'mr-1.5' : 'ml-1.5'}`} />\n                  </Button>\n                </CardContent>\n              ) : (\n                <>\n                  {/* Chat interface for paid users OR special access users */}\n                  <CardContent className=\"p-3 sm:p-4 flex-grow overflow-y-auto\">\n                    <div className=\"space-y-3 sm:space-y-4\">\n                      {messages.map((msg, index) => (\n                        <div key={index} className={`flex ${msg.sender === 'user' ? (isRTL ? 'justify-start' : 'justify-end') : (isRTL ? 'justify-end' : 'justify-start')}`}>\n                          <div className={`max-w-[80%] p-2 sm:p-2.5 rounded-xl text-xs sm:text-sm ${ // Text size\n                            msg.sender === 'user'\n                              ? 'bg-teal-500 text-white'\n                              : 'bg-gray-100 text-gray-800'\n                          } ${msg.sender === 'user'\n                            ? (isRTL ? 'rounded-br-none' : 'rounded-bl-none') // User bubble RTL adjustment\n                            : (isRTL ? 'rounded-bl-none' : 'rounded-br-none') // AI bubble RTL adjustment\n                          }`}>\n                            {msg.text}\n                          </div>\n                        </div>\n                      ))}\n                      <div ref={messagesEndRef} />\n                    </div>\n                  </CardContent>\n                  <CardFooter className=\"p-3 sm:p-4 border-t\">\n                    <form onSubmit={handleSendMessage} className=\"flex w-full items-center gap-2\">\n                      <Textarea\n                        value={inputValue}\n                        onChange={(e) => setInputValue(e.target.value)}\n                        placeholder={t.placeholder}\n                        className=\"flex-grow resize-none text-xs sm:text-sm p-2 h-10 min-h-[2.5rem]\" // Responsive text size and padding\n                        rows={1}\n                        onKeyDown={(e) => {\n                          if (e.key === 'Enter' && !e.shiftKey) { // Prevent new line on Enter without Shift\n                            e.preventDefault();\n                            handleSendMessage(e); // Pass the event to handleSendMessage\n                          }\n                        }}\n                        disabled={isLoading}\n                      />\n                      <Button type=\"submit\" size=\"icon\" disabled={isLoading || !inputValue.trim()} className=\"w-9 h-9 sm:w-10 sm:h-10\"> {/* Button size */}\n                        {isLoading ? <Loader2 className=\"w-4 h-4 animate-spin\" /> : <Send className=\"w-4 h-4\" />}\n                      </Button>\n                    </form>\n                  </CardFooter>\n                </>\n              )}\n            </Card>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </>\n  );\n}\n","sharing/SocialShareButtons":"\nimport React, { useState } from 'react';\nimport { Button } from '@/components/ui/button';\nimport { \n  Facebook, \n  Instagram, \n  Linkedin, \n  Copy, \n  Share, \n  Download,\n  CheckCircle,\n  ExternalLink\n} from 'lucide-react';\nimport {\n  Dialog,\n  DialogContent,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n  DialogFooter,\n} from \"@/components/ui/dialog\";\nimport { Textarea } from '@/components/ui/textarea';\nimport { Card, CardContent } from '@/components/ui/card';\nimport { Badge } from '@/components/ui/badge';\n\nconst XIcon = () => (\n  <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" className=\"w-4 h-4\">\n    <path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\"></path>\n  </svg>\n);\n\nconst translations = {\n  he: {\n    shareContent: \"שתף תוכן\",\n    shareOn: \"שתף ב\",\n    copyText: \"העתק טקסט\",\n    openInNewTab: \"פתח בטאב חדש\",\n    textCopied: \"הטקסט הועתק!\",\n    shareTitle: \"שתף את התוכן שלך\",\n    shareDescription: \"בחר פלטפורמה לשיתוף התוכן שיצרת\",\n    generatedWith: \"נוצר עם RePostly AI\",\n    close: \"סגור\",\n    facebook: \"Facebook\",\n    instagram: \"Instagram\", \n    x: \"X (Twitter)\",\n    linkedin: \"LinkedIn\",\n    formats: {\n      linkedin: \"פוסט לינקדאין\",\n      x_post: \"פוסט X\",\n      podcast: \"תסריט פודקאסט\",\n      newsletter: \"ניוזלטר\",\n      landing: \"דף נחיתה\",\n      video: \"תסריט וידאו\",\n      graphic: \"הנחיה גרפית\",\n      facebook: \"פוסט פייסבוק\",\n      instagram: \"כיתוב אינסטגרם\",\n      tiktok: \"תסריט TikTok\",\n      reddit: \"פוסט Reddit\"\n    }\n  },\n  en: {\n    shareContent: \"Share Content\",\n    shareOn: \"Share on\",\n    copyText: \"Copy Text\",\n    openInNewTab: \"Open in New Tab\",\n    textCopied: \"Text copied!\",\n    shareTitle: \"Share Your Content\",\n    shareDescription: \"Choose a platform to share your generated content\",\n    generatedWith: \"Generated with RePostly AI\",\n    close: \"Close\",\n    facebook: \"Facebook\",\n    instagram: \"Instagram\",\n    x: \"X (Twitter)\", \n    linkedin: \"LinkedIn\",\n    formats: {\n      linkedin: \"LinkedIn Post\",\n      x_post: \"X Post\",\n      podcast: \"Podcast Script\",\n      newsletter: \"Newsletter\",\n      landing: \"Landing Page\",\n      video: \"Video Script\",\n      graphic: \"Graphic Prompt\",\n      facebook: \"Facebook Post\",\n      instagram: \"Instagram Caption\",\n      tiktok: \"TikTok Script\",\n      reddit: \"Reddit Post\"\n    }\n  }\n};\n\nexport default function SocialShareButtons({ content, format, effectiveLanguage = 'en' }) {\n  const [isOpen, setIsOpen] = useState(false);\n  const [copiedStates, setCopiedStates] = useState({});\n  \n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  // Prepare sharing content\n  const shareText = `${content}\\n\\n${t.generatedWith} 🚀\\n#RePostlyAI #ContentCreation #AI`;\n  const shortContent = content.length > 200 ? content.substring(0, 200) + '...' : content;\n  const shareUrl = 'https://repostlyai.com';\n\n  const handleCopyToClipboard = async (text, platform) => {\n    try {\n      await navigator.clipboard.writeText(text);\n      setCopiedStates(prev => ({ ...prev, [platform]: true }));\n      setTimeout(() => {\n        setCopiedStates(prev => ({ ...prev, [platform]: false }));\n      }, 2000);\n    } catch (error) {\n      console.error('Failed to copy text:', error);\n    }\n  };\n\n  const socialPlatforms = [\n    {\n      id: 'facebook',\n      name: t.facebook,\n      icon: <Facebook className=\"w-4 h-4\" />,\n      color: 'bg-blue-600 hover:bg-blue-700',\n      shareUrl: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}&quote=${encodeURIComponent(shortContent)}`,\n      shareText: shareText\n    },\n    {\n      id: 'instagram',\n      name: t.instagram,\n      icon: <Instagram className=\"w-4 h-4\" />,\n      color: 'bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600',\n      shareUrl: null, // Instagram doesn't support direct URL sharing\n      shareText: shareText,\n      note: effectiveLanguage === 'he' ? 'אינסטגרם לא תומך בשיתוף ישיר - העתק את הטקסט ופרסם באפליקציה' : 'Instagram doesn\\'t support direct sharing - copy text and post in the app'\n    },\n    {\n      id: 'x',\n      name: t.x,\n      icon: <XIcon />,\n      color: 'bg-black hover:bg-gray-800',\n      shareUrl: `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText.substring(0, 240))}&url=${encodeURIComponent(shareUrl)}`,\n      shareText: shareText.substring(0, 240) // Twitter character limit\n    },\n    {\n      id: 'linkedin',\n      name: t.linkedin,\n      icon: <Linkedin className=\"w-4 h-4\" />,\n      color: 'bg-blue-700 hover:bg-blue-800',\n      shareUrl: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(shareUrl)}&summary=${encodeURIComponent(shortContent)}`,\n      shareText: shareText\n    }\n  ];\n\n  const handlePlatformShare = (platform) => {\n    if (platform.shareUrl) {\n      window.open(platform.shareUrl, '_blank', 'width=600,height=400');\n    }\n  };\n\n  return (\n    <Dialog open={isOpen} onOpenChange={setIsOpen}>\n      <DialogTrigger asChild>\n        <Button variant=\"outline\" size=\"sm\" className=\"gap-2\">\n          <Share className=\"w-4 h-4\" />\n          {t.shareContent}\n        </Button>\n      </DialogTrigger>\n      \n      <DialogContent className={`max-w-2xl ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n        <DialogHeader>\n          <DialogTitle className=\"text-xl font-semibold flex items-center gap-2\">\n            <Share className=\"w-5 h-5 text-teal-600\" />\n            {t.shareTitle}\n          </DialogTitle>\n          <p className=\"text-sm text-gray-600 mt-2\">{t.shareDescription}</p>\n        </DialogHeader>\n\n        <div className=\"space-y-4\">\n          {/* Format Badge */}\n          <div className=\"flex items-center gap-2\">\n            <Badge variant=\"outline\" className=\"text-sm\">\n              {t.formats[format] || format}\n            </Badge>\n          </div>\n\n          {/* Content Preview */}\n          <Card className=\"bg-gray-50\">\n            <CardContent className=\"p-4\">\n              <Textarea\n                value={content}\n                readOnly\n                className=\"min-h-[120px] resize-none bg-transparent border-none\"\n              />\n            </CardContent>\n          </Card>\n\n          {/* Social Platform Buttons */}\n          <div className=\"space-y-3\">\n            <h3 className=\"font-medium text-gray-900\">{t.shareOn}:</h3>\n            <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n              {socialPlatforms.map((platform) => (\n                <Card key={platform.id} className=\"hover:shadow-md transition-shadow\">\n                  <CardContent className=\"p-4\">\n                    <div className=\"flex items-center justify-between mb-3\">\n                      <div className=\"flex items-center gap-3\">\n                        <div className={`p-2 rounded-lg text-white ${platform.color}`}>\n                          {platform.icon}\n                        </div>\n                        <span className=\"font-medium\">{platform.name}</span>\n                      </div>\n                    </div>\n                    \n                    {platform.note && (\n                      <p className=\"text-xs text-amber-600 mb-3 bg-amber-50 p-2 rounded\">\n                        {platform.note}\n                      </p>\n                    )}\n                    \n                    <div className=\"flex gap-2\">\n                      {platform.shareUrl && (\n                        <Button\n                          size=\"sm\"\n                          onClick={() => handlePlatformShare(platform)}\n                          className={`flex-1 text-white ${platform.color}`}\n                        >\n                          <ExternalLink className=\"w-3 h-3 mr-1\" />\n                          {t.openInNewTab}\n                        </Button>\n                      )}\n                      \n                      <Button\n                        size=\"sm\"\n                        variant=\"outline\"\n                        onClick={() => handleCopyToClipboard(platform.shareText, platform.id)}\n                        className=\"flex-1\"\n                      >\n                        {copiedStates[platform.id] ? (\n                          <>\n                            <CheckCircle className=\"w-3 h-3 mr-1 text-green-600\" />\n                            {t.textCopied}\n                          </>\n                        ) : (\n                          <>\n                            <Copy className=\"w-3 h-3 mr-1\" />\n                            {t.copyText}\n                          </>\n                        )}\n                      </Button>\n                    </div>\n                  </CardContent>\n                </Card>\n              ))}\n            </div>\n          </div>\n        </div>\n\n        <DialogFooter>\n          <Button variant=\"outline\" onClick={() => setIsOpen(false)}>\n            {t.close}\n          </Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  );\n}\n","sharing/ShareDropdown":"import React, { useState } from 'react';\nimport { Button } from '@/components/ui/button';\nimport { \n  MoreHorizontal,\n  Facebook, \n  Instagram, \n  Linkedin, \n  Copy, \n  Download,\n  CheckCircle,\n  ExternalLink,\n  Share2\n} from 'lucide-react';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n  DropdownMenuSeparator,\n  DropdownMenuLabel,\n} from \"@/components/ui/dropdown-menu\";\n\nconst XIcon = () => (\n  <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" className=\"w-4 h-4\">\n    <path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\"></path>\n  </svg>\n);\n\nconst translations = {\n  he: {\n    shareOptions: \"אפשרויות שיתוף\",\n    copyToClipboard: \"העתק ללוח\",\n    downloadAsFile: \"הורד כקובץ\",\n    shareToFacebook: \"שתף ב-Facebook\",\n    shareToInstagram: \"שתף ב-Instagram\",\n    shareToX: \"שתף ב-X\",\n    shareToLinkedIn: \"שתף ב-LinkedIn\",\n    textCopied: \"הועתק!\",\n    generatedWith: \"נוצר עם RePostly AI\"\n  },\n  en: {\n    shareOptions: \"Share Options\",\n    copyToClipboard: \"Copy to Clipboard\", \n    downloadAsFile: \"Download as File\",\n    shareToFacebook: \"Share to Facebook\",\n    shareToInstagram: \"Share to Instagram\",\n    shareToX: \"Share to X\",\n    shareToLinkedIn: \"Share to LinkedIn\",\n    textCopied: \"Copied!\",\n    generatedWith: \"Generated with RePostly AI\"\n  }\n};\n\nexport default function ShareDropdown({ content, format, originalInput, effectiveLanguage = 'en' }) {\n  const [copied, setCopied] = useState(false);\n  \n  const t = translations[effectiveLanguage] || translations.en;\n\n  const shareText = `${content}\\n\\n${t.generatedWith} 🚀`;\n  const shareUrl = 'https://repostlyai.com';\n\n  const handleCopy = async () => {\n    try {\n      await navigator.clipboard.writeText(content);\n      setCopied(true);\n      setTimeout(() => setCopied(false), 2000);\n    } catch (error) {\n      console.error('Failed to copy:', error);\n    }\n  };\n\n  const handleDownload = () => {\n    const fullContent = `${originalInput ? `Original: ${originalInput}\\n\\n` : ''}${content}\\n\\n${t.generatedWith}`;\n    const blob = new Blob([fullContent], { type: 'text/plain;charset=utf-8' });\n    const link = document.createElement(\"a\");\n    link.href = URL.createObjectURL(blob);\n    link.download = `RePostly_${format}_${Date.now()}.txt`;\n    document.body.appendChild(link);\n    link.click();\n    document.body.removeChild(link);\n  };\n\n  const handleSocialShare = (platform) => {\n    let url = '';\n    const shortContent = content.length > 200 ? content.substring(0, 200) + '...' : content;\n    \n    switch (platform) {\n      case 'facebook':\n        url = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}&quote=${encodeURIComponent(shortContent)}`;\n        break;\n      case 'x':\n        url = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText.substring(0, 240))}&url=${encodeURIComponent(shareUrl)}`;\n        break;\n      case 'linkedin':\n        url = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(shareUrl)}&summary=${encodeURIComponent(shortContent)}`;\n        break;\n      case 'instagram':\n        // Instagram doesn't support direct URL sharing, copy to clipboard instead\n        navigator.clipboard.writeText(shareText);\n        alert(effectiveLanguage === 'he' ? 'הטקסט הועתק! פתח את אינסטגרם והדבק' : 'Text copied! Open Instagram and paste');\n        return;\n    }\n    \n    if (url) {\n      window.open(url, '_blank', 'width=600,height=400');\n    }\n  };\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger asChild>\n        <Button variant=\"outline\" size=\"sm\">\n          <Share2 className=\"w-4 h-4 mr-1\" />\n          <span className=\"hidden sm:inline\">Share</span>\n        </Button>\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align=\"end\" className=\"w-56\">\n        <DropdownMenuLabel>{t.shareOptions}</DropdownMenuLabel>\n        <DropdownMenuSeparator />\n        \n        <DropdownMenuItem onClick={handleCopy}>\n          {copied ? (\n            <CheckCircle className=\"mr-2 h-4 w-4 text-green-600\" />\n          ) : (\n            <Copy className=\"mr-2 h-4 w-4\" />\n          )}\n          {copied ? t.textCopied : t.copyToClipboard}\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={handleDownload}>\n          <Download className=\"mr-2 h-4 w-4\" />\n          {t.downloadAsFile}\n        </DropdownMenuItem>\n        \n        <DropdownMenuSeparator />\n        \n        <DropdownMenuItem onClick={() => handleSocialShare('facebook')}>\n          <Facebook className=\"mr-2 h-4 w-4 text-blue-600\" />\n          {t.shareToFacebook}\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={() => handleSocialShare('instagram')}>\n          <Instagram className=\"mr-2 h-4 w-4 text-pink-600\" />\n          {t.shareToInstagram}\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={() => handleSocialShare('x')}>\n          <XIcon />\n          <span className=\"ml-2\">{t.shareToX}</span>\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={() => handleSocialShare('linkedin')}>\n          <Linkedin className=\"mr-2 h-4 w-4 text-blue-700\" />\n          {t.shareToLinkedIn}\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}","auth/LoginModal":"import React, { useState } from 'react';\nimport { User } from '@/entities/User';\nimport { Button } from '@/components/ui/button';\nimport { Input } from '@/components/ui/input';\nimport { Label } from '@/components/ui/label';\nimport { \n  Dialog,\n  DialogContent,\n  DialogHeader,\n  DialogTitle,\n  DialogDescription,\n  DialogFooter \n} from \"@/components/ui/dialog\";\nimport { \n  Loader2, \n  LogIn, \n  Mail, \n  Globe,\n  Shield,\n  Zap,\n  CheckCircle\n} from 'lucide-react';\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\n\nconst translations = {\n  en: {\n    signIn: \"Sign In\",\n    signInTitle: \"Welcome to RePostly AI\",\n    signInSubtitle: \"Transform your content with AI-powered automation\",\n    continueWithGoogle: \"Continue with Google\",\n    emailPlaceholder: \"Enter your email address\",\n    loading: \"Signing in...\",\n    orContinueWith: \"Or continue with\",\n    features: {\n      title: \"Why RePostly AI?\",\n      feature1: \"5+ Content Formats\",\n      feature1Desc: \"LinkedIn, X, Podcast, Newsletter & more\",\n      feature2: \"AI-Powered\",\n      feature2Desc: \"Advanced language models for quality content\",\n      feature3: \"Multi-Language\",\n      feature3Desc: \"Support for 7+ languages including RTL\"\n    },\n    selectLanguage: \"Select Language\",\n    privacyNote: \"By signing in, you agree to our Terms of Service and Privacy Policy\",\n    languages: {\n      en: \"English\",\n      he: \"עברית\",\n      ar: \"العربية\",\n      es: \"Español\",\n      fr: \"Français\",\n      zh: \"中文\",\n      it: \"Italiano\"\n    }\n  },\n  he: {\n    signIn: \"התחבר\",\n    signInTitle: \"ברוכים הבאים ל-RePostly AI\",\n    signInSubtitle: \"הפוך את התוכן שלך עם אוטומציה מבוססת AI\",\n    continueWithGoogle: \"המשך עם Google\",\n    emailPlaceholder: \"הכנס את כתובת האימייל שלך\",\n    loading: \"מתחבר...\",\n    orContinueWith: \"או המשך עם\",\n    features: {\n      title: \"למה RePostly AI?\",\n      feature1: \"5+ פורמטי תוכן\",\n      feature1Desc: \"לינקדאין, X, פודקאסט, ניוזלטר ועוד\",\n      feature2: \"מונע בינה מלאכותית\",\n      feature2Desc: \"מודלי שפה מתקדמים לתוכן איכותי\",\n      feature3: \"רב-לשוני\",\n      feature3Desc: \"תמיכה ב-7+ שפות כולל RTL\"\n    },\n    selectLanguage: \"בחר שפה\",\n    privacyNote: \"על ידי התחברות, אתה מסכים לתנאי השירות ומדיניות הפרטיות שלנו\",\n    languages: {\n      en: \"English\",\n      he: \"עברית\",\n      ar: \"العربية\",\n      es: \"Español\",\n      fr: \"Français\",\n      zh: \"中文\",\n      it: \"Italiano\"\n    }\n  }\n};\n\nconst supportedLanguages = [\"en\", \"he\", \"ar\", \"es\", \"fr\", \"zh\", \"it\"];\n\nexport default function LoginModal({ isOpen, onClose, effectiveLanguage = 'en', onLanguageChange }) {\n  const [loading, setLoading] = useState(false);\n  const [email, setEmail] = useState('');\n  const [currentLang, setCurrentLang] = useState(effectiveLanguage);\n  \n  const t = translations[currentLang] || translations.en;\n  const isRTL = currentLang === 'he' || currentLang === 'ar';\n\n  const handleGoogleSignIn = async () => {\n    setLoading(true);\n    try {\n      await User.login();\n      // onClose will be called automatically after successful login\n    } catch (error) {\n      console.error('Google sign in failed:', error);\n      setLoading(false);\n    }\n  };\n\n  const handleLanguageChange = (lang) => {\n    setCurrentLang(lang);\n    if (onLanguageChange) {\n      onLanguageChange(lang);\n    }\n    localStorage.setItem('repostly_lang', lang);\n  };\n\n  const features = [\n    {\n      icon: <Zap className=\"w-5 h-5 text-teal-600\" />,\n      title: t.features.feature1,\n      description: t.features.feature1Desc\n    },\n    {\n      icon: <Shield className=\"w-5 h-5 text-emerald-600\" />,\n      title: t.features.feature2,\n      description: t.features.feature2Desc\n    },\n    {\n      icon: <Globe className=\"w-5 h-5 text-blue-600\" />,\n      title: t.features.feature3,\n      description: t.features.feature3Desc\n    }\n  ];\n\n  return (\n    <Dialog open={isOpen} onOpenChange={onClose}>\n      <DialogContent className={`max-w-md mx-auto ${isRTL ? 'rtl' : 'ltr'}`} dir={isRTL ? 'rtl' : 'ltr'}>\n        <div className=\"relative\">\n          {/* Language Selector */}\n          <div className={`absolute top-0 ${isRTL ? 'left-0' : 'right-0'}`}>\n            <DropdownMenu>\n              <DropdownMenuTrigger asChild>\n                <Button variant=\"ghost\" size=\"sm\" className=\"h-8 px-2\">\n                  <Globe className=\"w-4 h-4 mr-1\" />\n                  <span className=\"text-xs\">{t.languages[currentLang]}</span>\n                </Button>\n              </DropdownMenuTrigger>\n              <DropdownMenuContent align={isRTL ? \"start\" : \"end\"}>\n                {supportedLanguages.map(lang => (\n                  <DropdownMenuItem \n                    key={lang} \n                    onClick={() => handleLanguageChange(lang)}\n                    disabled={currentLang === lang}\n                  >\n                    {t.languages[lang]}\n                  </DropdownMenuItem>\n                ))}\n              </DropdownMenuContent>\n            </DropdownMenu>\n          </div>\n\n          <DialogHeader className=\"text-center pb-6\">\n            {/* Logo */}\n            <div className=\"mx-auto mb-4 flex justify-center\">\n              <div className=\"w-16 h-16 bg-gradient-to-r from-teal-500 to-emerald-600 rounded-2xl flex items-center justify-center\">\n                <span className=\"text-white font-bold text-2xl\">R</span>\n              </div>\n            </div>\n            \n            <DialogTitle className=\"text-2xl font-bold bg-gradient-to-r from-teal-600 to-emerald-600 bg-clip-text text-transparent\">\n              {t.signInTitle}\n            </DialogTitle>\n            <DialogDescription className=\"text-gray-600 mt-2\">\n              {t.signInSubtitle}\n            </DialogDescription>\n          </DialogHeader>\n\n          <div className=\"space-y-6\">\n            {/* Main Sign In Button */}\n            <Button\n              onClick={handleGoogleSignIn}\n              disabled={loading}\n              className=\"w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white py-3 h-12 rounded-xl font-medium transition-all duration-300 shadow-lg hover:shadow-xl\"\n            >\n              {loading ? (\n                <>\n                  <Loader2 className=\"w-5 h-5 mr-2 animate-spin\" />\n                  {t.loading}\n                </>\n              ) : (\n                <>\n                  <LogIn className=\"w-5 h-5 mr-2\" />\n                  {t.continueWithGoogle}\n                </>\n              )}\n            </Button>\n\n            {/* Features Section */}\n            <div className=\"bg-gray-50 rounded-xl p-4\">\n              <h3 className=\"font-semibold text-gray-900 mb-3 text-center\">\n                {t.features.title}\n              </h3>\n              <div className=\"space-y-3\">\n                {features.map((feature, index) => (\n                  <div key={index} className=\"flex items-start gap-3\">\n                    <div className=\"flex-shrink-0 mt-0.5\">\n                      {feature.icon}\n                    </div>\n                    <div>\n                      <div className=\"font-medium text-sm text-gray-900\">\n                        {feature.title}\n                      </div>\n                      <div className=\"text-xs text-gray-600\">\n                        {feature.description}\n                      </div>\n                    </div>\n                  </div>\n                ))}\n              </div>\n            </div>\n\n            {/* Privacy Note */}\n            <div className=\"text-center\">\n              <p className=\"text-xs text-gray-500 leading-relaxed\">\n                {t.privacyNote}\n              </p>\n            </div>\n          </div>\n        </div>\n      </DialogContent>\n    </Dialog>\n  );\n}","auth/AuthButton":"import React, { useState, useEffect } from 'react';\nimport { User } from '@/entities/User';\nimport { Button } from '@/components/ui/button';\nimport { \n  LogIn, \n  LogOut, \n  User as UserIcon,\n  Settings,\n  CreditCard,\n  FileText\n} from 'lucide-react';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n  DropdownMenuSeparator,\n  DropdownMenuLabel,\n} from \"@/components/ui/dropdown-menu\";\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\";\nimport LoginModal from './LoginModal';\nimport { createPageUrl } from '@/utils';\nimport { useNavigate } from 'react-router-dom';\n\nconst translations = {\n  en: {\n    signIn: \"Sign In\",\n    myAccount: \"My Account\",\n    dashboard: \"Dashboard\",\n    settings: \"Settings\", \n    pricing: \"Pricing\",\n    signOut: \"Sign Out\",\n    conversions: \"Conversions\",\n    freePlan: \"Free Plan\",\n    basicPlan: \"Basic Plan\",\n    proPlan: \"Pro Plan\",\n    ultraPlan: \"Ultra Plan\"\n  },\n  he: {\n    signIn: \"התחבר\",\n    myAccount: \"החשבון שלי\",\n    dashboard: \"דשבורד\",\n    settings: \"הגדרות\",\n    pricing: \"תמחור\", \n    signOut: \"התנתק\",\n    conversions: \"המרות\",\n    freePlan: \"תוכנית חינמית\",\n    basicPlan: \"תוכנית בסיסית\",\n    proPlan: \"תוכנית מקצועית\",\n    ultraPlan: \"תוכנית אולטרה\"\n  }\n};\n\nexport default function AuthButton({ \n  effectiveLanguage = 'en', \n  onLanguageChange,\n  size = 'default',\n  variant = 'default' \n}) {\n  const [user, setUser] = useState(null);\n  const [loading, setLoading] = useState(true);\n  const [showLoginModal, setShowLoginModal] = useState(false);\n  const navigate = useNavigate();\n  \n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === 'he' || effectiveLanguage === 'ar';\n\n  useEffect(() => {\n    const checkUser = async () => {\n      try {\n        const currentUser = await User.me();\n        setUser(currentUser);\n      } catch (error) {\n        setUser(null);\n      }\n      setLoading(false);\n    };\n    checkUser();\n  }, []);\n\n  const handleSignOut = async () => {\n    try {\n      await User.logout();\n      setUser(null);\n      navigate(createPageUrl(\"HomePage\"));\n    } catch (error) {\n      console.error('Sign out failed:', error);\n    }\n  };\n\n  const handleNavigation = (path) => {\n    navigate(createPageUrl(path));\n  };\n\n  const getPlanDisplayName = (planType) => {\n    const plans = {\n      free: t.freePlan,\n      basic: t.basicPlan,\n      pro: t.proPlan,\n      ultra: t.ultraPlan\n    };\n    return plans[planType] || t.freePlan;\n  };\n\n  if (loading) {\n    return (\n      <Button variant=\"ghost\" size={size} disabled>\n        <div className=\"w-4 h-4 animate-spin rounded-full border-2 border-gray-300 border-t-gray-600\"></div>\n      </Button>\n    );\n  }\n\n  if (!user) {\n    return (\n      <>\n        <Button \n          onClick={() => setShowLoginModal(true)}\n          size={size}\n          variant={variant}\n          className={variant === 'default' ? \"bg-teal-600 hover:bg-teal-700 text-white\" : \"\"}\n        >\n          <LogIn className=\"w-4 h-4 mr-2\" />\n          {t.signIn}\n        </Button>\n        \n        <LoginModal \n          isOpen={showLoginModal}\n          onClose={() => setShowLoginModal(false)}\n          effectiveLanguage={effectiveLanguage}\n          onLanguageChange={onLanguageChange}\n        />\n      </>\n    );\n  }\n\n  return (\n    <DropdownMenu dir={isRTL ? 'rtl' : 'ltr'}>\n      <DropdownMenuTrigger asChild>\n        <Button variant=\"ghost\" className=\"relative h-10 w-10 rounded-full\">\n          <Avatar className=\"h-9 w-9\">\n            <AvatarImage src={user.avatar_url} alt={user.full_name || 'User'} />\n            <AvatarFallback className=\"bg-gradient-to-r from-teal-500 to-emerald-600 text-white\">\n              {(user.full_name || user.email || 'U').charAt(0).toUpperCase()}\n            </AvatarFallback>\n          </Avatar>\n        </Button>\n      </DropdownMenuTrigger>\n      \n      <DropdownMenuContent className=\"w-56\" align={isRTL ? \"start\" : \"end\"} forceMount>\n        <DropdownMenuLabel className=\"font-normal\">\n          <div className=\"flex flex-col space-y-1\">\n            <p className=\"text-sm font-medium leading-none\">\n              {user.full_name || 'User'}\n            </p>\n            <p className=\"text-xs leading-none text-muted-foreground\">\n              {user.email}\n            </p>\n            <div className=\"mt-2\">\n              <span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${\n                user.plan_type === 'free' ? 'bg-gray-100 text-gray-800' :\n                user.plan_type === 'basic' ? 'bg-blue-100 text-blue-800' :\n                user.plan_type === 'pro' ? 'bg-purple-100 text-purple-800' :\n                'bg-gradient-to-r from-yellow-400 to-orange-500 text-white'\n              }`}>\n                {getPlanDisplayName(user.plan_type)}\n              </span>\n            </div>\n          </div>\n        </DropdownMenuLabel>\n        \n        <DropdownMenuSeparator />\n        \n        <DropdownMenuItem onClick={() => handleNavigation(\"Dashboard\")}>\n          <UserIcon className=\"mr-2 h-4 w-4\" />\n          <span>{t.dashboard}</span>\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={() => handleNavigation(\"MyConversions\")}>\n          <FileText className=\"mr-2 h-4 w-4\" />\n          <span>{t.conversions}</span>\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={() => handleNavigation(\"Settings\")}>\n          <Settings className=\"mr-2 h-4 w-4\" />\n          <span>{t.settings}</span>\n        </DropdownMenuItem>\n        \n        <DropdownMenuItem onClick={() => handleNavigation(\"Pricing\")}>\n          <CreditCard className=\"mr-2 h-4 w-4\" />\n          <span>{t.pricing}</span>\n        </DropdownMenuItem>\n        \n        <DropdownMenuSeparator />\n        \n        <DropdownMenuItem onClick={handleSignOut}>\n          <LogOut className=\"mr-2 h-4 w-4\" />\n          <span>{t.signOut}</span>\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}","payments/PayPalSubscriptionButton":"import React, { useEffect, useRef, useState } from 'react';\nimport { User } from '@/entities/User';\nimport { Button } from '@/components/ui/button';\nimport { Loader2 } from 'lucide-react';\n\nconst PayPalSubscriptionButton = ({ \n  paypalPlanId, \n  planTypeForCallback,\n  planName, \n  onSubscriptionSuccess, \n  onSubscriptionError,\n  effectiveLanguage = 'en' \n}) => {\n  const paypalRef = useRef();\n  const [showFallback, setShowFallback] = useState(false);\n  const [loading, setLoading] = useState(true);\n  const [scriptLoaded, setScriptLoaded] = useState(false);\n\n  // PayPal.me URLs as fallback\n  const paypalMeUrls = {\n    basic: 'https://paypal.me/yaron513/5.9',\n    pro: 'https://paypal.me/yaron513/12.9',\n    ultra: 'https://paypal.me/yaron513/19.9'\n  };\n\n  // Plan prices for display\n  const planPrices = {\n    basic: '$5.90',\n    pro: '$12.90', \n    ultra: '$19.90'\n  };\n\n  const translations = {\n    en: {\n      payWithPayPal: 'Subscribe with PayPal',\n      loading: 'Loading...',\n      subscriptionSuccess: 'Subscription created successfully!',\n      subscriptionFailed: 'Subscription failed. Please try again.',\n      contactAfterPayment: 'After payment, please contact us at repostlyai@gmail.com with payment confirmation.'\n    },\n    he: {\n      payWithPayPal: 'הירשם עם PayPal',\n      loading: 'טוען...',\n      subscriptionSuccess: 'המנוי נוצר בהצלחה!',\n      subscriptionFailed: 'המנוי נכשל. אנא נסה שוב.',\n      contactAfterPayment: 'לאחר התשלום, אנא צור קשר במייל repostlyai@gmail.com עם אישור התשלום.'\n    }\n  };\n\n  const t = translations[effectiveLanguage] || translations.en;\n\n  useEffect(() => {\n    // Only run on client side\n    if (typeof window === 'undefined') return;\n\n    // Check if we have a valid plan ID\n    if (!paypalPlanId) {\n      console.log('No PayPal plan ID found, using PayPal.me fallback');\n      setShowFallback(true);\n      setLoading(false);\n      return;\n    }\n\n    // Load PayPal script and render button\n    loadPayPalScript();\n  }, [paypalPlanId]);\n\n  const loadPayPalScript = () => {\n    // Check if PayPal script is already loaded\n    if (window.paypal && scriptLoaded) {\n      renderPayPalButton();\n      return;\n    }\n\n    // Remove existing PayPal script if any\n    const existingScript = document.querySelector('script[src*=\"paypal.com/sdk\"]');\n    if (existingScript) {\n      existingScript.remove();\n    }\n\n    // Create and load PayPal script with exact parameters\n    const script = document.createElement('script');\n    script.src = `https://www.paypal.com/sdk/js?client-id=AflSwzlOTbgkER1aXi622hfzcsNMfg73MRfGrRRVxpVGbtjiSEplNKpo9oGp_KBis92D39nR_ck4ILEJ&vault=true&intent=subscription&locale=${effectiveLanguage === 'he' ? 'he_IL' : 'en_US'}`;\n    script.setAttribute('data-sdk-integration-source', 'button-factory');\n    \n    script.onload = () => {\n      console.log('PayPal script loaded successfully');\n      setScriptLoaded(true);\n      renderPayPalButton();\n    };\n    \n    script.onerror = () => {\n      console.error('Failed to load PayPal script, falling back to PayPal.me');\n      setShowFallback(true);\n      setLoading(false);\n    };\n\n    document.head.appendChild(script);\n  };\n\n  const renderPayPalButton = () => {\n    if (!window.paypal || !paypalRef.current) {\n      setShowFallback(true);\n      setLoading(false);\n      return;\n    }\n\n    try {\n      // Clear previous button\n      paypalRef.current.innerHTML = '';\n\n      console.log('Rendering PayPal button for plan:', paypalPlanId);\n\n      window.paypal.Buttons({\n        style: {\n          shape: 'rect',\n          color: 'gold',\n          layout: 'vertical',\n          label: 'subscribe',\n          height: 50\n        },\n        createSubscription: function(data, actions) {\n          console.log('Creating subscription for plan:', paypalPlanId);\n          return actions.subscription.create({\n            plan_id: paypalPlanId\n          });\n        },\n        onApprove: async function(data, actions) {\n          console.log('Subscription approved:', data.subscriptionID);\n          \n          try {\n            // Update user plan in the database\n            await User.updateMyUserData({ \n              plan_type: planTypeForCallback,\n              monthly_conversions: 0,\n              last_reset_date: new Date().toISOString().split('T')[0],\n              paypal_subscription_id: data.subscriptionID\n            });\n\n            if (onSubscriptionSuccess) {\n              onSubscriptionSuccess(data.subscriptionID, planTypeForCallback);\n            }\n\n            const message = effectiveLanguage === 'he' \n              ? `${t.subscriptionSuccess} מזהה מנוי: ${data.subscriptionID}`\n              : `${t.subscriptionSuccess} Subscription ID: ${data.subscriptionID}`;\n            \n            alert(message);\n\n            setTimeout(() => {\n              window.location.reload();\n            }, 2000);\n\n          } catch (error) {\n            console.error('Error updating user subscription:', error);\n            if (onSubscriptionError) {\n              onSubscriptionError('Failed to update subscription in database');\n            }\n          }\n        },\n        onError: function(err) {\n          console.error('PayPal Subscription Error:', err);\n          alert(t.subscriptionFailed);\n          if (onSubscriptionError) {\n            onSubscriptionError('PayPal subscription failed');\n          }\n        },\n        onCancel: function(data) {\n          console.log('PayPal Subscription Cancelled:', data);\n        }\n      }).render(paypalRef.current).then(() => {\n        console.log('PayPal button rendered successfully');\n        setLoading(false);\n      }).catch((error) => {\n        console.error('Error rendering PayPal button:', error);\n        setShowFallback(true);\n        setLoading(false);\n      });\n\n    } catch (error) {\n      console.error('Error setting up PayPal button:', error);\n      setShowFallback(true);\n      setLoading(false);\n    }\n  };\n\n  const handlePayPalMePayment = async () => {\n    const user = await User.me().catch(() => null);\n    \n    if (!user) {\n      alert('Please log in first');\n      return;\n    }\n\n    const paypalUrl = paypalMeUrls[planTypeForCallback];\n    const price = planPrices[planTypeForCallback];\n    \n    const isHebrew = effectiveLanguage === 'he';\n    \n    const confirmMessage = isHebrew \n      ? `אתה עומד להיות מועבר לתשלום PayPal עבור תוכנית ${planName} (${price}/חודש).\\n\\n${t.contactAfterPayment}\\n\\nהאם תרצה להמשיך?`\n      : `You will be redirected to PayPal to pay for the ${planName} plan (${price}/month).\\n\\n${t.contactAfterPayment}\\n\\nWould you like to continue?`;\n    \n    if (confirm(confirmMessage)) {\n      window.open(paypalUrl, '_blank');\n    }\n  };\n\n  if (loading) {\n    return (\n      <div className=\"w-full py-4 flex items-center justify-center\">\n        <Loader2 className=\"w-4 h-4 animate-spin mr-2\" />\n        <span className=\"text-sm text-gray-600\">{t.loading}</span>\n      </div>\n    );\n  }\n\n  if (showFallback) {\n    return (\n      <div className=\"w-full\">\n        <Button\n          onClick={handlePayPalMePayment}\n          className=\"w-full bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white py-2.5 text-sm font-medium transition-all duration-300 rounded-lg\"\n        >\n          {t.payWithPayPal} ({planPrices[planTypeForCallback]})\n        </Button>\n      </div>\n    );\n  }\n\n  return (\n    <div className=\"paypal-subscription-container w-full\">\n      <div \n        ref={paypalRef}\n        id={`paypal-button-container-${paypalPlanId}`}\n        className=\"w-full min-h-[50px]\"\n      />\n    </div>\n  );\n};\n\nexport default PayPalSubscriptionButton;","payments/PayPalSubscriptionButtonBasic":"import React from 'react';\n\nexport default function PayPalSubscriptionButtonBasic() {\n  React.useEffect(() => {\n    // Only run on client side\n    if (typeof window === 'undefined') return;\n\n    const loadPayPalScript = () => {\n      // Check if PayPal script is already loaded\n      if (window.paypal) {\n        renderButton();\n        return;\n      }\n\n      // Create and load PayPal script\n      const script = document.createElement('script');\n      script.src = 'https://www.paypal.com/sdk/js?client-id=AflSwzlOTbgkER1aXi622hfzcsNMfg73MRfGrRRVxpVGbtjiSEplNKpo9oGp_KBis92D39nR_ck4ILEJ&vault=true&intent=subscription';\n      script.setAttribute('data-sdk-integration-source', 'button-factory');\n      script.onload = renderButton;\n      document.head.appendChild(script);\n    };\n\n    const renderButton = () => {\n      if (!window.paypal) return;\n\n      window.paypal.Buttons({\n        style: {\n          shape: 'rect',\n          color: 'gold',\n          layout: 'vertical',\n          label: 'subscribe'\n        },\n        createSubscription: function(data, actions) {\n          return actions.subscription.create({\n            plan_id: 'P-6DN55179DP995293ENBEUZVQ'\n          });\n        },\n        onApprove: function(data, actions) {\n          alert(data.subscriptionID);\n        }\n      }).render('#paypal-button-container-P-6DN55179DP995293ENBEUZVQ');\n    };\n\n    loadPayPalScript();\n  }, []);\n\n  return <div id=\"paypal-button-container-P-6DN55179DP995293ENBEUZVQ\" className=\"w-full min-h-[50px]\"></div>;\n}","payments/PayPalSubscriptionButtonPro":"import React from 'react';\n\nexport default function PayPalSubscriptionButtonPro() {\n  React.useEffect(() => {\n    // Only run on client side\n    if (typeof window === 'undefined') return;\n\n    const loadPayPalScript = () => {\n      // Check if PayPal script is already loaded\n      if (window.paypal) {\n        renderButton();\n        return;\n      }\n\n      // Create and load PayPal script with exact parameters from PayPal\n      const script = document.createElement('script');\n      script.src = 'https://www.paypal.com/sdk/js?client-id=AflSwzlOTbgkER1aXi622hfzcsNMfg73MRfGrRRVxpVGbtjiSEplNKpo9oGp_KBis92D39nR_ck4ILEJ&vault=true&intent=subscription';\n      script.setAttribute('data-sdk-integration-source', 'button-factory');\n      script.onload = renderButton;\n      document.head.appendChild(script);\n    };\n\n    const renderButton = () => {\n      if (!window.paypal) return;\n\n      window.paypal.Buttons({\n        style: {\n          shape: 'rect',\n          color: 'gold',\n          layout: 'vertical',\n          label: 'subscribe'\n        },\n        createSubscription: function(data, actions) {\n          return actions.subscription.create({\n            /* Creates the subscription */\n            plan_id: 'P-5AY18892AT0712446NBEU3DY'\n          });\n        },\n        onApprove: function(data, actions) {\n          alert(data.subscriptionID); // You can add optional success message for the subscriber here\n        }\n      }).render('#paypal-button-container-P-5AY18892AT0712446NBEU3DY'); // Renders the PayPal button\n    };\n\n    loadPayPalScript();\n  }, []);\n\n  return <div id=\"paypal-button-container-P-5AY18892AT0712446NBEU3DY\" className=\"w-full min-h-[50px]\"></div>;\n}","payments/PayPalSubscriptionButtonUltra":"import React from 'react';\n\nexport default function PayPalSubscriptionButtonUltra() {\n  React.useEffect(() => {\n    // Only run on client side\n    if (typeof window === 'undefined') return;\n\n    const loadPayPalScript = () => {\n      // Check if PayPal script is already loaded\n      if (window.paypal) {\n        renderButton();\n        return;\n      }\n\n      // Create and load PayPal script\n      const script = document.createElement('script');\n      script.src = 'https://www.paypal.com/sdk/js?client-id=AflSwzlOTbgkER1aXi622hfzcsNMfg73MRfGrRRVxpVGbtjiSEplNKpo9oGp_KBis92D39nR_ck4ILEJ&vault=true&intent=subscription';\n      script.setAttribute('data-sdk-integration-source', 'button-factory');\n      script.onload = renderButton;\n      document.head.appendChild(script);\n    };\n\n    const renderButton = () => {\n      if (!window.paypal) return;\n\n      window.paypal.Buttons({\n        style: {\n          shape: 'rect',\n          color: 'gold',\n          layout: 'vertical',\n          label: 'subscribe'\n        },\n        createSubscription: function(data, actions) {\n          return actions.subscription.create({\n            plan_id: 'P-94N45978Y3751092WNBEUTOI'\n          });\n        },\n        onApprove: function(data, actions) {\n          alert(data.subscriptionID);\n        }\n      }).render('#paypal-button-container-P-94N45978Y3751092WNBEUTOI');\n    };\n\n    loadPayPalScript();\n  }, []);\n\n  return <div id=\"paypal-button-container-P-94N45978Y3751092WNBEUTOI\" className=\"w-full min-h-[50px]\"></div>;\n}","recycle/SimilarityList":"import React from \"react\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { format, parseISO } from \"date-fns\";\n\nfunction SimilarityBar({ score }) {\n  const pct = Math.round(score * 100);\n  const color =\n    pct >= 80 ? \"bg-red-500\" : pct >= 60 ? \"bg-amber-500\" : pct >= 40 ? \"bg-yellow-500\" : \"bg-emerald-500\";\n  return (\n    <div className=\"w-full h-2 bg-gray-200 rounded\">\n      <div className={`h-2 ${color} rounded`} style={{ width: `${pct}%` }} />\n    </div>\n  );\n}\n\nexport default function SimilarityList({ items = [], onUse }) {\n  if (!items.length) return null;\n\n  return (\n    <Card className=\"bg-white/90\">\n      <CardHeader>\n        <CardTitle className=\"text-base\">Similar content found</CardTitle>\n      </CardHeader>\n      <CardContent className=\"space-y-3\">\n        {items.map(({ conversion, score }) => (\n          <div key={conversion.id} className=\"p-3 rounded-lg border bg-white\">\n            <div className=\"flex justify-between items-center mb-2\">\n              <Badge variant=\"outline\">Similarity: {Math.round(score * 100)}%</Badge>\n              <span className=\"text-xs text-gray-500\">\n                {conversion.created_date ? format(parseISO(conversion.created_date), \"dd/MM/yy HH:mm\") : \"\"}\n              </span>\n            </div>\n            <p className=\"text-sm text-gray-700 line-clamp-3 mb-2\">{conversion.input_text}</p>\n            <SimilarityBar score={score} />\n            <div className=\"mt-2 flex justify-end\">\n              <Button size=\"sm\" variant=\"outline\" onClick={() => onUse(conversion)}>\n                Use as base\n              </Button>\n            </div>\n          </div>\n        ))}\n      </CardContent>\n    </Card>\n  );\n}","recycle/TwistControls":"import React from \"react\";\nimport { Label } from \"@/components/ui/label\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\n\nconst tones = [\n  { value: \"professional\", label: \"Professional\" },\n  { value: \"casual\", label: \"Casual\" },\n  { value: \"marketing\", label: \"Marketing\" },\n  { value: \"funny\", label: \"Funny\" }\n];\n\nconst languages = [\n  { value: \"en\", label: \"English\" },\n  { value: \"he\", label: \"Hebrew\" },\n  { value: \"ar\", label: \"Arabic\" },\n  { value: \"es\", label: \"Spanish\" },\n  { value: \"fr\", label: \"French\" },\n  { value: \"zh\", label: \"Chinese\" },\n  { value: \"it\", label: \"Italian\" }\n];\n\nconst platforms = [\n  { value: \"linkedin\", label: \"LinkedIn\" },\n  { value: \"facebook\", label: \"Facebook\" },\n  { value: \"instagram\", label: \"Instagram\" },\n  { value: \"x_post\", label: \"X (Thread)\" },\n  { value: \"tiktok\", label: \"TikTok\" },\n  { value: \"reddit\", label: \"Reddit\" },\n  { value: \"newsletter\", label: \"Newsletter\" },\n  { value: \"video\", label: \"Short Video\" },\n  { value: \"landing\", label: \"Landing Intro\" },\n  { value: \"graphic\", label: \"Graphic Prompt\" }\n];\n\nexport default function TwistControls({ options, setOptions }) {\n  const set = (key, val) => setOptions(prev => ({ ...prev, [key]: val }));\n\n  return (\n    <div className=\"space-y-3\">\n      <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n        <div>\n          <Label className=\"text-sm\">Target Platform</Label>\n          <Select value={options.platform} onValueChange={(v) => set(\"platform\", v)}>\n            <SelectTrigger><SelectValue /></SelectTrigger>\n            <SelectContent>\n              {platforms.map(p => <SelectItem key={p.value} value={p.value}>{p.label}</SelectItem>)}\n            </SelectContent>\n          </Select>\n        </div>\n        <div>\n          <Label className=\"text-sm\">Output Language</Label>\n          <Select value={options.language} onValueChange={(v) => set(\"language\", v)}>\n            <SelectTrigger><SelectValue /></SelectTrigger>\n            <SelectContent>\n              {languages.map(l => <SelectItem key={l.value} value={l.value}>{l.label}</SelectItem>)}\n            </SelectContent>\n          </Select>\n        </div>\n        <div>\n          <Label className=\"text-sm\">Tone</Label>\n          <Select value={options.tone} onValueChange={(v) => set(\"tone\", v)}>\n            <SelectTrigger><SelectValue /></SelectTrigger>\n            <SelectContent>\n              {tones.map(t => <SelectItem key={t.value} value={t.value}>{t.label}</SelectItem>)}\n            </SelectContent>\n          </Select>\n        </div>\n        <div>\n          <Label className=\"text-sm\">Audience</Label>\n          <Select value={options.audience} onValueChange={(v) => set(\"audience\", v)}>\n            <SelectTrigger><SelectValue placeholder=\"General\" /></SelectTrigger>\n            <SelectContent>\n              {[\"Beginners\", \"SMBs\", \"Startups\", \"Enterprise\", \"Developers\", \"Marketers\"].map(a => (\n                <SelectItem key={a} value={a}>{a}</SelectItem>\n              ))}\n            </SelectContent>\n          </Select>\n        </div>\n      </div>\n\n      <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-2\">\n        <label className=\"flex items-center gap-2\">\n          <Checkbox checked={options.twistCurrentEvent} onCheckedChange={(v) => set(\"twistCurrentEvent\", !!v)} />\n          <span className=\"text-sm\">Connect to current events</span>\n        </label>\n        <label className=\"flex items-center gap-2\">\n          <Checkbox checked={options.twistNewPerspective} onCheckedChange={(v) => set(\"twistNewPerspective\", !!v)} />\n          <span className=\"text-sm\">Add new perspective</span>\n        </label>\n        <label className=\"flex items-center gap-2\">\n          <Checkbox checked={options.timeAnchor} onCheckedChange={(v) => set(\"timeAnchor\", !!v)} />\n          <span className=\"text-sm\">\"On this day\" angle</span>\n        </label>\n        <label className=\"flex items-center gap-2\">\n          <Checkbox checked={options.rewriteEvergreen} onCheckedChange={(v) => set(\"rewriteEvergreen\", !!v)} />\n          <span className=\"text-sm\">Make it Evergreen</span>\n        </label>\n      </div>\n    </div>\n  );\n}","ai/SentimentBadge":"import React from \"react\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Smile, Meh, Frown, AlertCircle } from \"lucide-react\";\n\nexport default function SentimentBadge({ sentiment = \"neutral\", confidence = 0, hint }) {\n  const map = {\n    positive: { label: \"Positive\", icon: <Smile className=\"w-4 h-4\" />, cls: \"bg-green-100 text-green-800\" },\n    neutral: { label: \"Neutral\", icon: <Meh className=\"w-4 h-4\" />, cls: \"bg-gray-100 text-gray-800\" },\n    negative: { label: \"Negative\", icon: <Frown className=\"w-4 h-4\" />, cls: \"bg-red-100 text-red-800\" },\n  };\n  const item = map[sentiment] || map.neutral;\n  const pct = Math.round((confidence || 0) * 100);\n\n  return (\n    <div className=\"space-y-2\">\n      <div className=\"flex items-center gap-2 flex-wrap\">\n        <Badge className={`gap-1 ${item.cls}`}>\n          {item.icon}\n          <span>{item.label}</span>\n          {confidence ? <span className=\"opacity-80 ml-1\">({pct}%)</span> : null}\n        </Badge>\n      </div>\n      {hint ? (\n        <div className=\"flex items-start gap-2 text-sm\">\n          <AlertCircle className=\"w-4 h-4 text-amber-600 mt-0.5\" />\n          <p className=\"text-gray-700\">{hint}</p>\n        </div>\n      ) : null}\n    </div>\n  );\n}","ai/TopicChips":"import React from \"react\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Tag } from \"lucide-react\";\n\nexport default function TopicChips({ topics = [], onClickTopic }) {\n  if (!topics?.length) return null;\n  return (\n    <div>\n      <div className=\"flex items-center gap-2 mb-2\">\n        <Tag className=\"w-4 h-4 text-teal-600\" />\n        <span className=\"text-sm font-semibold text-gray-900\">Topics</span>\n      </div>\n      <div className=\"flex flex-wrap gap-2\">\n        {topics.map((t) => (\n          <Badge\n            key={t}\n            variant=\"outline\"\n            onClick={onClickTopic ? () => onClickTopic(t) : undefined}\n            className={`cursor-${onClickTopic ? \"pointer\" : \"default\"} border-teal-200 text-teal-700`}\n          >\n            #{t}\n          </Badge>\n        ))}\n      </div>\n    </div>\n  );\n}","ai/PlatformRewrite":"import React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { Loader2, Wand2 } from \"lucide-react\";\nimport { InvokeLLM } from \"@/integrations/Core\";\n\nconst platformHints = {\n  tiktok: \"- Short (30-60s). Hook in first 3s → Value → Strong CTA. Add timing cues, visuals, and on-screen text.\",\n  instagram: '- Caption up to 2,000 chars. First-line hook, storytelling, question for engagement, 5-10 hashtags, include \"Link in bio\" if relevant.',\n  linkedin: \"- Professional, value-driven, 300-500 words, clear structure and CTA.\",\n  x_post: \"- X thread: 10 posts, each 250-280 chars, 1/10 hook, 2-3/10 context, 4-6/10 value, 7-8/10 examples, 9/10 takeaway, 10/10 CTA.\",\n  facebook: \"- Up to 300 words, conversational, include 1-2 hashtags, clear CTA.\",\n  reddit: \"- Title (<=120 chars) + Body. Authentic, community-first, discussion oriented. Suggest relevant subreddits.\",\n  newsletter: \"- Scannable sections, clear summary and CTA.\",\n  video: \"- Short video script with scenes and voiceover notes.\",\n  landing: \"- Landing intro with benefits bullets and CTA.\",\n};\n\nconst defaultPlatforms = [\n  { id: \"tiktok\", label: \"TikTok\" },\n  { id: \"instagram\", label: \"Instagram\" },\n  { id: \"linkedin\", label: \"LinkedIn\" },\n  { id: \"x_post\", label: \"X (Thread)\" },\n  { id: \"facebook\", label: \"Facebook\" },\n  { id: \"reddit\", label: \"Reddit\" },\n  { id: \"newsletter\", label: \"Newsletter\" },\n  { id: \"video\", label: \"Short Video\" },\n  { id: \"landing\", label: \"Landing Intro\" },\n];\n\nexport default function PlatformRewrite({ inputText, language = \"en\", tone = \"professional\", defaultPlatform = \"linkedin\", onApply }) {\n  const [platform, setPlatform] = React.useState(defaultPlatform);\n  const [loading, setLoading] = React.useState(false);\n  const [result, setResult] = React.useState(\"\");\n\n  const handleRewrite = async () => {\n    if (!inputText?.trim()) return;\n    setLoading(true);\n    setResult(\"\");\n    try {\n      const prompt = `\nRewrite the following content specifically for ${platform} in ${language}, using a ${tone} tone.\nFollow these constraints:\n${platformHints[platform] || \"\"}\nEnsure it fits the platform conventions and feels native.\nReturn only the rewritten content, no extra commentary.\n\nOriginal:\n${inputText}\n      `.trim();\n\n      const out = await InvokeLLM({ prompt });\n      setResult(out);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const handleApply = () => {\n    if (result && onApply) onApply(result);\n  };\n\n  return (\n    <Card className=\"bg-white/80 border-teal-100\">\n      <CardHeader className=\"pb-2\">\n        <CardTitle className=\"text-base\">Platform-Adaptive Rewriting</CardTitle>\n      </CardHeader>\n      <CardContent className=\"space-y-3\">\n        <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n          <div className=\"sm:col-span-2\">\n            <Select value={platform} onValueChange={setPlatform}>\n              <SelectTrigger>\n                <SelectValue placeholder=\"Choose platform\" />\n              </SelectTrigger>\n              <SelectContent>\n                {defaultPlatforms.map((p) => (\n                  <SelectItem key={p.id} value={p.id}>{p.label}</SelectItem>\n                ))}\n              </SelectContent>\n            </Select>\n          </div>\n          <Button onClick={handleRewrite} disabled={loading || !inputText?.trim()} className=\"bg-gradient-to-r from-teal-500 to-emerald-600 text-white\">\n            {loading ? (<><Loader2 className=\"w-4 h-4 mr-2 animate-spin\" />Rewriting...</>) : (<><Wand2 className=\"w-4 h-4 mr-2\" />Rewrite</>)}\n          </Button>\n        </div>\n\n        {result ? (\n          <div className=\"space-y-2\">\n            <Textarea value={result} onChange={(e) => setResult(e.target.value)} rows={8} className=\"bg-gray-50\" />\n            <div className=\"flex gap-2\">\n              <Button variant=\"outline\" onClick={() => navigator.clipboard.writeText(result)}>Copy</Button>\n              <Button onClick={handleApply}>Replace Input</Button>\n            </div>\n          </div>\n        ) : null}\n      </CardContent>\n    </Card>\n  );\n}","ai/PostAnalyzerCard":"import React from \"react\";\nimport { InvokeLLM } from \"@/integrations/Core\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { Loader2, Wand2, Sparkles, Copy, Check, ArrowRight } from \"lucide-react\";\nimport SentimentBadge from \"./SentimentBadge\";\nimport TopicChips from \"./TopicChips\";\n\nconst platformLabels = {\n  en: { tiktok: \"TikTok\", instagram: \"Instagram\", linkedin: \"LinkedIn\", x_post: \"X (Thread)\", facebook: \"Facebook\", reddit: \"Reddit\", newsletter: \"Newsletter\", video: \"Short Video\", landing: \"Landing Intro\" },\n  he:  { tiktok: \"טיקטוק\", instagram: \"אינסטגרם\", linkedin: \"לינקדאין\", x_post: \"X (ת׳רד)\", facebook: \"פייסבוק\", reddit: \"רדיט\", newsletter: \"ניוזלטר\", video: \"וידאו קצר\", landing: \"פתיח לדף נחיתה\" }\n};\n\nconst platformHints = {\n  tiktok: \"- 30–60s. Hook (first 3s) → Value → Strong CTA. Use timing cues, visuals, on-screen text.\",\n  instagram: '- Caption ≤ 2,000 chars. First-line hook, storytelling, engagement question. Add 5–10 hashtags. Include \"Link in bio\" if relevant.',\n  linkedin: \"- Professional, value-driven, 300–500 words, clear structure and CTA. Insightful tone.\",\n  x_post: \"- Thread of 10 posts, each 250–280 chars. 1/10 hook, 2–3 context, 4–6 value, 7–8 examples, 9 takeaway, 10 CTA. Use emojis sparingly.\",\n  facebook: \"- ≤ 300 words, conversational, include 1–2 hashtags, clear CTA. Include share-worthy angle.\",\n  reddit: \"- Title ≤ 120 chars + Body. Authentic, community-first, discussion-oriented. Suggest 2–3 relevant subreddits.\",\n  newsletter: \"- Scannable sections, summary + CTA. Friendly informative tone.\",\n  video: \"- Short video script with scenes and voiceover notes.\",\n  landing: \"- Landing intro with benefits bullets and CTA.\"\n};\n\nconst translations = {\n  en: {\n    title: \"Post Analyzer\",\n    analyze: \"Analyze\",\n    analyzing: \"Analyzing...\",\n    platformSuggestions: \"Suggested platforms\",\n    rewriteFor: \"Rewrite for\",\n    rewrite: \"Rewrite\",\n    rewritten: \"Rewritten\",\n    original: \"Original\",\n    copy: \"Copy\",\n    copied: \"Copied\",\n    apply: \"Replace Input\",\n    tip: \"Smart tip\",\n    choosePlatform: \"Choose platform\",\n    sentiment: \"Sentiment\",\n    topic: \"Topic\",\n    noSuggestions: \"No platform suggestions yet. Analyze first.\",\n  },\n  he: {\n    title: \"מנתח פוסט\",\n    analyze: \"נתח\",\n    analyzing: \"מנתח...\",\n    platformSuggestions: \"פלטפורמות מומלצות\",\n    rewriteFor: \"שכתב לפלטפורמה\",\n    rewrite: \"שכתוב\",\n    rewritten: \"גרסה משוכתבת\",\n    original: \"המקור\",\n    copy: \"העתק\",\n    copied: \"הועתק\",\n    apply: \"החלף את הטקסט\",\n    tip: \"המלצה חכמה\",\n    choosePlatform: \"בחר פלטפורמה\",\n    sentiment: \"סנטימנט\",\n    topic: \"נושא\",\n    noSuggestions: \"עדיין אין המלצות. הרץ ניתוח תחילה.\",\n  }\n};\n\nexport default function PostAnalyzerCard({\n  inputText,\n  language = \"en\",\n  tone = \"professional\",\n  onApplyRewrite,\n}) {\n  const t = translations[language] || translations.en;\n  const labels = platformLabels[language] || platformLabels.en;\n  const isRTL = language === \"he\" || language === \"ar\";\n\n  const [loading, setLoading] = React.useState(false);\n  const [sentiment, setSentiment] = React.useState(null); // 'positive' | 'neutral' | 'negative'\n  const [confidence, setConfidence] = React.useState(0);\n  const [topic, setTopic] = React.useState(\"\");\n  const [topics, setTopics] = React.useState([]);\n  const [advisory, setAdvisory] = React.useState(\"\");\n  const [suggestions, setSuggestions] = React.useState([]); // [{platform, score, reason}]\n  const [selectedPlatform, setSelectedPlatform] = React.useState(\"\");\n  const [rewriting, setRewriting] = React.useState(false);\n  const [rewritten, setRewritten] = React.useState(\"\");\n  const [copied, setCopied] = React.useState(false);\n\n  const runAnalysis = async () => {\n    if (!inputText?.trim()) return;\n    setLoading(true);\n    setAdvisory(\"\");\n    try {\n      const prompt = `\nYou are an assistant that analyzes a social post and returns:\n- sentiment: one of [\"positive\",\"neutral\",\"negative\"]\n- confidence: 0..1\n- topic: short 1-2 word topic (e.g., \"Marketing\", \"AI\", \"Inspiration\")\n- topics: 3-6 short keywords\n- suggestions: best target platforms ranked with a score 0..1 and a brief reason. Allowed platforms: [\"tiktok\",\"instagram\",\"linkedin\",\"x_post\",\"facebook\",\"reddit\"]\n- advisory: one-sentence tip to adapt tone for the top platform in ${language}.\n\nText:\n${inputText}\n      `.trim();\n\n      const res = await InvokeLLM({\n        prompt,\n        response_json_schema: {\n          type: \"object\",\n          properties: {\n            sentiment: { type: \"string\" },\n            confidence: { type: \"number\" },\n            topic: { type: \"string\" },\n            topics: { type: \"array\", items: { type: \"string\" } },\n            advisory: { type: \"string\" },\n            suggestions: {\n              type: \"array\",\n              items: {\n                type: \"object\",\n                properties: {\n                  platform: { type: \"string\" },\n                  score: { type: \"number\" },\n                  reason: { type: \"string\" }\n                },\n                required: [\"platform\", \"score\"]\n              }\n            }\n          },\n          required: [\"sentiment\", \"confidence\", \"topic\", \"topics\", \"suggestions\"]\n        }\n      });\n\n      setSentiment((res.sentiment || \"neutral\").toLowerCase());\n      setConfidence(typeof res.confidence === \"number\" ? Math.max(0, Math.min(1, res.confidence)) : 0.5);\n      setTopic(res.topic || \"\");\n      setTopics(Array.isArray(res.topics) ? res.topics.slice(0, 6) : []);\n      setAdvisory(res.advisory || \"\");\n      const sug = Array.isArray(res.suggestions) ? [...res.suggestions] : [];\n      sug.sort((a, b) => (b.score || 0) - (a.score || 0));\n      setSuggestions(sug);\n      if (sug[0]?.platform) setSelectedPlatform(sug[0].platform);\n    } catch (e) {\n      console.error(\"Post analysis failed\", e);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const doRewrite = async (platform) => {\n    if (!inputText?.trim() || !platform) return;\n    setRewriting(true);\n    setRewritten(\"\");\n    try {\n      const hint = platformHints[platform] || \"\";\n      const prompt = `\nRewrite the following content for ${platform} in ${language}, using a ${tone} tone.\nFollow these constraints:\n${hint}\nReturn only the rewritten content.\n\nOriginal:\n${inputText}\n      `.trim();\n      const out = await InvokeLLM({ prompt });\n      setRewritten(out);\n    } catch (e) {\n      console.error(\"Rewrite failed\", e);\n    } finally {\n      setRewriting(false);\n    }\n  };\n\n  const copyText = async () => {\n    if (!rewritten) return;\n    try {\n      await navigator.clipboard.writeText(rewritten);\n      setCopied(true);\n      setTimeout(() => setCopied(false), 1600);\n    } catch (e) {\n      console.error(\"Copy failed\", e);\n    }\n  };\n\n  return (\n    <Card className=\"bg-white/90 backdrop-blur-xl border-teal-100\" dir={isRTL ? \"rtl\" : \"ltr\"}>\n      <CardHeader className=\"pb-3\">\n        <CardTitle className=\"flex items-center justify-between text-lg\">\n          <span className=\"flex items-center gap-2\">\n            <Sparkles className=\"w-5 h-5 text-teal-600\" />\n            {t.title}\n          </span>\n          <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={runAnalysis} disabled={loading || !inputText?.trim()}>\n            {loading ? <Loader2 className=\"w-4 h-4 animate-spin\" /> : <Wand2 className=\"w-4 h-4\" />}\n            {loading ? t.analyzing : t.analyze}\n          </Button>\n        </CardTitle>\n      </CardHeader>\n      <CardContent className=\"space-y-4\">\n        {/* Sentiment + Topic row */}\n        <div className=\"flex flex-wrap items-center gap-3\">\n          <div className=\"flex items-center gap-2\">\n            <span className=\"text-sm text-gray-600\">{t.sentiment}:</span>\n            <SentimentBadge sentiment={sentiment || \"neutral\"} confidence={confidence} hint={advisory} />\n          </div>\n          {topic ? (\n            <div className=\"flex items-center gap-2\">\n              <span className=\"text-sm text-gray-600\">{t.topic}:</span>\n              <Badge className=\"bg-amber-100 text-amber-800\">{topic}</Badge>\n            </div>\n          ) : null}\n        </div>\n\n        {/* Topics chips */}\n        {topics?.length ? <TopicChips topics={topics} /> : null}\n\n        <Separator />\n\n        {/* Platform suggestions */}\n        <div className=\"space-y-2\">\n          <div className=\"flex items-center justify-between\">\n            <span className=\"text-sm font-semibold text-gray-900\">{t.platformSuggestions}</span>\n            <div className=\"flex items-center gap-2\">\n              <select\n                value={selectedPlatform || \"\"}\n                onChange={(e) => setSelectedPlatform(e.target.value)}\n                className=\"border rounded-md px-2 py-1 text-sm\"\n              >\n                <option value=\"\">{t.choosePlatform}</option>\n                {suggestions.map((s, idx) => (\n                  <option key={`${s.platform}-${idx}`} value={s.platform}>\n                    {labels[s.platform] || s.platform}\n                  </option>\n                ))}\n              </select>\n              <Button size=\"sm\" onClick={() => doRewrite(selectedPlatform)} disabled={!selectedPlatform || rewriting} className=\"gap-2 bg-gradient-to-r from-teal-500 to-emerald-600 text-white\">\n                {rewriting ? <Loader2 className=\"w-4 h-4 animate-spin\" /> : <Sparkles className=\"w-4 h-4\" />}\n                {t.rewrite}\n              </Button>\n            </div>\n          </div>\n\n          {suggestions?.length ? (\n            <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n              {suggestions.map((s, i) => (\n                <div key={i} className=\"p-3 bg-gray-50 rounded-lg border\">\n                  <div className=\"flex items-center justify-between\">\n                    <Badge variant=\"outline\" className=\"text-xs\">\n                      {labels[s.platform] || s.platform}\n                    </Badge>\n                    <Badge className={`${(s.score || 0) > 0.7 ? \"bg-emerald-100 text-emerald-800\" : \"bg-sky-100 text-sky-800\"}`}>\n                      {(Math.round(((s.score || 0) * 100))) || 0}%\n                    </Badge>\n                  </div>\n                  {s.reason ? <p className=\"text-xs text-gray-600 mt-2 line-clamp-3\">{s.reason}</p> : null}\n                  <div className=\"mt-2 flex justify-end\">\n                    <Button size=\"xs\" variant=\"outline\" onClick={() => { setSelectedPlatform(s.platform); doRewrite(s.platform); }} className=\"gap-1\">\n                      {t.rewrite} <ArrowRight className=\"w-3 h-3\" />\n                    </Button>\n                  </div>\n                </div>\n              ))}\n            </div>\n          ) : (\n            <p className=\"text-xs text-gray-500\">{t.noSuggestions}</p>\n          )}\n        </div>\n\n        <Separator />\n\n        {/* Side-by-side comparison */}\n        <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n          <div>\n            <div className=\"flex items-center justify-between mb-2\">\n              <h3 className=\"text-sm font-semibold text-gray-900\">{t.original}</h3>\n              <Badge variant=\"outline\">{inputText?.length || 0} chars</Badge>\n            </div>\n            <Textarea value={inputText} readOnly rows={10} className=\"bg-white\" />\n          </div>\n          <div>\n            <div className=\"flex items-center justify-between mb-2\">\n              <h3 className=\"text-sm font-semibold text-gray-900\">{t.rewritten}</h3>\n              <div className=\"flex items-center gap-2\">\n                <Badge variant=\"outline\">{rewritten?.length || 0} chars</Badge>\n                <Button size=\"sm\" variant=\"outline\" onClick={copyText} disabled={!rewritten} className=\"gap-2\">\n                  {copied ? <Check className=\"w-4 h-4 text-green-600\" /> : <Copy className=\"w-4 h-4\" />}\n                  {copied ? t.copied : t.copy}\n                </Button>\n                {onApplyRewrite ? (\n                  <Button size=\"sm\" onClick={() => onApplyRewrite(rewritten)} disabled={!rewritten}>\n                    {t.apply}\n                  </Button>\n                ) : null}\n              </div>\n            </div>\n            <Textarea value={rewritten} onChange={(e) => setRewritten(e.target.value)} rows={10} placeholder=\"...\" />\n          </div>\n        </div>\n      </CardContent>\n    </Card>\n  );\n}","ai/postAnalyzerActionExample":"export const ANALYZE_AND_REWRITE_ACTION = {\n  name: \"AnalyzeAndRewritePost\",\n  input: {\n    originalPost: \"{{post_text}}\"\n  },\n  steps: [\n    {\n      id: \"analyze_sentiment\",\n      type: \"ai/gpt\",\n      input: {\n        prompt: \"Analyze the sentiment of the following post and return one word: Positive, Neutral, or Negative:\\\\n\\\\n{{originalPost}}\"\n      }\n    },\n    {\n      id: \"detect_topic\",\n      type: \"ai/gpt\",\n      input: {\n        prompt: \"What is the main topic of the following post? Answer in one or two words:\\\\n\\\\n{{originalPost}}\"\n      }\n    },\n    {\n      id: \"suggest_platform\",\n      type: \"ai/gpt\",\n      input: {\n        prompt: \"Based on this post: '{{originalPost}}' and its topic '{{detect_topic.result}}', what is the best platform for publishing it? Choose from: TikTok, LinkedIn, Twitter, Instagram.\"\n      }\n    },\n    {\n      id: \"rewrite_post\",\n      type: \"ai/gpt\",\n      input: {\n        prompt: \"Rewrite the following post for {{suggest_platform.result}} using its preferred tone:\\\\n\\\\n{{originalPost}}\\\\n\\\\nTone guide:\\\\n- TikTok: Casual, fun, engaging.\\\\n- LinkedIn: Professional, insightful.\\\\n- Twitter: Short, snappy, newsy.\\\\n- Instagram: Personal, aesthetic, emotional.\"\n      }\n    }\n  ],\n  output: {\n    sentiment: \"{{analyze_sentiment.result}}\",\n    topic: \"{{detect_topic.result}}\",\n    suggestedPlatform: \"{{suggest_platform.result}}\",\n    rewrittenPost: \"{{rewrite_post.result}}\"\n  }\n};","vault/VaultFilters":"import React from \"react\";\nimport { Label } from \"@/components/ui/label\";\nimport { Input } from \"@/components/ui/input\";\nimport { Button } from \"@/components/ui/button\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { Calendar } from \"@/components/ui/calendar\";\nimport { Calendar as CalendarIcon, X } from \"lucide-react\";\nimport { format } from \"date-fns\";\n\nexport default function VaultFilters({\n  search,\n  onSearch,\n  dateRange,\n  onDateRange,\n  topic,\n  onTopic,\n  tag,\n  onTag,\n  status,\n  onStatus,\n  onlySuggestions,\n  onOnlySuggestions,\n  t = {}\n}) {\n  return (\n    <div className=\"mb-4 p-4 bg-white/80 backdrop-blur-md rounded-xl border\">\n      <div className=\"grid grid-cols-1 md:grid-cols-6 gap-3 items-end\">\n        <div className=\"md:col-span-2\">\n          <Label className=\"text-sm\">{t.search || \"חיפוש\"}</Label>\n          <Input value={search} onChange={(e) => onSearch(e.target.value)} placeholder={t.searchPlaceholder || \"חפש בתוכן...\"} className=\"mt-1\" />\n        </div>\n        <div className=\"md:col-span-2\">\n          <Label className=\"text-sm\">{t.topic || \"נושא\"}</Label>\n          <Input value={topic} onChange={(e) => onTopic(e.target.value)} placeholder={t.topicPlaceholder || \"AI, Marketing...\"} className=\"mt-1\" />\n        </div>\n        <div>\n          <Label className=\"text-sm\">{t.tag || \"תגית\"}</Label>\n          <Input value={tag} onChange={(e) => onTag(e.target.value)} placeholder={t.tagPlaceholder || \"label\"} className=\"mt-1\" />\n        </div>\n        <div>\n          <Label className=\"text-sm\">{t.status || \"סטטוס\"}</Label>\n          <Select value={status} onValueChange={onStatus}>\n            <SelectTrigger className=\"mt-1\">\n              <SelectValue placeholder={t.all || \"הכל\"} />\n            </SelectTrigger>\n            <SelectContent>\n              <SelectItem value=\"all\">{t.all || \"הכל\"} </SelectItem>\n              <SelectItem value=\"new\">{t.new || \"חדש\"}</SelectItem>\n              <SelectItem value=\"candidate\">{t.candidate || \"מועמד למחזור\"}</SelectItem>\n              <SelectItem value=\"recycled\">{t.recycled || \"ממוחזר\"}</SelectItem>\n            </SelectContent>\n          </Select>\n        </div>\n        <div className=\"md:col-span-2\">\n          <Label className=\"text-sm\">{t.dateRange || \"טווח תאריכים\"}</Label>\n          <Popover>\n            <PopoverTrigger asChild>\n              <Button variant=\"outline\" className=\"w-full justify-start mt-1\">\n                <CalendarIcon className=\"w-4 h-4 mr-2\" />\n                {dateRange?.from\n                  ? dateRange?.to\n                    ? `${format(dateRange.from, \"dd/MM/yy\")} - ${format(dateRange.to, \"dd/MM/yy\")}`\n                    : format(dateRange.from, \"dd/MM/yy\")\n                  : t.pick || \"בחר תאריכים\"}\n              </Button>\n            </PopoverTrigger>\n            <PopoverContent align=\"start\" className=\"w-auto p-0\">\n              <Calendar\n                initialFocus\n                mode=\"range\"\n                defaultMonth={dateRange?.from}\n                selected={dateRange}\n                onSelect={onDateRange}\n                numberOfMonths={2}\n              />\n            </PopoverContent>\n          </Popover>\n        </div>\n        <div className=\"flex items-center gap-2\">\n          <input id=\"suggestions\" type=\"checkbox\" checked={onlySuggestions} onChange={(e) => onOnlySuggestions(e.target.checked)} />\n          <Label htmlFor=\"suggestions\" className=\"text-sm\">{t.onlySuggestions || \"הצעות למחזור בלבד\"}</Label>\n        </div>\n        <div className=\"md:col-span-6\">\n          <Button variant=\"outline\" size=\"sm\" onClick={() => { onSearch(\"\"); onTopic(\"\"); onTag(\"\"); onStatus(\"all\"); onDateRange({ from: null, to: null }); onOnlySuggestions(false); }} className=\"gap-2\">\n            <X className=\"w-4 h-4\" /> {t.clear || \"נקה\"}\n          </Button>\n        </div>\n      </div>\n    </div>\n  );\n}","vault/VaultCard":"import React from \"react\";\nimport { Card, CardContent } from \"@/components/ui/card\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { RotateCcw, Tags, Sparkles, Calendar as CalendarIcon } from \"lucide-react\";\nimport { format, parseISO } from \"date-fns\";\n\nexport default function VaultCard({ conversion, onAnalyze, onRecycle, onAddTag }) {\n  const tags = [...(conversion.auto_tags || []), ...(conversion.user_tags || [])];\n\n  const shortTitle = (conversion.input_text || \"\").slice(0, 90) + ((conversion.input_text || \"\").length > 90 ? \"…\" : \"\");\n  const created = conversion.created_date ? format(parseISO(conversion.created_date), \"dd/MM/yy\") : \"\";\n  const isCandidate = conversion.__isRecycleCandidate === true;\n\n  return (\n    <Card className=\"bg-white/90 border\">\n      <CardContent className=\"p-4\">\n        <div className=\"flex items-start justify-between gap-3\">\n          <div className=\"flex-1 min-w-0\">\n            <div className=\"flex items-center gap-2 mb-1\">\n              <h3 className=\"font-semibold text-gray-900 truncate\">{shortTitle}</h3>\n              {conversion.evergreen ? (\n                <Badge className=\"bg-emerald-100 text-emerald-800\">Evergreen</Badge>\n              ) : null}\n              {isCandidate ? (\n                <Badge className=\"bg-amber-100 text-amber-800\">Recycle Suggestion</Badge>\n              ) : null}\n            </div>\n            <div className=\"flex flex-wrap gap-2 mb-2\">\n              {conversion.topic ? <Badge variant=\"outline\">{conversion.topic}</Badge> : null}\n              {conversion.suggested_platforms?.slice(0, 3).map((p) => (\n                <Badge key={p} variant=\"secondary\" className=\"capitalize\">{p.replace(\"_\", \" \")}</Badge>\n              ))}\n              <div className=\"flex items-center text-xs text-gray-500 gap-1\">\n                <CalendarIcon className=\"w-3.5 h-3.5\" /> {created}\n              </div>\n            </div>\n            {tags?.length ? (\n              <div className=\"flex flex-wrap gap-1.5\">\n                {tags.map((t, i) => (\n                  <Badge key={`${t}-${i}`} variant=\"outline\" className=\"text-xs\">#{t}</Badge>\n                ))}\n              </div>\n            ) : (\n              <div className=\"text-xs text-gray-500\">אין תגיות עדיין</div>\n            )}\n          </div>\n\n          <div className=\"flex flex-col gap-2 shrink-0\">\n            <Button size=\"sm\" variant=\"outline\" className=\"gap-2\" onClick={() => onAnalyze(conversion)}>\n              <Sparkles className=\"w-4 h-4\" /> נתח/תייג\n            </Button>\n            <Button size=\"sm\" className=\"gap-2 bg-teal-600 hover:bg-teal-700 text-white\" onClick={() => onRecycle(conversion)}>\n              <RotateCcw className=\"w-4 h-4\" /> מחזר\n            </Button>\n            <Button size=\"sm\" variant=\"ghost\" className=\"gap-2\" onClick={() => onAddTag(conversion)}>\n              <Tags className=\"w-4 h-4\" /> תגית\n            </Button>\n          </div>\n        </div>\n      </CardContent>\n    </Card>\n  );\n}","accessibility/AccessibilityMenu":"import React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { Switch } from \"@/components/ui/switch\";\n\nconst STORAGE_KEY = \"a11y_prefs\";\n\nfunction readPrefs() {\n  try {\n    const raw = localStorage.getItem(STORAGE_KEY);\n    if (!raw) return null;\n    return JSON.parse(raw);\n  } catch {\n    return null;\n  }\n}\n\nfunction writePrefs(prefs) {\n  try {\n    localStorage.setItem(STORAGE_KEY, JSON.stringify(prefs));\n  } catch {}\n}\n\nfunction applyPrefs(prefs) {\n  const root = document.documentElement;\n  const classes = [\n    \"a11y-text-lg\",\n    \"a11y-text-xl\",\n    \"a11y-high-contrast\",\n    \"a11y-text-spacing\",\n    \"a11y-highlight-links\",\n    \"a11y-reduce-motion\",\n  ];\n  classes.forEach((c) => root.classList.remove(c));\n\n  if (prefs.fontScale === \"lg\") root.classList.add(\"a11y-text-lg\");\n  if (prefs.fontScale === \"xl\") root.classList.add(\"a11y-text-xl\");\n  if (prefs.highContrast) root.classList.add(\"a11y-high-contrast\");\n  if (prefs.textSpacing) root.classList.add(\"a11y-text-spacing\");\n  if (prefs.highlightLinks) root.classList.add(\"a11y-highlight-links\");\n  if (prefs.reduceMotion) root.classList.add(\"a11y-reduce-motion\");\n}\n\nexport default function AccessibilityMenu() {\n  const [open, setOpen] = React.useState(false);\n  const [prefs, setPrefs] = React.useState(() => readPrefs() || {\n    fontScale: \"md\", // md | lg | xl\n    highContrast: false,\n    textSpacing: false,\n    highlightLinks: false,\n    reduceMotion: false,\n  });\n\n  React.useEffect(() => {\n    applyPrefs(prefs);\n    writePrefs(prefs);\n  }, [prefs]);\n\n  const increaseFont = () => {\n    setPrefs((p) => {\n      const order = [\"md\", \"lg\", \"xl\"];\n      const idx = Math.min(order.indexOf(p.fontScale) + 1, order.length - 1);\n      return { ...p, fontScale: order[idx] };\n    });\n  };\n\n  const decreaseFont = () => {\n    setPrefs((p) => {\n      const order = [\"md\", \"lg\", \"xl\"];\n      const idx = Math.max(order.indexOf(p.fontScale) - 1, 0);\n      return { ...p, fontScale: order[idx] };\n    });\n  };\n\n  const resetAll = () => {\n    const base = { fontScale: \"md\", highContrast: false, textSpacing: false, highlightLinks: false, reduceMotion: false };\n    setPrefs(base);\n  };\n\n  return (\n    <div className=\"fixed right-4 bottom-28 z-50\">\n      <Popover open={open} onOpenChange={setOpen}>\n        <PopoverTrigger asChild>\n          <Button\n            aria-label=\"Accessibility menu\"\n            className=\"rounded-full w-12 h-12 bg-gray-900 text-white hover:bg-gray-800 shadow-lg\"\n            title=\"נגישות\"\n          >\n            Aa\n          </Button>\n        </PopoverTrigger>\n        <PopoverContent align=\"end\" className=\"w-72 p-4\">\n          <div className=\"space-y-3\">\n            <div className=\"flex items-center justify-between\">\n              <span className=\"text-sm font-semibold\">גודל טקסט</span>\n              <div className=\"flex items-center gap-1\">\n                <Button size=\"sm\" variant=\"outline\" onClick={decreaseFont} aria-label=\"הקטן טקסט\">A-</Button>\n                <div className=\"px-2 text-xs text-gray-600\">({prefs.fontScale})</div>\n                <Button size=\"sm\" variant=\"outline\" onClick={increaseFont} aria-label=\"הגדל טקסט\">A+</Button>\n              </div>\n            </div>\n\n            <div className=\"flex items-center justify-between\">\n              <span className=\"text-sm\">ניגודיות גבוהה</span>\n              <Switch checked={prefs.highContrast} onCheckedChange={(v) => setPrefs({ ...prefs, highContrast: v })} />\n            </div>\n\n            <div className=\"flex items-center justify-between\">\n              <span className=\"text-sm\">ריווח טקסט משופר</span>\n              <Switch checked={prefs.textSpacing} onCheckedChange={(v) => setPrefs({ ...prefs, textSpacing: v })} />\n            </div>\n\n            <div className=\"flex items-center justify-between\">\n              <span className=\"text-sm\">הדגשת קישורים</span>\n              <Switch checked={prefs.highlightLinks} onCheckedChange={(v) => setPrefs({ ...prefs, highlightLinks: v })} />\n            </div>\n\n            <div className=\"flex items-center justify-between\">\n              <span className=\"text-sm\">צמצום אנימציות</span>\n              <Switch checked={prefs.reduceMotion} onCheckedChange={(v) => setPrefs({ ...prefs, reduceMotion: v })} />\n            </div>\n\n            <div className=\"pt-2\">\n              <Button variant=\"ghost\" className=\"w-full\" onClick={resetAll}>איפוס</Button>\n            </div>\n          </div>\n        </PopoverContent>\n      </Popover>\n    </div>\n  );\n}","layout/AppFooter":"import React from \"react\";\nimport { Link } from \"react-router-dom\";\nimport { createPageUrl } from \"@/utils\";\n\nconst translations = {\n  he: {\n    product: \"מוצר\",\n    legal: \"משפטי\",\n    pricing: \"תמחור\",\n    about: \"אודות\",\n    privacy: \"מדיניות פרטיות\",\n    terms: \"תנאי שימוש\",\n    copyrightDisclaimer: \"זכויות יוצרים ודיסקליימר\",\n    tagline: \"פלטפורמת AI למחזור תוכן חכם\",\n  },\n  en: {\n    product: \"Product\",\n    legal: \"Legal\",\n    pricing: \"Pricing\",\n    about: \"About\",\n    privacy: \"Privacy Policy\",\n    terms: \"Terms of Use\",\n    copyrightDisclaimer: \"Copyright & Disclaimer\",\n    tagline: \"AI platform for smart content repurposing\",\n  },\n};\n\nexport default function AppFooter({ effectiveLanguage = \"en\" }) {\n  const t = translations[effectiveLanguage] || translations.en;\n  const isRTL = effectiveLanguage === \"he\" || effectiveLanguage === \"ar\";\n\n  return (\n    <footer className={`mt-8 border-t bg-white/80 backdrop-blur-sm ${isRTL ? \"rtl\" : \"ltr\"}`} dir={isRTL ? \"rtl\" : \"ltr\"}>\n      <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8\">\n        <div className=\"grid grid-cols-1 md:grid-cols-4 gap-8\">\n          <div className=\"md:col-span-2\">\n            <div className=\"flex items-center gap-2 mb-3\">\n              <img\n                src=\"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/54c656121_5cea2907f_May27202510_40_12AM.png\"\n                alt=\"RePostly Logo\"\n                className=\"w-8 h-8 rounded-lg object-contain bg-teal-600/5\"\n                onError={(e) => {\n                  e.currentTarget.onerror = null;\n                  e.currentTarget.src =\n                    \"https://images.unsplash.com/photo-1515879218367-8466d910aaa4?w=64&q=80&auto=format&fit=crop\";\n                }}\n              />\n              <span className=\"text-lg font-semibold text-gray-900\">RePostly</span>\n            </div>\n            <p className=\"text-sm text-gray-600\">{t.tagline}</p>\n          </div>\n\n          <div>\n            <h3 className=\"font-semibold text-gray-900 mb-3\">{t.product}</h3>\n            <ul className=\"space-y-2 text-sm\">\n              <li>\n                <Link to={createPageUrl(\"Pricing\")} className=\"text-gray-600 hover:text-teal-700\">\n                  {t.pricing}\n                </Link>\n              </li>\n              <li>\n                <Link to={createPageUrl(\"About\")} className=\"text-gray-600 hover:text-teal-700\">\n                  {t.about}\n                </Link>\n              </li>\n            </ul>\n          </div>\n\n          <div>\n            <h3 className=\"font-semibold text-gray-900 mb-3\">{t.legal}</h3>\n            <ul className=\"space-y-2 text-sm\">\n              <li>\n                <Link to={createPageUrl(\"PrivacyPolicy\")} className=\"text-gray-600 hover:text-teal-700\">\n                  {t.privacy}\n                </Link>\n              </li>\n              <li>\n                <Link to={createPageUrl(\"TermsOfUse\")} className=\"text-gray-600 hover:text-teal-700\">\n                  {t.terms}\n                </Link>\n              </li>\n              <li>\n                <Link to={createPageUrl(\"CopyrightDisclaimer\")} className=\"text-gray-600 hover:text-teal-700\">\n                  {t.copyrightDisclaimer}\n                </Link>\n              </li>\n            </ul>\n          </div>\n        </div>\n\n        <div className=\"mt-8 text-xs text-gray-500 border-t pt-4\">\n          © {new Date().getFullYear()} RePostly. All rights reserved.\n        </div>\n      </div>\n    </footer>\n  );\n}","config":"export const RUN_MODE_FREE = true;\n\nexport const PLAN_LIMITS = {\n  free: Infinity,\n  basic: Infinity,\n  pro: Infinity,\n  ultra: Infinity,\n};"},"layout":"\nimport React from 'react';\nimport { useLocation, Link } from 'react-router-dom';\nimport { User } from '@/entities/User';\nimport { Button } from '@/components/ui/button';\nimport { createPageUrl } from '@/utils';\nimport { RUN_MODE_FREE } from \"@/components/config\";\nimport {\n  Home,\n  Zap,\n  FileArchive,\n  CreditCard,\n  Settings,\n  LogOut,\n  Globe,\n  RefreshCw,\n  Archive,\n  Lightbulb\n} from 'lucide-react';\nimport {\n  Sidebar,\n  SidebarContent,\n  SidebarFooter,\n  SidebarGroup,\n  SidebarGroupContent,\n  SidebarGroupLabel,\n  SidebarHeader,\n  SidebarMenu,\n  SidebarMenuButton,\n  SidebarMenuItem,\n  SidebarProvider,\n  SidebarTrigger,\n} from \"@/components/ui/sidebar\";\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport ChatWidget from \"@/components/layout/ChatWidget\";\nimport AuthButton from \"@/components/auth/AuthButton\";\nimport AccessibilityMenu from \"@/components/accessibility/AccessibilityMenu\";\nimport AppFooter from \"@/components/layout/AppFooter\";\n\nconst translations = {\n  en: {\n    dashboard: \"Dashboard\",\n    newConversion: \"Create\",\n    myConversions: \"History\",\n    recycle: \"Recycle\",\n    contentVault: \"Content Vault\",\n    pricing: \"Pricing\",\n    settings: \"Settings\",\n    currentPlanStatus: \"Current Plan\",\n    monthlyConversionsUsed: \"Conversions used\",\n    free: \"Free Plan\",\n    basic: \"Basic Plan\",\n    pro: \"Pro Plan\",\n    ultra: \"Ultra Plan\",\n    logout: \"Logout\",\n    loginWithGoogle: \"Login with Google\",\n    backToHomePage: \"Back to Home Page\",\n    languages: {\n      en: \"English\",\n      he: \"עברית\",\n      ar: \"العربية\",\n      es: \"Español\",\n      fr: \"Français\",\n      zh: \"中文\",\n      it: \"Italiano\"\n    },\n    inspire: \"Inspire Now\"\n  },\n  he: {\n    dashboard: \"דשבורד\",\n    newConversion: \"צור\",\n    myConversions: \"היסטוריה\",\n    recycle: \"מחזור\",\n    contentVault: \"ארכיון\",\n    pricing: \"תמחור\",\n    settings: \"הגדרות\",\n    currentPlanStatus: \"תוכנית נוכחית\",\n    monthlyConversionsUsed: \"המרות שבוצעו\",\n    free: \"תוכנית חינמית\",\n    basic: \"תוכנית בסיסית\",\n    pro: \"תוכנית מקצועית\",\n    ultra: \"תוכנית אולטרה\",\n    logout: \"התנתק\",\n    loginWithGoogle: \"התחבר עם Google\",\n    backToHomePage: \"חזור לדף הבית\",\n    languages: {\n      en: \"English\",\n      he: \"עברית\",\n      ar: \"הערבית\",\n      es: \"ספרדית\",\n      fr: \"צרפתית\",\n      zh: \"סינית\",\n      it: \"איטלקית\"\n    },\n    inspire: \"השראה עכשיו\"\n  }\n};\n\nconst planColors = {\n  free: \"bg-gray-100 text-gray-800\",\n  basic: \"bg-blue-100 text-blue-800\",\n  pro: \"bg-purple-100 text-purple-800\",\n  ultra: \"bg-gradient-to-r from-yellow-400 to-orange-500 text-white\"\n};\n\nconst navigationItems = [\n  { key: \"dashboard\", url: \"Dashboard\", icon: Home },\n  { key: \"newConversion\", url: \"Convert\", icon: Zap },\n  { key: \"myConversions\", url: \"MyConversions\", icon: FileArchive },\n  { key: \"recycle\", url: \"RecycleEngine\", icon: RefreshCw },\n  { key: \"contentVault\", url: \"ContentVault\", icon: Archive },\n  { key: \"inspire\", url: \"InspireNow\", icon: Lightbulb },\n  { key: \"pricing\", url: \"Pricing\", icon: CreditCard },\n  { key: \"settings\", url: \"Settings\", icon: Settings },\n];\n\nconst supportedLanguages = [\"en\", \"he\", \"ar\", \"es\", \"fr\", \"zh\", \"it\"];\n\nexport default function Layout({ children, currentPageName }) {\n  const location = useLocation();\n  const [user, setUser] = React.useState(null);\n  const [loading, setLoading] = React.useState(true);\n  const [effectiveLanguage, setEffectiveLanguage] = React.useState('en');\n\n  React.useEffect(() => {\n    const initializeUserAndLanguage = async () => {\n      setLoading(true);\n      try {\n        let userData = await User.me();\n\n        // Special access for yaronpm.eng@gmail.com\n        if (userData.email === 'yaronpm.eng@gmail.com') {\n          // Update user with admin privileges and unlimited access\n          const updatedData = {\n            plan_type: 'ultra',\n            monthly_conversions: 0,\n            is_admin: true,\n            special_access: true,\n            last_reset_date: new Date().toISOString().split('T')[0]\n          };\n\n          try {\n            await User.updateMyUserData(updatedData);\n            userData = { ...userData, ...updatedData };\n          } catch (error) {\n            console.log('Could not update admin privileges, but continuing...');\n          }\n        }\n\n        // Check and reset monthly usage if needed (for other users)\n        if (userData.email !== 'yaronpm.eng@gmail.com') {\n          const today = new Date();\n          const lastResetDateStr = userData.last_reset_date;\n          const lastReset = lastResetDateStr ? new Date(lastResetDateStr) : null;\n\n          let needsReset = false;\n          if (!lastReset) {\n            needsReset = true;\n          } else {\n            // Check if a month has passed\n            const monthsPassed = (today.getFullYear() - lastReset.getFullYear()) * 12 +\n                                (today.getMonth() - lastReset.getMonth());\n            if (monthsPassed >= 1) {\n              needsReset = true;\n            }\n          }\n\n          if (needsReset) {\n            const updatedUserData = {\n              monthly_conversions: 0,\n              last_reset_date: today.toISOString().split('T')[0]\n            };\n            await User.updateMyUserData(updatedUserData);\n            userData = { ...userData, ...updatedUserData };\n          }\n        }\n\n        setUser(userData);\n        setEffectiveLanguage(userData.user_language || 'en');\n\n      } catch (error) {\n        console.log(\"User not authenticated or error fetching user for Layout.\");\n        // If user is not authenticated, try to get language from localStorage\n        const storedLang = localStorage.getItem('repostly_lang');\n        if (storedLang && supportedLanguages.includes(storedLang)) {\n            setEffectiveLanguage(storedLang);\n        } else {\n            setEffectiveLanguage('en'); // Default language\n        }\n      }\n      setLoading(false);\n    };\n    initializeUserAndLanguage();\n  }, []);\n\n  const handleLogout = async () => {\n    try {\n      await User.logout();\n      setUser(null);\n    } catch (error) {\n      console.error(\"Logout failed:\", error);\n    }\n  };\n\n  const handleChangeLanguage = async (lang) => {\n    setEffectiveLanguage(lang);\n    localStorage.setItem('repostly_lang', lang);\n\n    if (user) {\n      try {\n        await User.updateMyUserData({ user_language: lang });\n        setUser(prev => ({ ...prev, user_language: lang }));\n      } catch (error) {\n        console.error(\"Failed to update user language:\", error);\n      }\n    }\n  };\n\n  const t = translations[effectiveLanguage] || translations.en;\n\n  if (loading) {\n    return (\n      <div className=\"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50 flex items-center justify-center\">\n        <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600\"></div>\n      </div>\n    );\n  }\n\n  // For HomePage, don't wrap in layout\n  if (currentPageName === \"HomePage\") {\n    const homePageContent = React.isValidElement(children) ? React.cloneElement(children, { effectiveLanguage }) : children;\n    return homePageContent;\n  }\n\n  // Standard login prompt if user is not logged in and not on HomePage\n  if (!user) {\n    return (\n      <div className={`min-h-screen bg-gradient-to-br from-slate-50 via-teal-50 to-emerald-50 flex items-center justify-center p-4 ${effectiveLanguage === 'he' || effectiveLanguage === 'ar' ? 'rtl' : 'ltr'}`} dir={effectiveLanguage === 'he' || effectiveLanguage === 'ar' ? 'rtl' : 'ltr'}>\n        <div className=\"max-w-md w-full bg-white/90 backdrop-blur-xl rounded-3xl shadow-2xl p-6 sm:p-8 border border-white/30 relative\">\n          <div className=\"text-center\">\n            <div className=\"mx-auto mb-4 sm:mb-6 flex justify-center\">\n              <img\n                src=\"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/54c656121_5cea2907f_May27202510_40_12AM.png\"\n                alt=\"RePostly\"\n                className=\"w-20 h-20 sm:w-24 sm:h-24 rounded-2xl object-contain bg-teal-600/5\"\n                onError={(e) => {\n                  e.currentTarget.onerror = null;\n                  e.currentTarget.src = \"https://images.unsplash.com/photo-1515879218367-8466d910aaa4?w=64&q=80&auto=format&fit=crop\";\n                }}\n              />\n            </div>\n            <AuthButton\n              effectiveLanguage={effectiveLanguage}\n              onLanguageChange={handleChangeLanguage}\n              size=\"lg\"\n              variant=\"default\"\n            />\n            <p className=\"mt-3 sm:mt-4 text-sm\">\n              <Link to={createPageUrl(\"HomePage\")} className=\"text-teal-600 hover:underline\">\n                {t.backToHomePage}\n              </Link>\n            </p>\n          </div>\n        </div>\n        {/* תפריט נגישות גם במסך ההתחברות */}\n        <AccessibilityMenu />\n      </div>\n    );\n  }\n\n  // If user is logged in, proceed to render the main layout\n  const pageContent = React.isValidElement(children) ? React.cloneElement(children, { effectiveLanguage, appTranslations: t, user }) : children;\n\n  return (\n    <div className={`bg-gray-50 ${effectiveLanguage === 'he' || effectiveLanguage === 'ar' ? 'rtl' : 'ltr'}`} dir={effectiveLanguage === 'he' || effectiveLanguage === 'ar' ? 'rtl' : 'ltr'}>\n      <style>{`\n        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');\n\n        * {\n          box-sizing: border-box;\n        }\n\n        body, html {\n          font-family: 'Inter', 'Assistant', sans-serif;\n          overflow-x: hidden;\n          margin: 0;\n          padding: 0;\n        }\n\n        :root {\n          --primary-gradient: linear-gradient(135deg, #0f766e 0%, #059669 100%);\n          --secondary-gradient: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);\n        }\n        .rtl { direction: rtl; }\n        .ltr { direction: ltr; }\n\n        ::-webkit-scrollbar {\n          width: 6px;\n          height: 6px;\n        }\n        ::-webkit-scrollbar-track {\n          background: #f8fafc;\n          border-radius: 10px;\n        }\n        ::-webkit-scrollbar-thumb {\n          background: #14b8a6;\n          border-radius: 10px;\n        }\n        ::-webkit-scrollbar-thumb:hover {\n          background: #0f766e;\n        }\n\n        /* Fixed layout container */\n        .layout-container {\n          display: flex;\n          min-height: 100vh;\n          width: 100%;\n          max-width: 100vw;\n          overflow-x: hidden;\n        }\n\n        /* Desktop sidebar */\n        .desktop-sidebar {\n          width: 256px;\n          min-width: 256px;\n          background: white;\n          border-right: 1px solid #e5e7eb;\n          position: fixed;\n          left: 0;\n          top: 0;\n          height: 100vh;\n          z-index: 40;\n          display: flex;\n          flex-direction: column;\n        }\n\n        /* Hide desktop sidebar on smaller screens */\n        @media (max-width: 1023px) { /* Equivalent to Tailwind's lg breakpoint -1px */\n          .desktop-sidebar {\n            display: none;\n          }\n        }\n\n        /* Main content area */\n        .main-content {\n          flex: 1;\n          display: flex;\n          flex-direction: column;\n          min-height: 100vh;\n          width: 100%; /* Default to full width for mobile */\n        }\n\n        /* Desktop: add left margin for sidebar and adjust width */\n        @media (min-width: 1024px) {\n          .main-content {\n            margin-left: 256px; /* Width of desktop-sidebar */\n            width: calc(100% - 256px);\n          }\n        }\n\n        /* Mobile header */\n        .mobile-header {\n          background: white;\n          border-bottom: 1px solid #e5e7eb;\n          padding: 12px 16px; /* px-4 py-3 */\n          display: flex;\n          align-items: center;\n          justify-content: space-between;\n          position: sticky;\n          top: 0;\n          z-index: 30;\n          width: 100%;\n          box-sizing: border-box;\n        }\n\n        /* Page content wrapper */\n        .page-content {\n          flex: 1; /* Allow content to grow and fill available height */\n          padding: 16px; /* p-4 */\n          width: 100%;\n          max-width: 100%;\n          box-sizing: border-box;\n          overflow-x: hidden; /* Prevent horizontal scroll for page content */\n          overflow-y: auto; /* Allow vertical scroll for content if needed */\n        }\n\n        @media (min-width: 640px) { /* sm: */\n          .page-content {\n            padding: 24px; /* sm:p-6 */\n          }\n        }\n\n        @media (min-width: 1024px) { /* lg: */\n          .page-content {\n            padding: 32px; /* lg:p-8 */\n          }\n        }\n      `}</style>\n      {/* Accessibility CSS (appended) */}\n      <style>{`\n        /* Accessibility helpers */\n        .a11y-text-lg { font-size: 110%; }\n        .a11y-text-xl { font-size: 120%; }\n        .a11y-high-contrast { filter: contrast(1.25) saturate(1.1); }\n        .a11y-text-spacing { letter-spacing: 0.03em; word-spacing: 0.05em; }\n        .a11y-text-spacing body, .a11y-text-spacing .page-content { line-height: 1.8; }\n        .a11y-highlight-links a { text-decoration: underline !important; background-color: rgba(250, 204, 21, 0.25); border-radius: 0.25rem; padding: 0 0.15em; }\n        .a11y-reduce-motion *, .a11y-reduce-motion *::before, .a11y-reduce-motion *::after { transition: none !important; animation: none !important; }\n      `}</style>\n\n      <SidebarProvider>\n        <div className=\"layout-container\">\n          {/* Desktop Sidebar */}\n          <Sidebar className=\"desktop-sidebar\">\n            <SidebarHeader className=\"border-b border-gray-100 p-4\">\n              <div className=\"flex items-center gap-3\">\n                <img\n                  src=\"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/54c656121_5cea2907f_May27202510_40_12AM.png\"\n                  alt=\"RePostly\"\n                  className=\"w-10 h-10 rounded-xl object-contain bg-teal-600/5\"\n                  onError={(e) => {\n                    e.currentTarget.onerror = null;\n                    e.currentTarget.src = \"https://images.unsplash.com/photo-1515879218367-8466d910aaa4?w=64&q=80&auto=format&fit=crop\";\n                  }}\n                />\n                <div>\n                  <h2 className=\"font-semibold text-gray-900\">RePostly</h2>\n                  <p className=\"text-xs text-gray-500\">AI Content Platform</p>\n                </div>\n              </div>\n            </SidebarHeader>\n\n            <SidebarContent className=\"p-4 flex-1 overflow-y-auto\">\n              <SidebarGroup>\n                <SidebarGroupContent>\n                  <SidebarMenu>\n                    {navigationItems.map((item) => (\n                      <SidebarMenuItem key={item.key}>\n                        <SidebarMenuButton\n                          asChild\n                          className={`hover:bg-teal-50 hover:text-teal-700 transition-all duration-200 rounded-xl mb-1 font-medium ${\n                            location.pathname === createPageUrl(item.url) ? 'bg-teal-50 text-teal-700 border-r-2 border-teal-600' : 'text-gray-700'\n                          }`}\n                        >\n                          <Link to={createPageUrl(item.url)} className=\"flex items-center gap-3 px-4 py-3\">\n                            <item.icon className=\"w-5 h-5\" />\n                            <span>{t[item.key]}</span>\n                          </Link>\n                        </SidebarMenuButton>\n                      </SidebarMenuItem>\n                    ))}\n                  </SidebarMenu>\n                </SidebarGroupContent>\n              </SidebarGroup>\n\n              <SidebarGroup className=\"mt-6\">\n                <SidebarGroupLabel className=\"text-xs font-medium text-gray-500 uppercase tracking-wider px-4 py-2\">\n                  {t.currentPlanStatus}\n                </SidebarGroupLabel>\n                <SidebarGroupContent>\n                  <div className=\"px-4 py-3\">\n                    <div className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${\n                      user?.plan_type === 'free' ? 'bg-gray-100 text-gray-800' :\n                      user?.plan_type === 'basic' ? 'bg-blue-100 text-blue-800' :\n                      user?.plan_type === 'pro' ? 'bg-purple-100 text-purple-800' :\n                      'bg-gradient-to-r from-yellow-400 to-orange-500 text-white'\n                    }`}>\n                      {t[user?.plan_type || 'free']}\n                    </div>\n\n                    {RUN_MODE_FREE ? (\n                      <div className=\"mt-3 text-xs text-emerald-700 bg-emerald-50 border border-emerald-100 rounded-lg p-2\">\n                        {effectiveLanguage === 'he' ? 'מצב ריצה פעיל: ללא הגבלות וללא תשלום' : 'Run mode: No limits and no payment'}\n                      </div>\n                    ) : (\n                      <div className=\"mt-3 text-sm text-gray-600\">\n                        <div className=\"flex justify-between\">\n                          <span>{t.monthlyConversionsUsed}</span>\n                          <span className=\"font-semibold\">{user?.monthly_conversions || 0}</span>\n                        </div>\n                        {user?.plan_type === 'free' && (\n                          <div className=\"w-full bg-gray-200 rounded-full h-2 mt-2\">\n                            <div\n                              className=\"bg-teal-600 h-2 rounded-full transition-all duration-500\"\n                              style={{ width: `${Math.min((user?.monthly_conversions || 0) / 2 * 100, 100)}%` }}\n                            ></div>\n                          </div>\n                        )}\n                      </div>\n                    )}\n                  </div>\n                </SidebarGroupContent>\n              </SidebarGroup>\n            </SidebarContent>\n\n            <SidebarFooter className=\"border-t border-gray-100 p-4\">\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex items-center gap-3 min-w-0 flex-1\">\n                  <div className=\"w-8 h-8 bg-gradient-to-r from-teal-500 to-emerald-600 rounded-full flex items-center justify-center\">\n                    <span className=\"text-white font-medium text-sm\">\n                      {user?.full_name?.charAt(0) || 'U'}\n                    </span>\n                  </div>\n                  <div className=\"flex-1 min-w-0\">\n                    <p className=\"font-medium text-gray-900 text-sm truncate\">{user?.full_name}</p>\n                    <p className=\"text-xs text-gray-500 truncate\">{user?.email}</p>\n                  </div>\n                </div>\n                <Button\n                  variant=\"ghost\"\n                  size=\"icon\"\n                  onClick={handleLogout}\n                  className=\"hover:bg-red-50 hover:text-red-600 transition-colors duration-200\"\n                  title={t.logout}\n                >\n                  <LogOut className=\"w-4 h-4\" />\n                </Button>\n              </div>\n            </SidebarFooter>\n          </Sidebar>\n\n          {/* Main Content Area */}\n          <main className=\"main-content\">\n            {/* Mobile Header (Hidden on Desktop) */}\n            <header className=\"mobile-header lg:hidden\">\n              <div className=\"flex items-center gap-4 min-w-0 flex-1\">\n                <SidebarTrigger className=\"hover:bg-gray-100 p-2 rounded-lg transition-colors duration-200\" />\n\n                <div className=\"min-w-0 flex-1\">\n                  <h1 className=\"text-lg font-semibold text-gray-900 truncate\">\n                    {currentPageName && navigationItems.find(item => item.url === currentPageName)\n                      ? t[navigationItems.find(item => item.url === currentPageName).key]\n                      : 'RePostly'}\n                  </h1>\n                </div>\n              </div>\n\n              <div className=\"flex items-center gap-2\">\n                {/* Language Dropdown */}\n                <DropdownMenu>\n                  <DropdownMenuTrigger asChild>\n                    <Button variant=\"outline\" size=\"sm\" className=\"flex items-center gap-2\">\n                      <Globe className=\"w-4 h-4\" />\n                      <span className=\"hidden sm:inline\">{t.languages[effectiveLanguage] || effectiveLanguage.toUpperCase()}</span>\n                    </Button>\n                  </DropdownMenuTrigger>\n                  <DropdownMenuContent align={effectiveLanguage === 'he' || effectiveLanguage === 'ar' ? \"start\" : \"end\"}>\n                    {supportedLanguages.map(langKey => (\n                      <DropdownMenuItem key={langKey} onClick={() => handleChangeLanguage(langKey)} disabled={effectiveLanguage === langKey}>\n                        {t.languages[langKey] || langKey.toUpperCase()}\n                      </DropdownMenuItem>\n                    ))}\n                  </DropdownMenuContent>\n                </DropdownMenu>\n\n                {/* User Menu */}\n                <AuthButton\n                  effectiveLanguage={effectiveLanguage}\n                  onLanguageChange={handleChangeLanguage}\n                  size=\"sm\"\n                  variant=\"ghost\"\n                />\n              </div>\n            </header>\n\n            {/* Page Content */}\n            <div className=\"page-content\">\n              {pageContent}\n            </div>\n            {/* הוספת פוטר גלובלי */}\n            <AppFooter effectiveLanguage={effectiveLanguage} />\n          </main>\n        </div>\n\n        {/* Mobile Sidebar */}\n        <div className=\"lg:hidden\">\n          <Sidebar className=\"fixed inset-y-0 left-0 z-50 w-64 bg-white border-r border-gray-200\">\n            <SidebarHeader className=\"border-b border-gray-100 p-4\">\n              <div className=\"flex items-center gap-3\">\n                <img\n                  src=\"https://qtrypzzcjebvfcihiynt.supabase.co/storage/v1/object/public/base44-prod/public/54c656121_5cea2907f_May27202510_40_12AM.png\"\n                  alt=\"RePostly\"\n                  className=\"w-10 h-10 rounded-xl object-contain bg-teal-600/5\"\n                  onError={(e) => {\n                    e.currentTarget.onerror = null;\n                    e.currentTarget.src = \"https://images.unsplash.com/photo-1515879218367-8466d910aaa4?w=64&q=80&auto=format&fit=crop\";\n                  }}\n                />\n                <div>\n                  <h2 className=\"font-semibold text-gray-900\">RePostly</h2>\n                  <p className=\"text-xs text-gray-500\">AI Content Platform</p>\n                </div>\n              </div>\n            </SidebarHeader>\n\n            <SidebarContent className=\"p-4 flex-1 overflow-y-auto\">\n              <SidebarGroup>\n                <SidebarGroupContent>\n                  <SidebarMenu>\n                    {navigationItems.map((item) => (\n                      <SidebarMenuItem key={item.key}>\n                        <SidebarMenuButton\n                          asChild\n                          className={`hover:bg-teal-50 hover:text-teal-700 transition-all duration-200 rounded-xl mb-1 font-medium ${\n                            location.pathname === createPageUrl(item.url) ? 'bg-teal-50 text-teal-700 border-r-2 border-teal-600' : 'text-gray-700'\n                          }`}\n                        >\n                          <Link to={createPageUrl(item.url)} className=\"flex items-center gap-3 px-4 py-3\">\n                            <item.icon className=\"w-5 h-5\" />\n                            <span>{t[item.key]}</span>\n                          </Link>\n                        </SidebarMenuButton>\n                      </SidebarMenuItem>\n                    ))}\n                  </SidebarMenu>\n                </SidebarGroupContent>\n              </SidebarGroup>\n\n              <SidebarGroup className=\"mt-6\">\n                <SidebarGroupLabel className=\"text-xs font-medium text-gray-500 uppercase tracking-wider px-4 py-2\">\n                  {t.currentPlanStatus}\n                </SidebarGroupLabel>\n                <SidebarGroupContent>\n                  <div className=\"px-4 py-3\">\n                    <div className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${\n                      user?.plan_type === 'free' ? 'bg-gray-100 text-gray-800' :\n                      user?.plan_type === 'basic' ? 'bg-blue-100 text-blue-800' :\n                      user?.plan_type === 'pro' ? 'bg-purple-100 text-purple-800' :\n                      'bg-gradient-to-r from-yellow-400 to-orange-500 text-white'\n                    }`}>\n                      {t[user?.plan_type || 'free']}\n                    </div>\n                    {RUN_MODE_FREE ? (\n                      <div className=\"mt-3 text-xs text-emerald-700 bg-emerald-50 border border-emerald-100 rounded-lg p-2\">\n                        {effectiveLanguage === 'he' ? 'מצב ריצה פעיל: ללא הגבלות וללא תשלום' : 'Run mode: No limits and no payment'}\n                      </div>\n                    ) : (\n                      <div className=\"mt-3 text-sm text-gray-600\">\n                        <div className=\"flex justify-between\">\n                          <span>{t.monthlyConversionsUsed}</span>\n                          <span className=\"font-semibold\">{user?.monthly_conversions || 0}</span>\n                        </div>\n                        {user?.plan_type === 'free' && (\n                          <div className=\"w-full bg-gray-200 rounded-full h-2 mt-2\">\n                            <div\n                              className=\"bg-teal-600 h-2 rounded-full transition-all duration-500\"\n                              style={{ width: `${Math.min((user?.monthly_conversions || 0) / 2 * 100, 100)}%` }}\n                            ></div>\n                          </div>\n                        )}\n                      </div>\n                    )}\n                  </div>\n                </SidebarGroupContent>\n              </SidebarGroup>\n            </SidebarContent>\n\n            <SidebarFooter className=\"border-t border-gray-100 p-4\">\n              <div className=\"flex items-center justify-between\">\n                <div className=\"flex items-center gap-3 min-w-0 flex-1\">\n                  <div className=\"w-8 h-8 bg-gradient-to-r from-teal-500 to-emerald-600 rounded-full flex items-center justify-center\">\n                    <span className=\"text-white font-medium text-sm\">\n                      {user?.full_name?.charAt(0) || 'U'}\n                    </span>\n                  </div>\n                  <div className=\"flex-1 min-w-0\">\n                    <p className=\"font-medium text-gray-900 text-sm truncate\">{user?.full_name}</p>\n                    <p className=\"text-xs text-gray-500 truncate\">{user?.email}</p>\n                  </div>\n                </div>\n                <Button\n                  variant=\"ghost\"\n                  size=\"icon\"\n                  onClick={handleLogout}\n                  className=\"hover:bg-red-50 hover:text-red-600 transition-colors duration-200\"\n                  title={t.logout}\n                >\n                  <LogOut className=\"w-4 h-4\" />\n                </Button>\n              </div>\n            </SidebarFooter>\n          </Sidebar>\n        </div>\n      </SidebarProvider>\n\n      {user && <ChatWidget currentUser={user} effectiveLanguage={effectiveLanguage} />}\n\n      {/* תפריט נגישות – תמיד בצד ימין למטה */}\n      <AccessibilityMenu />\n    </div>\n  );\n}\n","globals_css":null,"entities":{"Conversion":{"name":"Conversion","type":"object","properties":{"input_text":{"type":"string","description":"הטקסט המקורי שהוכנס"},"input_url":{"type":"string","description":"URL אם הוכנס"},"selected_formats":{"type":"array","items":{"type":"string","enum":["linkedin","x_post","podcast","newsletter","landing","video","graphic","facebook","instagram","tiktok","reddit"]},"description":"הפורמטים שנבחרו להמרה"},"writing_tone":{"type":"string","enum":["professional","casual","marketing","funny"],"description":"טון הכתיבה שנבחר"},"output_language":{"type":"string","enum":["en","he","ar","es","fr","zh","it"],"description":"שפת הפלט"},"content_depth":{"type":"string","enum":["quick_summary","standard","enriched","deep_dive"],"default":"enriched","description":"רמת העומק של התוכן"},"outputs":{"type":"object","additionalProperties":{"type":"string"},"description":"התוצאות לכל פורמט"},"status":{"type":"string","enum":["processing","completed","failed"],"default":"processing","description":"סטטוס ההמרה"},"recycled_from_id":{"type":"string","description":"מזהה ההמרה המקורית שממנה בוצע המחזור (אם יש)"},"recycle_notes":{"type":"string","description":"הערות מחזור/הנחיות שנשלחו למנוע ה-AI"},"topic":{"type":"string","description":"נושא מרכזי מזוהה (AI, Marketing, Inspiration וכו')"},"auto_tags":{"type":"array","items":{"type":"string"},"default":[],"description":"תגיות שנוצרו אוטומטית"},"user_tags":{"type":"array","items":{"type":"string"},"default":[],"description":"תגיות שהמשתמש הוסיף ידנית"},"evergreen":{"type":"boolean","default":false,"description":"האם התוכן נחשב נצחי (Evergreen)"},"suggested_platforms":{"type":"array","items":{"type":"string","enum":["linkedin","x_post","podcast","newsletter","landing","video","graphic","facebook","instagram","tiktok","reddit"]},"default":[],"description":"הצעות פלטפורמה לפרסום מחדש"},"last_recycled_date":{"type":"string","format":"date","description":"תאריך מחזור אחרון (אם היה)"},"recycle_count":{"type":"number","default":0,"description":"כמה פעמים התוכן מומחז/שוכתב"}},"required":["input_text","selected_formats","writing_tone","output_language","content_depth"],"rls":{"read":{"created_by":"{{user.email}}"},"write":{"created_by":"{{user.email}}"}}}},"additional_user_data_schema":{"name":"User","type":"object","properties":{"plan_type":{"type":"string","enum":["free","basic","pro","ultra"],"default":"free","description":"סוג המנוי של המשתמש"},"user_language":{"type":"string","enum":["en","he","ar","es","fr","zh","it"],"default":"en","description":"שפת הממשק של המשתמש"},"monthly_conversions":{"type":"number","default":0,"description":"מספר ההמרות החודשיות"},"last_reset_date":{"type":"string","format":"date","description":"תאריך איפוס הקאונטר החודשי"},"favorites":{"type":"object","additionalProperties":{"type":"boolean"},"default":{},"description":"המרות מועדפות על ידי המשתמש"},"is_admin":{"type":"boolean","default":false,"description":"האם המשתמש הוא מנהל מערכת"},"special_access":{"type":"boolean","default":false,"description":"גישה מיוחדת לכל המודולים"}},"required":[]},"agents":{},"backend_function_metadata":{},"public_settings":"public_without_login","draft_public_settings":null,"custom_auth_enrolled":false,"custom_auth_modal_seen":false,"main_page":"Dashboard","auth_config":{"enable_username_password":true,"enable_google_login":true,"enable_microsoft_login":false,"enable_facebook_login":false,"enable_apple_login":false,"sso_provider_name":null,"enable_sso_login":false,"sso_pkce_enabled":true,"sso_include_offline_access":true,"sso_override_discovery_url":false,"sso_use_custom_domain_callback":false,"google_oauth_mode":"default","google_oauth_client_id":null,"use_workspace_sso":false},"enable_username_password":false,"hide_entity_created_by":false,"installable_integrations":{},"installed_integration_context_items":[],"payment_integrations":null,"seo_settings":null,"using_sandbox":true,"captured_from":null,"figma_source_url":null,"last_git_commit_hash":"f362cc454f27a26cd2d66762df6aa2f980b414bc","git_remote_source":"s3","has_unchained_ai":false,"tools_permission_config":{"auto_approved_operations":[],"connector_guards":{}},"prevent_iframe_embedding":false,"restrict_browser_features":false,"platform_version":1,"github_repo_url":null,"is_remixable":false,"remixed_from_app_id":null,"purchase_from_id":null,"purchased_at":null,"slug":"re-postly-ai-4d910a9f","is_blocked":false,"is_unpublished":false,"last_deployed_at":"2026-03-22T14:41:28.405000","last_deployed_checkpoint_id":"68aee241ed3e0f78e2f512a6","last_deployed_git_commit_hash":null,"last_deployed_source_type":null,"screenshot_url":null,"screenshot_updated_at":null,"preview_screenshot_url":null,"preview_screenshot_updated_at":null,"entities_agents_jsonc_synced_at":null,"created_by_id":null,"owner_id":"67d5c631be5ea69ce7169f3c","wix_metasite_id":null,"app_stage":"ready","is_managed_source_code":true,"has_non_prod_entities":false,"is_deleted":false,"deleted_date":null,"model_arena_candidate":false,"model_arena_source_app_id":null,"model_arena_run_id":null,"model_arena_label":null,"migration_context":null,"data_region":null,"byom_enabled":false,"function_names":["executePayment","createPayment"],"user_entity":{"type":"object","name":"User","title":"User","properties":{"role":{"type":"string","description":"The role of the user in the app","enum":["admin","user"]},"email":{"type":"string","description":"The email of the user"},"full_name":{"type":"string","description":"The full name of the user"},"plan_type":{"type":"string","enum":["free","basic","pro","ultra"],"default":"free","description":"סוג המנוי של המשתמש"},"user_language":{"type":"string","enum":["en","he","ar","es","fr","zh","it"],"default":"en","description":"שפת הממשק של המשתמש"},"monthly_conversions":{"type":"number","default":0,"description":"מספר ההמרות החודשיות"},"last_reset_date":{"type":"string","format":"date","description":"תאריך איפוס הקאונטר החודשי"},"favorites":{"type":"object","additionalProperties":{"type":"boolean"},"default":{},"description":"המרות מועדפות על ידי המשתמש"},"is_admin":{"type":"boolean","default":false,"description":"האם המשתמש הוא מנהל מערכת"},"special_access":{"type":"boolean","default":false,"description":"גישה מיוחדת לכל המודולים"}},"required":["role","full_name","email"]},"has_backend_functions_enabled":true,"is_private":false,"hide_entity_created_by_locked":false,"has_active_migration":false,"backend_deployment_ids":{"executePayment":"d6009bd36def4fae950d9506ed6b7b7d","createPayment":"d6009bd36def4fae950d9506ed6b7b7d"},"backend_deno_app_slugs":{},"snapshot_id":"68355753439cb9574d910c70"}