/* global React */
/* Bilingual strings + menu + quadrant constants */

const MENU = {
  Tapas: ["Patatas bravas","Croquetas de jamón","Pan con tomate","Gambas al ajillo","Boquerones fritos","Tortilla española","Pimientos de padrón","Mejillones al vapor","Albóndigas en salsa","Champiñones al ajillo"],
  Raciones: ["Jamón ibérico","Queso manchego","Pulpo a la gallega","Carrillada ibérica","Secreto ibérico","Bacalao a la vizcaína","Tabla de embutidos","Ensalada madrileña"],
  Bebidas: ["Vino tinto Rioja","Cerveza artesanal","Agua mineral","Tinto de verano","Vermut rojo","Vino blanco Albariño","Sangría de la casa","Zumo natural"],
  Postres: ["Churros con chocolate","Crema catalana","Tarta de Santiago","Flan de huevo","Arroz con leche","Brownie con helado","Sorbete de limón"],
};
const ALL_ITEMS = Object.entries(MENU).flatMap(([cat, items]) => items.map(n => ({ name: n, category: cat })));

/* 10 pricing items */
const PRICING_ITEMS = [
  { name: "Croquetas de jamón",  price: 5.50, cost: 32, views: 94, returns: 18 },
  { name: "Tortilla española",   price: 4.00, cost: 28, views: 81, returns: 14 },
  { name: "Patatas bravas",      price: 4.50, cost: 22, views: 76, returns: 12 },
  { name: "Secreto ibérico",     price: 17.00,cost: 45, views: 31, returns: 6  },
  { name: "Gambas al ajillo",    price: 8.50, cost: 38, views: 58, returns: 9  },
  { name: "Gazpacho andaluz",    price: 5.00, cost: 18, views: 22, returns: 3  },
  { name: "Pulpo a la gallega",  price: 14.00,cost: 48, views: 27, returns: 4  },
  { name: "Pan con tomate",      price: 3.00, cost: 15, views: 63, returns: 11 },
  { name: "Carrillada ibérica",  price: 16.00,cost: 52, views: 19, returns: 2  },
  { name: "Pimientos de padrón", price: 5.00, cost: 20, views: 44, returns: 7  },
];

const T = {
  en: {
    // nav / landing
    navHow: "How it works", navFeatures: "Features", navPricing: "Pricing", navFaq: "FAQ",
    signIn: "Sign in", getStarted: "Get started",
    // hero
    heroBadge: "For independent restaurants",
    heroTitle: "Turn every QR scan into a business decision.",
    heroSub: "Scanalytics replaces your QR menu with one that watches, learns, and tells you what your customers really want — in plain language, every week.",
    heroCta1: "Start your free pilot", heroCta2: "See how it works",
    heroStat1: "€0 to start", heroStat2: "< 1 day setup time", heroStat3: "10+ signals per scan",
    // dashboard
    weeklyInsights: "Weekly insights", analytics: "Analytics", pricing: "Pricing",
    liveDashboard: "Live dashboard",
    sim10: "+ Simulate 10 sessions", sim50: "+ Simulate 50 sessions", simReset: "Reset data",
    simLabel: "Demo controls",
    weeklyTitle: "Weekly insight report", aiGen: "AI generated",
    generateBtn: "Generate insights", regenerateBtn: "Regenerate insights",
    emptyInsight: "Simulate sessions then hit 'Generate insights' to see your personalised weekly report.",
    keyAlerts: "Key alerts this week",
    // metrics
    mTotalSessions: "Total sessions", mItemViews: "Item views", mAvgDwell: "Avg dwell per item",
    mDropOff: "Drop-off rate", mReturns: "Return visits", mIntent: "Intent flags",
    mScrollDepth: "Avg scroll depth", mItemsPerSession: "Items per session",
    aboveTarget: "Above target", withinTarget: "Within target",
    pctOfSessions: "of sessions", pctIntent: "intent rate",
    goodDepth: "Good depth", lowDepth: "Low",
    perVisit: "items per visit",
    vsPrev: "vs prev period",
    mTotalScans: "Total scans", mSessions: "Sessions", mUnique: "Unique visitors", mSessionDur: "Avg session duration",
    returningLbl: "returning", pctOfVisitors: "of visitors",
    // analytics
    topViewed: "Top viewed items", highViewsLowIntent: "High views, low intent — conversion risk",
    categoryPerf: "Category performance", coViewed: "Co-viewed pairs — combo opportunities",
    heatmapTitle: "Scan heatmap — hour of day",
    devices: "Devices", referrals: "Referral sources", locales: "Top locales",
    quieter: "Quieter", busier: "Busier",
    attentionTitle: "Attention per dish", qrSources: "QR sources",
    // pricing
    matrixTitle: "Menu engineering matrix",
    matrixSub: "Every dish plotted by popularity and margin. Edit inputs below to reclassify in real time.",
    popAxis: "Popularity →", marAxis: "Margin →",
    star: "Star", plowhorse: "Plowhorse", puzzle: "Puzzle", dog: "Dog",
    starDesc: "High popularity, high margin. Protect price and promote.",
    plowDesc: "High popularity, low margin. Reprice carefully — customers forgive small bumps.",
    puzzleDesc: "Low popularity, high margin. Reposition, rewrite, re-recommend.",
    dogDesc: "Low popularity, low margin. Retire or rework.",
    starReco: "This is your strongest item. Protect its price — do not raise it unless ingredient costs force it. Feature it prominently with a 'Chef's Favourite' label.",
    plowReco: "Customers love this item but it's not pulling its weight on margin. Consider a modest 5–8% price increase. Its popularity gives you room to do so without losing orders.",
    puzzleReco: "Great margin but not enough people order it. Don't raise the price yet. Reposition it on the menu, improve its description, or have staff recommend it.",
    dogReco: "This item is costing you more than it's earning. Either rework the recipe, move it to a less visible spot, or remove it altogether.",
    lblPrice: "Current price (€)", lblCost: "Food cost %",
    lblViews: "views", lblReturns: "returns", lblMargin: "margin",
    confHigh: "High confidence", confMed: "Medium confidence", confLow: "Low confidence",
    // alerts
    alertLowIntent: (item) => `${item} gets the most views but low intent`,
    alertLowIntentD: "Guests are looking but not tapping through. Consider a better photo or reposition on the menu.",
    alertTopPerformer: (item) => `${item} is your top performer`,
    alertTopPerformerD: "Strong view-to-intent rate. Keep it front and center.",
    alertDropOff: "Drop-off rate is high",
    alertDropOffD: "Many guests leave after viewing 1–2 items. The menu may feel overwhelming on mobile.",
    alertPeak: (h) => `Peak traffic at ${h}`,
    alertPeakD: "Staff up 15 minutes before this window for the smoothest service.",
    alertCombo: (a, b) => `Combo opportunity: ${a} + ${b}`,
    alertComboD: "These two items are viewed together often enough to bundle or cross-sell.",
    // final cta
    finalHead: "Ready to see what your menu is actually doing?",
    finalSub: "Start a free 1-month pilot. Real data, your restaurant, no credit card.",
    finalCta: "Start your pilot",
    // footer
    footProduct: "Product", footCompany: "Company", footLegal: "Legal",
    footTag: "Turn every QR scan into a business decision.",
    // auth
    createAccount: "Create your account",
    createSub: "Start your free 1-month pilot. No credit card required.",
    welcomeBack: "Welcome back",
    signInSub: "Sign in to your Scanalytics dashboard.",
    restaurantName: "Restaurant name", email: "Email", password: "Password",
    createAccountBtn: "Create account",
    alreadyHave: "Already have an account?", dontHave: "Don't have an account?",
    signInLink: "Sign in", createOne: "Create one",
    passHint: "At least 8 characters.",
    signOut: "Sign out",
    // devices / referrals
    mobileIOS: "Mobile (iOS)", mobileAndroid: "Mobile (Android)", tabletIOS: "Tablet (iOS)",
    refTableCard: "Table card / sticker", refInstagram: "Instagram", refGoogleMaps: "Google Maps", refTakeaway: "Takeaway bag",
    locES: "Spanish (ES)", locENUS: "English (US)", locENUK: "English (UK)", locFR: "French", locDE: "German",
    // report
    reportGreet: "Good morning,", reportOutro: "— The Scanalytics team",
  },
  es: {
    navHow: "Cómo funciona", navFeatures: "Características", navPricing: "Precios", navFaq: "Preguntas",
    signIn: "Iniciar sesión", getStarted: "Comenzar",
    heroBadge: "Para restaurantes independientes",
    heroTitle: "Convierte cada escaneo de QR en una decisión de negocio.",
    heroSub: "Scanalytics sustituye tu menú QR por uno que observa, aprende y te dice lo que tus clientes realmente quieren — en lenguaje claro, cada semana.",
    heroCta1: "Empieza tu piloto gratis", heroCta2: "Mira cómo funciona",
    heroStat1: "€0 para empezar", heroStat2: "< 1 día de instalación", heroStat3: "10+ señales por escaneo",
    weeklyInsights: "Informe semanal", analytics: "Analítica", pricing: "Precios",
    liveDashboard: "Panel en vivo",
    sim10: "+ Simular 10 sesiones", sim50: "+ Simular 50 sesiones", simReset: "Reiniciar datos",
    simLabel: "Controles demo",
    weeklyTitle: "Informe semanal", aiGen: "Generado por IA",
    generateBtn: "Generar informe", regenerateBtn: "Regenerar informe",
    emptyInsight: "Simula sesiones y pulsa 'Generar informe' para ver tu reporte personalizado.",
    keyAlerts: "Alertas clave de la semana",
    mTotalSessions: "Sesiones totales", mItemViews: "Vistas de platos", mAvgDwell: "Tiempo medio por plato",
    mDropOff: "Tasa de abandono", mReturns: "Visitas recurrentes", mIntent: "Señales de interés",
    mScrollDepth: "Profundidad de scroll media", mItemsPerSession: "Platos por sesión",
    aboveTarget: "Por encima del objetivo", withinTarget: "Dentro del objetivo",
    pctOfSessions: "de las sesiones", pctIntent: "tasa de interés",
    goodDepth: "Buena profundidad", lowDepth: "Baja",
    perVisit: "platos por visita",
    vsPrev: "vs periodo anterior",
    mTotalScans: "Escaneos totales", mSessions: "Sesiones", mUnique: "Visitantes únicos", mSessionDur: "Duración media de sesión",
    returningLbl: "recurrentes", pctOfVisitors: "de visitantes",
    topViewed: "Platos más vistos", highViewsLowIntent: "Muchas vistas, poco interés — riesgo de conversión",
    categoryPerf: "Rendimiento por categoría", coViewed: "Pares co-vistos — oportunidades de combo",
    heatmapTitle: "Mapa de escaneos — hora del día",
    devices: "Dispositivos", referrals: "Fuentes de tráfico", locales: "Idiomas principales",
    quieter: "Tranquilo", busier: "Ocupado",
    attentionTitle: "Atención por plato", qrSources: "Fuentes QR",
    matrixTitle: "Matriz de ingeniería de menú",
    matrixSub: "Cada plato situado por popularidad y margen. Edita los valores para reclasificar en tiempo real.",
    popAxis: "Popularidad →", marAxis: "Margen →",
    star: "Estrella", plowhorse: "Burro", puzzle: "Enigma", dog: "Perro",
    starDesc: "Alta popularidad, alto margen. Protege el precio y promociónalo.",
    plowDesc: "Alta popularidad, bajo margen. Sube el precio con cuidado — los clientes perdonan pequeños ajustes.",
    puzzleDesc: "Baja popularidad, alto margen. Reposiciona, reescribe, recomienda.",
    dogDesc: "Baja popularidad, bajo margen. Retíralo o reinvéntalo.",
    starReco: "Este es tu plato más fuerte. Protege su precio — no lo subas salvo que suban los costes. Destácalo con una etiqueta 'Favorito del chef'.",
    plowReco: "A los clientes les encanta este plato pero no aporta margen suficiente. Considera subir el precio un 5–8%. Su popularidad te da margen de maniobra sin perder pedidos.",
    puzzleReco: "Buen margen pero no lo pide suficiente gente. No subas el precio aún. Reposiciónalo en la carta, mejora su descripción o pide al equipo que lo recomiende.",
    dogReco: "Este plato te cuesta más de lo que te aporta. Reformula la receta, muévelo a un lugar menos visible o retíralo.",
    lblPrice: "Precio actual (€)", lblCost: "Coste alimentario %",
    lblViews: "vistas", lblReturns: "retornos", lblMargin: "margen",
    confHigh: "Alta confianza", confMed: "Confianza media", confLow: "Baja confianza",
    alertLowIntent: (item) => `${item} tiene muchas vistas pero poco interés`,
    alertLowIntentD: "Los clientes lo miran pero no hacen clic. Prueba una mejor foto o reposicionarlo.",
    alertTopPerformer: (item) => `${item} es tu plato estrella`,
    alertTopPerformerD: "Buena conversión de vista a interés. Mantenlo en primera plana.",
    alertDropOff: "La tasa de abandono es alta",
    alertDropOffD: "Muchos clientes se van tras 1–2 platos. La carta puede sentirse larga en móvil.",
    alertPeak: (h) => `Tráfico máximo a las ${h}`,
    alertPeakD: "Ten más personal listo 15 minutos antes de esta ventana.",
    alertCombo: (a, b) => `Oportunidad de combo: ${a} + ${b}`,
    alertComboD: "Estos dos platos se ven juntos con frecuencia — idea natural para un bundle.",
    finalHead: "¿Listo para ver qué está haciendo realmente tu carta?",
    finalSub: "Empieza un piloto gratuito de 1 mes. Datos reales, tu restaurante, sin tarjeta.",
    finalCta: "Empezar el piloto",
    footProduct: "Producto", footCompany: "Empresa", footLegal: "Legal",
    footTag: "Convierte cada escaneo de QR en una decisión de negocio.",
    createAccount: "Crea tu cuenta",
    createSub: "Empieza tu piloto gratuito de 1 mes. Sin tarjeta.",
    welcomeBack: "Bienvenido de nuevo",
    signInSub: "Inicia sesión en tu panel Scanalytics.",
    restaurantName: "Nombre del restaurante", email: "Correo", password: "Contraseña",
    createAccountBtn: "Crear cuenta",
    alreadyHave: "¿Ya tienes cuenta?", dontHave: "¿No tienes cuenta?",
    signInLink: "Inicia sesión", createOne: "Créala",
    passHint: "Mínimo 8 caracteres.",
    signOut: "Cerrar sesión",
    mobileIOS: "Móvil (iOS)", mobileAndroid: "Móvil (Android)", tabletIOS: "Tablet (iOS)",
    refTableCard: "Tarjeta de mesa", refInstagram: "Instagram", refGoogleMaps: "Google Maps", refTakeaway: "Bolsa de llevar",
    locES: "Español (ES)", locENUS: "Inglés (EE.UU.)", locENUK: "Inglés (RU)", locFR: "Francés", locDE: "Alemán",
    reportGreet: "Buenos días,", reportOutro: "— El equipo de Scanalytics",
  },
};

Object.assign(window, { T, MENU, ALL_ITEMS, PRICING_ITEMS });
