// i18n.jsx — FR/EN dictionary + tiny helper. Exports to window: I18N, useLang, makeT
const I18N = {
  fr: {
    // header / nav
    nav_home: "Accueil",
    nav_create: "Créer mon QR code",
    nav_cart: "Panier",
    nav_admin: "Admin",
    footer_privacy: "Confidentialité",
    privacy_body: "Les informations que vous saisissez (nom, téléphone, email, message) servent uniquement à générer le QR code de votre porte-clé et à traiter votre commande. Elles ne sont jamais rendues publiques ni revendues, et le contenu du QR code n'est visible que par les personnes à qui vous montrez votre porte-clé.",
    tagline: "QR codes personnalisés, imprimés en 3D",
    // home
    home_title: "Votre QR code personnalisé, imprimé en 3D",
    home_subtitle: "Retrouvez rapidement ce qui vous est précieux : valises, sacs, clés, porte-clés et animaux de compagnie.",
    home_cta: "Créer mon QR code",
    home_cta_sub: "Livraison suivie offerte · Fabriqué à la demande",
    home_trust_1: "Imprimé en 3D en France",
    home_trust_2: "Données privées par défaut",
    home_trust_3: "Expédié sous 3–5 jours",
    home_products_kicker: "Nos packs",
    home_products_title: "Choisissez votre pack",
    home_products_sub: "Trois offres, une infinité de combinaisons de couleurs.",
    band_caption: "une infinité de combinaisons de couleurs.",
    home_choose: "Choisir ce pack",
    badge_popular: "Le plus populaire",
    badge_best: "Meilleure offre",
    unit_label: "Porte-clé",
    cust_copy_all: "Copier sur tous les porte-clés",
    cust_unit_intro: "Personnalisez chaque porte-clé.",
    home_how_kicker: "Comment ça marche",
    home_how_title: "Simple, en trois étapes",
    step1_t: "Personnalisez",
    step1_d: "Vos infos, vos couleurs — avec aperçu 3D en direct.",
    step1_delay: "5 minutes",
    step2_t: "On l'imprime en 3D",
    step2_d: "Chaque porte-clé est fabriqué à la demande, rien que pour vous.",
    step2_delay: "30 minutes",
    step3_t: "Recevez-le chez vous",
    step3_d: "Expédié en lettre suivie dès la sortie d'impression — livraison offerte.",
    step3_delay: "2 à 3 jours",
    ship_free: "Livraison suivie offerte",
    home_final_title: "Prêt à créer le vôtre ?",
    home_final_cta: "Commencer",
    // customize
    cust_kicker: "Personnalisation",
    cust_title: "Composez votre QR code",
    cust_back: "Retour",
    cust_model: "Modèle",
    cust_content_legend: "Remplissez votre QR",
    cust_type_contact: "Fiche contact",
    cust_type_text: "Texte / message",
    cust_type_url: "Lien (URL)",
    cust_type_contact_hint: "Au scan : nom, téléphone et email.",
    cust_type_text_hint: "Au scan : votre message s'affiche.",
    cust_type_url_hint: "Au scan : ouvre le lien de votre choix.",
    cust_firstname: "Prénom",
    cust_lastname: "Nom",
    cust_phone: "Téléphone",
    cust_email: "Email",
    cust_message: "Message personnalisé",
    cust_message_opt: "optionnel",
    cust_social: "Réseaux sociaux",
    cust_social_opt: "optionnel",
    cust_social_hint: "Ajoutez vos comptes : ils seront accessibles depuis votre contact.",
    cust_instagram: "Instagram",
    cust_snapchat: "Snapchat",
    cust_tiktok: "TikTok",
    cust_social_ph: "@votrepseudo",
    cust_url: "Adresse du lien",
    cust_text: "Texte à encoder",
    cust_colors_legend: "Couleurs du produit",
    cust_colors_hint: "Chaque plaque combine 2 couleurs.",
    cust_color_plate: "Plaque",
    cust_color_code: "Motif du code",
    cust_qty: "Quantité",
    cust_preview: "Aperçu",
    cust_pick_colors: "Sélectionnez vos couleurs",
    cust_preview_hint: "Scannez ce QR code pour le tester en direct !",
    cust_consent: "J'accepte que ces informations soient encodées dans mon QR code.",
    cust_privacy_hint: "Vos informations servent uniquement à générer votre QR code et ne sont jamais rendues publiques.",
    cust_add: "Ajouter au panier",
    cust_unit: "l'unité",
    err_required: "Champ requis",
    err_email: "Email invalide",
    err_phone: "Téléphone invalide",
    err_url: "Lien invalide (commence par http)",
    err_consent: "Merci de confirmer votre consentement.",
    // cart
    cart_title: "Votre panier",
    cart_empty: "Votre panier est vide.",
    cart_empty_cta: "Découvrir les modèles",
    cart_model: "Modèle",
    cart_qty: "Quantité",
    cart_colors: "Couleurs",
    cart_content: "Contenu du QR",
    cart_unit_price: "Prix unitaire",
    cart_subtotal: "Sous-total",
    cart_shipping: "Livraison",
    cart_free: "Offerte",
    cart_total: "Total",
    cart_remove: "Retirer",
    cart_edit: "Modifier",
    cart_checkout: "Passer au paiement",
    cart_continue: "Continuer mes achats",
    // payment
    pay_title: "Paiement",
    pay_contact: "Coordonnées",
    pay_ship: "Adresse de livraison",
    pay_name: "Nom complet",
    pay_email: "Email",
    pay_address: "Adresse",
    pay_address2: "Complément d'adresse",
    pay_zip: "Code postal",
    pay_city: "Ville",
    pay_country: "Pays",
    pay_method: "Moyen de paiement",
    pay_card: "Numéro de carte",
    pay_exp: "Expiration",
    pay_cvc: "CVC",
    pay_cardname: "Nom sur la carte",
    pay_secure: "Paiement sécurisé · Vos données sont chiffrées",
    pay_btn: "Payer",
    pay_processing: "Traitement…",
    pay_summary: "Récapitulatif",
    pay_test: "Mode démo — aucun paiement réel n'est effectué.",
    pay_stripe_badge: "Paiement sécurisé via Stripe.",
    pay_redirect: "Redirection vers le paiement sécurisé…",
    pay_btn_stripe: "Payer avec Stripe",
    err_card: "Numéro de carte invalide",
    err_exp: "Date invalide",
    err_cvc: "CVC invalide",
    // confirmation
    conf_title: "Merci pour votre commande !",
    conf_body: "Votre QR code personnalisé va être imprimé en 3D et expédié prochainement.",
    conf_order: "Commande",
    conf_email_note: "Un email de confirmation a été envoyé à",
    conf_back: "Retour à l'accueil",
    conf_track: "Suivi de commande",
    // admin
    admin_title: "Commandes",
    admin_sub: "Interface administrateur",
    admin_empty: "Aucune commande pour le moment.",
    admin_col_order: "Commande",
    admin_col_customer: "Client",
    admin_col_model: "Modèle",
    admin_col_colors: "Couleurs",
    admin_col_qr: "QR code",
    admin_col_total: "Total",
    admin_col_status: "Statut",
    admin_status_new: "Nouvelle",
    admin_status_printing: "Impression",
    admin_status_shipped: "Expédiée",
    admin_download: "Télécharger le QR (PNG)",
    admin_download_svg: "SVG (impression 3D)",
    admin_download_all: "Tout télécharger",
    admin_archived: "QR codes archivés — réimprimables à tout moment",
    admin_details: "Détails",
    admin_close: "Fermer",
    admin_qr_content: "Contenu encodé",
    admin_ship_to: "Expédier à",
    admin_clear: "Vider les commandes (démo)",
    admin_back: "Retour au site",
    // misc
    qty: "Qté",
    optional: "optionnel",
    currency: "€",
  },
  en: {
    nav_home: "Home",
    nav_create: "Create my QR code",
    nav_cart: "Cart",
    nav_admin: "Admin",
    footer_privacy: "Privacy",
    privacy_body: "The information you enter (name, phone, email, message) is only used to generate your keychain's QR code and process your order. It is never made public or resold, and the QR code content is only visible to people you show your keychain to.",
    tagline: "Custom QR codes, 3D printed",
    home_title: "Your custom QR code, 3D printed",
    home_subtitle: "Perfect for your luggage, bags, keys or keychains.",
    home_cta: "Create my QR code",
    home_cta_sub: "Free tracked shipping · Made to order",
    home_trust_1: "3D printed in France",
    home_trust_2: "Private by default",
    home_trust_3: "Ships in 3–5 days",
    home_products_kicker: "Our packs",
    home_products_title: "Choose your pack",
    home_products_sub: "Three packs, endless color combinations.",
    band_caption: "endless color combinations.",
    home_choose: "Choose this pack",
    badge_popular: "Most popular",
    badge_best: "Best value",
    unit_label: "Keychain",
    cust_copy_all: "Copy to all keychains",
    cust_unit_intro: "Personalize each keychain.",
    home_how_kicker: "How it works",
    home_how_title: "Simple, in three steps",
    step1_t: "Personalize",
    step1_d: "Your info, your colors — with a live 3D preview.",
    step1_delay: "5 minutes",
    step2_t: "We 3D print it",
    step2_d: "Every keychain is made to order, just for you.",
    step2_delay: "30 minutes",
    step3_t: "Get it delivered",
    step3_d: "Shipped with tracking straight off the printer — free shipping.",
    step3_delay: "2–3 days",
    ship_free: "Free tracked shipping",
    home_final_title: "Ready to create yours?",
    home_final_cta: "Get started",
    cust_kicker: "Personalization",
    cust_title: "Build your QR code",
    cust_back: "Back",
    cust_model: "Model",
    cust_content_legend: "Fill in your QR",
    cust_type_contact: "Contact card",
    cust_type_text: "Text / message",
    cust_type_url: "Link (URL)",
    cust_type_contact_hint: "On scan: name, phone and email.",
    cust_type_text_hint: "On scan: your message is shown.",
    cust_type_url_hint: "On scan: opens the link you choose.",
    cust_firstname: "First name",
    cust_lastname: "Last name",
    cust_phone: "Phone",
    cust_email: "Email",
    cust_message: "Custom message",
    cust_message_opt: "optional",
    cust_social: "Social media",
    cust_social_opt: "optional",
    cust_social_hint: "Add your accounts — they'll be reachable from your contact card.",
    cust_instagram: "Instagram",
    cust_snapchat: "Snapchat",
    cust_tiktok: "TikTok",
    cust_social_ph: "@yourhandle",
    cust_url: "Link address",
    cust_text: "Text to encode",
    cust_colors_legend: "Product colors",
    cust_colors_hint: "Each tag combines 2 colors.",
    cust_color_plate: "Plate",
    cust_color_code: "Code pattern",
    cust_qty: "Quantity",
    cust_preview: "Preview",
    cust_pick_colors: "Select your colors",
    cust_preview_hint: "Scan this QR code to try it live!",
    cust_consent: "I agree to encode this information in my QR code.",
    cust_privacy_hint: "Your information is only used to generate your QR code and is never made public.",
    cust_add: "Add to cart",
    cust_unit: "each",
    err_required: "Required",
    err_email: "Invalid email",
    err_phone: "Invalid phone",
    err_url: "Invalid link (must start with http)",
    err_consent: "Please confirm your consent.",
    cart_title: "Your cart",
    cart_empty: "Your cart is empty.",
    cart_empty_cta: "Browse models",
    cart_model: "Model",
    cart_qty: "Quantity",
    cart_colors: "Colors",
    cart_content: "QR content",
    cart_unit_price: "Unit price",
    cart_subtotal: "Subtotal",
    cart_shipping: "Shipping",
    cart_free: "Free",
    cart_total: "Total",
    cart_remove: "Remove",
    cart_edit: "Edit",
    cart_checkout: "Checkout",
    cart_continue: "Continue shopping",
    pay_title: "Checkout",
    pay_contact: "Contact",
    pay_ship: "Shipping address",
    pay_name: "Full name",
    pay_email: "Email",
    pay_address: "Address",
    pay_address2: "Apt, suite, etc.",
    pay_zip: "ZIP code",
    pay_city: "City",
    pay_country: "Country",
    pay_method: "Payment method",
    pay_card: "Card number",
    pay_exp: "Expiry",
    pay_cvc: "CVC",
    pay_cardname: "Name on card",
    pay_secure: "Secure payment · Your data is encrypted",
    pay_btn: "Pay",
    pay_processing: "Processing…",
    pay_summary: "Summary",
    pay_test: "Demo mode — no real payment is processed.",
    pay_stripe_badge: "Secure payment via Stripe.",
    pay_redirect: "Redirecting to secure payment…",
    pay_btn_stripe: "Pay with Stripe",
    err_card: "Invalid card number",
    err_exp: "Invalid date",
    err_cvc: "Invalid CVC",
    conf_title: "Thank you for your order!",
    conf_body: "Your custom QR code will be 3D printed and shipped soon.",
    conf_order: "Order",
    conf_email_note: "A confirmation email was sent to",
    conf_back: "Back to home",
    conf_track: "Order tracking",
    admin_title: "Orders",
    admin_sub: "Admin interface",
    admin_empty: "No orders yet.",
    admin_col_order: "Order",
    admin_col_customer: "Customer",
    admin_col_model: "Model",
    admin_col_colors: "Colors",
    admin_col_qr: "QR code",
    admin_col_total: "Total",
    admin_col_status: "Status",
    admin_status_new: "New",
    admin_status_printing: "Printing",
    admin_status_shipped: "Shipped",
    admin_download: "Download QR (PNG)",
    admin_download_svg: "SVG (3D printing)",
    admin_download_all: "Download all",
    admin_archived: "QR codes archived — reprintable anytime",
    admin_details: "Details",
    admin_close: "Close",
    admin_qr_content: "Encoded content",
    admin_ship_to: "Ship to",
    admin_clear: "Clear orders (demo)",
    admin_back: "Back to site",
    qty: "Qty",
    optional: "optional",
    currency: "€",
  },
};

function makeT(lang) {
  const dict = I18N[lang] || I18N.fr;
  return (key) => (key in dict ? dict[key] : key);
}

Object.assign(window, { I18N, makeT });
