/* 기본 스타일 — 클로드 디자이너 컴포넌트 이식 전 임시 */
:root {
  --primary: #003087;      /* 민주당 파란색 */
  --accent: #0070c0;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --badge-news: #1d4ed8;
  --badge-youtube: #dc2626;
  --badge-facebook: #2563eb;
  --badge-twitter: #0ea5e9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
body { font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; max-width: 100vw; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* 헤더 */
.site-header { background: var(--primary); color: white; padding: 0.75rem 0; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem; }
.site-title { color: white; text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 120px); }
.site-nav a { color: rgba(255,255,255,0.85); text-decoration: none; margin-left: 1rem; font-size: 0.9rem; white-space: nowrap; }
.site-nav a:hover { color: white; }

/* 메인 */
main.container { padding-top: 2rem; padding-bottom: 3rem; }

/* 푸터 */
.site-footer { background: #1e293b; color: #94a3b8; padding: 1.5rem 0; margin-top: 3rem; font-size: 0.8rem; }
.site-footer .disclaimer { margin-bottom: 0.5rem; }
.site-footer a { color: #60a5fa; }

/* 페이지 헤더 */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header .subtitle { color: var(--text-muted); margin-top: 0.25rem; }

/* 필터 바 */
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filter-bar select, .filter-bar button, .btn-reset, .filter-name-input {
  padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
  background: white; font-size: 0.9rem;
}
.filter-name-input { width: 130px; cursor: text; }
.filter-name-input:focus { outline: none; border-color: var(--accent); }
.filter-bar select { cursor: pointer; }
.filter-bar button { background: var(--primary); color: white; border-color: var(--primary); cursor: pointer; }
.btn-reset { text-decoration: none; color: var(--text-muted); cursor: pointer; }

.result-count { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }

/* 의원 카드 그리드 */
.politician-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.politician-card {
  background: var(--card-bg);
  border: 1px solid #dde3ef;
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none; color: inherit; cursor: pointer; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 48, 135, 0.07);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.politician-card:hover {
  box-shadow: 0 6px 20px rgba(0, 48, 135, 0.15);
  border-color: #a8bfe8;
  transform: translateY(-3px);
}

.card-photo { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 0.75rem; }
.card-photo-placeholder {
  width: 60px; height: 60px; border-radius: 50%; background: var(--accent);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; margin: 0 auto 0.75rem;
}
.card-name { font-weight: 600; text-align: center; margin-bottom: 0.25rem; }
.card-meta { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-bottom: 0.15rem; }
.card-terms { margin-top: 0; margin-bottom: 0.5rem; }

/* 배지 */
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: #dbeafe; color: #1e40af; font-size: 0.75rem; font-weight: 600;
}
.faction-badge { display: block; text-align: center; margin-bottom: 0.5rem; }
.badge-caveat { color: #f59e0b; }

/* 성향 바 */
.leaning-bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin: 0.25rem 0; }
.leaning-fill { height: 100%; background: linear-gradient(to right, #dc2626, #3b82f6); border-radius: 3px; }
.leaning-label { font-size: 0.75rem; color: var(--text-muted); }

/* 의원 상세 */
.detail-header { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 2rem; }
.detail-photo { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.detail-photo-placeholder {
  width: 100px; height: 100px; border-radius: 50%; background: var(--accent);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 700; flex-shrink: 0;
}
.detail-info h1 { font-size: 1.8rem; }
.hanja { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.committee { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }

/* 입각 리본 — 카드/헤더 상단 가로 바 */
.cabinet-ribbon {
  background: #1a3a6b;
  color: #fff;
  font-size: 0.72rem; font-weight: 700;
  padding: 5px 10px;
  text-align: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 9px 9px 0 0;
  /* 카드 padding 상쇄해 가장자리까지 꽉 채움 */
  margin: -1rem -1rem 0.75rem -1rem;
}
/* 입각 없는 카드 — 리본 자리만 확보, 투명 */
.cabinet-ribbon-empty { background: transparent; pointer-events: none; min-height: 28.5px; }
/* 상세 페이지 리본은 헤더 위에 */
.detail-header .cabinet-ribbon { border-radius: 8px 8px 0 0; margin-bottom: 12px; }
.detail-header .cabinet-ribbon-empty { display: none; }

/* 이름 옆 배지 (상세 페이지) */
.cabinet-badge {
  display: inline-block; vertical-align: middle;
  background: #1a3a6b; color: #fff;
  font-size: 0.75rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
  margin-left: 8px;
}

/* 카드 SNS 아이콘 */
.card-sns { display: flex; gap: 5px; margin: 4px 0; flex-wrap: wrap; justify-content: center; }
.card-sns-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 0.7rem; font-weight: 900; text-decoration: none;
  transition: opacity 0.15s;
}
.card-sns-icon:hover { opacity: 0.75; }
.sns-yt   { background: #ff0000; color: #fff; }
.sns-fb   { background: #1877f2; color: #fff; }
.sns-tw   { background: #000;    color: #fff; }
.sns-blog { background: #03c75a; color: #fff; font-size: 0.65rem; }

/* 재산 그래프 버튼 */
.asset-chart-btn {
  margin-left: auto; padding: 3px 10px; border: 1px solid #2563eb;
  border-radius: 6px; background: #eff6ff; color: #2563eb;
  font-size: 0.78rem; cursor: pointer; font-weight: 600;
  flex-shrink: 0;
}
.asset-chart-btn:hover { background: #2563eb; color: #fff; }

/* 모달 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 20px;
  width: 90%; max-width: 680px; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; font-weight: 700; font-size: 0.95rem;
}
.modal-close {
  border: none; background: none; font-size: 1.2rem;
  cursor: pointer; color: #666; padding: 0 4px;
}
.modal-close:hover { color: #000; }

/* SNS 링크 배지 */
.sns-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sns-badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; text-decoration: none;
  transition: opacity 0.15s;
}
.sns-badge:hover { opacity: 0.8; }
.sns-youtube  { background: #ff0000; color: #fff; }
.sns-facebook { background: #1877f2; color: #fff; }
.sns-twitter  { background: #000;    color: #fff; }
.sns-blog     { background: #03c75a; color: #fff; }
.sns-home     { background: #6b7280; color: #fff; }

/* 분석 카드 */
.analysis-card {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 1.5rem; margin-bottom: 2rem;
}
.analysis-card h2 { margin-bottom: 0.5rem; font-size: 1.2rem; }
.ai-badge { font-size: 0.7rem; background: #3b82f6; color: white; padding: 0.1rem 0.4rem; border-radius: 4px; vertical-align: middle; }
.analysis-disclaimer { font-size: 0.85rem; color: #4b5563; margin-bottom: 1rem; }
.analysis-row { margin-bottom: 0.75rem; }
.analysis-label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.2rem; }
.analysis-value { font-size: 0.95rem; }
.caveat { font-size: 0.8rem; color: #f59e0b; }
.leaning-bar-large { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; margin: 0.3rem 0; max-width: 300px; }
.analysis-summary { color: var(--text); font-size: 0.95rem; line-height: 1.6; }
.issue-list { padding-left: 1.2rem; font-size: 0.9rem; }
.issue-list li { margin-bottom: 0.25rem; }
.analysis-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.75rem; }

/* 발언 탭 */
.statements-section h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.tab-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; padding-bottom: 0; border-bottom: none; }
.tab-btn {
  padding: 0.35rem 0.85rem; border: none; cursor: pointer;
  border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  background: #f1f5f9; color: #64748b;
  transition: opacity 0.15s, transform 0.1s;
}
.tab-btn:hover { opacity: 0.85; }

/* 전체 탭 — 활성 */
.tab-btn.active { background: #1e3a5f; color: #fff; }

/* 소스별 파스텔 색상 (비활성) */
.tab-btn[data-source="news"]     { background: #e8edf5; color: #3d5a8a; }
.tab-btn[data-source="youtube"]  { background: #fde8e8; color: #c0392b; }
.tab-btn[data-source="blog"]     { background: #e6f4ea; color: #2e7d32; }
.tab-btn[data-source="facebook"] { background: #dbeafe; color: #1e40af; }
.tab-btn[data-source="twitter"]  { background: #e0f2fe; color: #0369a1; }

/* 소스별 활성 탭 — 진한 버전 */
.tab-btn[data-source="news"].active     { background: #3d5a8a; color: #fff; }
.tab-btn[data-source="youtube"].active  { background: #c0392b; color: #fff; }
.tab-btn[data-source="blog"].active     { background: #2e7d32; color: #fff; }
.tab-btn[data-source="facebook"].active { background: #1e40af; color: #fff; }
.tab-btn[data-source="twitter"].active  { background: #0369a1; color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* 발언 아이템 */
.statement-item {
  border-bottom: 1px solid var(--border); padding: 1rem 0;
}
.statement-item:last-child { border-bottom: none; }
.statement-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.statement-date, .statement-author { font-size: 0.8rem; color: var(--text-muted); }
.statement-title { font-size: 1rem; margin-bottom: 0.3rem; overflow-wrap: anywhere; word-break: break-word; }
.statement-title a { color: var(--text); text-decoration: none; }
.statement-title a:hover { color: var(--accent); text-decoration: underline; }
.statement-summary { font-size: 0.9rem; color: var(--text-muted); overflow-wrap: anywhere; word-break: break-word; }
.statement-ambiguous-warning { font-size: 0.8rem; color: #b45309; margin-top: 0.3rem; }

/* 소스 아이콘 (원형 뱃지) */
.src-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 0.62rem; font-weight: 900; color: #fff;
  flex-shrink: 0;
}
.src-news     { background: #9ca3af; font-size: 0.75rem; }
.src-youtube  { background: #dc2626; }
.src-blog     { background: #16a34a; }
.src-facebook { background: #2563eb; }
.src-twitter  { background: #0284c7; }

/* 검색 */
.search-form { display: flex; gap: 0.5rem; margin: 1rem 0 1.5rem; }
.search-form input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; }
.search-form button { padding: 0.5rem 1rem; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; }
.search-result-item { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.result-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.result-politician { font-weight: 600; color: var(--accent); text-decoration: none; }

/* about */
.about-page section { margin-bottom: 2rem; }
.about-page h2 { font-size: 1.1rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.about-page ul { padding-left: 1.2rem; }
.about-page li { margin-bottom: 0.4rem; }

/* 공통 */
.empty-state { color: var(--text-muted); padding: 2rem; text-align: center; }

/* 재산공개 */
.asset-section { margin: 2rem 0; }
.asset-section h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.asset-disclosure { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.75rem; overflow: hidden; }
.asset-disclosure-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; cursor: pointer; background: var(--surface); flex-wrap: wrap; }
.asset-disclosure-header:hover { background: var(--border); }
.asset-date { font-weight: 600; }
.asset-type { font-size: 0.8rem; color: var(--text-muted); }
.asset-change { font-size: 0.85rem; margin-left: auto; }
.asset-change.positive { color: #e53935; }
.asset-change.negative { color: #1e88e5; }
.asset-toggle { margin-left: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }
.asset-items { padding: 0 0.5rem 0.5rem; overflow-x: auto; max-width: 100%; }
.asset-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 480px; }
.asset-table th { background: var(--surface); padding: 0.4rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.asset-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.asset-table tr.summary-row td { background: #f9f9f9; font-weight: 600; }
.asset-table .amount { text-align: right; white-space: nowrap; }
.asset-table .asset-desc { max-width: 200px; word-break: break-all; }

/* 통계 바 */
.stats-bar { display: flex; gap: 2rem; margin-top: 1rem; }
.stat-item { display: flex; align-items: baseline; gap: 0.3rem; }
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* 의원 카드 수집건수 */
.card-count { font-size: 0.75rem; color: var(--text-muted); margin: 0; text-align: center; }

/* 발언 새로고침 버튼 */
.collect-btn {
  font-size: 0.8rem; padding: 0.25rem 0.7rem; margin-left: 0.8rem;
  background: var(--accent); color: #fff; border: none; border-radius: 4px;
  cursor: pointer; vertical-align: middle;
}
.collect-btn:hover { opacity: 0.85; }
.collect-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.collect-status { font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0 0.8rem; }

/* 모바일 대응 */
@media (max-width: 600px) {
  .site-title { font-size: 0.95rem; }
  .site-nav a { margin-left: 0.6rem; font-size: 0.82rem; }
  .detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-info h1 { font-size: 1.4rem; }
  .analysis-card { word-break: break-word; overflow-wrap: break-word; }
  .analysis-label, .analysis-value, .analysis-summary { word-break: break-word; overflow-wrap: break-word; }
  .statement-title, .statement-summary, .statement-meta { word-break: break-word; overflow-wrap: break-word; }
  .asset-table { font-size: 0.75rem; }
  .asset-table th, .asset-table td { padding: 0.3rem 0.4rem; }
  .modal-box { width: 95vw; }
  .tab-bar { gap: 0.3rem; flex-wrap: wrap; }
  .tab-btn { font-size: 0.78rem; padding: 0.3rem 0.6rem; }
  .sns-links { flex-wrap: wrap; }
}

/* 맨 위로 버튼 */
#scroll-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 100;
}
#scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#scroll-to-top:hover { background: var(--accent); }
