/* ═══════════════════════════════════════════════
   EduCS.me — Feature Styles
   YouTube lite-embed, HL/SL toggle, quiz score,
   progress tracker, mini-TOC, glossary, prev/next
   ═══════════════════════════════════════════════ */

/* ── YouTube Lite-Embed ─────────────────────── */
.yt-lite {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.yt-lite__thumb {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

.yt-lite__play {
  position: relative;
  z-index: 1;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.yt-lite:hover .yt-lite__play,
.yt-lite:focus .yt-lite__play {
  opacity: 1;
  transform: scale(1.08);
}

.yt-lite:focus {
  outline: 2px solid #5093BB;
  outline-offset: -2px;
}

/* ── HL/SL Toggle ───────────────────────────── */
.hl-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #F7FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  padding: 0.3rem 0.75rem 0.3rem 0.5rem;
  cursor: pointer;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2D3748;
  transition: background 0.15s, border-color 0.15s;
  margin: 0.75rem 0;
}

.hl-toggle-btn:hover {
  border-color: #5093BB;
}

.hl-toggle-btn__badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
}

.hl-toggle-btn__badge--hl {
  background: #5093BB;
}

.hl-toggle-btn__badge--sl {
  background: #8FD4BF;
}

.hl-content {
  transition: none;
}

.hl-content--hidden {
  display: none !important;
}

/* ── Quiz Score Widget ──────────────────────── */
.quiz-score-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #fff;
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2D3748;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  z-index: 100;
  transform: translateY(120%);
  transition: transform 0.3s ease, border-color 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-score-widget--visible {
  transform: translateY(0);
}

.quiz-score-widget--perfect {
  border-color: #48BB78;
}

.quiz-score-widget__icon {
  font-size: 1.1rem;
}

.quiz-score-widget__close {
  background: none;
  border: none;
  color: #9AA5B4;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0 0 0.25rem;
  line-height: 1;
}

.quiz-score-widget__close:hover {
  color: #2D3748;
}

/* ── Progress Tracker ───────────────────────── */
.progress-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #F7FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #5093BB;
  transition: background 0.15s, border-color 0.15s;
  margin: 1.5rem 0;
}

.progress-btn:hover {
  background: #EDF2F7;
  border-color: #5093BB;
}

.progress-btn--reviewed {
  background: #E8F7F1;
  border-color: #8FD4BF;
  color: #1a7f4b;
}

.progress-btn--reviewed:hover {
  background: #D6F0E4;
}

.progress-check {
  color: #48BB78;
  font-weight: 700;
  margin-left: 0.35rem;
}

/* ── Glossary Tooltips ──────────────────────── */
.glossary-term {
  border-bottom: 1.5px dashed #5093BB;
  cursor: help;
  position: relative;
  display: inline;
}

.glossary-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #2D3748;
  color: #F7FAFC;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  width: max-content;
  max-width: 280px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
}

.glossary-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #2D3748;
}

.glossary-term:hover .glossary-tooltip,
.glossary-term:focus .glossary-tooltip,
.glossary-tooltip--visible {
  display: block;
}

/* ── Sticky Mini-TOC ────────────────────────── */
.mini-toc {
  position: fixed;
  top: 5rem;
  right: 1rem;
  width: 200px;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  border-left: 3px solid #5093BB;
  padding-left: 0.75rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.78rem;
  z-index: 50;
}

.mini-toc__title {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9AA5B4;
  margin-bottom: 0.5rem;
}

.mini-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mini-toc__item {
  margin-bottom: 0.3rem;
}

.mini-toc__item--sub {
  padding-left: 0.75rem;
}

.mini-toc__link {
  color: #6B7785;
  text-decoration: none !important;
  transition: color 0.15s;
  line-height: 1.4;
  display: block;
}

.mini-toc__link:hover {
  color: #5093BB;
  text-decoration: none !important;
}

.mini-toc__link--active {
  color: #5093BB;
  font-weight: 600;
}

.mini-toc__item--hl-hidden {
  display: none;
}

/* Only show on wide screens */
@media (max-width: 1199px) {
  .mini-toc { display: none; }
}

/* ── Previous / Next Navigation ─────────────── */
.prev-next-nav {
  display: flex;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid #E2E8F0;
}

.prev-next-nav__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  text-decoration: none !important;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.prev-next-nav__link:hover {
  border-color: #5093BB;
  box-shadow: 0 2px 8px rgba(80, 147, 187, 0.1);
  text-decoration: none !important;
}

.prev-next-nav__link--prev {
  align-items: flex-start;
}

.prev-next-nav__link--next {
  align-items: flex-end;
  text-align: right;
}

.prev-next-nav__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9AA5B4;
  margin-bottom: 0.25rem;
}

.prev-next-nav__title {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: #5093BB;
}

.prev-next-nav__spacer {
  flex: 1;
}

@media (max-width: 600px) {
  .prev-next-nav {
    flex-direction: column;
  }
  .prev-next-nav__link--next {
    align-items: flex-start;
    text-align: left;
  }
}

/* ── Teacher Mode Page ─────────────────────── */
.tm-hidden {
  display: none !important;
}

.tm-input {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 0.6rem 0.8rem;
  border: 1px solid #CBD5E0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: "Inter", system-ui, sans-serif;
  margin-bottom: 0.75rem;
}

.tm-btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Inter", system-ui, sans-serif;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.tm-btn--primary {
  background: #5093BB;
  color: #fff;
}

.tm-btn--primary:hover {
  background: #3D7A9E;
}

.tm-btn--secondary {
  background: #E2E8F0;
  color: #2D3748;
}

.tm-btn--secondary:hover {
  background: #CBD5E0;
}

.tm-error {
  color: #E53E3E;
  font-size: 0.88rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.tm-status {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.tm-status--active {
  background: #E8F7F1;
  border: 1px solid #8FD4BF;
  color: #1a7f4b;
}

.tm-gate {
  text-align: center;
  padding: 3rem 1rem;
}

.tm-gate p {
  font-size: 1.05rem;
  color: #6B7785;
  margin-bottom: 1.5rem;
}

/* ── Teacher Guide Link ────────────────────── */
.teacher-guide-link {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid #CBD5E0;
  border-radius: 6px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5093BB !important;
  text-decoration: none !important;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 0.5rem;
}

.teacher-guide-link:hover {
  border-color: #5093BB;
  background: rgba(80, 147, 187, 0.06);
  text-decoration: none !important;
}

/* ═══════════════════════════════════════════════
   Dark Mode Overrides
   ═══════════════════════════════════════════════ */
[data-theme="dark"] {

  .hl-toggle-btn {
    background: #1A2029;
    border-color: #313D4F;
    color: #B0BAC8;
  }

  .hl-toggle-btn:hover {
    border-color: #87D1E8;
  }

  .quiz-score-widget {
    background: #1A2029;
    border-color: #313D4F;
    color: #B0BAC8;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  }

  .quiz-score-widget--perfect {
    border-color: #48BB78;
  }

  .quiz-score-widget__close {
    color: #6B7785;
  }

  .quiz-score-widget__close:hover {
    color: #B0BAC8;
  }

  .progress-btn {
    background: #1A2029;
    border-color: #313D4F;
    color: #87D1E8;
  }

  .progress-btn:hover {
    background: #242D3A;
    border-color: #87D1E8;
  }

  .progress-btn--reviewed {
    background: rgba(72, 187, 120, 0.12);
    border-color: rgba(72, 187, 120, 0.3);
    color: #48BB78;
  }

  .progress-btn--reviewed:hover {
    background: rgba(72, 187, 120, 0.18);
  }

  .progress-check {
    color: #48BB78;
  }

  .glossary-term {
    border-bottom-color: #87D1E8;
  }

  .glossary-tooltip {
    background: #242D3A;
    color: #D1D9E6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }

  .glossary-tooltip::after {
    border-top-color: #242D3A;
  }

  .mini-toc {
    border-left-color: #87D1E8;
  }

  .mini-toc__title {
    color: #6B7785;
  }

  .mini-toc__link {
    color: #7D8A99;
  }

  .mini-toc__link:hover {
    color: #87D1E8;
  }

  .mini-toc__link--active {
    color: #87D1E8;
  }

  .prev-next-nav {
    border-top-color: #313D4F;
  }

  .prev-next-nav__link {
    border-color: #313D4F;
  }

  .prev-next-nav__link:hover {
    border-color: #87D1E8;
    box-shadow: 0 2px 8px rgba(135, 209, 232, 0.08);
  }

  .prev-next-nav__label {
    color: #6B7785;
  }

  .prev-next-nav__title {
    color: #87D1E8;
  }

  .tm-input {
    background: #1A2029;
    border-color: #313D4F;
    color: #D1D9E6;
  }

  .tm-btn--secondary {
    background: #313D4F;
    color: #B0BAC8;
  }

  .tm-btn--secondary:hover {
    background: #3D4A5C;
  }

  .tm-status--active {
    background: rgba(72, 187, 120, 0.12);
    border-color: rgba(72, 187, 120, 0.3);
    color: #48BB78;
  }

  .teacher-guide-link {
    border-color: #313D4F;
    color: #87D1E8 !important;
  }

  .teacher-guide-link:hover {
    border-color: #87D1E8;
    background: rgba(135, 209, 232, 0.08);
  }
}
