/* Add custom CSS styles below */ 
document.addEventListener("DOMContentLoaded", function () {
  const styles = document.querySelectorAll("link[rel='stylesheet']");

  styles.forEach(link => {
    let href = link.getAttribute("href");

    // استثناء CSS الأساسي للثيم
    if (!href.includes("theme") && !href.includes("salla")) {
      // تحميل CSS بعد تحميل الصفحة (Async)
      link.setAttribute("media", "print");
      link.onload = function () {
        link.removeAttribute("media");
      };
    }
  });

  // إزالة أي CSS Inline كبير مش مستخدم
  const inlineStyles = document.querySelectorAll("style");
  inlineStyles.forEach(style => {
    if (style.innerHTML.length > 5000) {
      style.remove();
    }
  });
});