/* ════════════════════════════════════════════════════════════════
   OrivenAI — generation progress (js/orivenProgress.js)
   Create (campaign build), video creative cards, Research.
   Uses the --ow-* tokens (light + dark, orivenWorkspace.css). Motion is
   transform/opacity only: one indeterminate bar and a soft pulse on the
   active stage — both removed under prefers-reduced-motion.
   ════════════════════════════════════════════════════════════════ */
.op {
  --op-accent: var(--ow-lime-fill, #B6FF3B);
  --op-accent-ink: var(--ow-lime, #4F7A00);
  max-width: 560px; margin: 0 auto; color: var(--ow-ink);
  border: 1px solid var(--ow-line); border-radius: 16px; background: var(--ow-card);
  padding: 26px 28px 22px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 40px -18px rgba(0, 0, 0, .18);
}
.op-head { margin-bottom: 18px; }
.op-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.op-chips span {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ow-sub); border: 1px solid var(--ow-line); border-radius: 999px; padding: 3px 9px;
}
.op-title { margin: 0; font-size: clamp(20px, 2.2vw, 24px); font-weight: 650; letter-spacing: -.02em; text-wrap: balance; }

.op-now { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.op-status { margin: 0; font-size: 15px; font-weight: 560; color: var(--ow-ink); min-height: 1.4em; flex: 1 1 260px; }
.op[data-state="error"] .op-status:empty { display: none; }
.op-meta { margin: 0; display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; color: var(--ow-sub); white-space: nowrap; }
.op-elapsed { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ow-ink); }
.op-est::before { content: '·'; margin-right: 10px; color: var(--ow-sub); }

/* Indeterminate bar — no percentage exists, so none is shown. */
.op-bar { position: relative; height: 3px; margin: 14px 0 20px; border-radius: 3px; overflow: hidden; background: var(--ow-raise-2, rgba(0, 0, 0, .06)); }
.op-bar span { position: absolute; inset: 0 auto 0 0; width: 34%; border-radius: inherit; background: var(--op-accent); transform: translateX(-100%); }
.op[data-state="done"] .op-bar span { width: 100%; transform: none; transition: width .3s var(--ow-ease, ease); }
.op[data-state="error"] .op-bar span { width: 100%; transform: none; background: var(--ow-coral); opacity: .55; }

.op-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.op-stage { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; padding: 7px 0; color: var(--ow-sub); font-size: 14px; }
.op-mark { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--ow-line); display: grid; place-items: center; position: relative; }
.op-mark::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.op-st { display: grid; gap: 2px; min-width: 0; }
.op-st-t { line-height: 1.35; }
.op-st-note { font-size: 12.5px; color: var(--ow-sub); line-height: 1.45; }
.op-st-note:empty { display: none; }
.op-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.op-stage[data-s="active"] { color: var(--ow-ink); font-weight: 600; }
.op-stage[data-s="active"] .op-mark { border-color: var(--op-accent-ink); }
.op-stage[data-s="active"] .op-mark::before { background: var(--op-accent-ink); }
.op-stage[data-s="done"] { color: var(--ow-ink); }
.op-stage[data-s="done"] .op-mark { border-color: var(--op-accent-ink); background: var(--op-accent-ink); }
.op-stage[data-s="done"] .op-mark::before { width: 8px; height: 4px; border-radius: 0; background: none; border: solid var(--ow-card); border-width: 0 0 1.8px 1.8px; transform: translateY(-1px) rotate(-45deg); }
.op-stage[data-s="skipped"] { opacity: .55; }
.op-stage[data-s="skipped"] .op-st-t { text-decoration: line-through; text-decoration-color: var(--ow-line); }
.op-stage[data-s="bg"] { color: var(--ow-ink); }
.op-stage[data-s="bg"] .op-mark { border-style: dashed; border-color: var(--op-accent-ink); }
.op-stage[data-s="bg"] .op-mark::before { background: var(--op-accent-ink); }
.op-stage[data-s="warn"] { color: var(--ow-ink); }
.op-stage[data-s="warn"] .op-mark { border-color: var(--ow-amber); color: var(--ow-amber); }
.op-stage[data-s="warn"] .op-mark::before { content: '!'; width: auto; height: auto; background: none; font-size: 11px; font-weight: 800; line-height: 1; }
.op-stage[data-s="failed"] { color: var(--ow-ink); font-weight: 600; }
.op-stage[data-s="failed"] .op-mark { border-color: var(--ow-coral); color: var(--ow-coral); }
.op-stage[data-s="failed"] .op-mark::before { content: '×'; width: auto; height: auto; background: none; font-size: 13px; line-height: 1; }

.op-foot:not(:empty) { margin-top: 16px; }
.op-notice { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; color: var(--ow-sub); background: var(--ow-raise-2, rgba(0, 0, 0, .04)); }
.op-notice-slow { border-left: 2px solid var(--ow-amber); }
.op-notice-retry { border-left: 2px solid var(--ow-blue); }

/* Compact (Research strip) */
.op-compact { max-width: none; border: 0; box-shadow: none; background: transparent; padding: 4px 0; }
.op-compact .op-bar { margin: 10px 0 12px; }
.op-compact .op-stage { padding: 5px 0; font-size: 13.5px; }

@media (prefers-reduced-motion: no-preference) {
  .op[data-state="running"] .op-bar span, .op-vprog .op-bar span { animation: opSlide 1.6s cubic-bezier(.45, 0, .25, 1) infinite; }
  .op-stage[data-s="active"] .op-mark::before { animation: opPulse 1.6s ease-in-out infinite; }
  .op-stage { transition: color .2s ease; }
}
@media (prefers-reduced-motion: reduce) {
  .op[data-state="running"] .op-bar span, .op-vprog .op-bar span { transform: none; width: 100%; opacity: .35; }
}
@keyframes opSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes opPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.6); opacity: .5; } }

@media (max-width: 640px) {
  .op:not(.op-compact) { padding: 20px 18px 18px; border-radius: 14px; }
  .op-now { flex-direction: column; align-items: flex-start; gap: 4px; }
  .op-status { flex: none; }
}

/* ── Video creative card (Create results grid) ─────────────────── */
.op-vcard { display: grid; gap: 0; }
.op-vframe {
  position: relative; aspect-ratio: 9 / 16; max-height: 300px; width: 100%; overflow: hidden;
  background: linear-gradient(160deg, rgba(127, 127, 127, .14), rgba(127, 127, 127, .05));
  display: grid; place-items: center;
}
.op-vframe svg { width: 34px; height: 34px; opacity: .45; }
.op-vprog .op-bar span { position: absolute; inset: 0 auto 0 0; width: 34%; border-radius: inherit; background: var(--ow-lime-fill, #B6FF3B); transform: translateX(-100%); }
.op-vframe .op-bar { position: absolute; left: 14px; right: 14px; bottom: 14px; margin: 0; background: rgba(127, 127, 127, .22); }
.op-vbody { padding: 12px 14px 14px; display: grid; gap: 6px; }
.op-vstage { margin: 0; font-size: 13.5px; font-weight: 600; }
.op-vmsg { margin: 0; font-size: 12.5px; line-height: 1.5; opacity: .72; }
.op-vmeta { margin: 0; display: flex; gap: 8px; font-size: 12px; opacity: .8; }
.op-vmeta .op-elapsed { color: inherit; }
.op-vcard .op-notice { background: rgba(127, 127, 127, .12); color: inherit; opacity: .9; font-size: 12.5px; padding: 8px 10px; }

/* Research canvas is always dark (styles.css .rsc-canvas), whatever the
   app theme — progress inside it uses the dark token values. */
.rsc-canvas .op {
  --ow-ink: #F2F2EE; --ow-sub: rgba(255, 255, 255, .58); --ow-line: rgba(255, 255, 255, .12);
  --ow-raise-2: rgba(255, 255, 255, .06); --ow-card: #0e0e10;
  --ow-amber: #F5B84A; --ow-coral: #FF6B5E; --ow-blue: #7CB7FF;
  --op-accent-ink: #B6FF3B;
}
#researchActivityFeed > .op { flex: 1 1 100%; }
