/* ═══════════════════════════════════════════════════════════ */
/* BNT 매뉴얼 (마인드맵) — bnt-manual                           */
/* ═══════════════════════════════════════════════════════════ */

.page#page-bnt-manual {
  max-width: none;
  padding: 0;
  margin: 0;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  contain: layout paint style;
}

.page#page-bnt-manual.active {
  display: flex;
}

/* 상단 툴바 */
.bm-toolbar {
  display: flex;
  align-items: center;
  /* justify-content 제거 — left+mid 좌측 정렬, right는 margin-left:auto로 우측 정렬 */
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px 12px;
}

/* auth.css:13의 전역 .btn-primary{width:100%; padding:10px} 무력화 (다른 페이지에도 비슷한 패치 존재).
   매뉴얼 toolbar의 모든 버튼은 동일한 .btn-sm 사이즈로 통일. */
.bm-toolbar .btn,
.bm-toolbar .btn-primary,
.bm-toolbar .btn-outline {
  width: auto !important;
  padding: 6px 12px;
  font-size: 12.5px;
}

.bm-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bm-toolbar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.bm-mode-badge {
  padding: 2px 8px;
  border-radius: 10px;
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 500;
}

.bm-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bm-zoom-group {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.bm-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
}
.bm-zoom-btn.bm-zoom-reset { font-size: 12px; width: 56px; }
.bm-zoom-btn:last-child { border-right: none; }
.bm-zoom-btn:hover { background: var(--surface2); color: var(--text); }
.bm-zoom-btn:active { background: var(--accent-light); }

/* 레이아웃: 좌측 마인드맵 + 우측 상세 */
.bm-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.bm-mindmap-wrap {
  position: relative;
  background: #fafbfc;
  border-right: 1px solid var(--border);
  overflow: hidden;
  cursor: grab;
}
.bm-mindmap-wrap.bm-panning {
  cursor: grabbing;
  user-select: none;
}
.bm-mindmap-wrap.bm-panning * {
  user-select: none;
}

.bm-mindmap-container {
  width: 100%;
  height: 100%;
  min-height: 500px;
  overflow: hidden;
  position: relative;
}

.bm-empty {
  padding: 40px;
  text-align: center;
  color: #6b7280;
}

/* 우측 상세 패널 */
.bm-detail-panel {
  background: var(--surface);
  overflow-y: auto;
  padding: 24px;
}

.bm-detail-empty {
  padding: 20px 0;
}

.bm-detail-empty h2 {
  margin: 0 0 12px 0;
  font-size: 20px;
}

.bm-detail-empty p {
  color: #6b7280;
  line-height: 1.6;
  margin: 8px 0;
}

.bm-detail-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.bm-detail-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}

.bm-detail-title {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  word-break: keep-all;
}

.bm-detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bm-detail-actions .btn {
  font-size: 12px;
  padding: 4px 10px;
}

.bm-detail-body {
  font-size: 14px;
  line-height: 1.7;
  color: #1f2937;
}

.bm-detail-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 20px 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.bm-detail-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 8px 0;
}

.bm-detail-body h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 6px 0;
  color: #374151;
}

.bm-detail-body p {
  margin: 8px 0;
}

.bm-detail-body ul,
.bm-detail-body ol {
  margin: 8px 0;
  padding-left: 22px;
}

.bm-detail-body li {
  margin: 4px 0;
}

.bm-detail-body strong {
  font-weight: 600;
  color: #111827;
}

.bm-detail-body code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: 'Monaco', 'Menlo', monospace;
}

.bm-detail-body pre.bm-code {
  background: #1f2937;
  color: #e5e7eb;
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  margin: 10px 0;
}

.bm-detail-body pre.bm-code code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.bm-detail-body table.bm-table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}

.bm-detail-body table.bm-table th,
.bm-detail-body table.bm-table td {
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}

.bm-detail-body table.bm-table th {
  background: #f3f4f6;
  font-weight: 600;
}

.bm-detail-meta {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
  font-size: 11px;
  color: #9ca3af;
}

/* 모달 전용 스타일 */
.bm-modal {
  width: min(600px, 92vw);
}

.bm-modal h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.bm-modal .form-row {
  margin-bottom: 12px;
}

.bm-modal .form-row label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

.bm-modal .form-row input[type="text"],
.bm-modal .form-row select,
.bm-modal .form-row textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}

.bm-modal .form-row textarea {
  resize: vertical;
  min-height: 220px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.5;
}

.bm-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.bm-modal .modal-actions .btn {
  white-space: nowrap;
  min-width: 64px;
}

.bm-warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 12px 0;
  font-size: 13px;
}

.bm-delete-target {
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 14px;
}

.bm-dim {
  color: #9ca3af;
  font-size: 12px;
}

/* 반응형 */
@media (max-width: 1100px) {
  .bm-layout {
    grid-template-columns: 1fr 360px;
  }
}

@media (max-width: 900px) {
  .bm-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    overflow-y: auto;
  }
  .bm-mindmap-wrap {
    min-height: 400px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .bm-detail-panel {
    max-height: none;
  }
}

/* ═════════════════════════════════════════════════════════════
   매뉴얼 트리뷰 (.bm-tree-* / .bm-content-* / .bm-search-*)
   기존 .bm-layout flex로 변경. tree-side(280px) + content-main(1fr).
   마인드맵 모드일 땐 .bm-mindmap-wrap이 flex:1로 전체 차지.
   ═════════════════════════════════════════════════════════════ */

/* 검색창 영역 — left 옆에 바로 붙음 (가운데 정렬 X). 우측 버튼들은 margin-left:auto로 우측 끝. */
.bm-toolbar-mid {
  flex: 0 1 320px;
  display: flex;
  padding: 0;
  min-width: 0;
}
.bm-search-wrap {
  position: relative;
  width: 100%;
}

/* 우측 버튼 그룹은 자동으로 우측 끝에 정렬 */
.bm-toolbar-right {
  margin-left: auto;
}
.bm-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  color: #94a3b8;
}
.bm-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color .12s, box-shadow .12s;
}
.bm-search-input:focus {
  outline: none;
  border-color: #0f7f97;
  box-shadow: 0 0 0 3px rgba(15,127,151,.12);
}

.bm-view-toggle { white-space: nowrap; }

/* toolbar 우측 버튼 공통 — 한국어 글자 줄바꿈으로 세로 깨지는 것 방지 */
.bm-toolbar-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* HTML5 hidden 속성 강제 — 일부 환경에서 display 우선순위 충돌 방지 */
.bm-zoom-group[hidden] { display: none !important; }

/* 매뉴얼 내보내기 형식 선택 모달 */
.bm-export-picker h3 { margin: 0 0 8px; font-size: 16px; }
.bm-export-picker-options {
  display: grid;
  gap: 8px;
}
.bm-export-picker-btn {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, border-color .12s, transform .08s;
}
.bm-export-picker-btn:hover {
  background: #ecfeff;
  border-color: #67e8f9;
  transform: translateY(-1px);
}
.bm-export-picker-btn strong {
  font-size: 14px;
  color: #0f172a;
}
.bm-export-picker-btn small {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
  line-height: 1.5;
}

/* 좌측 트리 */
.bm-tree-side {
  flex: 0 0 280px;
  background: #fafbfc;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}
.bm-tree-list {
  display: flex;
  flex-direction: column;
}
.bm-tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 6px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  border-left: 2px solid transparent;
  user-select: none;
  transition: background .1s, color .1s;
}
.bm-tree-item:hover { background: #eef2f7; }
.bm-tree-item.active {
  background: #ecfeff;
  color: #0c6478;
  font-weight: 700;
  border-left-color: #0f7f97;
}
.bm-tree-toggle {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 3px;
}
.bm-tree-toggle:hover { background: #cbd5e1; color: #475569; }
.bm-tree-toggle-empty { cursor: default; }
.bm-tree-toggle-empty:hover { background: transparent; }
.bm-tree-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 13px;
}
.bm-tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-tree-empty {
  padding: 24px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

/* 검색 결과 */
.bm-search-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
}
.bm-search-status strong { color: #0f172a; }
.bm-search-clear-btn {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  color: #64748b;
}
.bm-search-clear-btn:hover { background: #ffffff; color: #0f172a; }
.bm-search-results {
  display: flex;
  flex-direction: column;
}
.bm-search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .1s;
}
.bm-search-result-item:hover { background: #ecfeff; }
.bm-search-result-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #0f172a;
  font-size: 13px;
}
.bm-search-result-icon { font-size: 13px; flex-shrink: 0; }
.bm-search-result-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-search-result-path {
  margin-top: 2px;
  font-size: 11px;
  color: #94a3b8;
}
.bm-search-result-snippet {
  margin-top: 4px;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.bm-search-result-item mark {
  background: #fef08a;
  color: #0f172a;
  padding: 0 2px;
  border-radius: 2px;
}
.bm-search-result-snippet mark { background: #fef08a; }

/* 우측 본문 */
.bm-content-main {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  overflow-y: auto;
}
.bm-content-main .bm-detail-panel {
  background: transparent;
  padding: 24px 28px;
}

/* 빵부스러기 */
.bm-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #64748b;
}
.bm-breadcrumb-item {
  background: transparent;
  border: none;
  padding: 2px 6px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
.bm-breadcrumb-item:hover { color: #0f7f97; background: #ecfeff; }
.bm-breadcrumb-sep {
  color: #cbd5e1;
  font-size: 11px;
}

/* 자식 카드 그리드 */
.bm-content-children {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
}
.bm-content-children-head {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}
.bm-content-children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.bm-content-child-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  color: #0f172a;
  text-align: left;
  transition: background .1s, border-color .1s, transform .08s;
}
.bm-content-child-card:hover {
  background: #ecfeff;
  border-color: #67e8f9;
  transform: translateY(-1px);
}
.bm-content-child-icon { font-size: 14px; flex-shrink: 0; }
.bm-content-child-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* 마인드맵 wrap이 토글로 hidden일 때 잘 처리되도록 */
.bm-mindmap-wrap[hidden] { display: none !important; }
.bm-mindmap-wrap:not([hidden]) {
  flex: 1;
  min-width: 0;
}

@media (max-width: 880px) {
  .bm-layout { flex-direction: column; }
  .bm-tree-side {
    flex: 0 0 auto;
    max-height: 240px;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .bm-toolbar-mid { padding: 0 8px; }
}

/* 매뉴얼 Import 미리보기 모달 */
.bm-import-modal h3 { margin: 0 0 12px; font-size: 16px; }
.bm-import-info {
  font-size: 12.5px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.bm-import-info > div { margin: 2px 0; }
.bm-import-info code {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
}
.bm-import-info .bm-import-plus { color: #047857; font-weight: 700; }
.bm-import-info .bm-import-minus { color: #b91c1c; font-weight: 700; }
.bm-import-warning {
  font-size: 12.5px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.bm-import-backup-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #334155;
  margin-bottom: 8px;
  cursor: pointer;
}
.bm-import-summary-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin: 8px 0 4px;
}
.bm-import-summary {
  flex: 1;
  min-height: 100px;
  max-height: 320px;
  overflow: auto;
  font-family: 'SF Mono', Consolas, 'Noto Sans KR', monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.bm-import-apply-btn {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
}
.bm-import-apply-btn:hover { background: #b45309; border-color: #b45309; }
.bm-import-apply-btn:disabled { opacity: 0.6; cursor: not-allowed; }

