/* /public/css/investigation.css */
/* Investigation 탭 전용 (dashboard.css에서 분리) */

html.modal-open,
html.modal-open body {
  overflow: hidden;
}

/* Investigation Tab – 다크 카드 스타일 */
#investigation {
  background: #020617;
  border-radius: 14px;
  padding: 18px 16px 20px;
  color: #e5e7eb;
}

/* 내부 패널은 배경/테두리 제거해서 #investigation 배경만 보이게 */
#investigation .panel {
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

#investigation .inv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#investigation .inv-header h3 {
  margin: 0;
  color: #93c5fd;
  font-family: "Orbitron", sans-serif;
  font-size: 0.98rem;
  letter-spacing: 0.5px;
}

#investigation .inv-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 필터 */
#investigation .inv-filter {
  margin: 8px 0 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px);
}

#investigation .inv-filter-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.7fr;
  gap: 10px;
  align-items: end;
}

#investigation .inv-date-row {
  margin-top: 10px;
  grid-template-columns: 1fr auto;
  align-items: center;
}

#investigation .inv-field label {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 6px;
}

#investigation .inv-field input,
#investigation .inv-field select {
  width: 100%;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #0b1120;
  color: #e5e7eb;
  font-size: 13px;
  outline: none;
}

#investigation .inv-field input:focus,
#investigation .inv-field select:focus {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

#investigation .inv-date-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

#investigation .inv-date-inline .dash {
  color: #64748b;
  font-weight: 700;
}

#investigation .inv-filter-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

#investigation button.ghost {
  border: 1px solid #1f2937;
  background: #0b1120;
  color: #e5e7eb;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}
#investigation button.ghost:hover {
  background: #111827;
}

/* 레이아웃: 데스크탑 2열 */
#investigation .inv-body {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
  align-items: start;
}

/* 리스트 */
#investigation .inv-list {
  background: #020617;
  border-radius: 12px;
  border: 1px solid #1f2937;
  padding: 10px;
}

#investigation .table-wrap {
  overflow: auto;
  border-radius: 10px;
}

/* 리스트 테이블 */
#investigation #inv-list-table {
  table-layout: fixed;
  width: 100%;
  min-width: 740px; /* 모바일에서 가로 스크롤 */
  border-collapse: collapse;
  background: #020617;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1f2937;
}

#investigation #inv-list-table thead th,
#investigation #inv-list-table tbody td {
  padding: 10px 12px;
}

#investigation #inv-list-table thead th {
  background: #020617;
  color: #9ca3af;
  border-bottom: 1px solid #1f2937;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

#investigation #inv-list-table tbody td {
  background: #020617;
  color: #e5e7eb;
  border-bottom: 1px solid #0b1120;
}

#investigation #inv-list-table tbody tr[data-id] {
  cursor: pointer;
}
#investigation #inv-list-table tbody tr:hover td {
  background: #0b1120;
}
#investigation #inv-list-table tbody tr.selected td {
  background: #111827;
}

/* 긴 텍스트 말줄임 */
#investigation #inv-list-table td:nth-child(4),
#investigation #inv-list-table td:nth-child(6) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 상세 */
#investigation .inv-detail {
  background: #020617;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #1f2937;
}

/* 히어로 */
#investigation .inv-hero .ttl {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  margin: 10px 0;
  color: #e5e7eb;
}
#investigation .inv-hero .sub {
  text-align: center;
  opacity: 0.85;
  margin-bottom: 18px;
  color: #9ca3af;
}
#investigation .inv-hero .case-badge {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #020617;
  color: #cbd5e1;
  font-weight: 700;
}

#investigation .inv-hero .metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin-top: 18px;
  text-align: center;
}
#investigation .inv-hero .metrics .k {
  opacity: 0.7;
  font-size: 12px;
  margin-bottom: 6px;
  color: #9ca3af;
}
#investigation .inv-hero .metrics .v {
  font-size: 18px;
  font-weight: 700;
  color: #e5e7eb;
}
#investigation .rank-img {
  height: 40px;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

#investigation .inv-section {
  margin-top: 26px;
}
#investigation .inv-section h4 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #e5e7eb;
}

/* 매치 테이블 */
#investigation .inv-matches {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}
#investigation .inv-matches th,
#investigation .inv-matches td {
  padding: 8px 10px;
  border-bottom: 1px solid #1f2937;
}
#investigation .inv-matches th {
  background: #020617;
  color: #9ca3af;
}
#investigation .inv-matches td {
  color: #e5e7eb;
}
#investigation .inv-matches .empty {
  text-align: center;
  opacity: 0.7;
}

/* 스크린샷 */
#investigation .inv-screenshots .ss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

#investigation .inv-screenshots .ss-item {
  position: relative;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(31,41,55,0.9);
  background: #0b1120;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}
#investigation .inv-screenshots .ss-item:hover {
  transform: translateY(-2px);
  border-color: rgba(59,130,246,0.7);
}

#investigation .inv-screenshots .ss-item img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
}

#investigation .inv-screenshots .ss-tag {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 3px 7px;
  font-size: 11px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  border-radius: 999px;
  font-weight: 800;
}

/* 오버레이 */
#ss-overlay.ss-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
#ss-overlay .ss-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}
#ss-overlay .ss-overlay-inner {
  position: relative;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
#ss-overlay .ss-overlay-img {
  width: min(1100px, 94vw);
  height: min(740px, 78vh);
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0,0,0,0.65);
  border-radius: 12px;
  background: rgba(2,6,23,0.9);
}
#ss-overlay .ss-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: rgba(2,6,23,0.8);
  border: 1px solid rgba(148,163,184,0.2);
  color: #fff;
  font-size: 22px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
}
#ss-overlay .ss-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(2, 6, 23, 0.92);
  border: 1px solid rgba(148,163,184,0.2);
  color: #e5e7eb;
  font-size: 22px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  cursor: pointer;
}
#ss-overlay .ss-prev { left: 10px; }
#ss-overlay .ss-next { right: 10px; }

/* 도넛/레포트 */
#investigation .report-wrap {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
#investigation .donut {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  position: relative;
}
#investigation .donut-hole {
  position: absolute;
  inset: 28px;
  background: #020617;
  border-radius: 50%;
}
#investigation .donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#investigation .donut-center .main {
  font-weight: 800;
  font-size: 24px;
  color: #e5e7eb;
}
#investigation .donut-center .sub {
  opacity: 0.85;
  font-size: 12px;
  margin-top: 4px;
  color: #9ca3af;
}
#investigation .legend {
  list-style: none;
  padding: 0;
  margin: 0;
}
#investigation .legend li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #1f2937;
}
#investigation .legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
#investigation .legend .label {
  flex: 1;
  opacity: 0.95;
  color: #e5e7eb;
}
#investigation .legend .val,
#investigation .legend .per {
  width: 80px;
  text-align: right;
  color: #9ca3af;
}

#investigation .inv-report .report-wrap.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
#investigation .inv-report .report-right {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}
#investigation .report-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#investigation .report-item {
  padding: 12px 0;
  border-bottom: 1px solid #1f2937;
}
#investigation .report-item .hdr {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #9ca3af;
  font-size: 12px;
}
#investigation .report-item .nick {
  font-weight: 700;
  color: #e5e7eb;
}
#investigation .report-item .reason {
  margin: 4px 0;
  font-weight: 700;
  color: #f97316;
}
#investigation .report-item .body {
  color: #e5e7eb;
  white-space: pre-wrap;
  word-break: break-word;
}
#investigation .inv-report .report-right::-webkit-scrollbar {
  width: 8px;
}
#investigation .inv-report .report-right::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 8px;
}

/* 코멘트 */
#investigation .inv-comments {
  list-style: none;
  padding: 0;
  margin: 0;
}
#investigation .inv-comments li {
  padding: 12px 8px;
  border-bottom: 1px solid #1f2937;
}
#investigation .inv-comments .who {
  font-weight: 800;
  display: inline-block;
  margin-right: 8px;
  color: #e5e7eb;
}
#investigation .inv-comments .time {
  display: inline-block;
  opacity: 0.75;
  font-size: 12px;
  color: #9ca3af;
}
#investigation .inv-comments .txt {
  margin-top: 6px;
  color: #e5e7eb;
}
#investigation .inv-comments .meta {
  margin-top: 4px;
  opacity: 0.75;
  font-size: 12px;
  color: #9ca3af;
}

/* 페이지네이션 */
#investigation .pager {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  margin: 12px 0 4px;
  flex-wrap: wrap;
}
#investigation .pager .pg {
  border: 1px solid #1f2937;
  padding: 6px 10px;
  border-radius: 10px;
  background: #020617;
  cursor: pointer;
  color: #e5e7eb;
}
#investigation .pager .pg.current {
  font-weight: 800;
  outline: 2px solid #3b82f6;
}
#investigation .pager .pg:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#investigation .pager .ellipsis {
  padding: 0 6px;
  opacity: 0.7;
  color: #9ca3af;
}

/* 반응형 */
@media (max-width: 1100px) {
  #investigation .inv-hero .metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 980px) {
  #investigation .inv-body {
    grid-template-columns: 1fr;
  }

  #investigation .inv-filter-row {
    grid-template-columns: 1fr;
  }

  #investigation .inv-date-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #investigation .inv-filter-actions {
    justify-content: stretch;
  }

  #investigation .inv-filter-actions .submit,
  #investigation .inv-filter-actions .ghost {
    width: 100%;
  }

  #investigation .report-wrap,
  #investigation .inv-report .report-wrap.two-col {
    grid-template-columns: 1fr;
  }

  #investigation .donut {
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  #investigation {
    padding: 14px 12px 16px;
  }

  #investigation .inv-hero .ttl {
    font-size: 24px;
  }

  #ss-overlay .ss-overlay-inner {
    padding: 10px;
  }

  #ss-overlay .ss-overlay-img {
    width: 94vw;
    height: 68vh;
  }
}


/* ===============================
   SA.GG 확장 토큰 - 토글 스위치 UI
   =============================== */

.ext-token-box .ext-token-opt{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:10px 10px;
  border-radius:10px;
  border:1px solid #111827;
  background: linear-gradient(180deg, rgba(2,6,23,.92), rgba(2,6,23,.75));
  margin:6px 0 10px;
}

.ext-token-box .ext-token-opt-left{
  min-width:0;
}

.ext-token-box .ext-token-opt-title{
  font-size:12px;
  font-weight:700;
  color:#e5e7eb;
  line-height:1.1;
}

.ext-token-box .ext-token-opt-sub{
  margin-top:4px;
  font-size:11px;
  color:#94a3b8;
  line-height:1.2;
  word-break:keep-all;
}

/* Toggle */
.ext-token-box .sa-toggle{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:48px;
  height:26px;
  flex:0 0 auto;
  cursor:pointer;
  user-select:none;
}

.ext-token-box .sa-toggle input{
  position:absolute;
  inset:0;
  opacity:0;
  margin:0;
  cursor:pointer;
}

.ext-token-box .sa-toggle-track{
  position:absolute;
  inset:0;
  border-radius:999px;
  background: rgba(15,23,42,.85);
  border:1px solid rgba(30,41,59,.95);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.ext-token-box .sa-toggle-track::before{
  content:'';
  position:absolute;
  top:50%;
  left:3px;
  width:20px;
  height:20px;
  border-radius:50%;
  transform: translateY(-50%);
  background: #e5e7eb;
  box-shadow: 0 8px 16px rgba(0,0,0,.35);
  transition: transform .18s ease, background .18s ease;
}

/* ON */
.ext-token-box .sa-toggle input:checked + .sa-toggle-track{
  background: rgba(56,189,248,.18);
  border-color: rgba(56,189,248,.55);
  box-shadow: inset 0 0 0 1px rgba(56,189,248,.15), 0 0 0 3px rgba(56,189,248,.08);
}

.ext-token-box .sa-toggle input:checked + .sa-toggle-track::before{
  transform: translate(22px, -50%);
  background: #38bdf8;
}

/* Focus */
.ext-token-box .sa-toggle input:focus-visible + .sa-toggle-track{
  outline:2px solid rgba(56,189,248,.6);
  outline-offset:2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  .ext-token-box .sa-toggle-track,
  .ext-token-box .sa-toggle-track::before{
    transition:none;
  }
}
