/* Review app — dark editor chrome. 3-pane workspace. */

:root {
  --bg: #0a0a0f;
  --panel: #15151e;
  --panel-2: #1c1c28;
  --border: #242433;
  --accent: #ffe66d;
  --teal: #4ecdc4;
  --red: #ff6b6b;
  --amber: #f4a261;
  --text: #f0f0f0;
  --muted: #7d7d8f;
  --muted-2: #5a5a6e;
  --topbar-h: 48px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  height: 100vh;
  overflow: hidden;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--accent); }

button {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
button:hover { border-color: var(--accent); }
button.ghost { background: transparent; }
button.primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }
button.tiny { padding: 2px 8px; font-size: 12px; }

input, textarea, select {
  font: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--accent);
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ─── Login ─────────────────────────────────────────────────── */
.login {
  max-width: 340px;
  margin: 15vh auto;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.login h1 { margin-top: 0; color: var(--accent); }
.login label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.login input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
}
.login button { width: 100%; }
.error { color: var(--red); margin: 4px 0 12px; font-size: 13px; }

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar h1 { margin: 0; font-size: 15px; font-weight: 500; }
.topbar .back { color: var(--muted); font-size: 13px; margin-right: 4px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ─── Projects list ──────────────────────────────────────────── */
.projects { padding: 24px; max-width: 900px; margin: 0 auto; overflow-y: auto; height: calc(100vh - var(--topbar-h)); }
.project-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.project-list a {
  display: block;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.project-list a:hover { border-color: var(--accent); }
.project-list .name { font-weight: 600; color: var(--accent); }
.project-list .meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); padding: 40px; text-align: center; }

/* ─── Workspace (3-pane) ────────────────────────────────────── */
.workspace {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ─── Left pane: media bin ──────────────────────────────────── */
.bin {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bin-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  font-size: 11px; letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.bin-list { flex: 1; overflow-y: auto; padding: 6px 0; }

.bin-group { margin: 2px 0; }
.bin-group summary {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 13px;
}
.bin-group summary::-webkit-details-marker { display: none; }
.bin-group summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.12s;
  width: 8px;
}
.bin-group[open] summary::before { transform: rotate(90deg); }
.bin-group summary:hover { background: var(--panel-2); }

.bg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.bg-dot-final { background: var(--accent); }
.bg-dot-voice { background: var(--teal); }
.bg-dot-scene { background: #a78bfa; }
.bg-dot-cover { background: #f4a261; }
.bg-dot-take,
.bg-dot-donor,
.bg-dot-draft,
.bg-dot-script,
.bg-dot-subtitle { background: var(--muted-2); }
.bg-label { flex: 1; }
.bg-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.bin-items { list-style: none; margin: 0; padding: 0 0 4px 24px; }
.bin-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
  border-left: 2px solid transparent;
}
.bin-item:hover { background: var(--panel-2); }
.bin-item.active {
  background: var(--panel-2);
  border-left-color: var(--accent);
}
.bi-kind {
  width: 14px; height: 14px; flex-shrink: 0;
  border-radius: 3px;
  background: var(--border);
  display: inline-block;
  position: relative;
}
.bi-kind-audio::after { content: "♪"; }
.bi-kind-video::after { content: "▶"; }
.bi-kind-image::after { content: "▢"; }
.bi-kind-text::after  { content: "≡"; }
.bi-kind::after {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  color: var(--muted);
}
.bi-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bi-cmt-dot {
  color: var(--red);
  font-size: 10px;
}

/* ─── Center pane: preview ──────────────────────────────────── */
.preview {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.preview-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}
.preview-empty .hint { font-size: 12px; margin-top: 8px; }

.preview-inner {
  display: flex; flex-direction: column;
  height: 100%;
  padding: 12px 16px 16px;
  gap: 10px;
  overflow: hidden;
}
.preview-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  flex-shrink: 0;
}
#pv-name { font-weight: 500; }
#pv-meta { font-size: 12px; }

#pv-stage {
  flex: 1;
  min-height: 0;
  background: #000;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
#pv-stage video,
#pv-stage audio {
  max-width: 100%;
  max-height: 100%;
}
#pv-stage video { width: 100%; height: 100%; object-fit: contain; }
#pv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
#pv-stage .text-view {
  width: 100%; height: 100%;
  overflow: auto;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  color: #e3e3e3;
  background: var(--panel);
}

/* ─── Timeline ──────────────────────────────────────────────── */
.timeline {
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex; flex-direction: column;
  gap: 6px;
}
.tl-wave {
  position: relative;
  height: 64px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
}
.tl-comment-layer {
  position: absolute; inset: 0;
  pointer-events: none;
}
.tl-comment-layer > * { pointer-events: auto; }

.tl-pin {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
  transform: translateX(-1px);
  cursor: pointer;
}
.tl-pin::before {
  content: "●";
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--red);
  font-size: 12px;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}
.tl-pin-resolved { background: var(--teal); }
.tl-pin-resolved::before { color: var(--teal); content: "✓"; font-size: 10px; }
.tl-pin-in_progress { background: var(--amber); }
.tl-pin-in_progress::before { color: var(--amber); }

.tl-region {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(255, 107, 107, 0.2);
  border-left: 2px solid var(--red);
  border-right: 2px solid var(--red);
  cursor: pointer;
}
.tl-region-resolved { background: rgba(78, 205, 196, 0.15); border-color: var(--teal); }
.tl-region-in_progress { background: rgba(244, 162, 97, 0.18); border-color: var(--amber); }

.tl-drag {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(255, 230, 109, 0.22);
  border: 1px dashed var(--accent);
  pointer-events: none;
}

.tl-ruler {
  height: 16px;
  position: relative;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tl-ruler span {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.tl-transport {
  display: flex; align-items: center; gap: 10px;
}
.tl-transport .tl-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
}
.tl-transport .tl-hint {
  margin-left: auto;
  font-size: 11px;
}

/* ─── Right pane: comments ──────────────────────────────────── */
.comments {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.cm-head select {
  padding: 4px 8px;
  font-size: 12px;
}
.cm-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}
.cm-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

.cmt {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 13px;
  cursor: pointer;
}
.cmt:hover { border-color: var(--border); border-left-color: var(--accent); }
.cmt-resolved { opacity: 0.6; border-left-color: var(--teal); }
.cmt-in_progress { border-left-color: var(--amber); }
.cmt-dismissed { opacity: 0.4; border-left-color: var(--muted-2); }

.cmt-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.cmt-loc {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent);
}
.cmt-status {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: auto;
}
.cmt-text { margin: 4px 0; word-break: break-word; }
.cmt-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex; justify-content: space-between;
}
.cmt-actions {
  display: flex; gap: 4px;
  margin-top: 6px;
  opacity: 0; transition: opacity 0.12s;
}
.cmt:hover .cmt-actions { opacity: 1; }
.cmt-actions button { padding: 2px 8px; font-size: 11px; }

.cmt-replies { margin-top: 6px; }
.cmt-reply {
  font-size: 12px;
  padding: 5px 8px;
  background: var(--bg);
  border-radius: 4px;
  margin-top: 4px;
}
.cmt-reply-ai { border-left: 2px solid var(--teal); }
.rep-author {
  font-weight: 600;
  color: var(--muted);
  margin-right: 6px;
  font-size: 11px;
  text-transform: uppercase;
}
.cmt-reply-ai .rep-author { color: var(--teal); }

.cmt-reply-form {
  display: flex; gap: 6px;
  margin-top: 6px;
}
.cmt-reply-form textarea { flex: 1; font-size: 12px; padding: 4px 6px; }
.cmt-reply-form button { padding: 4px 10px; font-size: 12px; }

/* Composer */
.cm-composer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: flex; flex-direction: column;
  gap: 6px;
  background: var(--panel-2);
}
.cm-target {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  padding: 4px 6px;
  background: var(--bg);
  border-radius: 4px;
}
.cm-target.active { color: var(--accent); }
#cm-text {
  resize: none;
  font-size: 13px;
}
.cm-actions {
  display: flex; justify-content: flex-end; gap: 6px;
}

/* ─── Refresh banner ────────────────────────────────────────── */
#refresh-banner {
  position: fixed; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--accent);
  padding: 8px 14px;
  border-radius: 30px;
  display: flex; gap: 10px; align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 100;
  font-size: 13px;
}
#refresh-banner button { padding: 4px 10px; font-size: 12px; }

/* ─── Approval pill + actions ───────────────────────────────── */
.approval-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.approval-pill.pill-approved { background: rgba(78,205,196,0.15); color: var(--teal); border-color: var(--teal); }
.approval-pill.pill-rejected { background: rgba(255,107,107,0.15); color: var(--red); border-color: var(--red); }
.approval-pill.pill-needs_rework { background: rgba(244,162,97,0.15); color: var(--amber); border-color: var(--amber); }

.pv-approve:hover { border-color: var(--teal); color: var(--teal); }
.pv-reject:hover  { border-color: var(--red);  color: var(--red); }
.pv-rework:hover  { border-color: var(--amber); color: var(--amber); }
.pv-sep { display: inline-block; width: 1px; height: 14px; background: var(--border); margin: 0 4px; }

/* Bin approval indicator */
.bi-approval {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.bi-approval.approval-approved { background: var(--teal); }
.bi-approval.approval-rejected { background: var(--red); }
.bi-approval.approval-needs_rework { background: var(--amber); }

/* ─── Preview tools (draw button) ───────────────────────────── */
.pv-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pv-color {
  width: 18px; height: 18px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
}
.pv-color.active { outline: 2px solid #000; outline-offset: 1px; }

/* ─── Image spatial pins / drawings ─────────────────────────── */
.pv-spatial-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pv-spatial-pin {
  position: absolute;
  width: 18px; height: 18px;
  margin-left: -9px; margin-top: -9px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  cursor: pointer;
  pointer-events: auto;
  font-size: 10px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.pv-draw-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pv-draw-layer.active {
  pointer-events: auto;
  cursor: crosshair;
  background: rgba(0,0,0,0.2);
}
.pv-draw-layer svg {
  width: 100%; height: 100%;
  display: block;
}
