/* =========================
   CoreFramework Tokens
   - primary = Gold / Akzent
   - secondary = Graus / Flächen / Linien
   - success = Status (grün)
   ========================= */

/* ====== Grundlayout ====== */
.mk-ld-empty {
  padding: 16px;
  border: 1px solid var(--secondary-10);
  border-radius: 14px;
  background: var(--secondary-20);
}

/* Grid für Kurs-/Kapitel-Kacheln */
.mk-ld-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .mk-ld-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .mk-ld-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .mk-ld-grid { grid-template-columns: 1fr; }
}

/* Card */
.mk-ld-card {
  display: block;
  text-decoration: none;
  border-radius: 18px;
  overflow: hidden;

  background: var(--secondary-20);
  border: 2px solid var(--primary-40);

  transform: translateZ(0);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.mk-ld-card:hover {
  transform: scale(1.02);
  background: var(--primary-30);
}

/* Thumbnails bleiben erhalten */
.mk-ld-card__media {
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
}

.mk-ld-card__body {
  padding: 14px 14px 16px;
}

/* Keine harte Textfarbe -> Theme/Bricks bestimmt Typo */
.mk-ld-card__title {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 8px;
}

.mk-ld-card__excerpt {
  opacity: .78;
  font-size: 0.95em;
  line-height: 1.35;
}

/* ====== Lesson/Topic Shell ====== */
.mk-ld-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Desktop Sidebar sticky */
.mk-ld-sidebar {
  position: sticky;
  top: 18px;
}

/* Content */
.mk-ld-content {
  min-width: 0;
  position: relative; /* für Loader Overlay */
}

/* ====== Sidebar Nav ====== */
.mk-ld-nav {
  border: 1px solid var(--secondary-10);
  background: var(--secondary-20);
  border-radius: 18px;
  overflow: hidden;
}

.mk-ld-nav__toggle {
  width: 100%;
  display: none; /* mobil-only */
  padding: 14px 16px;
  background: transparent;
  border: 0;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.mk-ld-nav__panel {
  padding: 14px;
}

.mk-ld-nav__section + .mk-ld-nav__section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--secondary-10);
}

.mk-ld-nav__label {
  font-size: 0.85em;
  opacity: .75;
  margin: 0 0 8px;
}

/* ====== NAV ITEM ====== */
.mk-ld-navitem {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto; /* ✅ Platz für Status-Dot */
  gap: 10px;
  align-items: center;

  padding: 12px;
  border-radius: 14px;
  text-decoration: none;

  border: 1px solid var(--secondary-10);
  background: var(--secondary-20);

  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.mk-ld-navitem:hover {
  transform: translateY(-1px);
  border-color: var(--primary-30);
  background: var(--secondary-10);
}

.mk-ld-navitem__thumb {
  width: 64px;
  height: 42px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
}

.mk-ld-navitem__title {
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Status Dot (complete) ===== */
.mk-ld-status-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  justify-self: end;
  align-self: center;
  box-shadow: 0 0 0 3px var(--secondary-20);
}

/* ===== TOPICS: niedriger als Lessons ===== */
.mk-ld-navitem.is-topic {
  margin-left: 18px;
  padding: 8px 10px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  border-radius: 12px;
}

.mk-ld-navitem.is-topic .mk-ld-navitem__title {
  font-weight: 600;
  font-size: 0.95em;
}

.mk-ld-navitem.is-topic .mk-ld-navitem__thumb {
  width: 52px;
  height: 34px;
  border-radius: 10px;
}

/* ===== ACTIVE ===== */
.mk-ld-navitem.is-active {
  background: var(--primary-40);
  border-color: var(--primary-40);
}

/* Active Text hell (wenn dein Core kein secondary-0 hat: ersetze durch deine “white”-Variable) */
.mk-ld-navitem.is-active .mk-ld-navitem__title {
  color: var(--secondary-0, #fff);
}

/* Status Dot auf active: optisch sauber “eingebettet” */
.mk-ld-navitem.is-active .mk-ld-status-dot{
  box-shadow: 0 0 0 3px var(--primary-40);
}

/* Back Link */
.mk-ld-nav__back {
  display: inline-block;
  text-decoration: none;
  opacity: .85;
}

/* =========================================================
   Kompakte Gruppierung + feine Linie
   ========================================================= */

/* Weniger, aber spürbarer Abstand zwischen Lessons */
.mk-ld-nav__panel .mk-ld-navitem:not(.is-topic) + .mk-ld-navitem:not(.is-topic) {
  margin-top: 12px;
}

.mk-ld-nav__panel .mk-ld-nav__topics + .mk-ld-navitem:not(.is-topic) {
  margin-top: 12px;
}

/* Topics-Block direkt unter Lesson */
.mk-ld-nav__topics {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 1px 0 10px;
  padding-left: 16px;
}

/* Dünne vertikale Linie */
.mk-ld-nav__topics::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--primary-20);
}

/* Wenn Parent-Lesson aktiv ist */
.mk-ld-navitem.is-active + .mk-ld-nav__topics::before {
  background: var(--primary-40);
}

/* Verbindungslinie zu jedem Topic */
.mk-ld-navitem.is-topic {
  position: relative;
}

.mk-ld-navitem.is-topic::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  width: 10px;
  height: 1px;
  transform: translateY(-50%);
  background: var(--primary-20);
}

.mk-ld-navitem.is-active.is-topic::before {
  background: var(--primary-40);
}

/* ====== Mobil: LearnDash Navigation (iOS stabil, fixed Toggle) ====== */
@media (max-width: 900px) {

  .mk-ld-shell {
    grid-template-columns: 1fr;
  }

  .mk-ld-sidebar {
    position: relative;
    z-index: 80;
    padding-top: 64px; /* Platz für fixed Toggle */
  }

  /* ===== Toggle (eingeklappt sichtbar) ===== */
  .mk-ld-nav__toggle{
    position: fixed !important;
    top: var(--mk-header-bottom, 0px) !important;

    left: 50%;
    transform: translateX(-50%);

    width: calc(100% - 32px);
    max-width: 1100px;

    z-index: 90;
    display: block;

    padding: 14px 16px;

    border-radius: 16px;
    border: 1px solid var(--primary-20);

    background: var(--secondary-0, #fff);
    backdrop-filter: blur(10px);

    font-weight: 600;
    text-align: left;

    -webkit-appearance: none;
    appearance: none;
  }

  /* Navigation Toggle – Pfeil direkt hinter Text */
  .mk-ld-nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .mk-ld-nav__toggle::after {
    content: "";
    width: 7px;
    height: 7px;

    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;

    transform: rotate(45deg);
    transition: transform 0.2s ease;
  }

  .mk-ld-nav.is-open .mk-ld-nav__toggle::after {
    transform: rotate(-135deg);
  }

  /* ===== Backdrop ===== */
  .mk-ld-nav__backdrop {
    position: fixed;
    inset: 0;
    background: var(--secondary-10);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
    z-index: 85;
  }

  .mk-ld-nav.is-open .mk-ld-nav__backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* ===== Overlay Panel ===== */
  .mk-ld-nav__panel {
    position: fixed;
    left: 12px;
    right: 12px;

    top: calc(var(--mk-header-bottom, 0px) + 58px);

    max-height: 66vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;

    border-radius: 18px;
    border: 1px solid var(--primary-20);

    background: var(--secondary-0, #fff);
    backdrop-filter: blur(12px);

    box-shadow:
      0 10px 30px var(--secondary-10),
      0 2px 6px var(--secondary-10);

    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;

    transition: transform 170ms ease, opacity 170ms ease;
    z-index: 88;
  }

  .mk-ld-nav.is-open .mk-ld-nav__panel {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Nav Items (auf hellem Overlay) */
  .mk-ld-nav.is-open .mk-ld-navitem {
    background: var(--secondary-20);
    border-color: var(--secondary-10);
  }

  .mk-ld-nav.is-open .mk-ld-navitem:hover {
    background: var(--secondary-10);
    border-color: var(--primary-30);
  }

  /* Active */
  .mk-ld-nav.is-open .mk-ld-navitem.is-active {
    background: var(--primary-40);
    border-color: var(--primary-40);
  }

  .mk-ld-nav.is-open .mk-ld-navitem.is-active .mk-ld-navitem__title {
    color: var(--secondary-0, #fff);
  }

  /* Status Dot auf mobile-Overlay sauber */
  .mk-ld-nav.is-open .mk-ld-status-dot{
    box-shadow: 0 0 0 3px var(--secondary-20);
  }
  .mk-ld-nav.is-open .mk-ld-navitem.is-active .mk-ld-status-dot{
    box-shadow: 0 0 0 3px var(--primary-40);
  }
}

.mk-ld-lesson-intro {
  margin-bottom: 18px;
}

.mk-ld-grid--topics {
  margin-top: 6px;
}

/* Progress optisch in dein UI einbetten */
.learndash-wrapper .ld-progress {
  border: 1px solid var(--secondary-10);
  background: var(--secondary-20);
  border-radius: 14px;
  padding: 10px 12px;
}

h1.mk-ld-posttitle{
  display:inline-block;
  position:relative;
}
html.mk-ld-step-complete h1.mk-ld-posttitle::after{
  content:"";
  display:block;
  width:100%;
  height:3px;
  margin-top:10px;
  border-radius:999px;
  background: var(--success);
}