import { useState, useRef, useEffect } from "react";
const WA = "16453336442";
// ─── TEXTOS EDITABLES POR DEFECTO ────────────────────────────────────────────
const TEXTS_DEFAULT = {
heroTagline: "Artisan Desserts · Miami",
heroTitle: "Crafted with\nlove & precision",
heroSubtitle: "Handmade kosher desserts for every occasion. Order online and we deliver straight to your door.",
heroCta: "Order Now",
aboutTitle: "Our Story",
aboutText: "Rêver Pâtisserie was born from a passion for creating desserts that are as beautiful as they are delicious. Every item is made fresh to order with premium ingredients, always kosher-certified.\n\nBased in Miami, we deliver throughout the area and offer local pickup. Whether it's a birthday, Shabbat table, or just because — we make it special.",
howTitle: "How It Works",
how1Title: "Browse & Choose",
how1Text: "Explore our full menu of cakes, tarts, boxes and more. Pick your flavor and size.",
how2Title: "Send Your Order",
how2Text: "Confirm your details and send your order directly to us via WhatsApp. Fast and simple.",
how3Title: "Enjoy",
how3Text: "We prepare your order fresh and deliver to your door or you pick it up at our location.",
menuTitle: "Our Menu",
menuSubtitle: "All products are kosher-certified · Made fresh to order",
contactTitle: "Get in Touch",
contactPhone: "+1 (645) 333-6442",
contactEmail: "info@reverpâtisserie.com",
contactHours: "Mon–Thu: 9am–6pm · Fri: 9am–2pm · Sun: Closed",
contactArea: "Delivering across Miami-Dade",
footerTagline: "Made with love, crafted with precision.",
footerKosher: "All products are Kosher certified",
};
// ─── CATALOG ─────────────────────────────────────────────────────────────────
const CATALOG_DEFAULT = [
{ id:"cc_plain", nombre:"Plain NY Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Classic New York style baked cheesecake. Dense, creamy and rich with a buttery graham cracker crust.", tamanos:[{s:"6\"",p:45},{s:"7\"",p:58},{s:"9\"",p:70}], tags:["Classic","Bestseller"] },
{ id:"cc_passion",nombre:"Passion Fruit Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Creamy NY-style cheesecake topped with a vibrant passion fruit glaze. Tangy, sweet and irresistible.", tamanos:[{s:"6\"",p:48},{s:"7\"",p:62},{s:"9\"",p:75}], tags:["Tropical"] },
{ id:"cc_ddl", nombre:"Dulce de Leche Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Silky cheesecake layered with rich Argentine dulce de leche. Indulgent and caramel-forward.", tamanos:[{s:"6\"",p:48},{s:"7\"",p:62},{s:"9\"",p:75}], tags:["Caramel"] },
{ id:"cc_biscoff",nombre:"Lotus Biscoff Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Creamy cheesecake on a Biscoff crust topped with Biscoff spread. Warm spice meets smooth cream.", tamanos:[{s:"6\"",p:45},{s:"7\"",p:62},{s:"9\"",p:75}], tags:["Spiced"] },
{ id:"cc_nutella",nombre:"Nutella Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Hazelnut and chocolate cheesecake on an Oreo crust with Nutella swirled throughout.", tamanos:[{s:"9\"",p:75}], tags:["Chocolate"] },
{ id:"cc_oreo", nombre:"Cookies & Cream Cheesecake",categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Oreo crust, Oreo-studded filling, topped with chocolate ganache. A crowd favorite.", tamanos:[{s:"6\"",p:45},{s:"9\"",p:75}], tags:["Oreo","Bestseller"] },
{ id:"cc_turtle", nombre:"Turtle Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Chocolate ganache, caramel drizzle and toasted pecans on a classic cheesecake base.", tamanos:[{s:"9\"",p:75}], tags:["Caramel","Chocolate"] },
{ id:"cc_dubai", nombre:"Dubai Cheesecake", categoria:"Cheesecake", kashrut:"Dairy", imageUrl:"", descripcion:"Pistachio cream, Biscoff crust and dark chocolate topping. Inspired by the viral Dubai chocolate trend.", tamanos:[{s:"9\"",p:80}], tags:["Pistachio","Trending"] },
{ id:"bq_plain", nombre:"Basque Cheesecake — Plain", categoria:"Basque", kashrut:"Dairy", imageUrl:"", descripcion:"Burnt-style cheesecake with a deeply caramelized top and custardy center. Bold and creamy.", tamanos:[{s:"6\"",p:45}], tags:["Signature"] },
{ id:"bq_pist", nombre:"Basque Cheesecake — Pistachio",categoria:"Basque", kashrut:"Dairy", imageUrl:"", descripcion:"Classic Basque with pistachio cream and crushed pistachios. Earthy, nutty and luxurious.", tamanos:[{s:"6\"",p:52}], tags:["Pistachio","Signature"] },
{ id:"tira", nombre:"Tiramisu Box", categoria:"Box Desserts", kashrut:"Dairy", imageUrl:"", descripcion:"Classic Italian tiramisu in an elegant clear box. Coffee-soaked ladyfingers, silky mascarpone and cocoa. Ready to enjoy.", tamanos:[{s:"Individual",p:15}], tags:["Italian","Coffee"] },
{ id:"pist_tira", nombre:"Pistachio Tiramisu Box", categoria:"Box Desserts", kashrut:"Dairy", imageUrl:"", descripcion:"Mascarpone cream infused with pistachio paste over coffee-soaked ladyfingers. Elegant and unique.", tamanos:[{s:"Individual",p:15}], tags:["Pistachio","Coffee"] },
{ id:"choco", nombre:"Chocotorta Box", categoria:"Box Desserts", kashrut:"Dairy", imageUrl:"", descripcion:"The beloved Argentine classic. Chocolate cookies, coffee, dulce de leche and cream cheese. Nostalgic and irresistible.", tamanos:[{s:"Individual",p:15}], tags:["Argentine"] },
{ id:"tl", nombre:"Tres Leches", categoria:"Tres Leches", kashrut:"Dairy", imageUrl:"", descripcion:"Fluffy sponge soaked in three milks with your choice of topping. Presented in an elegant tin.", tamanos:[{s:"7\"",p:55}], tags:["Latin","Moist"] },
{ id:"mousse", nombre:"Matcha, Yuzu & Strawberry Entremet",categoria:"Entremet",kashrut:"Parve", imageUrl:"", descripcion:"Light matcha mousse with bright yuzu and strawberry insert on a soft sponge. Mirror glaze finish.", tamanos:[{s:"8\"",p:50}], tags:["Parve","Elegant"] },
{ id:"lemon_t", nombre:"Lemon Meringue Tart", categoria:"Tarts", kashrut:"Parve", imageUrl:"", descripcion:"Crisp tart shell, smooth lemon curd, lightly toasted meringue. Bright citrus with a sweet airy finish.", tamanos:[{s:"8\"",p:40},{s:"9\"",p:50}], tags:["Parve","Citrus"] },
{ id:"apple_t", nombre:"Apple Crumble Pie", categoria:"Tarts", kashrut:"Parve", imageUrl:"", descripcion:"Cinnamon-spiced apples in a golden tart shell with a buttery crumble topping.", tamanos:[{s:"8\"",p:40},{s:"9\"",p:50}], tags:["Parve","Seasonal"] },
{ id:"tartlet", nombre:"Tropical Exotic Tartlets", categoria:"Tartlets", kashrut:"Parve", imageUrl:"", descripcion:"Passion fruit curd, mango jelly insert and whipped coconut cream in a crisp shell.", tamanos:[{s:"Box of 4",p:26},{s:"Box of 9",p:55}], tags:["Parve","Tropical"] },
{ id:"flan", nombre:"Flan Quesillo", categoria:"Flan", kashrut:"Parve", imageUrl:"", descripcion:"Latin American classic with sweetened coconut condensed milk, baked silky-smooth with rich caramel.", tamanos:[{s:"7\"",p:45}], tags:["Parve","Latin"] },
{ id:"scone", nombre:"Savory Parmesan Scone", categoria:"Savory", kashrut:"Dairy", imageUrl:"", descripcion:"Buttery flaky scone with aged Parmesan, golden and crisp on the outside, tender within.", tamanos:[{s:"Box of 4",p:20}], tags:["Savory","Brunch"] },
];
const KCOL = { Dairy:{bg:"rgba(212,175,55,0.18)",b:"#d4af37",t:"#d4af37"}, Parve:{bg:"rgba(34,160,100,0.18)",b:"#22a064",t:"#22a064"} };
function uid(){ return Math.random().toString(36).slice(2,9); }
// ─── EDITABLE TEXT COMPONENT ─────────────────────────────────────────────────
function ET({ k, texts, setTexts, tag="span", style={}, multiline=false, adminMode }) {
const [editing, setEditing] = useState(false);
const ref = useRef();
useEffect(()=>{ if(editing && ref.current) ref.current.focus(); },[editing]);
if(!adminMode) {
const Tag = tag;
return {texts[k].split("\n").map((l,i)=>{l}{i})};
}
if(editing) {
const common = { value:texts[k], onChange:e=>setTexts(t=>({...t,[k]:e.target.value})),
onBlur:()=>setEditing(false), ref,
style:{...style,background:"rgba(212,175,55,0.15)",border:"1px solid #d4af37",borderRadius:4,
color:"inherit",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit",
letterSpacing:"inherit",lineHeight:"inherit",width:"100%",outline:"none",padding:"2px 6px",resize:"none"} };
return multiline ?