"use client" import { useState, useEffect } from "react" import Link from "next/link" import { usePathname, useRouter } from "next/navigation" import { useAuth } from "@/lib/auth-context" import { Home, MessageSquare, Mic, LogOut, Menu, X, Settings, BarChart3, Users, Shield, FileText, Activity, Brain, ArrowBigUp, Database, Sparkles, Zap, } from "lucide-react" import { Button } from "./ui/button" import { cn } from "@/lib/utils" export function AdminSidebar() { const [isOpen, setIsOpen] = useState(false) const [isHovered, setIsHovered] = useState(false) const pathname = usePathname() const router = useRouter() const { user, logout } = useAuth() // Auto-hide on desktop, show on mobile toggle const [isMobile, setIsMobile] = useState(false) useEffect(() => { const checkMobile = () => { setIsMobile(window.innerWidth < 768) } checkMobile() window.addEventListener("resize", checkMobile) return () => window.removeEventListener("resize", checkMobile) }, []) const handleLogout = async () => { await logout() } const adminNavItems = [ { href: "/admin", icon: BarChart3, label: "Dashboard" }, { href: "/admin/users", icon: Users, label: "Users" }, { href: "/admin/knowledge", icon: Database, label: "Knowledge Bases" }, { href: "/admin/models", icon: Sparkles, label: "AI Models" }, { href: "/admin/rag", icon: Zap, label: "RAG Pipeline" }, { href: "/admin/blog", icon: FileText, label: "Blog" }, { href: "/admin/analytics", icon: Activity, label: "Analytics" }, { href: "/admin/training", icon: ArrowBigUp, label: "Training" }, { href: "/admin/agent-monitoring", icon: Brain, label: "Agent Monitoring" }, { href: "/admin/settings", icon: Settings, label: "Settings" }, ] const generalNavItems = [ { href: "/", icon: Home, label: "Home" }, { href: "/chat", icon: MessageSquare, label: "Chat" }, { href: "/voice", icon: Mic, label: "Voice" }, ] // Desktop: Show on hover at left edge // Mobile: Toggle with hamburger button const shouldShow = isMobile ? isOpen : isHovered return ( <> {/* Mobile Hamburger Button */} {isMobile && ( )} {/* Mobile Overlay */} {isMobile && isOpen && (