# AEGIS-AI UI/UX Overhaul Plan
## Scope
Frontend-only changes. **Zero changes** to `core/`, `aegis/`, `app.py` routes, or the detection engine. The API contract (`/api/predict` JSON response) stays identical.
---
## Current Problems
| # | Problem | Impact |
|---|---|---|
| 1 | **83KB monolithic `index.html`** — 2,029 lines mixing HTML, CSS (~870 lines), and JS (~500 lines) | Unmaintainable, impossible to iterate on |
| 2 | **Fake 5.1-second scanning delay** — hardcoded `setTimeout` stages even if backend returns instantly | Users wait for nothing, feels sluggish |
| 3 | **Broken video preview** — video files assigned to `
` tag, shows broken icon | Critical bug |
| 4 | **Vertical scroll wall** — all result cards stacked in one endless column | Overwhelming, key findings buried |
| 5 | **Static heatmaps** — ELA/FFT/Attention shown as plain images in tabs | No comparison with original, hard to interpret |
| 6 | **No export capability** — no PDF report, no JSON download, no share link | Useless for actual forensic workflows |
| 7 | **No audio visualization** — just text numbers for audio analysis | Misses opportunity to show spectrogram |
| 8 | **Orphaned `main.css`** — 379-line stylesheet exists but is never linked | Wasted work |
| 9 | **XGBoost Fusion badge in nav** — references old pipeline, misleading | Outdated branding |
---
## Design Direction
Keep the **cyberpunk glassmorphism dark theme** — it's striking and fits a security/forensics tool. But refine it:
- **Reduce visual noise**: Fewer glowing borders, more whitespace between sections
- **Information hierarchy**: Verdict + evidence summary visible immediately, deep metrics available on demand
- **Progressive disclosure**: Collapsed sections that expand, not a wall of everything at once
- **Interactivity**: Heatmap overlays, audio waveforms, video timeline — make the data explorable
---
## Proposed Changes
### 1. Modularize the Codebase
Split the monolithic `index.html` into clean, maintainable files:
```
templates/
└── index.html # Clean HTML structure only (~300 lines)
static/
├── css/
│ ├── variables.css # CSS custom properties (colors, spacing, fonts)
│ ├── base.css # Reset, typography, layout grid
│ ├── components.css # Cards, badges, buttons, modals, toasts
│ ├── upload.css # Drop zone, preview, scan overlay
│ ├── results.css # Verdict, heatmaps, metrics, evidence
│ └── responsive.css # Media queries (900px, 768px, 600px, 480px)
│
└── js/
├── upload.js # File handling, drag-drop, preview rendering
├── analysis.js # API call, progress tracking, result rendering
├── heatmap-viewer.js # Interactive heatmap overlay slider
├── audio-viewer.js # Audio waveform + spectrogram canvas
├── video-timeline.js # Video frame scrubber with risk bars
├── export.js # PDF/JSON report generation
├── settings.js # Profile, username, opt-in toggles
└── utils.js # Toast system, metric scaling, helpers
```
> [!IMPORTANT]
> The HTML goes from **2,029 lines → ~300 lines**. Each JS/CSS file has a single responsibility.
---
### 2. Fix Video Preview Bug
**Current**: `FileReader.readAsDataURL` feeds into `
` tag → broken for video.
**Fix**: Detect media type from file, dynamically create `