/* ── 기본 리셋 & 폰트 ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  overflow-x: hidden;
}
body {
  min-height: 100%;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f5f8;
  color: #1a1a2e;
  overflow-x: hidden;
}

/* ── 레이아웃 ── */
.report-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── 헤더 ── */
.report-header {
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.member-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 2px solid rgba(0,0,0,0.1);
  background: #e8eaf0;
  flex-shrink: 0;
}

.report-header-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1;
}

.member-name {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 2.6rem;
  font-weight: 900;
  color: #1a1a2e;
  letter-spacing: -0.02em;
  line-height: 1;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
}

/* 이름 왼쪽 정당 색상 띠 */
.name-party-strip {
  display: block;
  width: 14px;
  align-self: stretch;
  flex-shrink: 0;
  margin-right: 12px;
}

.page-title {
  font-size: 2rem;
  font-weight: 900;
  color: #3344aa;
  letter-spacing: -0.02em;
}
.page-subtitle {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: #8899bb;
  letter-spacing: 0;
  margin-top: 4px;
  margin-bottom: 0;
}

.party-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
  flex-shrink: 0;
}
.party-minjoo  { background: rgba(58,123,213,0.12); border: 1px solid rgba(58,123,213,0.35); color: #2a6bcc; }
.party-power   { background: rgba(224,48,48,0.1);  border: 1px solid rgba(224,48,48,0.35);  color: #cc2222; }
.party-joguk   { background: rgba(155,89,182,0.12); border: 1px solid rgba(155,89,182,0.35); color: #8833cc; }
.party-gaehyuk { background: rgba(230,126,34,0.12); border: 1px solid rgba(230,126,34,0.35); color: #bb6600; }
.party-other   { background: rgba(85,102,136,0.08); border: 1px solid rgba(85,102,136,0.25); color: #556688; }

.district-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.76rem;
  color: #778899;
  background: rgba(0,0,0,0.04);
  border: 1px solid #dde0ea;
  flex-shrink: 0;
}

.report-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.back-link a {
  color: #7788aa;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.back-link a:hover { color: #3344aa; }

/* ── 크레딧 박스 ── */
.credit-box {
  display: inline-block;
  background: rgba(255,255,255,0.9);
  border: 1px solid #dde0ea;
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 12px;
  color: #778899;
  white-space: nowrap;
  user-select: none;
}
.credit-box a { color: #4455bb; text-decoration: none; }
.credit-box a:hover { color: #2233aa; text-decoration: underline; }

.report-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #dde0ea;
}

.related-links-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #dde0ea;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  color: #778899;
}
.related-links-box a { color: #4455bb; text-decoration: none; }
.related-links-box a:hover { color: #2233aa; text-decoration: underline; }
.related-links-divider { color: #ccddee; }

/* ── 요약 통계 ── */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #dde0ea;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.stat-label { font-size: 0.68rem; color: #889aaa; margin-bottom: 4px; letter-spacing: 0.04em; word-break: keep-all; }
.stat-value { font-size: 1.15rem; font-weight: 800; color: #3344aa; letter-spacing: -0.02em; word-break: keep-all; }

/* ── 섹션 ── */
.restaurant-section { margin-bottom: 44px; }
.restaurant-section h2 {
  font-size: 1.05rem;
  color: #556688;
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dde0ea;
}
.section-note { font-size: 0.72rem; color: #99aabb; margin-bottom: 14px; margin-top: 4px; }

/* ── 식당 리스트 ── */
.restaurant-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 14px;
}

.restaurant-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #edf0f5;
  transition: background 0.15s, border-color 0.15s;
  min-height: 60px;
  word-break: keep-all;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.restaurant-item:hover { background: #f0f4ff; border-color: #c0ccee; }
.r-rank { font-size: 0.8rem; font-weight: 800; color: #ccd0dc; min-width: 26px; text-align: right; flex-shrink: 0; }
.restaurant-item:nth-child(1) .r-rank { color: #c8a830; }
.restaurant-item:nth-child(2) .r-rank { color: #8899aa; }
.restaurant-item:nth-child(3) .r-rank { color: #aa7744; }
.r-info { flex: 1; min-width: 0; }
.r-name {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.r-name:hover { color: #3344aa; text-decoration: underline; }
.r-addr { display: block; font-size: 0.72rem; color: #99aabb; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.r-visits { font-size: 0.9rem; font-weight: 700; color: #4455bb; }
.r-avg    { font-size: 0.7rem; color: #99aabb; }
.r-spend  { font-size: 0.82rem; font-weight: 700; color: #cc4444; }

/* ── 인덱스 컨트롤 ── */
.index-controls {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#idx-search {
  background: #ffffff;
  border: 1px solid #dde0ea;
  border-radius: 8px;
  padding: 9px 16px;
  color: #1a1a2e;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  flex: 1;
  max-width: 320px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
#idx-search::placeholder { color: #aabbcc; }
#idx-search:focus { border-color: #4455ff; background: #f8f9ff; }

.idx-count { font-size: 0.78rem; color: #99aabb; white-space: nowrap; }

/* ── 필터 행 ── */
.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.filter-label {
  font-size: 0.72rem;
  color: #99aabb;
  padding-top: 5px;
  flex-shrink: 0;
  min-width: 24px;
}

/* ── 지역 칩 ── */
.rf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.rf-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.74rem;
  border: 1px solid #dde0ea;
  background: #ffffff;
  color: #556688;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.rf-chip em { font-style: normal; color: #99aabb; font-size: 0.65rem; }
.rf-chip:hover { background: #eef0ff; border-color: #99aadd; color: #3344aa; }
.rf-chip:hover em { color: #7788aa; }
.rf-chip.on {
  background: rgba(68,85,255,0.12);
  border-color: #4455ff;
  color: #3344cc;
  font-weight: 600;
}
.rf-chip.on em { color: #7788cc; }

/* ── 정당 칩 (색상 띠 포함) ── */
.pf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0 10px 0 0;
  border-radius: 12px;
  font-size: 0.74rem;
  border: 1px solid #dde0ea;
  background: #ffffff;
  color: #556688;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  overflow: hidden;
}
.pf-chip em { font-style: normal; color: #99aabb; font-size: 0.65rem; margin-left: 3px; }
.pf-party-strip {
  width: 14px;
  align-self: stretch;
  flex-shrink: 0;
  margin-right: 7px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.pf-chip:hover { background: #eef0ff; border-color: #99aadd; color: #3344aa; }
.pf-chip:hover .pf-party-strip { opacity: 1; }
.pf-chip:hover em { color: #7788aa; }
.pf-chip.on {
  background: rgba(68,85,255,0.12);
  border-color: #4455ff;
  color: #3344cc;
  font-weight: 600;
}
.pf-chip.on .pf-party-strip { opacity: 1; }
.pf-chip.on em { color: #7788cc; }

/* ── 의원 리스트 ── */
.member-index-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  margin-top: 16px;
}

.member-index-list li { display: block; }

/* 의원 링크 (색상 띠 스타일) */
.member-link {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a1a2e;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #dde0ea;
  transition: all 0.15s;
  overflow: hidden;
  width: 100%;
  min-height: 48px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.member-link:hover { background: #f0f4ff; border-color: #99aadd; color: #1a1a2e; }

.member-party-strip {
  width: 14px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.member-link:hover .member-party-strip { opacity: 1; }

.member-link-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 10px;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.member-link-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-link-district {
  display: block;
  font-size: 0.68rem;
  color: #99aabb;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-link:hover .member-link-district { color: #7788aa; }

/* ── 툴팁 & 모달 ── */
.tip-name  { font-size: 1.4rem; font-weight: bold; color: #1a1a2e; display: block; margin-bottom: 15px; }
.tip-popular { color: #dd3333; font-weight: bold; font-size: 0.75rem; }
.tip-row   { font-size: 1rem; color: #556688; display: block; margin-bottom: 8px; }
.tip-val   { color: #1a1a2e; font-weight: bold; }
.tip-btn {
  display: block;
  padding: 5px 15px;
  background: #f5f6fa;
  border: 1px solid #dde0ea;
  color: #4455bb;
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.2s;
}
.tip-btn:hover { background: #eaedf5; border-color: #aabbdd; color: #2233aa; }

/* ── 오버레이 & 고정 모달 ── */
#overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.2);
  z-index: 2000;
  display: none;
}
#modal-fixed {
  position: fixed;
  top: 0; left: 0;
  width: 34%; height: 100%;
  z-index: 2100;
  display: none;
  background: rgba(255,255,255,0.99);
  border-right: 1px solid #dde0ea;
  padding: 60px 30px;
  box-shadow: 6px 0 30px rgba(0,0,0,0.1);
  overflow-y: auto;
  color: #1a1a2e;
  line-height: 1.7em;
}
#modal-close {
  position: absolute;
  top: 20px; right: 20px;
  cursor: pointer;
  color: #4455bb;
  transition: color 0.2s;
  width: 24px; height: 24px;
}
#modal-close:hover { color: #1a1a2e; }

/* ── 방문 의원 목록 ── */
.visitors-section {
  margin-top: 18px;
  border-top: 1px solid #edf0f5;
  padding-top: 14px;
}
.visitors-title { font-size: 0.8rem; color: #99aabb; margin-bottom: 10px; }
.visitors-list { display: flex; flex-wrap: wrap; gap: 5px; }
.visitor-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 7px 0 0;
  border-radius: 12px;
  font-size: 0.72rem;
  border: 1px solid #dde0ea;
  background: #f8f9fc;
  color: #445566;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.visitor-party-dot {
  width: 15px;
  align-self: stretch;
  flex-shrink: 0;
  margin-right: 6px;
}
.visitor-more-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  border: 1px dashed #ccddee;
  color: #889aaa;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.visitor-more-btn:hover { color: #4455bb; border-color: #4455bb; }

/* ── 공유하기 버튼 ── */
.share-section {
  display: flex;
  justify-content: center;
  margin: 32px 0 0;
  padding-bottom: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: rgba(68,85,255,0.08);
  border: 1px solid rgba(68,85,255,0.28);
  border-radius: 24px;
  color: #4455bb;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.share-btn:hover {
  background: rgba(68,85,255,0.16);
  border-color: rgba(68,85,255,0.5);
  color: #2233cc;
}
.share-btn svg { flex-shrink: 0; }

/* ── 반응형 ── */
@media (max-width: 640px) {
  .stats-summary { grid-template-columns: 1fr; }
  .restaurant-item {
    flex-wrap: wrap;
    gap: 6px 14px;
  }
  .r-stats {
    flex: 0 0 100%;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-left: 40px;
    gap: 8px;
  }
  .r-avg { font-size: 0.72rem; }
  .report-header-right {
    flex: 0 0 100%;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .stats-summary { grid-template-columns: repeat(4, 1fr); }
  #modal-fixed { width: 60%; padding: 40px 20px; }
  .tip-name { font-size: 1.1rem; }
  .tip-row { font-size: 0.88rem; }
  .member-index-list { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 500px) {
  .report-wrap { padding: 24px 16px 60px; }
  .member-name { font-size: 1.8rem; }
  .report-header { gap: 10px; margin-bottom: 24px; }
  .page-subtitle { margin-bottom: 20px; }
  .stats-summary { grid-template-columns: 1fr; gap: 10px; }
  #modal-fixed {
    width: 100%; height: 72%;
    top: auto; bottom: 0;
    border-right: none;
    border-top: 1px solid #dde0ea;
    padding: 40px 18px 24px;
  }
  .restaurant-item { padding: 10px; gap: 10px; }
  .r-addr { font-size: 0.65rem; }
  .member-index-list { grid-template-columns: 1fr; }
  #idx-search { max-width: 100%; }
  .filter-row { flex-wrap: wrap; }
}
