/* ====================================================
   page.css  —  개별 실·국 페이지 공통 스타일
   ==================================================== */

body { background: #f4f6f8; }

/* ── 헤더 ── */
header {
  background: linear-gradient(135deg, #1a6cb5 0%, #0fa4c7 100%);
  color: #fff; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 100;
}
header .logo {
  display: flex; align-items: center; gap: 10px;
}
.logo-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff;
}
.logo-img {
  height: 34px; width: 34px; object-fit: contain;
  border-radius: 6px; background: #fff; padding: 2px;
  flex-shrink: 0; display: block;
}
.logo-name { font-size: 17px; font-weight: 700; }
.badge {
  background: rgba(255,255,255,.2); border-radius: 4px;
  padding: 2px 8px; font-size: 12px; font-weight: 400;
}
header nav { display: flex; align-items: center; }
.nav-home { color: rgba(255,255,255,.85); font-size: 13px; }
.nav-home:hover { color: #fff; }

/* ── 메타 배너 ── */
.meta-banner {
  background: #1a6cb5; color: #fff;
  text-align: center; padding: 6px; font-size: 12px; letter-spacing: .5px;
  position: sticky; top: 60px; z-index: 99;
}

/* ── 탭 바 (본문/연혁 2탭 형식) ── */
.tab-bar {
  background: #fff; border-bottom: 2px solid #1a6cb5;
  display: flex; align-items: center; padding: 0 24px; gap: 2px;
  position: sticky; top: 90px; z-index: 98;
}
.tab-bar .tab {
  padding: 10px 18px; font-size: 13px; cursor: pointer;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 4px 4px 0 0; color: #555; background: #f0f4f8;
  transition: background .15s;
}
.tab-bar .tab.active { background: #1a6cb5; color: #fff; border-color: #1a6cb5; }
.tab-bar .tab:hover:not(.active) { background: #dce8f5; }
.tab-bar .spacer { flex: 1; }
.tab-bar .print-btn {
  background: #0fa4c7; color: #fff; border: none; border-radius: 4px;
  padding: 6px 14px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.tab-bar .print-btn:hover { background: #0d8fad; }

/* ── 문서 탭 바 (다중 탭 형식) ── */
.doc-tab-bar {
  background: #fff; border-bottom: 2px solid #1a6cb5;
  display: flex; flex-wrap: wrap; padding: 0 16px; gap: 2px;
  position: sticky; top: 90px; z-index: 98;
}
.doc-tab {
  padding: 10px 20px; font-size: 13px; cursor: pointer;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 4px 4px 0 0; color: #555; background: #f0f4f8;
  white-space: nowrap; transition: background .15s;
}
.doc-tab.active { background: #1a6cb5; color: #fff; border-color: #1a6cb5; }
.doc-tab:hover:not(.active) { background: #dce8f5; }
.spacer { flex: 1; }
.print-btn {
  background: #0fa4c7; color: #fff; border: none; border-radius: 4px;
  padding: 6px 14px; font-size: 12px; cursor: pointer; margin: 8px 0;
}
.print-btn:hover { background: #0d8fad; }

/* ── 서브 탭 바 (본문/개정이력) ── */
.sub-tab-bar {
  background: #fff; border-bottom: 1px solid #dde3ea;
  display: flex; padding: 0 24px; gap: 2px;
  position: sticky; top: 132px; z-index: 97;
}
.sub-tab-bar.hidden-bar { display: none; }
.sub-tab-bar.hidden-bar.visible { display: flex; }
.sub-tab {
  padding: 7px 16px; font-size: 12px; cursor: pointer;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 4px 4px 0 0; color: #555; background: #f8fafc;
}
.sub-tab.active { background: #e8f0f8; color: #1a6cb5; border-color: #c0d4eb; font-weight: 700; }

/* ── 교육국 부서 탭 바 ── */
.dept-tab-bar {
  background: #fff; border-bottom: 2px solid #1a6cb5;
  display: flex; flex-wrap: wrap; padding: 0 16px; gap: 2px;
  position: sticky; top: 90px; z-index: 98;
}
.dept-tab {
  padding: 10px 20px; font-size: 13px; cursor: pointer;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 4px 4px 0 0; color: #555; background: #f0f4f8;
  white-space: nowrap; transition: background .15s;
}
.dept-tab.active { background: #1a6cb5; color: #fff; border-color: #1a6cb5; }
.dept-tab:hover:not(.active) { background: #dce8f5; }

/* ── PDF 뷰어 (교육국 등 다중 iframe) ── */
.viewer-wrap { width: 100%; }
.pdf-frame {
  display: none; width: 100%; border: none;
  height: calc(100vh - 150px);
}
.pdf-frame.active { display: block; }

/* ── 문서/탭 패널 ── */
.doc-panel { display: none; }
.doc-panel.active { display: block; }
.history-panel { display: none; }
.history-panel.visible { display: block; }

/* ── 2단 레이아웃 (사이드바 + 메인) ── */
.layout { display: flex; max-width: 1200px; margin: 20px auto; gap: 20px; padding: 0 20px; }

aside { width: 220px; flex-shrink: 0; }
aside .sidebar-card {
  background: #fff; border: 1px solid #dde3ea; border-radius: 6px;
  overflow: hidden; position: sticky; top: 130px;
  max-height: calc(100vh - 130px); overflow-y: auto;
}
aside .sidebar-header {
  background: #1a6cb5; color: #fff;
  padding: 10px 14px; font-size: 13px; font-weight: 700;
}
aside ul { list-style: none; }
aside ul li a {
  display: block; padding: 7px 14px; font-size: 12px;
  border-bottom: 1px solid #eef0f3; color: #333; transition: background .1s;
}
aside ul li a:hover,
aside ul li a.active { background: #dce8f5; color: #1a6cb5; }
aside ul li.addendum a { color: #888; font-style: italic; }

main { flex: 1; min-width: 0; }

/* ── 문서 카드 ── */
.doc-card {
  background: #fff; border: 1px solid #dde3ea;
  border-radius: 6px; padding: 32px 40px; margin-bottom: 16px;
}

/* ── 문서 제목 블록 ── */
.doc-title {
  text-align: center; margin-bottom: 28px;
  border-bottom: 2px solid #1a6cb5; padding-bottom: 16px;
}
.doc-title h1 { font-size: 22px; font-weight: 700; color: #111; margin-bottom: 8px; }
.doc-title .promulgation { font-size: 12px; color: #1a6cb5; margin-bottom: 4px; }
.doc-title .dept,
.doc-title .sub { font-size: 12px; color: #666; }

/* ── 법령 본문 구조 ── */
.article { margin-bottom: 20px; scroll-margin-top: 130px; }
.article-head { font-weight: 700; color: #111; line-height: 1.7; }
.article-head .article-num { color: #1a6cb5; margin-right: 2px; }
.article-head .article-num.draft-num { color: #e67e22; }

.clause { display: flex; gap: 6px; margin: 5px 0 5px 16px; line-height: 1.75; }
.clause .cn { flex-shrink: 0; color: #555; min-width: 16px; }

.item { display: flex; gap: 6px; margin: 4px 0 4px 32px; line-height: 1.75; }
.item .in { flex-shrink: 0; color: #666; min-width: 14px; }

.sq-item { margin: 3px 0 3px 16px; line-height: 1.85; }

/* ── 부칙 ── */
.addendum-section {
  margin-top: 32px; border-top: 2px solid #1a6cb5;
  padding-top: 20px; scroll-margin-top: 130px;
}
.addendum-title {
  font-size: 15px; font-weight: 700; color: #1a6cb5;
  text-align: center; margin-bottom: 16px;
}
.addendum-date { font-size: 12px; color: #888; text-align: right; margin-bottom: 12px; }

/* ── 개정안 배너 ── */
.draft-banner {
  background: #fff3cd; border: 1px solid #ffc107; border-radius: 6px;
  padding: 10px 16px; margin-bottom: 16px; font-size: 13px; color: #856404;
}

/* ── 자료 없음 안내 ── */
.pending-box { text-align: center; padding: 80px 20px; color: #aaa; }
.pending-box .icon { font-size: 48px; margin-bottom: 16px; }
.pending-box p { font-size: 15px; margin-bottom: 8px; color: #888; }
.pending-box small { font-size: 12px; color: #bbb; }

/* ── 연혁 테이블 ── */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
  background: #1a6cb5; color: #fff;
  padding: 10px 12px; text-align: center;
}
.history-table td {
  padding: 9px 12px; border-bottom: 1px solid #eef0f3;
  text-align: center; color: #444;
}
.history-table tr:nth-child(even) td { background: #f8fafc; }
.history-table .badge-new {
  background: #e8f4fd; color: #1a6cb5;
  border-radius: 3px; padding: 1px 6px; font-size: 11px;
}
.history-table .badge-rev {
  background: #fff3e0; color: #e67e00;
  border-radius: 3px; padding: 1px 6px; font-size: 11px;
}

/* ── PDF 뷰어 ── */
.pdf-wrap { width: 100%; height: calc(100vh - 112px); }
.pdf-wrap iframe { width: 100%; height: 100%; border: none; display: block; }

/* ── 인쇄 ── */
@media print {
  header, .meta-banner, .tab-bar, .doc-tab-bar, .sub-tab-bar,
  aside, .print-btn, footer { display: none !important; }
  .layout { max-width: 100%; margin: 0; padding: 0; }
  .doc-card { border: none; padding: 20px; box-shadow: none; }
  body { background: #fff; font-size: 12px; }
  .article-head .article-num { color: #000; }
  .doc-title { border-color: #000; }
  .addendum-section { border-color: #000; }
  .addendum-title { color: #000; }
}

/* ── 모바일 반응형 ── */
@media (max-width: 768px) {
  header { height: 52px !important; padding: 0 14px !important; }
  .meta-banner { top: 52px !important; font-size: 11px; padding: 4px 10px; }
  .tab-bar { top: 80px !important; padding: 0 10px !important; overflow-x: auto; }
  .doc-tab-bar { top: 80px !important; padding: 0 10px !important; overflow-x: auto; }
  .layout { flex-direction: column !important; padding: 0 10px !important; margin: 10px auto !important; gap: 12px !important; }
  aside { width: 100% !important; }
  aside .sidebar-card { position: static !important; max-height: none !important; }
  .doc-card { padding: 20px 16px !important; }
  .doc-content { padding: 16px !important; }
}
@media (max-width: 480px) {
  .logo-title { display: none; }
  .doc-tab { padding: 8px 12px; font-size: 12px; }
  .tab-bar .tab { padding: 8px 12px; font-size: 12px; }
  .ham-menu { width: 220px; }
}
