/* VidReview2 — RDIG house style, translated to a working dark UI.
   Navy base + gold accent (kept sparing: CTAs, active states, timeline
   markers, focus rings — not washed across the interface). Serif headings
   echo the Cambria used in RDIG documents; sans UI echoes Calibri. Both are
   system-font stacks, not a CDN font — this runs behind Loveworld's own
   network and shouldn't depend on reaching an external font host. */

:root {
  --bg: #0B1220;
  --panel: #131C2E;
  --panel-2: #1B2740;
  --border: #29354D;
  --gold: #C9A227;
  --gold-soft: #E4C766;
  --text: #EDEAE0;
  --text-muted: #8B96AD;
  --danger: #C4573A;
  --success: #6FA287;

  --font-serif: Iowan Old Style, Palatino Linotype, Georgia, "Noto Serif", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 4px;
  --radius-lg: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 0.5em;
  color: var(--text);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; color: var(--text-muted); max-width: 68ch; }

a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* --- App shell --- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-brand .name { font-family: var(--font-serif); font-size: 1.15rem; }
.sidebar-brand .tag { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.03em; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-left: 2px solid transparent;
}
.nav-item:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
.nav-item.active { color: var(--gold-soft); border-left-color: var(--gold); background: var(--panel-2); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 0;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
}

.main-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 120ms ease;
}
.btn:hover { border-color: var(--text-muted); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #1A1404;
  font-weight: 600;
}
.btn-primary:hover { background: var(--gold-soft); border-color: var(--gold-soft); }

.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: var(--bg); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* --- Panels / ledger list (flat, bordered — no drop shadows) --- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.quick-action {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: left;
  color: var(--text);
}
.quick-action:hover { border-color: var(--gold); text-decoration: none; }
.quick-action .label { font-family: var(--font-serif); font-size: 1rem; display: block; margin-top: 8px; }
.quick-action .icon { color: var(--gold); font-size: 1.3rem; }

.ledger {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ledger-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}
.ledger-row:last-child { border-bottom: none; }
.ledger-row:hover { background: var(--panel-2); text-decoration: none; }
.ledger-thumb {
  width: 64px; height: 36px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--panel-2);
  flex-shrink: 0;
}
.ledger-title { font-weight: 600; font-size: 0.92rem; }
.ledger-meta { font-size: 0.78rem; color: var(--text-muted); }
.ledger-row .spacer { flex: 1; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* --- Badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.badge.in_review::before { background: var(--gold); }
.badge.in_review { color: var(--gold-soft); }
.badge.approved::before { background: var(--success); }
.badge.approved { color: var(--success); }
.badge.archived::before { background: var(--text-muted); }

/* --- Forms --- */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=file], .field textarea, .field select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); }
.field .hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; }
.field .error { font-size: 0.8rem; color: var(--danger); margin-top: 6px; }

/* --- Review player screen --- */

.review-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  height: calc(100vh - 0px);
}
.review-main {
  padding: 24px 32px;
  overflow-y: auto;
}
.review-video-frame {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}
.review-video-frame video { width: 100%; display: block; max-height: 62vh; }

.scrubber {
  position: relative;
  height: 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.scrubber-track {
  position: absolute;
  top: 50%; left: 12px; right: 12px;
  height: 3px;
  background: var(--border);
  transform: translateY(-50%);
  border-radius: 2px;
}
.scrubber-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--gold);
  opacity: 0.25;
  border-radius: 2px;
}
.scrubber-marker {
  position: absolute;
  top: 50%;
  width: 10px; height: 10px;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
  cursor: pointer;
  border: 1px solid var(--bg);
}
.scrubber-marker.resolved { background: var(--success); opacity: 0.6; }
.scrubber-marker:hover { background: var(--gold-soft); }
@keyframes marker-pulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(201, 162, 39, 0); }
}
.scrubber-marker.new { animation: marker-pulse 900ms ease-out 1; }

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.comment-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.comment-panel-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
}
.comment-author { font-weight: 600; color: var(--text); }
.comment-time { color: var(--gold-soft); cursor: pointer; }
.comment-time:hover { text-decoration: underline; }
.comment-body { font-size: 0.88rem; color: var(--text); margin: 0; }
.comment-guest-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}
.comment-thread { margin-left: 16px; margin-top: 8px; border-left: 2px solid var(--border); padding-left: 12px; }

.comment-compose {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.comment-compose textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  resize: vertical;
  margin-bottom: 8px;
}
.comment-compose-row { display: flex; justify-content: space-between; align-items: center; }
.compose-timecode { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --- Role builder matrix --- */

.role-matrix { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.role-matrix th, .role-matrix td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.role-matrix th { color: var(--text-muted); font-weight: 500; font-size: 0.78rem; }
.role-matrix td.perm-name { color: var(--text-muted); }
.role-matrix input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }

/* --- Utility --- */

.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.text-muted { color: var(--text-muted); }
.mt-24 { margin-top: 24px; }

@media (max-width: 900px) {
  .review-layout { grid-template-columns: 1fr; }
  .comment-panel { height: auto; border-left: none; border-top: 1px solid var(--border); }
  .sidebar { display: none; }
}
