// Admin panel — the bot is the real admin surface. This modal just nudges
// the user toward Telegram.
function AdminPanel({ open, onClose }) {
  if (!open) return null;

  const bot = window.KAREN_CONFIG?.botUsername || "for_karen_bot";
  const tgDeep = `tg://resolve?domain=${bot}`;
  const tgWeb = `https://t.me/${bot}`;

  return (
    <div className="admin-modal" onClick={onClose}>
      <div className="admin-card" onClick={(e) => e.stopPropagation()}>
        <h2 className="admin-h">+ add a memory</h2>
        <p className="admin-sub">
          send a photo to <b>@{bot}</b> in Telegram. caption it (or don't) — the bot saves the rest.
        </p>

        <div className="bot-note">
          <b>how it works:</b> the bot lives in our private chat. send any photo and it becomes a new
          date pinned to today. reply with text to add memory / song / area. reply with another photo
          to attach it. <code>/list</code> shows everything, <code>/edit d3</code> to fix any entry.
        </div>

        <div className="admin-actions">
          <button className="btn btn-ghost" onClick={onClose}>close</button>
          <a className="btn btn-primary" href={tgDeep} onClick={() => {
            setTimeout(() => { window.open(tgWeb, "_blank"); }, 400);
          }}>open Telegram</a>
        </div>
      </div>
    </div>
  );
}

window.AdminPanel = AdminPanel;
