# المحلل الذكي — Smart System Analyst Agent

Node.js + Express + HTML/CSS application that conducts an interactive Arabic conversation
to extract Function Points & Use Cases, then generates a printable PDF requirements document.

## ✨ Features
- Glassmorphism Arabic UI (RTL, Cairo font)
- Powered by Google Gemini (`gemini-2.0-flash-exp`)
- Live sidebar: function-point counter + actor/use-case tree
- Live preview pane: requirements draft updated in real time
- One-click PDF export (printable HTML report — perfect Arabic shaping)
- In-memory session store

## 🚀 Setup

```bash
cd express-app
cp .env.example .env       # then add your GEMINI_API_KEY
npm install
npm start
```

Open http://localhost:3000

Get a free Gemini key: https://aistudio.google.com/app/apikey

## 📁 Structure
```
express-app/
├── server.js           # Express server + Gemini integration + report renderer
├── package.json
├── .env.example
└── public/
    ├── index.html      # Glassmorphism UI
    ├── style.css       # Design system (gold + violet on midnight)
    └── app.js          # Chat client + live state
```

## 🔌 API
- `POST /api/start`     `{ title }`  → starts a new session
- `POST /api/message`   `{ sessionId, message }` → sends user reply, returns updated state
- `GET  /report/:id`    → printable Arabic HTML report (use browser "Save as PDF")

## 📄 PDF Generation
الضغط على زر **"حفظ التقرير"** يفتح صفحة التقرير في تبويب جديد، ثم زر **"حفظ كـ PDF"**
يستدعي طباعة المتصفح (اختر "Save as PDF"). لا حاجة لأي مكتبة ثقيلة على السيرفر.