/* ── 기본 ───────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body { font-family: 'Noto Sans KR', sans-serif; }

/* ── 탭 버튼 ─────────────────────────────────────────────────────── */
.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 20px;
  font-size: 0.875rem; font-weight: 500;
  color: #6b7280;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
  white-space: nowrap;
}
.tab-btn:hover { color: #1e3a5f; }
.tab-btn.active { color: #1e3a5f; border-bottom-color: #1e3a5f; }

/* ── 페이지 섹션 ─────────────────────────────────────────────────── */
.page-section { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── 필터 셀렉트 ─────────────────────────────────────────────────── */
.filter-select {
  padding: 8px 28px 8px 10px;
  font-size: 0.8125rem;
  border: 1px solid #d1d5db; border-radius: 8px;
  background-color: #fff; color: #374151;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  cursor: pointer; transition: border-color 0.15s;
  font-family: 'Noto Sans KR', sans-serif;
}
.filter-select:focus { outline: none; border-color: #2d5f9e; box-shadow: 0 0 0 2px rgba(45,95,158,0.15); }

/* ── 법령 카드 ───────────────────────────────────────────────────── */
.law-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.law-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  border-color: #bfdbfe;
}
.law-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.law-card-title { font-size: 0.9375rem; font-weight: 700; color: #111827; line-height: 1.4; }
.law-card-title a { text-decoration: none; color: inherit; }
.law-card-title a:hover { color: #1e3a5f; text-decoration: underline; }

.type-badge {
  font-size: 0.6875rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px;
  white-space: nowrap; flex-shrink: 0;
}
.type-badge.법률   { background: #dbeafe; color: #1d4ed8; }
.type-badge.시행령 { background: #d1fae5; color: #065f46; }
.type-badge.시행규칙 { background: #e0e7ff; color: #3730a3; }
.type-badge.훈령   { background: #fef3c7; color: #92400e; }
.type-badge.예규   { background: #ede9fe; color: #5b21b6; }
.type-badge.고시   { background: #fce7f3; color: #9d174d; }
.type-badge.조례   { background: #f3f4f6; color: #374151; }

.category-chip {
  display: inline-flex; align-items: center;
  font-size: 0.6875rem; font-weight: 500; padding: 2px 8px; border-radius: 6px;
}

.law-card-desc { font-size: 0.8125rem; color: #6b7280; line-height: 1.6; }
.law-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.meta-item {
  font-size: 0.75rem; color: #9ca3af;
  display: flex; align-items: center; gap: 3px;
}
.meta-item svg { width: 12px; height: 12px; flex-shrink: 0; }

.keyword-list { display: flex; flex-wrap: wrap; gap: 4px; }
.keyword-chip {
  font-size: 0.6875rem; background: #f3f4f6; color: #6b7280; padding: 2px 7px; border-radius: 5px;
}

.law-card-footer {
  padding-top: 8px; border-top: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
}
.law-link {
  font-size: 0.8125rem; color: #2d5f9e; font-weight: 500;
  display: flex; align-items: center; gap: 4px; text-decoration: none;
  transition: color 0.15s;
}
.law-link:hover { color: #1e3a5f; text-decoration: underline; }
.law-link svg { width: 13px; height: 13px; }

/* ── 충돌·중복 분석 카드 ─────────────────────────────────────────── */
.conflict-card {
  background: #fff; border-radius: 12px; border: 1px solid #e5e7eb;
  overflow: hidden; transition: box-shadow 0.2s;
}
.conflict-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.07); }

.conflict-header {
  padding: 14px 18px; display: flex; align-items: center; gap-3px;
  justify-content: space-between; gap: 12px;
  border-bottom: 1px solid #f3f4f6;
}
.conflict-title { font-size: 1rem; font-weight: 700; color: #111827; }
.severity-badge {
  font-size: 0.6875rem; font-weight: 600; padding: 3px 10px; border-radius: 9999px;
  white-space: nowrap; flex-shrink: 0;
}
.conflict-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.conflict-laws { display: flex; flex-wrap: wrap; gap: 6px; }
.conflict-law-tag {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 6px;
  background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; font-weight: 500;
}
.conflict-section-label { font-size: 0.75rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.conflict-text { font-size: 0.8375rem; color: #4b5563; line-height: 1.65; }
.conflict-issue { background: #fff7ed; border-left: 3px solid #f97316; padding: 8px 12px; border-radius: 0 6px 6px 0; }
.conflict-issue p { font-size: 0.8125rem; color: #7c2d12; line-height: 1.6; }
.conflict-rec { background: #f0fdf4; border-left: 3px solid #22c55e; padding: 8px 12px; border-radius: 0 6px 6px 0; }
.conflict-rec p { font-size: 0.8125rem; color: #14532d; line-height: 1.6; }

/* ── 심각도 필터 버튼 ────────────────────────────────────────────── */
.severity-btn {
  padding: 6px 14px; font-size: 0.8125rem; font-weight: 500;
  border: 1px solid #d1d5db; border-radius: 9999px; background: #fff; color: #6b7280;
  cursor: pointer; display: inline-flex; align-items: center; transition: all 0.15s;
  font-family: 'Noto Sans KR', sans-serif;
}
.severity-btn:hover { border-color: #9ca3af; color: #374151; }
.severity-btn.active { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

/* ── 아이콘 버튼 ─────────────────────────────────────────────────── */
.icon-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid #e5e7eb;
  background: #fff; color: #374151; font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
  font-family: monospace;
}
.icon-btn:hover { background: #f3f4f6; }

/* ── 범례 ───────────────────────────────────────────────────────── */
.legend-item { display: flex; align-items: center; gap: 6px; color: #6b7280; }
.legend-line {
  width: 24px; height: 3px; border-radius: 2px; flex-shrink: 0;
}

/* ── D3 다이어그램 ──────────────────────────────────────────────── */
#law-diagram .link-근거 {
  stroke: #3b82f6; stroke-width: 1.6; fill: none; stroke-opacity: 0.55;
  marker-end: url(#arrow-blue);
}
#law-diagram .link-연계 {
  stroke: #94a3b8; stroke-width: 1.2; fill: none;
  stroke-dasharray: 4,3; stroke-opacity: 0.40;
  marker-end: url(#arrow-gray);
}
#law-diagram .link-충돌 {
  stroke: #ef4444; stroke-width: 2; fill: none;
  stroke-dasharray: 5,3; stroke-opacity: 0.65;
  marker-end: url(#arrow-red);
}

#law-diagram .node circle {
  stroke-width: 2; cursor: pointer;
  transition: stroke-width 0.1s, r 0.1s;
}
#law-diagram .node circle:hover { stroke-width: 3.5; filter: brightness(1.1); }
#law-diagram .node text {
  pointer-events: none; text-anchor: middle;
  font-family: 'Noto Sans KR', sans-serif;
}
#law-diagram .cluster-label {
  pointer-events: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
}

/* ── 유형별 섹션 헤더 ────────────────────────────────────────────── */
.law-type-section { margin-bottom: 2.5rem; scroll-margin-top: 120px; }

.law-type-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}

.law-type-badge {
  display: inline-block;
  font-size: 0.8125rem; font-weight: 700;
  padding: 3px 12px; border-radius: 9999px;
  white-space: nowrap; flex-shrink: 0;
  letter-spacing: -0.01em;
}

.law-type-count {
  font-size: 0.8125rem; font-weight: 600; color: #9ca3af;
  flex-shrink: 0;
}

.law-type-divider {
  flex: 1; height: 1px; background: #e5e7eb;
}

/* ── 유형 사이드바 버튼 ──────────────────────────────────────────── */
.type-nav-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 5px 8px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
  font-family: 'Noto Sans KR', sans-serif;
  gap: 4px;
}
.type-nav-btn:hover {
  background: #f3f4f6; border-color: #e5e7eb;
}
.type-nav-btn--active {
  background: #eff6ff !important; border-color: #bfdbfe !important;
}

.type-nav-badge {
  display: inline-block;
  font-size: 0.6875rem; font-weight: 600;
  padding: 2px 7px; border-radius: 9999px;
  white-space: nowrap; flex-shrink: 0;
}

.type-nav-count {
  font-size: 0.6875rem; color: #9ca3af; font-weight: 500; flex-shrink: 0;
}

/* ── 스크롤바 ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
