/* 목록 패널(머리·설정·검색·검색 결과·폴더 트리), 제목줄 */

/* 패널 머리: 제목, [설정], 그 아래 검색 칸. 목록을 스크롤해도 위에 붙어 있다. */
.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: 4px;
  height: 28px;
  padding: 0 8px;
  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; stroke-linecap: round; }

/* 검색 칸 */
.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-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.res-row:hover { background: var(--hover); }
.res-row.on { background: var(--accent-bg); }
.res-body { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.res-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-path { overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

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

/* 폴더 트리: 줄 = [펼침] [종류 그림] 이름 | 자막 | 태그 | 크기. 깊이마다 들여 쓴다. */
.tree { padding: 6px 8px 24px; }

.trow {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  padding: 4px 8px 4px calc(4px + var(--depth, 0) * 18px);
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.trow:hover { background: var(--hover); }
.trow.dir { font-weight: 500; }
.tchev { flex: none; width: 16px; height: 16px; color: var(--muted); }
.tchev svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.tnode.open > .trow .tchev svg { transform: rotate(90deg); }
.ticon { flex: none; width: 18px; height: 18px; color: var(--sub); }
.ticon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeta { flex: none; color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.tbadge { flex: none; padding: 0 5px; border-radius: 4px; background: var(--hover); color: var(--sub); font-size: 11px; font-weight: 500; }
.trow .tag { display: none; flex: none; }
.tnote { padding: 4px 8px 6px calc(26px + var(--depth, 0) * 18px); color: var(--muted); font-size: 12px; }
.tthumb { flex: none; width: 48px; height: 27px; border-radius: 3px; background: #000; object-fit: contain; }
.tthumb[hidden] { display: block; visibility: hidden; }   /* 장면을 만드는 동안에도 자리를 지켜 글이 밀리지 않게 */
.tnote.err { color: #c5362b; }

/* 종류별 그림 색 */
.k-dir .ticon, .trow.dir .ticon { color: #d4a017; }
.k-video .ticon { color: var(--accent); }
.k-audio .ticon { color: #8a5cd6; }
.k-pdf .ticon { color: #d0473b; }
.k-office .ticon { color: #2f8f5b; }
.k-image .ticon { color: #c77c1e; }

/* 아직 재생할 수 없는 형식(mkv·avi·wmv 등) */
.trow.later { color: var(--sub); }
.trow.later .ticon { color: var(--muted); }

/* 지금 연 영상·문서 */
.trow.current { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.trow.current .tag:not(:empty) { display: inline-block; }
.trow.doc-on { box-shadow: inset 0 0 0 1px var(--accent); }

/* 제목줄: [목록 메뉴] (폴더) 파일 이름 … 자동 재생 */
.now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-height: 52px;
  padding: 9px 0;
}

.menu-btn {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: -4px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  cursor: pointer;
}

.menu-btn:hover { background: var(--hover); }
.menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.now-sec {
  flex: none;
  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; }



/* 좁은 화면: 제목줄 한 줄 [메뉴] | (폴더) | 파일 이름… | 자동 재생 */
.app[data-device="compact"] .now {
  flex-wrap: nowrap;
  gap: 6px;
  min-height: 48px;
  padding: 6px 10px;
}

.app[data-device="compact"] .menu-btn { display: inline-flex; }
.app[data-device="compact"] .now-title { flex: 1 1 auto; font-size: 14.5px; }
.app[data-device="compact"] .cont { gap: 6px; }
.app[data-device="compact"] .app[data-device="compact"] .switch { gap: 4px; font-size: 12px; }
.app[data-full="true"] .menu-btn { display: none; }   /* 전체에서는 목록을 쓰지 않는다 */

@media (max-width: 420px) {
  .app[data-device="compact"] .now-sec { padding: 2px 6px; font-size: 11px; }
  .app[data-device="compact"] .sw-long { display: none; }   /* 아주 좁으면 '자동 재생'을 '자동'으로 */
}

/* 영상만 크게(전체, 휴대폰 가로): 제목줄은 영상 위에 떠 있다가 자동으로 숨는다 */
.app[data-layout="overlay"] .now {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 6;
  padding: 10px 16px 26px;
  background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  color: #fff;
  transition: opacity 0.25s;
}

.app[data-layout="overlay"] .now-sec { background: rgba(255, 255, 255, 0.18); color: #fff; }
.app[data-layout="overlay"] .switch,
.app[data-layout="overlay"] .app[data-layout="overlay"] .menu-btn:hover { background: rgba(255, 255, 255, 0.15); }

/* 50% 장면 크게 보기(마우스가 있는 기기에서 목록의 영상 줄에 올렸을 때) */
.thumb-tip {
  position: fixed;
  z-index: 95;
  width: 320px;
  height: 180px;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.thumb-tip img { display: block; width: 100%; height: 100%; object-fit: contain; }
