/* ============================================
   NAVIGASI DECK — outline slide, lesson switcher,
   pager antar-lesson (deck-nav.js)
   ============================================ */

/* tombol generik di header deck */
.deck-top__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.deck-top__btn:hover {
  border-color: var(--mint);
  background: rgba(47, 214, 158, .08);
}
.deck-top__btn[aria-expanded="true"] {
  border-color: var(--mint-dark);
  background: rgba(47, 214, 158, .14);
}

/* ---------- lesson switcher (pindah lesson tanpa balik ke index) ---------- */
.deck-switcher { position: relative; flex-shrink: 1; min-width: 0; }
.deck-switcher__btn { max-width: 320px; }
.deck-switcher__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-switcher__caret { color: var(--text-soft); font-size: .7rem; }

.deck-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: 340px;
  max-height: 68vh;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md, 0 12px 32px rgba(15, 23, 42, .16));
  padding: 6px;
}
.deck-switcher__menu[hidden] { display: none; }
.deck-switcher__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--navy);
  font-size: .875rem;
  transition: background .15s ease;
}
.deck-switcher__item:hover { background: var(--bg-alt); }
.deck-switcher__item.is-current {
  background: rgba(47, 214, 158, .13);
  font-weight: 600;
}
.deck-switcher__num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
}
.deck-switcher__item.is-current .deck-switcher__num {
  background: var(--mint-dark);
  color: #fff;
}
.deck-switcher__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-switcher__foot {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding: 8px 10px 4px;
}
.deck-switcher__all {
  color: var(--mint-dark);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}
.deck-switcher__all:hover { text-decoration: underline; }

/* ---------- pager antar-lesson di header ---------- */
.deck-lespager { display: flex; gap: 4px; flex-shrink: 0; }
.deck-lespager__btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--white);
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1;
  text-decoration: none;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.deck-lespager__btn:hover { border-color: var(--mint); background: rgba(47, 214, 158, .08); }
.deck-lespager__btn--off { opacity: .3; cursor: default; }

/* ---------- panel outline slide ---------- */
.deck-outline {
  position: fixed;
  top: 55px;
  right: 16px;
  z-index: 60;
  width: 330px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md, 0 16px 40px rgba(15, 23, 42, .18));
  padding: 12px 10px 10px;
  animation: deckOutlineIn .16s var(--ease);
}
.deck-outline[hidden] { display: none; }
@keyframes deckOutlineIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.deck-outline__title {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-soft);
}
.deck-outline__list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.deck-outline__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: .85rem;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  transition: background .14s ease;
}
.deck-outline__item:hover { background: var(--bg-alt); }
.deck-outline__item.is-current {
  background: rgba(47, 214, 158, .14);
  font-weight: 600;
}
.deck-outline__num {
  flex-shrink: 0;
  width: 22px;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-soft);
  text-align: right;
}
.deck-outline__item.is-current .deck-outline__num { color: var(--mint-dark); }
.deck-outline__ico { flex-shrink: 0; font-size: .9rem; }
.deck-outline__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* pembeda jenis slide */
.deck-outline__item--codelab .deck-outline__name { color: #1f9d75; }
.deck-outline__item--quiz .deck-outline__name { color: #b45309; }
.deck-outline__item--cover .deck-outline__name,
.deck-outline__item--end .deck-outline__name { color: var(--text-soft); }

/* dots: beri warna sesuai jenis slide supaya sekilas terlihat strukturnya */
.deck-dot--codelab { background: var(--mint); }
.deck-dot--quiz { background: var(--ink-3); }
.deck-dot--end { background: var(--ink-3); }
.deck-dot--cover { background: var(--line-strong); }

@media (max-width: 860px) {
  .deck-switcher__btn { max-width: 190px; }
  .deck-top__lesson { display: none; }
}
@media (max-width: 640px) {
  .deck-top__counter { display: none; } /* posisi tetap terlihat dari progress bar & dots */
  .deck-top__btn { padding: 6px 9px; }
  .deck-switcher { flex-shrink: 0; }
  .deck-switcher__btn { max-width: 124px; }
  .deck-lespager { display: none; } /* pindah lesson lewat dropdown di layar sempit */
  .deck-outline {
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 130px);
  }
  .deck-switcher__menu { width: min(320px, calc(100vw - 24px)); }
  .deck-lespager__btn { width: 28px; height: 28px; }
}
