/* 목차 패널(머리·참조·검색·검색 결과·목차), 지금 강의 줄, 섬네일 미리보기 */

/* 패널 머리: 제목과 참조 버튼, 그 아래 검색 칸. 목록을 스크롤해도 위에 붙어 있다. */
.panel-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.panel-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.panel-title { flex: 1; font-weight: 600; }

.panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--sub);
  font-size: 12.5px;
  cursor: pointer;
}

.panel-btn:hover,
.panel-btn[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.panel-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* 참조 링크 목록: 화면 기준으로 버튼 아래에 띄운다(자리는 refs.js가 정한다) */
.refs-menu {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: 320px;
  max-width: calc(100vw - 16px);
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.refs-menu a {
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  text-decoration: none;
}

.refs-menu a:hover { background: var(--hover); }
.refs-menu a::after { content: " ↗"; color: var(--muted); }

/* 검색 칸 */
.search-field { position: relative; }

.search-field input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
  outline: none;
}

.search-field input:focus { border-color: var(--accent); background: var(--panel); }
.search-field input::placeholder { color: var(--muted); }
.search-field input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }

.search-icon {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.search-clear:hover { background: var(--hover); color: var(--text); }

/* 검색 결과: 강의 제목 → 내용(주차 · 강의별 묶음) */
.results { padding: 2px 8px 24px; }

.res-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 8px 4px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.res-head span + span { color: var(--sub); font-weight: 400; font-variant-numeric: tabular-nums; }
.res-note { padding: 4px 8px; color: var(--muted); font-size: 12px; }
.res-sec { padding: 10px 8px 2px; color: var(--muted); font-size: 11.5px; }
.res-lec { margin-bottom: 4px; }

.res-lec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.res-lec-head:hover { background: var(--hover); }
.res-n { flex: none; color: var(--muted); font-size: 11.5px; font-weight: 400; }

.hit {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 4px 8px 4px 14px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--sub);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.hit:hover { background: var(--hover); color: var(--text); }
.hit.on { background: var(--accent-bg); color: var(--text); }
.hit-time { flex: none; min-width: 34px; color: var(--accent-text); font-variant-numeric: tabular-nums; }

.hit-text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.hit-more {
  display: block;
  margin: 0 0 2px 14px;
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--accent-text);
  font-size: 12px;
  cursor: pointer;
}

.hit-more:hover { background: var(--hover); }

mark { padding: 0 1px; border-radius: 2px; background: var(--mark); color: inherit; }

/* 목차 */
.toc { padding: 6px 8px 24px; }
.sec { margin-bottom: 2px; }
.sec-head { display: flex; align-items: center; gap: 2px; }

.sec-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.sec-title:hover { background: var(--hover); }
.sec-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-meta { font-size: 12px; font-weight: 400; color: var(--sub); white-space: nowrap; font-variant-numeric: tabular-nums; }

.sec-fold {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--sub);
  cursor: pointer;
}

.sec-fold:hover { background: var(--hover); }
.sec-fold svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.15s; }
.sec.open .sec-fold svg { transform: rotate(180deg); }

.sec-list { display: none; padding-bottom: 6px; }
.sec.open .sec-list { display: block; }

.lec {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px 5px 20px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--sub);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.lec:hover { background: var(--hover); color: var(--text); }
.lec-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lec-dur { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lec .tag { display: none; }
.lec.current { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.lec.current .tag { display: inline-block; }

/* 연속 재생으로 이어서 볼 강의 */
.lec.queued::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--accent);
}

/* 지금 강의 줄 */
.now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-height: 34px;
  margin-bottom: 10px;
}

.now-sec {
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--hover);
  color: var(--sub);
  font-size: 12px;
  white-space: nowrap;
}

.now-title {
  flex: 1 1 240px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
}

.cont { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* 자동 재생 스위치 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sub);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.switch-ui {
  position: relative;
  flex: none;
  width: 32px;
  height: 18px;
  border-radius: 99px;
  background: var(--line);
  transition: background 0.15s;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.cont select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 13px;
  cursor: pointer;
}

.cont-left { color: var(--sub); font-size: 12px; font-variant-numeric: tabular-nums; }

/* 섬네일 미리보기(목차 강의에 마우스를 올렸을 때) */
.thumb-tip {
  position: fixed;
  z-index: 60;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.thumb-tip img,
.thumb-tip video {
  display: block;
  width: 192px;
  height: 108px;
  border-radius: 5px;
  background: #000;
  object-fit: cover;
}
