/* ─────────────────────────────────────────────────────────────────────────
 * Report — prototype-v2 SoT: user-portal/report/index.html inline <style>
 *   뷰 전용 단일 라이브러리: 헤드라인 카드 + 검색 + 리스트 테이블 +
 *   내가 생성한 리포트 사이드바.
 * ──────────────────────────────────────────────────────────────────────── */

.rp-layout {
  padding: 8px 20px;
  max-width: var(--container-max);
  margin: 0 auto;
}
@media (min-width: 768px) {
  .rp-layout { padding: 12px 40px; }
}

/* UI-22 (V1.7.2) — 상단 타이틀·여백 축소: 리포트도 뉴스(UI-23)처럼 목록이 첫 뷰포트에 오게 한다.
   페이지 h1·설명 문구는 마크업에서 제거했고, 남는 헤더 슬롯은 여백만 차지하지 않도록 접어 둔다. */
.rp-page-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.rp-page-header:empty { display: none; }
.rp-page-header h1 { font-size: 22px; font-weight: 800; margin: 0 0 8px; color: var(--text-main); }
@media (min-width: 768px) { .rp-page-header h1 { font-size: 26px; } }
.rp-page-header p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.6; }

/* UI-20 — 안내 박스: 유채색 테두리 프레임 제거, 좌측 강조선 + 음영만 */
.rp-tab-intro {
  background: var(--surface-1-sunken, var(--bg-darker));
  border: none;
  border-left: 3px solid var(--primary-border, var(--primary));
  border-radius: var(--radius-sm, 8px);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.rp-tab-intro i { color: var(--primary); font-size: 14px; margin-top: 2px; flex-shrink: 0; }
.rp-tab-intro strong { color: var(--primary); font-weight: 800; }

/* 검색 필터 — prototype-v2 .filter-section / .search-box 정합 */
/* UI-20 — 필터 줄: 카드 프레임 제거(검색 입력 자체가 이미 프레임을 가짐) */
.rp-filter-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 12px;
  display: flex;
  gap: 20px;
  align-items: center;
  box-shadow: none;
}
.rp-search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.rp-search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--bg-darker);
  font-size: 15px;
  color: var(--text-main);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s;
}
.rp-search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 205, 0.1);
}
/* 검색 버튼 — 입력창 옆 */
.rp-search-btn {
  flex-shrink: 0;
  width: 48px;
  align-self: stretch;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s;
}
.rp-search-btn:hover { filter: brightness(1.08); }

.rp-divider-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rp-divider-label i { color: var(--primary); }

/* ── 로그인 시 2-컬럼 레이아웃: 본문 + 내가 생성한 리포트 사이드바 ── */
.rp-content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}
@media (min-width: 1280px) {
  .rp-content-wrapper.has-sidebar { grid-template-columns: 1fr 320px; gap: var(--spacing-xl); }
}
.rp-list-section { min-width: 0; }

.rp-sidebar { display: flex; flex-direction: column; gap: var(--spacing-lg); }
/* UI-20 — 사이드 위젯: 테두리 + 상단 4px 액센트 → 면·음영 기반 */
.rp-sidebar-widget {
  background: var(--surface-1, var(--bg-surface));
  border: none;
  border-top: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  box-shadow: var(--surface-1-shadow, none);
}
@media (min-width: 1280px) {
  .rp-sidebar { position: sticky; top: 90px; }
}
.rp-widget-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rp-widget-header i { font-size: 18px; color: var(--primary); }
.rp-widget-header h3 { font-size: 17px; font-weight: 800; margin: 0; color: var(--text-main); }
.rp-my-reports-widget[hidden] { display: none; }
.rp-my-reports-head { gap: 8px; }
.rp-my-reports-head h3 { font-size: 15px; white-space: nowrap; }
.rp-my-reports-count { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.rp-my-reports-all { margin-left: auto; color: var(--primary); font-size: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.rp-my-reports-all:hover { text-decoration: underline; }
.rp-my-reports-list { display: flex; flex-direction: column; }
.rp-my-report-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--surface-divider, var(--glass-border)); color: inherit; text-decoration: none; }
.rp-my-report-row:last-child { border-bottom: 0; }
.rp-my-report-row:hover strong { color: var(--primary); }
.rp-my-report-main { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rp-my-report-main strong { min-width: 0; overflow: hidden; color: var(--text-main); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.rp-my-report-meta { padding-left: 1px; color: var(--text-muted); font-size: 11.5px; }

/* ── 이번 주 주요 리포트 — headline 카드 (prototype headline-cards-grid 정합) ── */
.rp-headline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--surface-divider, var(--glass-border));
  border-bottom: 1px solid var(--surface-divider, var(--glass-border));
}
/* UI-20 — 헤드라인 카드: 테두리 프레임 제거, 배경 음영으로 구분 */
.rp-headline-card {
  display: flex;
  flex-direction: column;
  /* 페이지 배경 위에 놓이는 콘텐츠 카드 → surface-1(부상 톤).
     sunken 을 쓰면 다크(#0D1626 on #0F172A)에서 카드가 배경과 구분되지 않는다. */
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 15px 4px;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s;
}
.rp-headline-card:hover {
  background: var(--surface-1-sunken, var(--bg-darker));
  box-shadow: none;
  transform: none;
}
.rp-headline-card + .rp-headline-card {
  border-left: 1px solid var(--surface-divider, var(--glass-border));
  padding-left: 20px;
  margin-left: 16px;
}
.rp-headline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.rp-headline-date { display: inline-flex; align-items: center; gap: 4px; }
.rp-headline-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin: 0 0 10px;
  transition: color 0.2s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rp-headline-card:hover .rp-headline-title { color: var(--primary); }
.rp-headline-footer { margin-top: auto; display: flex; justify-content: flex-end; }
.rp-headline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.rp-headline-link:hover { text-decoration: underline; }
@media (max-width: 767px) {
  .rp-headline-grid { grid-template-columns: 1fr; }
  .rp-headline-card + .rp-headline-card {
    border-left: none;
    border-top: 1px solid var(--surface-divider, var(--glass-border));
    padding-left: 4px;
    margin-left: 0;
  }
}

/* 발행자 배지 — headline 카드 + 목록 테이블 + 상세 페이지 공용 */
.rp-issuer-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--bg-darker);
  color: var(--text-secondary);
  border-radius: 4px;
}

/* List table */
.rp-list-wrap {
  background: transparent;
  border: none;
  border-top: 1px solid var(--surface-divider, var(--glass-border));
  border-bottom: 1px solid var(--surface-divider, var(--glass-border));
  border-radius: 0;
  overflow-x: auto;
}
.rp-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}
.rp-list-table th,
.rp-list-table td {
  padding: 12px 12px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: top;
}
.rp-list-table th {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: transparent;
}
.rp-list-row { cursor: pointer; transition: background 0.2s; }
.rp-list-row:hover { background: var(--surface-1-sunken, var(--bg-darker)); }
.rp-list-no {
  color: var(--text-muted);
  font-size: 12px;
  font-family: monospace;
}
.rp-list-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  /* a(Link) 로도 렌더 — 키보드 접근용. 밑줄 제거 + 블록 유지. */
  text-decoration: none;
  display: inline-block;
}
.rp-list-title:hover { text-decoration: underline; }
.rp-list-title:focus-visible { outline: 2px solid var(--primary, #0071cd); outline-offset: 2px; }
.rp-list-snippet {
  display: none;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.rp-btn-download {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-darker);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.rp-btn-download:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}
.rp-btn-download:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Pagination */
.rp-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
  flex-wrap: wrap;
}
.rp-page-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rp-page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}
.rp-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.rp-page-btn.active {
  border-color: var(--primary);
}
.rp-page-ellipsis {
  align-self: center;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 4px;
}

/* 인라인 오류 배너 — 목록/상세 공용 */
.rp-form-error {
  background: var(--bg-accent-red);
  color: var(--danger);
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
}
.rp-empty {
  color: var(--text-muted);
  padding: 16px;
  font-size: 13px;
}

.rp-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.rp-status-badge.streaming { background: #fef3c7; color: #92400e; }
.rp-status-badge.complete  { background: #dcfce7; color: #166534; }
.rp-status-badge.error     { background: var(--bg-accent-red); color: var(--danger); }

/* ─── 자료유형 칩 (source 필터) ─────────────────────────────────── */
.rp-source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.rp-source-chip {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.rp-source-chip:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}
.rp-source-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* #41(A) 주요 지수 태그 — source 칩과 동일 pill 계열(일관성). 선택 시 색상 반전 강조. */
.rp-idx-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-divider, var(--glass-border));
}
.rp-idx-tags {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.rp-idx-tags::-webkit-scrollbar { display: none; }
.rp-create-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.rp-create-report-btn:hover { filter: brightness(1.06); }
.rp-create-report-btn[hidden] { display: none; }
.rp-idx-tags-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 2px;
}
.rp-idx-tag {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.rp-idx-tag:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.rp-idx-tag.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
/* ─── 출처 뱃지 (공사 발행 / AI 생성) ───────────────────────────── */
.rp-src-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.rp-src-official {
  background: rgba(0, 113, 205, 0.12);
  color: var(--primary);
}
.rp-src-ai {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

/* ─── Detail 페이지 (/user/report/:id) ─────────────────────────── */
.rp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.rp-back-link:hover { background: var(--glass-hover); color: var(--text-main); }

.rp-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.rp-detail-body {
  padding: var(--spacing-lg) 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--spacing-lg);
  min-height: 200px;
}
.rp-detail-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-main);
}
/* 멀티섹션 Markdown 본문(헤딩·표·목록) — renderMarkdown 출력 렌더 */
.rp-detail-content h2 {
  font-size: 19px;
  font-weight: 700;
  margin: var(--spacing-lg) 0 var(--spacing-sm);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--glass-border);
}
.rp-detail-content h2:first-child { margin-top: 0; }
.rp-detail-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin: var(--spacing-md) 0 4px;
  color: var(--text-main);
}
.rp-detail-content p { margin: 0 0 var(--spacing-sm); }
.rp-detail-content ul,
.rp-detail-content ol { margin: 0 0 var(--spacing-sm); padding-left: 1.4em; }
.rp-detail-content li { margin-bottom: 4px; }
.rp-detail-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-sm) 0 var(--spacing-md);
  font-size: 14px;
}
.rp-detail-content th,
.rp-detail-content td {
  border: 1px solid var(--glass-border);
  padding: 8px 10px;
  text-align: right;
}
.rp-detail-content th {
  background: var(--glass-bg, rgba(255, 255, 255, 0.04));
  font-weight: 600;
  text-align: center;
}
.rp-detail-content th:first-child,
.rp-detail-content td:first-child { text-align: left; }

/* 출처(다중 기사·지수) 섹션 */
.rp-detail-sources {
  margin-bottom: var(--spacing-lg);
}
.rp-sources-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--text-main);
}
.rp-sources-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rp-sources-list:last-child { margin-bottom: 0; }
.rp-sources-list a {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}
.rp-sources-list a:hover { text-decoration: underline; }
.rp-source-inert {
  color: var(--text-muted);
  font-size: 13px;
}
.rp-source-inert em { font-style: normal; }
.rp-source-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.rp-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rp-btn-primary,
.rp-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}
.rp-btn-primary {
  background: var(--primary);
  color: white;
}
.rp-btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.rp-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.rp-btn-secondary {
  background: transparent;
  border-color: var(--glass-border);
  color: var(--text-main);
}
.rp-btn-secondary:hover { background: var(--glass-hover); }

/* AI 리포트 만족도(👍/👎) — 성과지표 결과지표 계측 */
.rp-rate {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}
.rp-rate-label { font-size: 13px; color: var(--text-muted); }
.rp-rate-btn {
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--glass-border); border-radius: 6px;
  background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s, border-color .15s;
}
.rp-rate-btn:hover { color: var(--primary); border-color: var(--primary); }
.rp-rate-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rp-rate-btn.on.down { background: var(--danger, #d64545); border-color: var(--danger, #d64545); }
.rp-rate-thanks { font-size: 13px; color: var(--success, #2e7d32); font-weight: 600; }

/* 공사 발행 원본 PDF 인라인 뷰어 */
.rp-pdf-viewer { width: 100%; }
.rp-pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rp-pdf-page { width: 100%; max-width: 900px; height: auto; box-shadow: 0 1px 8px rgba(0,0,0,0.15); border-radius: 4px; background: #fff; }
