.ld-profile-cards,
.learndash-profile .ld-profile-cards,
.learndash-wrapper .ld-profile-cards {
    display: none !important;
}

function translateText() {
  const translations = {
    'Your Courses': 'Deine Kurse',
    'Course Content': 'Kursinhalte',
    'Available': 'Verfügbar',
    'Complete': 'Abgeschlossen',
    'Last activity on': 'Letzte Aktivität am',
    'In Progress': 'In Bearbeitung',
    'Previous': 'Zurück',
    'Next': 'Weiter',
    'Back to Course': 'Zurück zum Kurs'
  };

  const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
  let node;
  while ((node = walker.nextNode())) {
    Object.keys(translations).forEach((key) => {
      if (node.nodeValue.includes(key)) {
        node.nodeValue = node.nodeValue.replace(key, translations[key]);
      }
    });
  }
}

// 👀 Obserwujemy zmiany w DOM LearnDash
const observer = new MutationObserver((mutationsList, observer) => {
  for (const mutation of mutationsList) {
    if (mutation.type === 'childList') {
      translateText();
    }
  }
});

document.addEventListener("DOMContentLoaded", function () {
  const targetNode = document.body;
  const config = { childList: true, subtree: true };
  observer.observe(targetNode, config);

  // ⏳ Startowe tłumaczenie
  setTimeout(() => {
    translateText();
  }, 1000);
});

