/* "ตรวจ unseen" tab — compare each recorded test clip against the training clip
   for the same word and tick the bad ones. Tokens (--panel, --line, --accent, …)
   come from library.css, which this page loads first. Layout mirrors the Dataset
   tab (sticky word list + wide content) so the two public tabs feel the same. */

body.unseen-page {
  height: auto !important;
  min-height: 100vh;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  display: block !important;
}

.unseen-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - 94px);
  width: 100%;
  background: var(--bg);
}

.unseen-sidebar {
  padding: 18px 12px 24px 18px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.unseen-sidebar .sidebar-card {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.unseen-sidebar .section-head { align-items: flex-start; }
.unseen-sidebar .section-head h2 { margin: 0 0 3px; }

.unseen-filter-row { display: flex; flex-wrap: wrap; gap: 6px; }

.unseen-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unseen-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: inherit;
}
.unseen-item:hover { background: var(--accent-soft); border-color: var(--line); }
.unseen-item.active { background: var(--accent-soft); border-color: var(--accent); }

.unseen-item-title { font-weight: 600; line-height: 1.25; }
.unseen-item-meta { font-size: 12px; color: var(--muted); }
.unseen-item-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.unseen-source-hint {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  margin: 0;
}

.unseen-content { padding: 18px 20px 40px; min-width: 0; }

.unseen-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--muted);
}
.unseen-empty h2 { margin: 12px 0 6px; color: var(--text); }
.unseen-empty p { margin: 0; max-width: 520px; }
.unseen-empty-icon { font-size: 42px; }

.unseen-workspace { display: flex; flex-direction: column; gap: 16px; }

.unseen-head-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}
.unseen-title-block h2 { margin: 0 0 4px; font-size: 26px; }
.unseen-title-block .meta-line { word-break: break-word; }
.unseen-head-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Reference left, test clips right — the whole point of the page is the
   side-by-side comparison, so the reference column never scrolls away. */
.unseen-grid {
  display: grid;
  grid-template-columns: minmax(250px, 24%) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.unseen-ref-card {
  position: sticky;
  top: 16px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.unseen-ref-card h3 { margin: 0; font-size: 16px; }
.unseen-ref-player video {
  width: 100%;
  border-radius: 8px;
  background: #000;
  display: block;
  max-height: 46vh;
}
.unseen-ref-angles { display: flex; flex-wrap: wrap; gap: 6px; }
.unseen-ref-card .meta-line { margin: 0; }

.unseen-test-card { padding: 12px 14px 14px; }
.unseen-test-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.unseen-test-head h3 { margin: 0; font-size: 16px; }
.unseen-test-head .meta-line { margin: 0; }

/* Exactly three per row. The reviewer is judging a sign against the reference, so
   the clip has to be big enough to read the hands — auto-fill packed 4-5 tiny cards
   into a wide screen instead. Narrower viewports drop to 2, then 1. */
.unseen-clip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.unseen-clip {
  position: relative;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 8px;
  cursor: pointer;
  transition: border-color .08s ease, background .08s ease;
}
.unseen-clip:hover { border-color: var(--accent); }
.unseen-clip-media {
  position: relative;
  line-height: 0;
}
.unseen-clip video {
  width: 100%;
  border-radius: 6px;
  background: #000;
  display: block;
  pointer-events: none;
}
.unseen-clip-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-all;
}
.unseen-clip-meta strong { color: var(--text); }

.unseen-clip.verdict-bad { border-color: var(--red); background: var(--red-soft); }
.unseen-clip.verdict-ok { border-color: var(--green); background: var(--green-soft); }

.unseen-clip-key {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.unseen-clip-flag {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  display: none;
}
.unseen-clip.verdict-bad .unseen-clip-flag { display: block; background: var(--red); color: #fff; }
.unseen-clip.verdict-ok .unseen-clip-flag { display: block; background: var(--green); color: #fff; }

/* The pass button sits over the clip: clicking the card ticks it BAD (the
   cull.py gesture), so "ผ่าน" needs its own hit area. Anchored inside
   .unseen-clip-media, so it stays on the video whatever the caption wraps to. */
.unseen-clip-pass {
  position: absolute;
  bottom: 8px;
  right: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  cursor: pointer;
}
.unseen-clip-pass:hover { border-color: var(--green); color: var(--green); }

.unseen-loading { margin: 10px 0 0; }

.unseen-notice {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 14px 16px;
  color: var(--muted);
  line-height: 1.5;
}
.unseen-notice strong { color: var(--text); }

@media (max-width: 900px) {
  .unseen-clip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .unseen-clip-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1080px) {
  .unseen-shell { grid-template-columns: minmax(0, 1fr); }
  .unseen-sidebar { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .unseen-grid { grid-template-columns: minmax(0, 1fr); }
  .unseen-ref-card { position: static; }
}
