/* Sidebar — Phase 1.7 좌측 카테고리 네비게이션
 * brand-dna hero #00A1E0 + 다크 surface */

#app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 48px;                          /* ← 평소 접힘 (Phase 1.7.1) */
  background: rgba(8, 14, 26, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.18s ease;
  font-size: 12px;
  color: #D1D5DB;
  box-shadow: none;
}

/* 호버 시 자동 펼침 — 평소 접힘이므로 텍스트 숨김 룰을 호버 외부로 적용 */
#app-sidebar .sb-label,
#app-sidebar .sb-count,
#app-sidebar .sb-group-label,
#app-sidebar .sb-add-btn span,
#app-sidebar .sb-planned-list,
#app-sidebar .sb-version,
#app-sidebar .sb-title { display: none; }

#app-sidebar:hover,
#app-sidebar.is-pinned {
  width: 240px;
  box-shadow: 6px 0 20px rgba(0, 0, 0, 0.45);
}
#app-sidebar:hover .sb-label,
#app-sidebar:hover .sb-count,
#app-sidebar:hover .sb-group-label,
#app-sidebar:hover .sb-add-btn span,
#app-sidebar:hover .sb-planned-list,
#app-sidebar:hover .sb-version,
#app-sidebar:hover .sb-title,
#app-sidebar.is-pinned .sb-label,
#app-sidebar.is-pinned .sb-count,
#app-sidebar.is-pinned .sb-group-label,
#app-sidebar.is-pinned .sb-add-btn span,
#app-sidebar.is-pinned .sb-planned-list,
#app-sidebar.is-pinned .sb-version,
#app-sidebar.is-pinned .sb-title { display: inline; }

#app-sidebar:hover .sb-planned-list,
#app-sidebar.is-pinned .sb-planned-list { display: block; }

/* body는 항상 좁은 폭만 차지 (호버 시 사이드바가 본문 위에 오버레이) */
body.has-sidebar { margin-left: 48px; transition: margin-left 0.18s ease; }

/* ── HEADER ── */
.sb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.sb-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #9CA3AF;
}
.sb-toggle:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sb-title {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #9CA3AF;
}

/* ── BODY ── */
.sb-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sb-body::-webkit-scrollbar { width: 6px; }
.sb-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }

/* ── GROUP ── */
.sb-group {
  padding: 6px 0 14px 0;
}
.sb-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 4px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #5BC0EB;
}

/* ── ITEM (모드 진입 버튼) ── */
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #D1D5DB;
  text-align: left;
  font-size: 12.5px;
  border-left: 2px solid transparent;
  transition: background 0.1s ease, color 0.1s ease;
}
.sb-item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.sb-item.is-indent { padding-left: 30px; font-size: 12px; }
.sb-item.is-active {
  background: linear-gradient(90deg, rgba(0, 161, 224, 0.18) 0%, rgba(0, 161, 224, 0) 100%);
  color: #fff;
  border-left-color: #00A1E0;
}
.sb-item.is-accent { color: #5BC0EB; }
.sb-item .sidebar-icon { flex-shrink: 0; }

/* ── SUBGROUP (펼침/접힘) ── */
.sb-subgroup { margin-bottom: 2px; }
.sb-subgroup.is-planned .sb-subgroup-head { color: #6B7280; }
.sb-subgroup-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #D1D5DB;
  text-align: left;
  font-size: 12.5px;
}
.sb-subgroup-head:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.sb-count {
  margin-left: auto;
  font-size: 10px;
  color: #6B7280;
  font-weight: 500;
}

/* planned modules list */
.sb-planned-list { padding: 2px 0 4px 30px; }
.sb-planned-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
  color: #6B7280;
  font-style: italic;
}

/* ── ADD BUTTON ── */
.sb-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 16px);
  margin: 6px 8px 0 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #9CA3AF;
  cursor: pointer;
  font-size: 11.5px;
}
.sb-add-btn:hover {
  background: rgba(0, 161, 224, 0.08);
  border-color: rgba(0, 161, 224, 0.4);
  color: #00A1E0;
}

/* ── FOOTER ── */
.sb-footer {
  padding: 8px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10px;
  color: #4B5563;
  flex-shrink: 0;
}

/* ── ADD MODAL ── */
.sb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.sb-modal-card {
  background: #0F1929;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0;
  width: 480px;
  max-width: 92vw;
  color: #E5E7EB;
}
.sb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sb-modal-head h3 { font-size: 14px; font-weight: 600; margin: 0; color: #fff; }
.sb-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #9CA3AF;
  line-height: 1;
}
.sb-modal-close:hover { color: #fff; }
.sb-modal-body { padding: 16px 18px; font-size: 12.5px; line-height: 1.6; }
.sb-modal-help { margin: 0 0 8px 0; color: #9CA3AF; }
.sb-code {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(0, 161, 224, 0.12);
  color: #5BC0EB;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11.5px;
}
.sb-code-block {
  margin: 8px 0 0 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: #D1D5DB;
  white-space: pre;
  overflow-x: auto;
}

/* ── 헤더 패딩 슬림화 (사이드바 도입으로 topnav 제거됨) ── */
body.has-sidebar header { padding: 8px 18px !important; }

/* ── 모바일 ── */
@media (max-width: 768px) {
  #app-sidebar { width: 48px; }
  #app-sidebar .sb-label,
  #app-sidebar .sb-count,
  #app-sidebar .sb-group-label,
  #app-sidebar .sb-add-btn span,
  #app-sidebar .sb-planned-list,
  #app-sidebar .sb-version,
  #app-sidebar .sb-title { display: none; }
  body.has-sidebar { margin-left: 48px; }
}
