document.addEventListener("DOMContentLoaded",function(){const e=document.querySelector(".admin-layout"),t=document.querySelector(".admin-sidebar"),o=document.getElementById("sidebar-toggle");o&&t&&(o.addEventListener("click",()=>{const n=t.classList.toggle("collapsed");e&&e.classList.toggle("sidebar-collapsed",n),localStorage.setItem("sidebar-collapsed",n?"1":"0")}),localStorage.getItem("sidebar-collapsed")==="1"&&(t.classList.add("collapsed"),e&&e.classList.add("sidebar-collapsed")));const d=document.getElementById("mobile-sidebar-toggle");d&&t&&(d.addEventListener("click",()=>{t.classList.toggle("mobile-open")}),document.addEventListener("click",n=>{!t.contains(n.target)&&n.target!==d&&t.classList.remove("mobile-open")}))});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("[data-dropdown]").forEach(e=>{const t=document.querySelector(e.dataset.dropdown);t&&e.addEventListener("click",o=>{o.stopPropagation();const d=t.classList.contains("open");document.querySelectorAll(".dropdown-menu.open").forEach(n=>n.classList.remove("open")),d||t.classList.add("open")})}),document.addEventListener("click",()=>{document.querySelectorAll(".dropdown-menu.open").forEach(e=>e.classList.remove("open"))})});window.AdminModal={open(e){const t=document.getElementById(e);t&&(t.classList.add("open"),document.body.style.overflow="hidden")},close(e){const t=document.getElementById(e);t&&(t.classList.remove("open"),document.body.style.overflow="")}};document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("[data-modal-open]").forEach(e=>{e.addEventListener("click",()=>AdminModal.open(e.dataset.modalOpen))}),document.querySelectorAll("[data-modal-close]").forEach(e=>{e.addEventListener("click",()=>AdminModal.close(e.dataset.modalClose))}),document.querySelectorAll(".modal-overlay").forEach(e=>{e.addEventListener("click",t=>{t.target===e&&AdminModal.close(e.id)})}),document.addEventListener("keydown",e=>{e.key==="Escape"&&document.querySelectorAll(".modal-overlay.open").forEach(t=>{AdminModal.close(t.id)})})});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".alert[data-auto-dismiss]").forEach(e=>{const t=parseInt(e.dataset.autoDismiss)||4e3;setTimeout(()=>{e.style.opacity="0",e.style.transition="opacity 0.4s ease",setTimeout(()=>e.remove(),400)},t)})});document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("select-all");e&&e.addEventListener("change",function(){document.querySelectorAll(".row-check").forEach(t=>{t.checked=this.checked})})});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("[data-confirm-delete]").forEach(e=>{e.addEventListener("click",function(t){const o=this.dataset.confirmDelete||"Are you sure you want to delete this item?";confirm(o)||t.preventDefault()})})});document.addEventListener("DOMContentLoaded",function(){const e=window.location.pathname;document.querySelectorAll(".admin-nav-item").forEach(t=>{const o=t.getAttribute("href");o&&e.includes(o)&&o!=="/"&&t.classList.add("active")})});document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("statusbar-clock");if(e){const t=()=>{const o=new Date;e.textContent=o.toLocaleTimeString("en-IN",{hour:"2-digit",minute:"2-digit"})};t(),setInterval(t,3e4)}});
