/* ==========================================================
   grid.css — DB 표 공통 (네이버/구글 두 페이지가 같이 씁니다)
   툴바 · 표 · 필터행 · 페이저 · 상세 모달
   컬럼 너비/정렬은 페이지별 css(google.css · naver.css)에서 잡습니다.
   ========================================================== */

/* ── 툴바 ─────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.875rem;
  margin-bottom: 0.875rem;
  flex-wrap: wrap;
}

.search { display: flex; align-items: center; gap: 0.375rem; flex: 1 1 22rem; }
.search-col   { flex: 0 0 auto; min-width: 7.5em; }
.search-input { flex: 1 1 auto; min-width: 8em; }

.toolbar-right { display: flex; align-items: center; gap: 0.375rem; }
.size-label select { min-width: 5.5em; }


/* ── 표 ───────────────────────────────────── */
.table-card { overflow: hidden; }

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 16rem);
}

.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
  table-layout: fixed;
}

.grid th, .grid td {
  padding: 0.5em 0.65em;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 머리행 */
.grid thead th {
  position: sticky;
  z-index: 2;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}
.head-row th   { top: 0; height: 2.5em; }
.filter-row th { top: 2.5em; background: var(--surface); padding: 0.35em 0.4em; }
.filter-row th::after {          /* 필터행 아래 진한 경계 */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  border-bottom: 1px solid var(--line-strong);
}

.f-input { width: 100%; min-width: 0; font-size: 0.75rem; padding: 0.3em 0.45em; }

/* 정렬 가능한 머리 */
.sortable { cursor: pointer; transition: color .15s, background .15s; }
.sortable:hover { color: var(--text); background: #f1f3f6; }
.th-label { vertical-align: middle; }
.th-arrow { margin-left: 0.25em; color: var(--accent); font-size: 0.7em; visibility: hidden; }
.sortable.asc  .th-arrow::after { content: "▲"; }
.sortable.desc .th-arrow::after { content: "▼"; }
.sortable.asc  .th-arrow,
.sortable.desc .th-arrow { visibility: visible; }
.sortable.asc, .sortable.desc { color: var(--text); }

/* 본문행 */
.grid tbody tr { cursor: pointer; transition: background .1s; }
.grid tbody tr:hover { background: var(--accent-soft); }
.grid tbody tr.picked { background: #eef4ff; }
.grid tbody td { color: var(--text); }

/* 체크박스 칸 */
.col-check { width: 2.5em; text-align: center; padding-left: 0.5em; padding-right: 0.5em; }
.col-check input { cursor: pointer; width: 0.95em; height: 0.95em; accent-color: var(--accent); }

.cell-link { color: var(--accent); font-weight: 600; }
.cell-link:hover { text-decoration: underline; }
.cell-none { color: var(--faint); }


/* ── 표 하단 (선택삭제 · 페이저) ──────────── */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0.875rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.foot-left { display: flex; align-items: center; gap: 0.625rem; }
.sel-info  { color: var(--muted); font-size: 0.8125rem; }
.sel-info.on { color: var(--accent-dark); font-weight: 600; }

.pager { display: flex; align-items: center; gap: 0.25rem; }
.pager .btn { padding: 0.35em 0.7em; }
.pager-info { min-width: 6em; text-align: center; color: var(--muted); font-size: 0.8125rem; }


/* ── 상세 모달 ────────────────────────────── */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 40, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-back[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 46rem;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--line);
}
.modal-title { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.modal-sub   { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.8125rem; }
.modal-x     { font-size: 1rem; padding: 0.25em 0.55em; }

.modal-body { padding: 0.5rem 1.125rem 1.125rem; overflow-y: auto; }

/* 상세: 항목 목록 */
.detail-row {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 0.75rem;
  padding: 0.55em 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.detail-row:last-of-type { border-bottom: none; }
.detail-key { color: var(--muted); font-size: 0.8125rem; }
.detail-val { font-size: 0.8125rem; word-break: break-all; white-space: pre-wrap; }
.detail-val.empty-val { color: var(--faint); }

.detail-sec-title {
  margin: 1.125rem 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

/* 리뷰 카드 */
.review {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--surface-2);
}
.review-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
}
.review-author { font-weight: 600; }
.review-date   { color: var(--faint); font-size: 0.75rem; margin-left: auto; }
.review-stars  { color: #f5a524; letter-spacing: 0.05em; }
.review-text   { font-size: 0.8125rem; color: var(--text); white-space: pre-wrap; line-height: 1.55; }

/* 칩 묶음 · 영업시간 */
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.hours-list { display: flex; flex-direction: column; gap: 0.2rem; }
.hours-item { font-size: 0.8125rem; }


/* ── 좁은 화면 ────────────────────────────── */
@media (max-width: 60em) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { justify-content: flex-end; }
  .table-wrap { max-height: calc(100vh - 20rem); }
  .detail-row { grid-template-columns: 5.5em 1fr; }
}
