#!/usr/bin/env python3
"""Simple HTTP server for serving static files."""

import http.server
import socketserver
import os

PORT = 8080
DIRECTORY = os.path.dirname(os.path.abspath(__file__))

class Handler(http.server.SimpleHTTPRequestHandler):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, directory=DIRECTORY, **kwargs)
    
    def end_headers(self):
        # Add CORS headers for cross-origin access
        self.send_header('Access-Control-Allow-Origin', '*')
        self.send_header('Cache-Control', 'no-cache')
        super().end_headers()

if __name__ == '__main__':
    with socketserver.TCPServer(("", PORT), Handler) as httpd:
        print(f"🌐 Serving at http://0.0.0.0:{PORT}")
        print(f"📁 Directory: {DIRECTORY}")
        print(f"📊 Dashboard: http://localhost:{PORT}/agent-office.html")
        httpd.serve_forever()
