/* File: static/css/app.css | Version: 0.1.0 | Last Modified: 2026-05-23 */

* { box-sizing: border-box; }

:root {
  --bg: #0e0f12;
  --surface: #1a1c22;
  --surface-2: #22252e;
  --border: #2d3140;
  --text: #e8eaf0;
  --text-dim: #9aa0b4;
  --accent: #ffd400;
  --accent-text: #1a1a1a;
  --primary: #4e8cff;
  --primary-hover: #3a78ef;
  --danger: #ff5577;
  --success: #4ddb8b;
  --radius: 10px;
}

html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.4; }

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

header {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 19px; margin: 0; }
header .back { color: var(--text-dim); margin-right: 8px; }
header .tag { padding: 3px 8px; border-radius: 99px; font-size: 12px; background: var(--surface-2); color: var(--text-dim); }
header .tag.ok { color: var(--success); }
header .tag.err { color: var(--danger); }
header > :last-child { margin-left: auto; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; display: grid; gap: 22px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card h2 { margin: 0 0 14px 0; font-size: 17px; }

.sub { color: var(--text-dim); font-size: 13px; margin: 4px 0; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 200px; }

input[type="text"], input[type="url"], input[type="password"], select, textarea {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--text-dim); }
input[type="range"] { width: 100%; }
input[type="color"] { background: transparent; border: 1px solid var(--border); border-radius: 6px; width: 50px; height: 32px; padding: 2px; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 36px; text-align: center; transition: border-color 0.15s, background 0.15s;
}
.dropzone p { margin: 6px 0; }
.dropzone.drag { border-color: var(--primary); background: rgba(78, 140, 255, 0.06); }

.or-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--text-dim); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.status { margin-top: 14px; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }
.status.err { color: var(--danger); }

.jobs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.job-tile {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer;
}
.job-tile:hover { border-color: var(--primary); }
.job-tile .title { font-weight: 600; font-size: 14px; margin-bottom: 4px; word-break: break-word; }
.job-tile .meta { color: var(--text-dim); font-size: 12px; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 22px; max-width: 90vw; }
dialog::backdrop { background: rgba(0,0,0,0.6); }
dialog h3 { margin: 0 0 14px; }
dialog input { width: 320px; max-width: 70vw; display: block; margin-bottom: 12px; }

/* ============== REVIEW PAGE ============== */
body.review { overflow: hidden; }

.review-main {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px;
  padding: 18px;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.pane { overflow-y: auto; min-height: 0; }
.source-pane { display: flex; flex-direction: column; gap: 14px; }

.source-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
#source-video { width: 100%; max-height: 50vh; display: block; }
#source-video::cue { font-family: "Montserrat ExtraBold", Inter, sans-serif; color: #fff; background: rgba(0,0,0,0.4); font-size: 1.4em; }

.reframe-overlay { position: absolute; inset: 0; pointer-events: none; }
.reframe-overlay .frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
}

.seekbar-wrap { padding: 6px 8px 4px; background: var(--surface); }
.ranges { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ranges .marker {
  position: absolute; top: 0; bottom: 0; background: rgba(255,212,0,0.45); border-left: 1px solid var(--accent);
}
.ranges .marker.selected { background: rgba(78,140,255,0.55); border-left-color: var(--primary); }
.ranges .marker.dismissed { background: rgba(120,120,120,0.25); border-left-color: var(--text-dim); }

.aspect-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.aspect { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; text-align: center; }
.aspect .label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.aspect .frame { position: relative; background: #000; margin: 0 auto; overflow: hidden; }
.aspect .frame video { position: absolute; min-width: 100%; min-height: 100%; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.aspect[data-aspect="9:16"] .frame { width: 90px; height: 160px; }
.aspect[data-aspect="1:1"] .frame { width: 130px; height: 130px; }
.aspect[data-aspect="4:5"] .frame { width: 120px; height: 150px; }

.toolbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: var(--surface); border-radius: 8px; }
.toolbar label { color: var(--text); font-size: 13px; }

.transcript-wrap { background: var(--surface); border-radius: var(--radius); padding: 14px; max-height: 30vh; overflow-y: auto; }
.transcript-wrap h3 { margin: 0; font-size: 14px; }
.transcript { line-height: 1.8; font-size: 14px; margin-top: 10px; }
.transcript .word { padding: 1px 2px; border-radius: 3px; cursor: pointer; transition: background 0.1s; }
.transcript .word:hover { background: var(--border); }
.transcript .word.active { background: var(--accent); color: var(--accent-text); }
.transcript .word.edited { color: var(--accent); border-bottom: 1px dashed var(--accent); }
.transcript .speaker-tag { display: inline-block; font-size: 11px; color: var(--text-dim); padding: 2px 6px; background: var(--surface-2); border-radius: 99px; margin: 6px 6px 0 0; }

/* Side pane */
.side-pane { background: var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab { flex: 1; padding: 12px; background: transparent; color: var(--text-dim); border: none; cursor: pointer; font-size: 13px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.tab-panel { padding: 14px; overflow-y: auto; flex: 1; }

.candidates { display: flex; flex-direction: column; gap: 12px; }
.candidate {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.candidate.selected { border-color: var(--primary); }
.candidate.dismissed { opacity: 0.45; }
.candidate .row { gap: 6px; align-items: baseline; }
.candidate .score { background: var(--accent); color: var(--accent-text); padding: 2px 8px; border-radius: 99px; font-weight: 700; font-size: 12px; }
.candidate .title { font-weight: 600; font-size: 14px; }
.candidate .reason { color: var(--text-dim); font-size: 12px; margin: 4px 0; }
.candidate .hook { font-style: italic; color: var(--text-dim); font-size: 13px; }
.candidate .actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.candidate .trim { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-top: 8px; }
.candidate .trim input { width: 70px; padding: 4px 6px; }
.candidate .aspect-pick { display: flex; gap: 4px; margin-top: 8px; }
.candidate .aspect-pick button { padding: 4px 10px; font-size: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); border-radius: 6px; cursor: pointer; }
.candidate .aspect-pick button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.candidate .emojis { font-size: 18px; margin-top: 6px; }
.candidate .thumb-pick { font-size: 11px; color: var(--primary); cursor: pointer; margin-top: 6px; }

.caption-editor .preview-box {
  background: linear-gradient(135deg, #2a4 0%, #06c 100%);
  height: 120px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-family: "Montserrat ExtraBold", Inter, sans-serif; font-weight: 800;
  margin-bottom: 10px;
}

.music-picker { display: flex; flex-direction: column; gap: 10px; }
.music-cat { background: var(--surface-2); border-radius: 8px; padding: 10px; }
.music-cat h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; color: var(--text-dim); }
.music-cat .track { display: flex; gap: 6px; align-items: center; padding: 4px 0; cursor: pointer; }
.music-cat .track:hover { color: var(--accent); }
.music-cat .track.active { color: var(--accent); }
#music-audio { width: 100%; margin-top: 8px; }

.outputs { display: grid; grid-template-columns: 1fr; gap: 10px; }
.output-clip { background: var(--surface-2); padding: 8px; border-radius: 8px; }
.output-clip video { width: 100%; display: block; border-radius: 4px; }
.output-clip .row { margin-top: 6px; }

.toast {
  position: fixed; bottom: 18px; right: 18px; padding: 10px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; max-width: 350px; box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 100;
}
.toast.err { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--success); }

/* === Mobile === */
@media (max-width: 900px) {
  .review-main { grid-template-columns: 1fr; height: auto; overflow: visible; }
  body.review { overflow: auto; }
  .pane { overflow-y: visible; }
  .aspect-row { grid-template-columns: 1fr 1fr 1fr; }
  .aspect[data-aspect="9:16"] .frame { width: 70px; height: 124px; }
  .aspect[data-aspect="1:1"] .frame { width: 100px; height: 100px; }
  .aspect[data-aspect="4:5"] .frame { width: 95px; height: 119px; }
  header h1 { font-size: 16px; }
}
