/* jedai-icons.jsx — paper-cut style SVG icons + mascots.
   Exposed as window.JEDAI_ICONS. */

(function () {
  const Icon = {};

  Icon.brand = () => (
    <svg viewBox="0 0 40 40" fill="none" stroke="#2a2438" strokeWidth="3" strokeLinejoin="round" strokeLinecap="round">
      <rect x="5" y="8" width="30" height="24" rx="4" fill="#fff"/>
      <path d="M5 14h30"/>
      <path d="M12 5v8M28 5v8"/>
      <path d="M11 22h6M11 26h10" stroke="#2a2438"/>
      <circle cx="26" cy="24" r="4" fill="#ffc24c" stroke="#2a2438"/>
      <path d="M24 24h4M26 22v4" stroke="#2a2438" strokeWidth="2"/>
    </svg>
  );

  /* === tool category icons === */

  Icon.passage = () => (
    <svg viewBox="0 0 32 32" fill="none" stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <rect x="5" y="4" width="22" height="24" rx="3" fill="#fff"/>
      <path d="M9 10h14M9 14h14M9 18h10M9 22h12"/>
      <path d="M22 22l3 3 5-5" stroke="#5cd6b1" strokeWidth="3"/>
    </svg>
  );

  Icon.scroll = () => (
    <svg viewBox="0 0 32 32" fill="none" stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <path d="M7 5h14a4 4 0 014 4v18a4 4 0 01-4 4H10a3 3 0 010-6h14" fill="#fff"/>
      <path d="M11 12h10M11 16h10M11 20h7"/>
    </svg>
  );

  Icon.grid = () => (
    <svg viewBox="0 0 32 32" fill="none" stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <rect x="4" y="4" width="11" height="11" rx="2" fill="#fff"/>
      <rect x="17" y="4" width="11" height="11" rx="2" fill="#fff"/>
      <rect x="4" y="17" width="11" height="11" rx="2" fill="#fff"/>
      <rect x="17" y="17" width="11" height="11" rx="2" fill="#fff"/>
      <path d="M7 9h5M20 9h5M7 22h5M20 22h5"/>
    </svg>
  );

  Icon.check = () => (
    <svg viewBox="0 0 32 32" fill="none" stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <rect x="6" y="4" width="20" height="24" rx="3" fill="#fff"/>
      <path d="M10 10l2 2 4-4M10 18l2 2 4-4M10 24h12M18 12h6M18 20h6"/>
    </svg>
  );

  Icon.clipboard = () => (
    <svg viewBox="0 0 32 32" fill="none" stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <rect x="6" y="6" width="20" height="22" rx="3" fill="#fff"/>
      <rect x="11" y="3" width="10" height="6" rx="2" fill="#b07cff"/>
      <path d="M10 14h12M10 18h12M10 22h8"/>
    </svg>
  );

  Icon.letter = () => (
    <svg viewBox="0 0 32 32" fill="none" stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <rect x="4" y="7" width="24" height="18" rx="2" fill="#fff"/>
      <path d="M4 9l12 9 12-9"/>
      <path d="M4 24l9-7M28 24l-9-7"/>
    </svg>
  );

  /* === ui icons === */

  Icon.sparkle = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z"/>
      <path d="M19 17l.6 1.7L21 19l-1.4.3L19 21l-.6-1.7L17 19l1.4-.3z"/>
    </svg>
  );

  Icon.wand = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M14 6l4 4M5 19l11-11 3 3-11 11H5z"/>
      <path d="M16 3l1 2 2 1-2 1-1 2-1-2-2-1 2-1z"/>
    </svg>
  );

  Icon.refresh = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M20 11A8 8 0 006 6.5L4 9M4 13a8 8 0 0014 4.5L20 15"/>
      <path d="M4 4v5h5M20 20v-5h-5"/>
    </svg>
  );

  Icon.copy = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <rect x="9" y="9" width="12" height="12" rx="2"/>
      <path d="M5 15V5a2 2 0 012-2h10"/>
    </svg>
  );

  Icon.download = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M12 3v12M7 10l5 5 5-5"/>
      <path d="M4 20h16"/>
    </svg>
  );

  Icon.print = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M6 9V3h12v6"/>
      <rect x="3" y="9" width="18" height="9" rx="2"/>
      <rect x="6" y="15" width="12" height="6"/>
    </svg>
  );

  Icon.close = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <path d="M6 6l12 12M18 6l-12 12"/>
    </svg>
  );

  Icon.back = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <path d="M15 6l-6 6 6 6"/>
    </svg>
  );

  Icon.logout = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M9 3H5a2 2 0 00-2 2v14a2 2 0 002 2h4"/>
      <path d="M16 17l5-5-5-5M21 12H9"/>
    </svg>
  );

  Icon.info = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <circle cx="12" cy="12" r="9"/>
      <path d="M12 8v.01M12 11v5"/>
    </svg>
  );

  Icon.check_solo = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinejoin="round" strokeLinecap="round">
      <path d="M4 12l5 5L20 6"/>
    </svg>
  );

  Icon.cog = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <circle cx="12" cy="12" r="3"/>
      <path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 11-4 0v-.09a1.65 1.65 0 00-1-1.51 1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 110-4h.09a1.65 1.65 0 001.51-1 1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 112.83-2.83l.06.06a1.65 1.65 0 001.82.33h.01a1.65 1.65 0 001-1.51V3a2 2 0 114 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06a1.65 1.65 0 00-.33 1.82v.01a1.65 1.65 0 001.51 1H21a2 2 0 110 4h-.09a1.65 1.65 0 00-1.51 1z"/>
    </svg>
  );

  /* === agent pipeline icons === */

  Icon.agent_planner = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <rect x="3" y="4" width="18" height="16" rx="2"/>
      <path d="M3 9h18M8 4v5M16 4v5M7 14h4M7 17h7"/>
    </svg>
  );

  Icon.agent_generator = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M12 19l7-7-3-3-7 7-1 4z"/>
      <path d="M15 6l3 3"/>
      <path d="M4 4l3 3M4 9l3-3"/>
    </svg>
  );

  Icon.agent_validator = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M12 2l9 4v6c0 5-3.8 9.6-9 10-5.2-.4-9-5-9-10V6z"/>
      <path d="M9 12l2 2 4-4"/>
    </svg>
  );

  Icon.agent_reviser = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M21 4v6h-6M3 20v-6h6"/>
      <path d="M20 14a8 8 0 01-14 4l-3-3M4 10a8 8 0 0114-4l3 3"/>
    </svg>
  );

  Icon.agent_editor = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round">
      <path d="M12 20h9"/>
      <path d="M16.5 3.5a2.121 2.121 0 113 3L7 19l-4 1 1-4z"/>
    </svg>
  );

  Icon.agent_done = () => (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
      <circle cx="12" cy="12" r="9"/>
      <path d="M8 12l3 3 5-6"/>
    </svg>
  );

  /* === mascots (paper-cut, kid-friendly) === */
  const Mascot = {
    book: () => (
      <svg viewBox="0 0 64 64">
        <g stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
          <path d="M10 14h20a6 6 0 016 6v32H16a6 6 0 01-6-6Z" fill="#fff3b3"/>
          <path d="M54 14H34a6 6 0 00-6 6v32h20a6 6 0 006-6Z" fill="#ffd6e0"/>
          <path d="M32 20v32" fill="none"/>
          <circle cx="22" cy="30" r="1.5" fill="#2a2438" stroke="none"/>
          <circle cx="42" cy="30" r="1.5" fill="#2a2438" stroke="none"/>
          <path d="M22 38c3 2 7 2 10 0M32 38c3 2 7 2 10 0" fill="none"/>
        </g>
      </svg>
    ),
    sun: () => (
      <svg viewBox="0 0 64 64">
        <g stroke="#2a2438" strokeWidth="2.5" strokeLinecap="round">
          <circle cx="32" cy="32" r="14" fill="#fff3b3"/>
          <g>
            <path d="M32 8v8M32 48v8M8 32h8M48 32h8M14 14l5 5M45 45l5 5M14 50l5-5M45 19l5-5"/>
          </g>
          <circle cx="27" cy="30" r="1.5" fill="#2a2438" stroke="none"/>
          <circle cx="37" cy="30" r="1.5" fill="#2a2438" stroke="none"/>
          <path d="M28 36c2 2 6 2 8 0" fill="none"/>
        </g>
      </svg>
    ),
    cloud: () => (
      <svg viewBox="0 0 64 64">
        <g stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round">
          <path d="M16 40c-4 0-7-3-7-7s3-7 7-7c1-5 5-9 11-9s10 4 11 9c4 0 7 3 7 7s-3 7-7 7Z" fill="#fff"/>
          <circle cx="24" cy="34" r="1.5" fill="#2a2438" stroke="none"/>
          <circle cx="34" cy="34" r="1.5" fill="#2a2438" stroke="none"/>
          <path d="M25 40c1 2 5 2 7 0" fill="none"/>
        </g>
      </svg>
    ),
    star: () => (
      <svg viewBox="0 0 64 64">
        <g stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round">
          <path d="m32 8 7 14 16 2-12 11 3 16-14-8-14 8 3-16L9 24l16-2Z" fill="#ffd84a"/>
          <circle cx="28" cy="26" r="1.5" fill="#2a2438" stroke="none"/>
          <circle cx="36" cy="26" r="1.5" fill="#2a2438" stroke="none"/>
          <path d="M28 32c2 2 6 2 8 0" fill="none"/>
        </g>
      </svg>
    ),
    pencil: () => (
      <svg viewBox="0 0 64 64">
        <g stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round">
          <path d="M18 46l4-14 22-22 10 10-22 22z" fill="#ffd6a0"/>
          <path d="M32 14l10 10" fill="none"/>
          <path d="M18 46l-4 8 8-4" fill="#2a2438"/>
          <circle cx="26" cy="34" r="1.5" fill="#2a2438" stroke="none"/>
          <circle cx="30" cy="38" r="1.5" fill="#2a2438" stroke="none"/>
        </g>
      </svg>
    ),
    rocket: () => (
      <svg viewBox="0 0 64 64">
        <g stroke="#2a2438" strokeWidth="2.5" strokeLinejoin="round">
          <path d="M32 6c8 8 12 18 12 28v8h-8v-8h-8v8h-8v-8c0-10 4-20 12-28z" fill="#ff7aa9"/>
          <circle cx="32" cy="22" r="4" fill="#fff" stroke="#2a2438"/>
          <path d="M24 50l-4 6 6-2M40 50l4 6-6-2" fill="#ffd84a"/>
        </g>
      </svg>
    )
  };

  window.JEDAI_ICONS = { Icon, Mascot };
})();
