// EmptyState — used when collection in a view is empty.
// Also exposes a single source of copy per view (en/es).
(() => {
const EMPTY_COPY = {
  today: {
    eyebrow_en: "A QUIET DAY", eyebrow_es: "UN DÍA EN CALMA",
    title_en: "Nothing scheduled — and that's a kind of luxury.",
    title_es: "Nada agendado — y eso también es un lujo.",
    body_en:  "Drop in your first habit or sketch a plan for tomorrow. Vida grows with you, slowly.",
    body_es:  "Apunta tu primer hábito o esboza un plan para mañana. Vida crece contigo, sin prisa.",
    cta_en:   "Plan today",
    cta_es:   "Planear hoy",
  },
  finance: {
    eyebrow_en: "CLEAN LEDGER", eyebrow_es: "LIBRO LIMPIO",
    title_en: "Your ledger is empty.",
    title_es: "Tu libro de cuentas está vacío.",
    body_en:  "Log a single transaction to begin. The patterns reveal themselves once there are three.",
    body_es:  "Registra una transacción para empezar. Los patrones aparecen a la tercera.",
    cta_en:   "Add transaction",
    cta_es:   "Añadir transacción",
  },
  habits: {
    eyebrow_en: "FRESH SOIL", eyebrow_es: "TIERRA FÉRTIL",
    title_en: "No seeds planted yet.",
    title_es: "Aún no hay semillas en la tierra.",
    body_en:  "Choose something small — drink water, walk ten minutes. Daily is more than weekly.",
    body_es:  "Elige algo pequeño — beber agua, caminar diez minutos. Diario pesa más que semanal.",
    cta_en:   "Plant a habit",
    cta_es:   "Plantar un hábito",
  },
  goals: {
    eyebrow_en: "BLANK MAP", eyebrow_es: "MAPA EN BLANCO",
    title_en: "Where do you want to walk?",
    title_es: "¿Hacia dónde quieres caminar?",
    body_en:  "Name a goal. Break it into milestones. Vida draws the trail; you take the steps.",
    body_es:  "Nombra una meta. Divídela en hitos. Vida dibuja el sendero; tú das los pasos.",
    cta_en:   "Set a goal",
    cta_es:   "Definir una meta",
  },
  calendar: {
    eyebrow_en: "A QUIET MONTH", eyebrow_es: "UN MES TRANQUILO",
    title_en: "No events on the horizon.",
    title_es: "Ningún evento en el horizonte.",
    body_en:  "Add the next deadline, training, or a date you don't want to forget.",
    body_es:  "Añade tu próximo deadline, entreno, o una fecha que no quieres olvidar.",
    cta_en:   "Add event",
    cta_es:   "Añadir evento",
  },
  workouts: {
    eyebrow_en: "BODY AT REST", eyebrow_es: "CUERPO EN REPOSO",
    title_en: "No sessions logged.",
    title_es: "Aún sin sesiones registradas.",
    body_en:  "Even a ten-minute walk counts as movement. Log it.",
    body_es:  "Hasta diez minutos caminando cuenta como movimiento. Anótalo.",
    cta_en:   "Log workout",
    cta_es:   "Registrar entreno",
  },
  progress: {
    eyebrow_en: "EARLY DAYS", eyebrow_es: "DÍAS TEMPRANOS",
    title_en: "Your story is just starting.",
    title_es: "Tu historia apenas empieza.",
    body_en:  "Achievements unlock as you live. The first one is closer than you think.",
    body_es:  "Los logros se desbloquean al vivir. El primero está más cerca de lo que crees.",
    cta_en:   "Plant a habit",
    cta_es:   "Plantar un hábito",
  },
};

function EmptyState({ view, onCta }) {
  const { lang } = window.useApp();
  const c = EMPTY_COPY[view];
  if (!c) return null;
  const isToday = view === "today";
  return (
    <div className="card" style={{ position: "relative", overflow: "hidden" }}>
      <div className="empty-state">
        <div
          className={"art " + (isToday ? "square" : "")}
          style={{ backgroundImage: `url("assets/empty/${view === "calendar" ? "today" : view}.png")` }}
          role="img"
          aria-label={lang === "es" ? c.title_es : c.title_en}
        />
        <div className="eyebrow">{lang === "es" ? c.eyebrow_es : c.eyebrow_en}</div>
        <div className="title">{lang === "es" ? c.title_es : c.title_en}</div>
        <div className="body">{lang === "es" ? c.body_es : c.body_en}</div>
        <button className="btn primary" onClick={onCta} style={{ marginTop: 4 }}>
          {lang === "es" ? c.cta_es : c.cta_en}
        </button>
      </div>
    </div>
  );
}

window.EmptyState = EmptyState;
window.EMPTY_COPY = EMPTY_COPY;
})();
