/**
 * video-tools.css — "Polish your video" tray (Video Studio, WP2, 2026-07-09).
 * Component: src/public/js/video-tools.js (window.CBVideoTools).
 *
 * Design source of truth: css/outreach-dashboard.css (.mi-card/.mi-action/
 * .range-tabs idioms — Alex 2026-07-09: "that styling is spot on"). The tray
 * is appended to <body> and mounts from pages OUTSIDE the outreach dashboard's
 * `#page-outreach-dashboard` token scope (e.g. Settings → Media, which uses
 * the plain app-shell light theme). Exactly like the rel-editor modal further
 * down outreach-dashboard.css documents for its own overlay, this file uses
 * EXPLICIT colours copied from that same palette rather than `var(--...)`
 * tokens that would resolve to nothing here.
 */

.cbvt-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(13, 8, 25, 0.5);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* R2.1 (Alex, 2026-07-09): ONE constant frame for every view. The modal used
   to be 620px on the tray home and 900px in the working views — every tool
   switch visibly reshaped the window ("it just feels a bit stuck together").
   Now the frame never changes: same width and a steady min-height everywhere;
   only the content inside swaps, with a gentle cross-fade (.cbvt-anim below). */
.cbvt-modal {
  background: #ffffff; color: #15172b;
  width: 100%; max-width: 900px;
  min-height: min(640px, calc(100vh - 40px));
  max-height: calc(100vh - 40px);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(13, 8, 25, 0.35);
  font-family: inherit;
  display: flex; flex-direction: column;
  animation: cbvt-pop 0.22s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes cbvt-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
/* Tool-switch cross-fade — applied by switchTool() only (deliberately NOT on
   a tool's own internal re-renders, e.g. a gaps checkbox toggle, which would
   flicker). */
.cbvt-panel.cbvt-anim { animation: cbvt-panel-in 0.18s ease both; }
@keyframes cbvt-panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cbvt-modal, .cbvt-panel.cbvt-anim { animation: none; }
}
.cbvt-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 12px; flex: none;
}
.cbvt-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: #15172b; }
.cbvt-close {
  flex: none; border: none; background: transparent; font-size: 22px; line-height: 1;
  color: #9ca3af; cursor: pointer; padding: 0 2px; min-width: 32px; min-height: 32px;
}
.cbvt-close:hover { color: #374151; }

/* R2.1 — the chips (and the ← Back slot) stay pinned; only the tool's own
   content (#cbvt-panel) scrolls. Navigation never scrolls out of reach. */
.cbvt-body {
  display: flex; gap: 20px; padding: 6px 20px 20px;
  flex: 1; min-height: 0; overflow: hidden;
}

/* R2.1 — the old 200px "what people see" side column is gone; the tray home
   now shows the effective thumbnail on the SAME big stage every other tool
   uses (#cbvt-home-stage in video-tools.js), so the media area sits in the
   same place on every view. The empty/label/badge pieces below are still
   used by that stage. */
.cbvt-home-stage { position: relative; } /* anchors the absolute play badge to the stage, not the modal */
.cbvt-home-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cbvt-preview-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #4b4e63;
}
.cbvt-play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; pointer-events: none;
}
.cbvt-preview-label {
  font-size: 11.5px; color: #6b7280; text-align: center;
}

/* Layer-order bar — select a layer on the canvas, then reorder it (Alex
   2026-07-09). Sits between the preview label and the canvas stage. */
.cbvt-layer-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 10px; margin: 6px auto 2px; max-width: 640px;
}
.cbvt-layer-hint { font-size: 11.5px; color: #9096a3; }
.cbvt-layer-btns { display: inline-flex; gap: 6px; }
.cbvt-layer-btn {
  border: 1px solid #e0ddef; background: #fbfbfe; color: #4b40c9;
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer; min-height: 32px; line-height: 1;
}
.cbvt-layer-btn:hover:not(:disabled) { border-color: #cfc9ec; background: #f2f0fb; }
.cbvt-layer-btn:disabled { opacity: 0.45; cursor: not-allowed; color: #9096a3; }

/* Tool chips + the active tool's panel. */
.cbvt-tools { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; }

.cbvt-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: #f6f4ee; border-radius: 10px; padding: 4px;
}
.cbvt-chip {
  border: none; background: transparent;
  font-size: 12.5px; font-weight: 600; color: #6b7280;
  padding: 7px 12px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: default;
}
.cbvt-chip:not(.soon) { cursor: pointer; }
.cbvt-chip:not(.soon):hover { color: #15172b; }
.cbvt-chip.active { background: #ffffff; color: #15172b; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.cbvt-chip.soon { color: #9ca3af; cursor: not-allowed; }
.cbvt-chip-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: #ece9f7; color: #6a4cf1; padding: 2px 6px; border-radius: 999px;
}
/* WP12 (UX Round 2 §1) — the OTHER two chips while a job runs on this video:
   genuinely locked (the server 409s a second subtitles/trim/remove-gaps job
   regardless of which one asks) but not the one actually running, so this
   reads as "something else has this locked" rather than repeating the same
   claim on every chip. */
.cbvt-chip-badge-locked { background: #f0f1f5; color: #9ca3af; }

/* WP12 — the shared "← Back" slot for Subtitles/Trim/Remove-gaps (see
   syncWideBackButton() in video-tools.js); `display:flex` so the embedded
   .cbvt-back-btn's `align-self:flex-start` behaves exactly like the maker's
   own (a real flex item, not an incidental inline-block); collapsed via
   :empty whenever the Thumbnail tool is active, so it never adds a stray gap. */
#cbvt-panel-back { display: flex; }
#cbvt-panel-back:empty { display: none; }

.cbvt-panel {
  display: flex; flex-direction: column; gap: 12px;
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 2px; /* breathing room so focus rings/shadows aren't clipped by the scroll box */
}

/* Thumbnail action cards — the outreach dashboard's .mi-action idiom, sized
   up into full clickable cards (min-height 48px for touch). */
.cbvt-actions { display: flex; flex-direction: column; gap: 10px; }
.cbvt-action-card {
  display: flex; align-items: center; gap: 12px;
  background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 12px 14px; min-height: 48px;
  text-align: left; cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, background .12s;
}
.cbvt-action-card:hover { border-color: #6a4cf1; background: #faf9ff; }
.cbvt-action-card:disabled { opacity: 0.55; cursor: not-allowed; }
.cbvt-action-ico { font-size: 20px; flex: none; }
.cbvt-action-text { display: flex; flex-direction: column; gap: 2px; }
.cbvt-action-text b { font-size: 13.5px; color: #15172b; font-weight: 600; }
.cbvt-action-text small { font-size: 11.5px; color: #6b7280; }

.cbvt-reset-row { display: flex; }
.cbvt-ghost-btn {
  border-radius: 9px; font-size: 13px; font-weight: 600; padding: 9px 14px;
  cursor: pointer; border: 1px solid #e5e7eb; min-height: 40px;
  background: #fff; color: #374151; font-family: inherit;
}
.cbvt-ghost-btn:hover { border-color: #c9ccd3; }
.cbvt-ghost-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.cbvt-primary-btn {
  border-radius: 9px; font-size: 13.5px; font-weight: 600; padding: 9px 16px;
  cursor: pointer; border: 1px solid transparent; min-height: 44px;
  background: #6a4cf1; color: #fff; font-family: inherit;
}
.cbvt-primary-btn:hover { background: #5a3fd8; }
.cbvt-primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cbvt-status { font-size: 12px; color: #6b7280; min-height: 16px; }
.cbvt-status.error { color: #c0423a; }

/* Pick-a-frame scrubber */
.cbvt-scrub { display: flex; flex-direction: column; gap: 10px; }
.cbvt-back-btn {
  align-self: flex-start; border: none; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: #6a4cf1; padding: 4px 2px;
  min-height: 32px;
}
.cbvt-back-btn:hover { color: #5a3fd8; }
/* WP12 ("bigger UI", spec §2) — shared by Pick-a-frame, Trim, Subtitles and
   Remove-gaps' preview stages. Capped + centred like the maker's own
   `.cbvt-maker-stage` (below) rather than stretched edge-to-edge, so all the
   tray's "big preview" views share one proportion. `width:100%` still makes
   it fill a narrower (e.g. mobile) container correctly — the cap only binds
   once there's room to spare. */
.cbvt-scrub-stage {
  position: relative;
  width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 16 / 9; background: #000;
  border-radius: 10px; overflow: hidden;
}
/* Caption preview strip — sits directly under the video, linked above the
   editable transcript. Shows the line covering the current moment (or the line
   being edited), with a muted hint when there's nothing to show. */
.cbvt-caption-preview {
  width: 100%; max-width: 640px; margin: 0 auto;
  background: #15172b; color: #fff; text-align: center;
  font-size: 15px; font-weight: 600; line-height: 1.4;
  padding: 10px 14px; border-radius: 10px; white-space: pre-wrap; min-height: 20px;
}
.cbvt-caption-preview.empty {
  background: #f5f4fb; color: #9096a3; font-weight: 500; font-size: 12.5px;
}
.cbvt-scrub-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.cbvt-scrub-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px;
  border-radius: 6px; background: #ece9f7; outline: none; margin: 2px 0;
}
.cbvt-scrub-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px;
  border-radius: 50%; background: #6a4cf1; cursor: pointer; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(106, 76, 241, 0.5);
}
.cbvt-scrub-range::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%; background: #6a4cf1;
  cursor: pointer; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(106, 76, 241, 0.5);
}
.cbvt-scrub-range:disabled { opacity: 0.5; }
.cbvt-scrub-time { font-size: 11.5px; color: #6b7280; text-align: center; margin-top: -6px; }
.cbvt-scrub-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* AI: Suggest frames (Video Studio WP7, spec §2.5) — top-3 suggestion grid
   shown inside the Pick-a-frame panel (same scrub player, no second video). */
.cbvt-suggest-grid { display: flex; gap: 8px; }
.cbvt-suggest-card {
  position: relative; flex: 1 1 0; min-width: 0;
  aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  border: 2px solid #e5e7eb; background: #15172b; padding: 0; cursor: pointer;
  font-family: inherit;
}
.cbvt-suggest-card:hover { border-color: #6a4cf1; }
.cbvt-suggest-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cbvt-suggest-score {
  position: absolute; top: 4px; right: 4px;
  background: rgba(10, 10, 20, 0.72); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 6px; border-radius: 999px;
}

/* Subtitles tab — explainer / progress / editable-transcript states. */
.cbvt-subs-empty, .cbvt-subs-processing {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 18px 8px;
}
.cbvt-subs-empty-ico { font-size: 30px; }
.cbvt-subs-empty p, .cbvt-subs-processing p { margin: 0; font-size: 13px; color: #4b5563; line-height: 1.5; max-width: 380px; }
.cbvt-subs-note { font-size: 11.5px !important; color: #9ca3af !important; }
.cbvt-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #ece9f7; border-top-color: #6a4cf1;
  animation: cbvt-spin 0.8s linear infinite;
}
@keyframes cbvt-spin { to { transform: rotate(360deg); } }

.cbvt-subs-editor { display: flex; flex-direction: column; gap: 10px; }
.cbvt-subs-rows {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 260px; overflow-y: auto;
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px;
}
.cbvt-subs-row { display: flex; align-items: center; gap: 8px; }
/* WP12 — a <button> now (was a <span>): clicking it seeks the big preview
   player added above the row list. Reset button chrome, keep the original
   look exactly (same size/colour/weight) plus a hover to signal it's live. */
.cbvt-subs-time {
  flex: none; width: 76px; font-size: 11px; font-variant-numeric: tabular-nums;
  color: #6b7280; font-weight: 600;
  border: none; background: transparent; padding: 0; margin: 0;
  font-family: inherit; text-align: left; cursor: pointer;
}
.cbvt-subs-time:hover { color: #6a4cf1; }
.cbvt-subs-text {
  flex: 1; min-width: 0; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-family: inherit; min-height: 34px;
}
.cbvt-subs-text:focus { outline: none; border-color: #6a4cf1; }
.cbvt-subs-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Secondary actions (Redo / Remove) — tidied into a proper button row with a
   separator, so they read as deliberate options rather than floating text
   (Alex 2026-07-09). */
.cbvt-subs-secondary {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 10px; margin-top: 2px; border-top: 1px solid #eceaf4;
}
.cbvt-text-btn {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600; color: #9ca3af; padding: 4px 2px; min-height: 28px;
}
.cbvt-text-btn:hover { color: #6b7280; }
/* In the subtitles secondary row, give them a light chip treatment so they sit
   as tidy buttons, not stray links. */
.cbvt-subs-secondary .cbvt-text-btn {
  border: 1px solid #e0ddef; border-radius: 8px; background: #fbfbfe;
  color: #6b7280; padding: 7px 12px; min-height: 34px;
}
.cbvt-subs-secondary .cbvt-text-btn:hover { border-color: #cfc9ec; background: #f5f4fb; color: #4b40c9; }

/* Trim tab (Video Studio WP6, spec §2.4) — reuses .cbvt-scrub-stage/
   .cbvt-scrub-range/.cbvt-scrub-time/.cbvt-scrub-actions from the pick-a-frame
   scrubber above; adds two labeled range sliders (start/end) instead of one. */
.cbvt-trim { display: flex; flex-direction: column; gap: 10px; }
.cbvt-trim-labels {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: #6b7280; font-weight: 600;
}
.cbvt-trim-labels b { color: #15172b; font-variant-numeric: tabular-nums; }
.cbvt-trim-sliders { display: flex; flex-direction: column; gap: 6px; }

/* Remove-gaps tab — quiet-moment suggestion list (parity with the recorder's
   own silence-detect checkbox rows, recorder/recorder.js renderSilence()). */
.cbvt-gaps { display: flex; flex-direction: column; gap: 10px; }
.cbvt-gaps-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 220px; overflow-y: auto;
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 6px 8px;
}
.cbvt-gap-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: #374151; padding: 6px 2px; cursor: pointer;
}
.cbvt-gap-row span { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.cbvt-gap-row small { color: #9ca3af; }
.cbvt-gap-check { flex: none; width: 16px; height: 16px; accent-color: #6a4cf1; cursor: pointer; }

/* R2.1 — every tool's content sits in one shared 640px column, centred in
   the constant 900px frame, so nothing stretches edge-to-edge and the eye
   stays in the same place as you move between tools. The maker is the one
   exception: it's a working canvas and uses the full width. */
#cbvt-panel > * { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
#cbvt-panel > .cbvt-maker { max-width: none; }

.cbvt-maker { display: flex; flex-direction: column; gap: 12px; }

.cbvt-maker-stage {
  width: 100%; max-width: 640px; margin: 0 auto;
  aspect-ratio: 16 / 9; background: #15172b;
  border-radius: 10px; overflow: hidden; position: relative;
}
.cbvt-maker-stage canvas,
.cbvt-maker-stage .canvas-container {
  width: 100% !important; height: 100% !important; max-width: 100%;
}

.cbvt-maker-templates { display: flex; flex-wrap: wrap; gap: 8px; }
.cbvt-tmpl-chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 76px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  background: #fff; padding: 6px; cursor: pointer; font-family: inherit;
}
.cbvt-tmpl-chip:hover { border-color: #c9ccd3; }
.cbvt-tmpl-chip.active { border-color: #6a4cf1; box-shadow: 0 0 0 1px #6a4cf1 inset; }
.cbvt-tmpl-swatch {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 6px;
  background: #15172b; position: relative; overflow: hidden;
}
.cbvt-tmpl-label { font-size: 10px; font-weight: 600; color: #374151; text-align: center; line-height: 1.2; }

/* Per-template visual hint inside the swatch, pure CSS (no bitmap thumbnails
   — templates are data, per spec). Approximates each layout at a glance. */
.cbvt-tmpl-scrim-bold .cbvt-tmpl-swatch { background: linear-gradient(to bottom, #4b4e63 0%, #4b4e63 55%, rgba(10,10,20,0.75) 55%, rgba(10,10,20,0.75) 100%); }
.cbvt-tmpl-colour-block-left .cbvt-tmpl-swatch { background: linear-gradient(to right, #6a4cf1 0%, #6a4cf1 38%, #4b4e63 38%, #4b4e63 100%); }
.cbvt-tmpl-centred-title .cbvt-tmpl-swatch { background: #6a4cf1; }
.cbvt-tmpl-logo-corner .cbvt-tmpl-swatch { background: linear-gradient(to bottom, #4b4e63 0%, #4b4e63 65%, rgba(10,10,20,0.7) 65%, rgba(10,10,20,0.7) 100%); }
.cbvt-tmpl-lower-third .cbvt-tmpl-swatch { background: linear-gradient(to bottom, #4b4e63 0%, #4b4e63 82%, #6a4cf1 82%, #6a4cf1 100%); }

.cbvt-maker-field { display: flex; flex-direction: column; gap: 6px; }
.cbvt-maker-field > span { font-size: 12px; font-weight: 600; color: #374151; }
.cbvt-maker-field input[type="text"],
.cbvt-maker-field textarea {
  border: 1px solid #e5e7eb; border-radius: 9px; padding: 9px 12px;
  font-size: 13.5px; font-family: inherit; min-height: 40px;
}
.cbvt-maker-field textarea { resize: vertical; line-height: 1.45; }
.cbvt-maker-field input[type="text"]:focus,
.cbvt-maker-field textarea:focus { outline: none; border-color: #6a4cf1; }

/* AI: Draft headline (Video Studio WP7, spec §2.5) — button sits inline with
   the headline input; chips below set the input + the live Fabric Textbox. */
.cbvt-maker-headline-row { display: flex; gap: 8px; }
.cbvt-maker-headline-row input[type="text"] { flex: 1; min-width: 0; }
.cbvt-maker-headline-row .cbvt-ghost-btn { flex: none; white-space: nowrap; }
.cbvt-headline-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cbvt-headline-chip {
  border: 1px solid #e5e7eb; background: #faf9ff; color: #15172b;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.cbvt-headline-chip:hover { border-color: #6a4cf1; background: #ece9f7; }

.cbvt-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cbvt-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0; box-shadow: 0 0 0 1px #e5e7eb; flex: none;
}
.cbvt-swatch.active { box-shadow: 0 0 0 2px #6a4cf1; }
.cbvt-swatch-custom {
  position: relative; overflow: hidden;
  background: conic-gradient(from 0deg, #ff004d, #ffe100, #00ff6a, #00c8ff, #7a3bff, #ff004d);
}
.cbvt-swatch-custom input[type="color"] {
  position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px);
  border: none; padding: 0; cursor: pointer; opacity: 0;
}

.cbvt-maker-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cbvt-maker-save-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

@media (max-width: 480px) {
  .cbvt-overlay { padding: 0; align-items: flex-end; }
  .cbvt-modal { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .cbvt-body { flex-direction: column; padding: 6px 16px 16px; }
  .cbvt-modal { min-height: 0; } /* bottom-sheet on mobile — content-sized, not frame-sized */
  .cbvt-action-card { min-height: 52px; }
  .cbvt-scrub-actions { flex-direction: column-reverse; }
  .cbvt-scrub-actions .cbvt-ghost-btn,
  .cbvt-scrub-actions .cbvt-primary-btn { width: 100%; }
  .cbvt-gap-row { padding: 8px 2px; } /* touch target */
  .cbvt-subs-actions { flex-direction: column-reverse; }
  .cbvt-subs-actions .cbvt-ghost-btn,
  .cbvt-subs-actions .cbvt-primary-btn { width: 100%; }
  .cbvt-maker-stage,
  .cbvt-scrub-stage { max-width: 100%; }
  .cbvt-maker-save-row { flex-direction: column-reverse; }
  .cbvt-maker-save-row .cbvt-ghost-btn,
  .cbvt-maker-save-row .cbvt-primary-btn { width: 100%; }
  .cbvt-maker-actions-row .cbvt-ghost-btn { flex: 1 1 auto; }
  .cbvt-maker-headline-row { flex-direction: column; }
  .cbvt-maker-headline-row .cbvt-ghost-btn { width: 100%; }
}

/* WP13 (UX Round 2 §3.3) — background-effect preset chips. Same pill
   language as the template chips; disabled = the active template shows no
   background image (or none is set yet), so an effect would do nothing. */
.cbvt-effect-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cbvt-effect-chip {
  border: 1px solid #d0d3e0; border-radius: 999px; background: #fff;
  color: #374151; font-size: 12px; font-weight: 600; padding: 5px 12px;
  cursor: pointer; font-family: inherit;
}
.cbvt-effect-chip:hover:not(:disabled) { border-color: #6a4cf1; color: #6a4cf1; }
.cbvt-effect-chip.active { background: #6a4cf1; border-color: #6a4cf1; color: #fff; }
.cbvt-effect-chip:disabled { opacity: 0.45; cursor: default; }

/* WP13 (§3.1) — the "Use a video frame" strip: six clickable frame thumbs
   sampled from the video, scrolling horizontally if cramped. */
.cbvt-maker-frames-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; }
.cbvt-frame-thumb {
  flex: none; width: 128px; aspect-ratio: 16 / 9; padding: 0;
  border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: #000; cursor: pointer;
}
.cbvt-frame-thumb:hover { border-color: #6a4cf1; }
.cbvt-frame-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* R2.1 — the video's saved AI metadata (title/description/tags from the
   transcript, video-meta.js) shown in the maker under the headline tools. */
.cbvt-meta-block {
  border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; background: #fbfaf7;
}
.cbvt-meta-head { font-size: 12px; font-weight: 700; color: #15172b; }
.cbvt-meta-head small { font-weight: 500; color: #9ca3af; }
.cbvt-meta-row { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; }
.cbvt-meta-row > span { flex: none; width: 78px; color: #6b7280; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.cbvt-meta-row b { font-weight: 600; color: #15172b; }
.cbvt-meta-row p { margin: 0; color: #374151; }
.cbvt-meta-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.cbvt-meta-tags em {
  font-style: normal; font-size: 11px; font-weight: 600;
  background: #ece9f7; color: #6a4cf1; border-radius: 999px; padding: 2px 8px;
}

/* R2.5 (Alex: alternative titles as tap-to-apply pills) — same look as the
   headline chips (.cbvt-headline-chip) so title alternatives read as one
   consistent pattern across the maker. */
.cbvt-title-chip {
  border: 1px solid #e5e7eb; background: #faf9ff; color: #15172b;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.cbvt-title-chip:hover { border-color: #6a4cf1; background: #ece9f7; }

/* R2.5 — alternative descriptions: full text always visible (no line-clamp/
   ellipsis — the whole point is letting the user read and pick a complete
   option), tap anywhere on the card to apply it. */
.cbvt-desc-options { display: flex; flex-direction: column; gap: 6px; }
.cbvt-desc-option {
  display: block; width: 100%; text-align: left; border: 1px solid #e5e7eb;
  background: #faf9ff; color: #374151; font-family: inherit; font-size: 12.5px;
  line-height: 1.45; padding: 8px 12px; border-radius: 9px; cursor: pointer;
  white-space: normal; overflow-wrap: break-word;
}
.cbvt-desc-option:hover { border-color: #6a4cf1; background: #ece9f7; }

/* R2.2 — the tray's own confirm (cbvtConfirm in video-tools.js), replacing
   native confirm()'s browser chrome. Above the tray (4000), below the media
   picker (4600). */
.cbvt-confirm-overlay {
  position: fixed; inset: 0; z-index: 4500;
  background: rgba(13, 8, 25, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cbvt-confirm {
  background: #fff; color: #15172b;
  width: 100%; max-width: 420px;
  border-radius: 14px; padding: 20px;
  box-shadow: 0 20px 50px rgba(13, 8, 25, 0.35);
  animation: cbvt-pop 0.18s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@media (prefers-reduced-motion: reduce) { .cbvt-confirm { animation: none; } }
.cbvt-confirm p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.5; color: #374151; }
.cbvt-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── R2.4 — maker flow inversion + banner + premium + text look ─────────── */

/* Top bar: Back · status banner · Cancel · Save — feedback lives where the
   eye already is (Alex: the bottom status line was "easy to miss"). */
.cbvt-maker-topbar { display: flex; align-items: center; gap: 10px; }
.cbvt-maker-topbar .cbvt-back-btn { flex: none; }
.cbvt-maker-topbar .cbvt-ghost-btn, .cbvt-maker-topbar .cbvt-primary-btn { flex: none; }
.cbvt-banner {
  flex: 1; min-width: 0;
  font-size: 12.5px; font-weight: 600; line-height: 1.35;
  padding: 8px 12px; border-radius: 10px;
  background: #f2effe; color: #4c3ac2; /* info: something is happening */
}
.cbvt-banner:empty { display: none; }
.cbvt-banner.error { background: #fdf0ef; color: #c0423a; }
.cbvt-banner.ok { background: #eaf6f0; color: #1c8e5a; }

/* Premium action card — the Studio maker leads the list (Alex: "high-value
   tools need to be premium, at the top"). */
.cbvt-action-premium {
  position: relative;
  border-color: #6a4cf1;
  background: linear-gradient(135deg, #faf9ff 0%, #ffffff 60%);
}
.cbvt-action-premium:hover { background: linear-gradient(135deg, #f4f1ff 0%, #ffffff 60%); }
.cbvt-premium-badge {
  position: absolute; top: 10px; right: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: #fff; background: #6a4cf1;
  padding: 3px 8px; border-radius: 999px;
}

/* Text-look controls */
.cbvt-textstyle-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cbvt-swatches-small .cbvt-swatch { width: 22px; height: 22px; }
.cbvt-swatches-small .cbvt-swatch.active { outline: 2px solid #6a4cf1; outline-offset: 2px; }

/* Chooser (cbvtChooser) — stacked option cards inside the confirm shell */
.cbvt-choice-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cbvt-choice-btn {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 10px 12px; cursor: pointer; font-family: inherit;
}
.cbvt-choice-btn:hover { border-color: #6a4cf1; background: #faf9ff; }
.cbvt-choice-btn b { font-size: 13px; color: #15172b; font-weight: 600; }
.cbvt-choice-btn small { font-size: 11.5px; color: #6b7280; }

/* Frame-strip instruction line (background step + the cut-out dialog) */
.cbvt-strip-note { font-size: 11.5px; color: #6b7280; margin-bottom: 6px; }

/* R2.4f — the self-contained cut-out dialog (Alex: "whether it's an error
   message, the result, or part of the process, it should be contained
   within that modal"). Wider than the base confirm so the frame strip
   breathes; its own banner carries every progress/error/result line. */
.cbvt-cutout-dialog { max-width: 640px; }
.cbvt-cutout-dialog .cbvt-cutout-body { margin-bottom: 12px; }
.cbvt-cutout-dialog .cbvt-cutout-body:empty { display: none; }
.cbvt-cutout-dialog .cbvt-banner { margin-bottom: 12px; }
.cbvt-choice-btn:disabled { opacity: 0.55; cursor: default; }

/* R2.4b — the maker's numbered decision-tree steps (Alex: "collapse
   something so it's not all overwhelming… a logical workflow"). Native
   <details>: step 1 starts open, the rest expand on demand. */
.cbvt-step {
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
}
.cbvt-step > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  font-size: 13.5px; font-weight: 600; color: #15172b;
}
.cbvt-step > summary::-webkit-details-marker { display: none; }
.cbvt-step > summary i {
  flex: none; font-style: normal; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #ece9f7; color: #6a4cf1;
  font-size: 11.5px; font-weight: 700;
}
.cbvt-step[open] > summary i { background: #6a4cf1; color: #fff; }
.cbvt-step > summary small { font-weight: 500; font-size: 11.5px; color: #9ca3af; }
.cbvt-step > summary::after {
  content: '▾'; margin-left: auto; color: #9ca3af; font-size: 11px;
  transition: transform 0.15s ease;
}
.cbvt-step[open] > summary::after { transform: rotate(180deg); }
.cbvt-step-body {
  display: flex; flex-direction: column; gap: 12px;
  padding: 2px 14px 14px;
}

/* R2.4c — pulsing skeleton tiles in the suggestions zone while frames are
   sampled + scored: the "something is happening" signal lives exactly where
   the results will land. */
.cbvt-suggest-card.cbvt-skel {
  background: #eceef3; border: 1px solid #e5e7eb; cursor: default;
  animation: cbvt-skel-pulse 1.1s ease-in-out infinite;
}
@keyframes cbvt-skel-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) { .cbvt-suggest-card.cbvt-skel { animation: none; } }

/* R2.4d — real-time proofing. The subtitles preview carries a live caption
   overlay (styled like the burn: bottom-centred, dark box) that follows
   playback and repaints per keystroke while a line is being edited… */
.cbvt-live-caption {
  position: absolute; left: 50%; bottom: 8%;
  transform: translateX(-50%);
  max-width: 86%;
  background: rgba(10, 10, 20, 0.75); color: #fff;
  font-size: 15px; font-weight: 600; line-height: 1.35; text-align: center;
  padding: 4px 10px; border-radius: 6px;
  pointer-events: none; white-space: pre-wrap;
}
.cbvt-subs-row.active { background: #faf9ff; border-radius: 8px; }

/* …and each suggested quiet moment gets a play-through button, with the row
   highlighted while its stretch of video plays. */
.cbvt-gap-play {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #d0d3e0; background: #fff; color: #6a4cf1;
  font-size: 10px; line-height: 1; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.cbvt-gap-play:hover { border-color: #6a4cf1; background: #faf9ff; }
.cbvt-gap-row.playing { background: #f2effe; border-radius: 8px; }

/* R2.4e — the suggestions strip scrolls horizontally (up to 8 ranked
   frames), and the previewed pick is clearly selected. */
.cbvt-suggest-grid { overflow-x: auto; padding: 2px; }
.cbvt-suggest-card { flex: 0 0 150px; }
.cbvt-suggest-card.selected { border-color: #6a4cf1; box-shadow: 0 0 0 2px rgba(106, 76, 241, 0.25); }
