/* data-explorer.css — 5탭 데이터 직접 열람 */

.dx-wrap {
  margin-top: 32px;
  padding: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.dx-h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--clay-coral, #D03A5A);
  margin: 0 0 6px 0;
}

.dx-desc {
  color: #6b7280;
  font-size: 0.9rem;
  margin: 0 0 18px 0;
}

.dx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1.5px solid #f1e8eb;
  margin-bottom: 16px;
  padding-bottom: 8px;
}

.dx-tab {
  padding: 10px 16px;
  min-height: 44px;
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.dx-tab:hover {
  background: #fff5f7;
  border-color: var(--clay-coral, #D03A5A);
  color: var(--clay-coral, #D03A5A);
}

.dx-tab-active {
  background: var(--clay-coral, #D03A5A);
  color: white;
  border-color: var(--clay-coral-hover, #B82846);
  box-shadow: 0 2px 8px rgba(208, 58, 90, 0.25);
}

.dx-pane {
  display: none;
}

.dx-pane-active {
  display: block;
}

.dx-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.dx-input {
  padding: 8px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  min-width: 160px;
  font-family: inherit;
  background: white;
  color: #1f2937;
}

select.dx-input {
  padding-right: 28px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
}

.dx-input-sm {
  min-width: 110px;
  max-width: 140px;
}

.dx-input:focus {
  outline: none;
  border-color: var(--clay-coral, #D03A5A);
  box-shadow: 0 0 0 3px rgba(208, 58, 90, 0.1);
}

.dx-btn {
  padding: 8px 18px;
  min-height: 40px;
  background: var(--clay-coral, #D03A5A);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.dx-btn:hover {
  background: var(--clay-coral-hover, #B82846);
}

.dx-btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
  min-height: auto;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.dx-btn-sm:hover {
  background: var(--clay-coral, #D03A5A);
  color: white;
  border-color: var(--clay-coral, #D03A5A);
}

.dx-meta {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 8px 0 12px 0;
}

.dx-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 모바일 가로 스크롤 시각적 힌트 — 우측 그림자 */
  background:
    linear-gradient(to right, white 30%, rgba(255,255,255,0)),
    linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.12), rgba(0,0,0,0)),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.12), rgba(0,0,0,0)) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* 모바일 가로 스크롤 안내 라벨 */
@media (max-width: 768px) {
  .dx-table-wrap::before {
    content: "← 좌우로 스크롤 →";
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: #9ca3af;
    margin-bottom: 6px;
    font-weight: 500;
  }
}

.dx-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #4b5563;
}
.dx-pager button {
  padding: 6px 14px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.dx-pager button:hover:not(:disabled) {
  background: var(--clay-coral, #D03A5A);
  color: white;
  border-color: var(--clay-coral, #D03A5A);
}
.dx-pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* NER 원문 펼침 박스 */
.dx-raw-detail td {
  background: #fafafa !important;
  padding: 0 !important;
}
.dx-raw-box {
  padding: 16px 20px;
  background: linear-gradient(180deg, #fffaf6 0%, #fff 100%);
  border-left: 4px solid var(--clay-coral, #D03A5A);
}
.dx-raw-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 6px 0;
}
.dx-raw-meta {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 10px;
}
.dx-raw-summary {
  background: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 6px 0;
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid #fde2e8;
}
.dx-raw-summary strong { color: var(--clay-coral, #D03A5A); }
.dx-raw-body {
  margin: 10px 0;
}
.dx-raw-body summary {
  cursor: pointer;
  font-weight: 600;
  color: #4b5563;
  padding: 6px 10px;
  background: #f3f4f6;
  border-radius: 4px;
}
.dx-raw-body pre {
  background: #fff;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  white-space: pre-wrap;
  word-break: keep-all;
  font-family: 'Pretendard Variable', system-ui, sans-serif;
  font-size: 0.84rem;
  line-height: 1.7;
  color: #1f2937;
  max-height: 500px;
  overflow-y: auto;
  margin: 8px 0 0 0;
}
.dx-raw-footer {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e5e7eb;
}
.dx-raw-footer a { color: #0369a1; }

/* 수집 파이프라인 (진정성) 탭 */
.dx-pipe-h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--clay-coral, #D03A5A);
}
.dx-pipe-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}
.dx-pipe-totals > div {
  background: linear-gradient(135deg, #fff5f7, #fef2f4);
  border: 1px solid #fcc8d2;
  border-radius: 12px;
  padding: 14px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dx-pipe-num {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--clay-coral, #D03A5A);
}
.dx-pipe-totals span:nth-child(2) {
  font-size: 0.78rem;
  color: #6b7280;
}
.dx-pipe-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0.5rem 0 1rem;
}
.dx-pipe-card, .dx-pipe-prompt {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
}
.dx-pipe-card[open], .dx-pipe-prompt[open] {
  border-color: var(--clay-coral, #D03A5A);
}
.dx-pipe-card summary, .dx-pipe-prompt summary {
  cursor: pointer;
  font-size: 0.88rem;
}
.dx-pipe-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #374151;
}
.dx-pipe-detail code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.78rem;
}
.dx-pipe-pre {
  background: #1f2937;
  color: #d1d5db;
  padding: 12px 14px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: keep-all;
  margin: 8px 0;
}
.dx-pipe-trans {
  margin-top: 1rem;
  padding: 12px 16px;
  background: #ecfdf5;
  border-left: 4px solid #16a34a;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #14532d;
  line-height: 1.7;
}
.dx-pipe-wm {
  font-size: 0.78rem;
  color: #92400e;
  background: #fffbeb;
  padding: 6px 12px;
  border-radius: 4px;
  margin: 8px 0 0;
}
@media (max-width: 768px) {
  .dx-pipe-totals { grid-template-columns: 1fr; }
}

.dx-table-scroll {
  max-height: 600px;
  overflow: auto;
}

.dx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  /* table-layout:auto + word-break:keep-all → 한글 단어 단위 줄바꿈 (글자 단위 X) */
  word-break: keep-all;
  overflow-wrap: break-word;
}

.dx-table th {
  background: #fdf3f6;
  color: #1f2937;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--clay-coral, #D03A5A);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.dx-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: top;
  word-break: keep-all;
  overflow-wrap: break-word;
  min-width: 60px;
}

/* 긴 한글 텍스트가 들어가는 셀 — JS에서 dx-col-long / dx-cell-cols 클래스 명시 부여 */
.dx-table td.dx-cell-cols,
.dx-table td.dx-col-long {
  min-width: 140px;
}

/* 원본 링크는 한 줄 강제 */
.dx-table .dx-src-link,
.dx-table td:has(.dx-src-link) {
  white-space: nowrap;
}

/* 모바일: 표 자체가 max-content 폭 차지 → wrap이 가로 스크롤 */
@media (max-width: 768px) {
  .dx-table-wrap .dx-table {
    min-width: max-content;
    width: max-content;
  }
  .dx-table td,
  .dx-table th {
    min-width: 80px;
  }
  .dx-table td.dx-cell-cols,
  .dx-table td.dx-col-long {
    min-width: 180px;
    max-width: 280px;
  }
}

.dx-table tr:hover td {
  background: #fffaf6;
}

.dx-table-inner th {
  background: #f9fafb;
  border-bottom: 1.5px solid #d1d5db;
}

.dx-cell-cols {
  font-size: 0.78rem;
  color: #6b7280;
  max-width: 320px;
}

.dx-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.82rem;
}

.dx-mono {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  color: #6b7280;
}

.dx-detail-box {
  background: #fafafa;
  padding: 16px;
  border-radius: 8px;
  margin: 8px 0;
  border-left: 3px solid var(--clay-coral, #D03A5A);
}

.dx-detail-box strong {
  display: block;
  margin-bottom: 8px;
  color: #1f2937;
}

.dx-empty {
  padding: 24px;
  text-align: center;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 8px;
}

.dx-error {
  padding: 12px 16px;
  background: #fef2f2;
  color: #b91c1c;
  border-left: 3px solid #dc2626;
  border-radius: 6px;
}

.dx-comp-title {
  font-size: 1.05rem;
  margin: 0 0 12px 0;
  color: #1f2937;
}

.dx-comp-diff {
  margin-top: 16px;
  padding: 12px 16px;
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
  border-radius: 6px;
  font-size: 0.88rem;
}

.dx-comp-diff ul {
  margin: 6px 0 0 0;
  padding-left: 20px;
}

.dx-comp-wm {
  margin-top: 12px;
  font-size: 0.78rem;
  color: #92400e;
  background: #fffbeb;
  padding: 8px 12px;
  border-radius: 6px;
}

.dx-src-link {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f9ff;
  color: #0369a1;
  text-decoration: none;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
}

.dx-src-link:hover {
  background: #0369a1;
  color: white;
  border-color: #0369a1;
}

.dx-sources-box {
  margin-top: 24px;
  padding: 18px 20px;
  background: #f0fdf4;
  border-left: 4px solid #16a34a;
  border-radius: 8px;
}

.dx-sources-box h4 {
  margin: 0 0 10px 0;
  color: #15803d;
  font-size: 1rem;
}

.dx-sources-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: #1f2937;
  line-height: 1.7;
}

.dx-sources-box li {
  margin-bottom: 4px;
}

.dx-sources-box code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #d1fae5;
  color: #15803d;
}

.dx-sources-box .dx-src-link {
  background: #fff;
  border-color: #16a34a;
  color: #15803d;
}

.dx-sources-box .dx-src-link:hover {
  background: #16a34a;
  color: white;
}

/* Tab4 — 카드형 (셀당 평균 1,500자, 최대 7,700자라서 표 X) */
.dx-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.dx-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.dx-card[open] {
  border-color: var(--clay-coral, #D03A5A);
  box-shadow: 0 2px 8px rgba(208, 58, 90, 0.08);
}

.dx-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  background: #fafafa;
  transition: background 0.15s;
}

.dx-card-head::-webkit-details-marker {
  display: none;
}

.dx-card-head::before {
  content: '▶';
  font-size: 0.7rem;
  color: var(--clay-coral, #D03A5A);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.dx-card[open] .dx-card-head::before {
  transform: rotate(90deg);
}

.dx-card-head:hover {
  background: #fff5f7;
}

.dx-card-num {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  color: #6b7280;
  min-width: 30px;
}

.dx-card-title {
  flex: 1;
  font-weight: 600;
  color: #1f2937;
  word-break: keep-all;
}

.dx-card-meta {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
}

.dx-card-body {
  padding: 16px;
  background: white;
  font-size: 0.85rem;
  line-height: 1.6;
  border-top: 1px solid #f3f4f6;
}

.dx-card-row {
  margin-bottom: 12px;
}

.dx-card-row:last-child {
  margin-bottom: 0;
}

.dx-card-row strong {
  display: block;
  color: var(--clay-coral, #D03A5A);
  font-size: 0.82rem;
  margin-bottom: 4px;
  font-weight: 600;
}

.dx-card-row ul {
  margin: 0;
  padding-left: 20px;
  color: #374151;
}

.dx-card-row li {
  margin-bottom: 4px;
  word-break: keep-all;
}

.dx-card-row code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  color: #6b7280;
  background: #f9fafb;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #f3f4f6;
}

/* 모바일 */
@media (max-width: 768px) {
  /* Tab4 카드 헤더 — 모바일은 2줄 레이아웃 (제목 / 메타+링크) */
  .dx-card-head {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .dx-card-num {
    font-size: 0.72rem;
    min-width: 24px;
  }
  .dx-card-title {
    flex: 1 1 100%;
    font-size: 0.88rem;
    order: 1;
    /* 화살표 + 번호 다음 줄로 못 가게 */
    margin-left: -28px;
    padding-left: 28px;
  }
  .dx-card-meta {
    font-size: 0.72rem;
    flex: 1;
    order: 2;
  }
  .dx-card[open] .dx-card-meta,
  .dx-card .dx-card-head .dx-src-link {
    order: 3;
  }

  .dx-wrap {
    padding: 14px 12px;
    border-radius: 10px;
  }

  .dx-h3 {
    font-size: 1.05rem;
  }

  .dx-desc {
    font-size: 0.82rem;
    line-height: 1.5;
  }

  /* 모바일 dx-tabs — 가로 스크롤 chip 형태 (세로 stack 대신) */
  .dx-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }
  .dx-tabs::-webkit-scrollbar { height: 4px; }
  .dx-tabs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

  .dx-tab {
    flex: 0 0 auto;
    padding: 9px 12px;
    font-size: 0.82rem;
    min-height: 44px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .dx-controls {
    gap: 6px;
  }

  .dx-input {
    min-width: 100%;
    width: 100%;
  }

  .dx-input-sm {
    min-width: 100%;
    max-width: 100%;
  }

  .dx-btn {
    width: 100%;
  }

  .dx-table {
    font-size: 0.78rem;
  }

  .dx-table th,
  .dx-table td {
    padding: 6px 8px;
  }

  /* 데이터 원본 출처 박스 — 모바일 폰트 키움 */
  .dx-sources-box {
    padding: 14px 12px;
    font-size: 0.84rem;
  }
  .dx-sources-box ul {
    padding-left: 18px;
  }
  .dx-sources-box li {
    margin-bottom: 8px;
    line-height: 1.55;
  }
}

/* 작은폰 (<= 380px) */
@media (max-width: 380px) {
  .dx-wrap {
    padding: 12px 10px;
  }
  .dx-tab {
    font-size: 0.78rem;
    padding: 8px 10px;
  }
  .dx-table {
    font-size: 0.74rem;
  }
}

/* 양형위 SSOT + SOTA 통계 카드 */
.dx-stat-card {
  background: #fff; border: 1px solid #E5E7EB; border-radius: 8px;
  padding: 12px; text-align: center;
}
.dx-stat-card .big {
  font-size: 1.4rem; font-weight: 800; color: #1E40AF;
}
.dx-stat-card .lbl {
  font-size: 0.78rem; color: #6B7280; margin-top: 4px;
}
