/* File: public/css/sidebar.css */

/* ── 사이드바 기본 ── */
#sidebar {
  width: 250px;
  background: #1e1f1c;
  color: #ccc;
  overflow: auto;
  /* padding: 10px; */

}

.sidebar-body {
  padding: 10px;
  overflow: auto;
  flex: 1;
  font-size: 12px;
}

#sidebar a {
  color: #ccc;
  text-decoration: none;
  display: block;
  padding: 2px 0;
}

#sidebar li:hover>a {
  background: rgba(255, 255, 255, 0.1);
}

/* 폴더명 옆의 (폴더수 / 포스트수) 표시 */
.sidebar-tree .folder-name .count {
  font-size: 0.9em;
  color: #ccc;
  margin-left: 4px;
}


/* ── 트리 구조 토글 ── */
.sidebar-tree,
.sidebar-tree ul,
.posts-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-tree ul,
.posts-list {
  display: none;
  margin-left: 1em;
}

.sidebar-tree li.expanded>ul,
.sidebar-tree li.expanded>.posts-list {
  display: block;
}

/* ── 커넥터 선 ── */
.sidebar-tree li {
  position: relative;
}

/* .sidebar-tree li::before {
  content: "";
  position: absolute;
  top: 0.75em;
  left: 0;
  width: 1em;
  border-top: 1px solid #444;
} */

/* ── 폴더 아이템 ── */
.folder {
  display: grid;
  grid-template-columns: 1em 1em auto;
  /* connector / arrow / name */
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  column-gap: 0.5em;
  padding: 2px 0;
}

/* 2열: arrow 은 항상 폴더 아이콘 */
.folder .arrow {
  width: 1em;
  height: 1em;
  background: url("/assets/icon/folder.svg") no-repeat center/contain;
  transition: background-image .2s ease;
}

/* 펼쳐진 폴더일 때만 arrow 아이콘 교체 */
.sidebar-tree li.expanded>.folder .arrow {
  background-image: url("/assets/icon/folder-open.svg");
}

/* ── 파일(post) 링크 전용 아이콘 ── */
.posts-list li .post-link::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  vertical-align: middle;
  background: url("/assets/icon/file-document.svg") no-repeat center/contain;
}

/* 현재 열린 포스트(active)에 배경색 */
.sidebar-tree .posts-list .post-link.active {
  background-color: #414339;
  /* 필요하면 글자색도 조정 */
  color: #fff;
}


/* 검색 영역 기본 숨김 */
#search-view {
  display: none;
}

/* ── 검색 뷰 디자인 ── */
#search-view label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.75em;
  color: #aaa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#search-input {
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 8px;
  font-size: 0.9em;
  color: #ccc;
  background: #2b2b2b;
  border: 1px solid #444;
  border-radius: 4px;
  outline: none;
  box-sizing: border-box;
}

#search-input::placeholder {
  color: #666;
  opacity: 1;
}

/* 검색 결과 리스트 */
#search-results {
  list-style: none;
  padding: 0;
  margin: 0;
}

#search-results li {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  cursor: pointer;
  white-space: nowrap;
  color: #ccc;
  font-size: 0.9em;
}

#search-results li strong {
  flex-shrink: 0;
  color: #777;
  font-size: 0.8em;
  margin-right: 0.5em;
}

#search-results li:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 검색 모드의 sidebar-tree 안 post-link에도 파일 아이콘 붙이기 */
.sidebar-tree .post-link::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  vertical-align: middle;
  background: url("/assets/icon/file-document.svg") no-repeat center/contain;
}