/* ============================================================
   SmartPlace V10-5 User Manual — Shared Stylesheet
   Covers: admin_manual.html, user_manual.html
   ============================================================ */

/* Google Fonts — Noto Sans KR */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* ============================================================
   Reset
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  --brand: #1565c0;
  --brand-dark: #0d4a91;
  --brand-soft: #e3f2fd;
  --ink: #1a1a1a;
  --text: #2b2b2b;
  --muted: #667085;
  --line: #e0e0e0;
  --canvas: #eef1f5;
  --card: #ffffff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 6px 18px rgba(16, 24, 40, 0.06);
  /* spacing scale */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
}

/* ============================================================
   Body
   ============================================================ */
body {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--canvas);
}

/* ============================================================
   Sidebar TOC
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100%;
  background: #f8f9fa;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.back-btn {
  display: inline-block;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px 12px;
  background: transparent;
  transition: border-color 0.15s, color 0.15s;
}

.back-btn:hover {
  color: #1565c0;
  border-color: #1565c0;
}

.sidebar nav {
  padding: 8px 0;
}

.sidebar nav .nav-group {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  letter-spacing: 0.04em;
  padding: 14px 20px 4px;
  margin-top: 6px;
  border-top: 1px solid #e0e0e0;
}

.sidebar nav .nav-group:first-of-type {
  margin-top: 0;
  border-top: none;
}

.sidebar nav a {
  display: block;
  font-size: 14px;
  padding: 8px 20px;
  color: #333;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
  background: #e9ecef;
}

.sidebar nav a.active {
  background: #e3f2fd;
  color: #1565c0;
  border-left-color: #1565c0;
  font-weight: 500;
}

/* ============================================================
   TOC Section Number
   ============================================================ */
.toc-section-number {
  display: inline-block;
  width: 24px;
  color: #999;
  font-size: 12px;
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
  margin-left: 280px;
  padding: 40px 48px 64px;
  max-width: 1020px;
}

/* leave room for the fixed indicator bar — admin manual only */
.main-content:has(.section-indicator) {
  padding-top: 70px;
}

/* ============================================================
   Sticky section indicator (현재 위치 + 읽기 진행)
   ============================================================ */
.section-indicator {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 48px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  backdrop-filter: blur(4px);
  z-index: 100; /* 고정 헤더가 본문(예: z-index:1 인 .step-number)을 덮도록 */
}

.section-indicator .si-part {
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.section-indicator .si-sep {
  color: var(--muted);
}

.section-indicator .si-sec {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-indicator .si-progress {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.section-indicator .si-bar {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 3px;
  width: 0;
  background: var(--brand);
}

/* Each section renders as a white card on the canvas */
.main-content > section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s5) var(--s6) var(--s6);
  margin-bottom: var(--s5);
  scroll-margin-top: 60px;
}

.main-content h2 {
  font-size: 25px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  scroll-margin-top: 72px;
}

.section-desc {
  font-size: 16px;
  color: var(--muted);
  margin-top: var(--s2);
  margin-bottom: var(--s5);
}

.main-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-top: var(--s5);
  margin-bottom: var(--s3);
}

/* ============================================================
   Screenshots
   ============================================================ */
.screenshot-full {
  display: block;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  margin: 16px 0;
}

.screenshot-step {
  display: block;
  max-width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  margin: 12px 0;
}

/* ============================================================
   Steps
   ============================================================ */
.steps {
  position: relative;
  margin: 20px 0;
}

/* Admin steps are collapsible <details> on a vertical rail.
   user_manual.html still uses plain <div class="step"> (shared CSS) — keep its
   original flex row (number beside content) so it is not broken. */
details.step {
  position: relative;
  margin-bottom: 14px;
}

div.step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

/* rail connector (details only): from this node down to the next node */
details.step::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  height: calc(100% - 32px + 14px);
  width: 2px;
  background: var(--line);
  z-index: 0;
}

details.step:last-child::before {
  display: none;
}

.step > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.step > summary::-webkit-details-marker {
  display: none;
}

.step-number {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 3px var(--card); /* white halo so rail line is hidden behind node */
}

/* disclosure chevron on the right of the summary */
.step > summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  transition: transform 0.12s ease;
}

.step:not([open]) > summary::after {
  transform: rotate(-90deg);
}

/* user_manual flex row: content fills beside the number */
.step-content {
  flex: 1;
}

/* admin details: content indented under the summary, clearing the rail */
details.step > .step-content {
  flex: initial;
  margin-left: 44px;
  margin-top: 8px;
}

/* ============================================================
   Callout Boxes
   ============================================================ */
.callout {
  padding: 14px 18px;
  border-radius: 4px;
  margin: 16px 0;
  border-left: 4px solid transparent;
}

.callout.tip {
  background: #e8f5e9;
  border-left-color: #4caf50;
}

.callout.tip::before {
  content: '💡 팁: ';
  font-weight: 700;
}

.callout.warning {
  background: #fff3e0;
  border-left-color: #ff9800;
}

.callout.warning::before {
  content: '⚠️ 주의: ';
  font-weight: 700;
}

.callout.note {
  background: #e3f2fd;
  border-left-color: #2196f3;
}

.callout.note::before {
  content: '📌 참고: ';
  font-weight: 700;
}

/* ============================================================
   Part Banner (업무 흐름 단계 구분)
   ============================================================ */
/* Part banner = full-bleed header at the top of its section card */
.part-banner {
  margin: calc(-1 * var(--s5)) calc(-1 * var(--s6)) var(--s5);
  padding: var(--s4) var(--s6);
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
}

.part-banner .part-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.part-banner .part-title {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

.part-banner .part-desc {
  display: block;
  font-size: 13px;
  margin-top: 6px;
  opacity: 0.92;
}

/* h2 directly under a part-banner needs no extra top gap (banner provides it) */
section .part-banner + h2 {
  margin-top: 0;
}

/* ============================================================
   Tables (빠른 시작 · FAQ · 용어집 · 역할 경로)
   ============================================================ */
.manual-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 15px;
}

.manual-table th,
.manual-table td {
  border: 1px solid var(--line);
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}

.manual-table thead th {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.manual-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.manual-table tbody tr:hover {
  background: #e3f2fd;
}

.manual-table td strong {
  color: #1a1a1a;
}

/* 첫 컬럼이 단계 번호/ID 인 표 강조 */
.manual-table td:first-child {
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================================
   Quick Start Highlight Box
   ============================================================ */
.quickstart-box {
  border: 2px solid #1565c0;
  border-radius: 8px;
  padding: 8px 20px 20px;
  margin: 20px 0;
  background: #f5f9ff;
}

.quickstart-box h3 {
  color: #1565c0;
}

/* ============================================================
   At-a-glance flow box (무거운 섹션 상단 흐름 요약)
   ============================================================ */
.at-a-glance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  padding: 14px 18px;
  margin: 0 0 var(--s5);
  background: var(--brand-soft);
  border: 1px solid #cfe3fb;
  border-radius: var(--radius-sm);
  font-size: 15px;
}

.at-a-glance .ag-label {
  font-weight: 700;
  color: var(--brand-dark);
  margin-right: var(--s1);
}

.at-a-glance .ag-step {
  background: #fff;
  border: 1px solid #cfe3fb;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
  color: var(--ink);
}

.at-a-glance .ag-arrow {
  color: var(--brand);
  font-weight: 700;
}

/* ============================================================
   Inline UI tokens — button names & menu paths
   ============================================================ */
.ui-btn {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: #eef2f7;
  border: 1px solid #d2dbe6;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 0.95em;
  line-height: 1.5;
  white-space: nowrap;
}

.ui-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  vertical-align: baseline;
}

.ui-path > .seg {
  background: #eef2f7;
  border: 1px solid #d2dbe6;
  border-radius: 6px;
  padding: 1px 8px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.ui-path > .sep {
  color: var(--muted);
  font-weight: 700;
}

/* numbered area list (화면의 ①②③ 배지와 1:1 대응) */
.ui-list {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
}

.ui-list > li {
  padding: 6px 0;
  line-height: 1.7;
}

.ui-list > li + li {
  border-top: 1px dashed var(--line);
}

.ui-list .ui-num {
  font-weight: 700;
  color: var(--brand);
  margin-right: 6px;
}

/* ============================================================
   PDF Cover + TOC (print-only skeleton; 페이지번호/링크는 차기 PDF 엔진이 채움)
   ============================================================ */
.pdf-cover,
.pdf-toc {
  display: none;
}

.pdf-cover {
  text-align: center;
}

.pdf-cover .cover-product {
  font-size: 40px;
  font-weight: 700;
  color: var(--brand);
}

.pdf-cover .cover-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 8px;
}

.pdf-cover .cover-meta {
  font-size: 14px;
  color: var(--muted);
  margin-top: 24px;
}

.pdf-toc h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}

.pdf-toc .toc-group {
  font-weight: 700;
  color: var(--brand);
  margin-top: 14px;
  font-size: 15px;
}

.pdf-toc .toc-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0 3px 14px;
  font-size: 14px;
}

.pdf-toc .toc-item .toc-num {
  color: var(--muted);
  min-width: 28px;
}

.pdf-toc .toc-item .toc-leader {
  flex: 1;
  border-bottom: 1px dotted var(--line);
  transform: translateY(-3px);
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  @page {
    size: A4;
    margin: 16mm 14mm;
  }

  body {
    background: #fff;
    font-size: 12pt;
  }

  /* screen-only chrome off */
  .sidebar,
  .section-indicator {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
    max-width: none;
  }

  /* cards flatten into clean document blocks */
  .main-content > section {
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0 0 8mm;
    break-inside: auto;
  }

  /* keep brand fills/borders in the PDF */
  .part-banner,
  .manual-table thead th,
  .at-a-glance,
  .at-a-glance .ag-step,
  .ui-btn,
  .ui-path > .seg,
  .callout {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .part-banner {
    background: #1565c0 !important;
    border-radius: 0;
    margin: 0 0 6mm;
    break-after: avoid;
  }

  .main-content h2,
  .main-content h3 {
    break-after: avoid;
  }

  /* screenshots: keep aspect ratio, fit a page, don't split */
  .screenshot-full,
  .screenshot-step {
    box-shadow: none;
    break-inside: avoid;
    max-height: 200mm;
    width: auto;
    max-width: 100%;
  }

  .manual-table thead th {
    background: #1565c0 !important;
  }

  .manual-table tr,
  .at-a-glance,
  .callout,
  .ui-list > li {
    break-inside: avoid;
  }

  /* details: always reveal content in PDF (belt-and-suspenders to beforeprint JS) */
  details.step > .step-content {
    display: block !important;
  }

  .step > summary::after {
    display: none;
  }

  /* cover + TOC become print-only pages */
  .pdf-cover,
  .pdf-toc {
    display: block;
    break-after: page;
  }

  .pdf-cover {
    height: 240mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}
