/* =========================================================================
   RE-PLAN DIFF DEMO (#rePlanDiffDemo).
   See src/components/RePlanDiffDemo.astro for the storyboard.
   Timeline: public/js/re-plan-diff-demo.js toggles `is-*` classes and
   positions `.rpd__cursor` at runtime.

   A single steady scene, no crossfade — a two-version comparison table
   (flex rows) with an audit line beneath it, same audit-line language as
   QuotaLoadDemo's .qldAudit. Same --xxx-canvas/card/border/accent
   palette (product likeness) as every other demo on the site.
   ========================================================================= */

.rpd {
  --rpd-canvas: #FAF9F5;
  --rpd-card: #FFFFFF;
  --rpd-border: #DBDBDE;
  --rpd-line: #EAEAEA;
  --rpd-head: #F6F6F7;
  --rpd-ink: #2B2B2B;
  --rpd-ink2: #777777;
  --rpd-accent: #6A5BC6;
  --rpd-accent-soft: #ECECFF;
  --rpd-green: #2C8E45;
  --rpd-green-soft: #E3F5E9;
  --rpd-red: #D63B29;
}

.rpd__stage {
  position: relative; overflow: hidden; width: 100%;
  aspect-ratio: 3 / 2; min-height: 380px; max-width: 640px; margin: 0 auto;
  background: var(--rpd-canvas);
  display: flex; flex-direction: column;
  transition: opacity .5s ease;
}
.rpd.is-out .rpd__stage { opacity: 0; }

.rpd__topBar {
  flex: none; font-size: 11px; font-weight: 600; color: var(--rpd-ink);
  padding: 12px 14px 9px; border-bottom: 1px solid var(--rpd-line);
  white-space: nowrap;
}

.rpd__pane { flex: 1; min-height: 0; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; }

.rpdHead { margin-bottom: 8px; }
.rpdHead__title { font-size: 12px; font-weight: 600; color: var(--rpd-ink); }

.rpdTable { background: var(--rpd-card); border: 1px solid var(--rpd-border); border-radius: 8px; overflow: hidden; }
.rpdRow {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 9px; font-size: 9.5px; color: var(--rpd-ink2);
  border-bottom: 1px solid var(--rpd-line);
}
.rpdTable > .rpdRow:last-child { border-bottom: none; }
.rpdRow--head { background: var(--rpd-head); font-weight: 500; border-bottom: 1px solid var(--rpd-border); }
.rpdRow__role { flex: 1; min-width: 0; font-weight: 600; color: var(--rpd-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpdRow--head .rpdRow__role { font-weight: 500; color: var(--rpd-ink2); }
.rpdRow__ver { flex: none; width: 68px; text-align: right; font-variant-numeric: tabular-nums; }
.rpdRow__ver--old { color: var(--rpd-ink2); }
.rpdRow__ver--new { font-weight: 700; color: var(--rpd-ink); }

.rpdRow--moved .rpdRow__ver--new { color: var(--rpd-accent); }
.rpdRow--cancelled .rpdRow__ver--old { text-decoration: line-through; opacity: .6; }
.rpdRow--cancelled .rpdRow__ver--new { color: var(--rpd-red); }
.rpdRow--new .rpdRow__ver--new { color: var(--rpd-green); }

.rpd.is-flagged [data-el="movedCell"] {
  outline: 1.5px solid var(--rpd-accent); outline-offset: -1.5px; border-radius: 3px;
  background: var(--rpd-accent-soft);
}

.rpdAudit {
  display: flex; align-items: center; gap: 7px; margin-top: 9px;
  padding: 7px 9px; background: var(--rpd-card);
  border: 1px solid var(--rpd-border); border-radius: 8px;
  font-size: 8.5px; color: var(--rpd-ink2);
  opacity: 0; transform: translateY(4px);
  transition: opacity .35s ease, transform .35s ease;
}
.rpd.is-logged .rpdAudit { opacity: 1; transform: none; }
.rpdAudit i {
  width: 15px; height: 15px; border-radius: 50%; flex: none; font-style: normal;
  font-size: 6px; font-weight: 700; color: #fff; background: var(--rpd-accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.rpdAudit b { color: var(--rpd-ink); font-weight: 600; }
.rpdAudit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rpd__cursor {
  position: absolute; opacity: 0; pointer-events: none; z-index: 9;
  transition: left .6s cubic-bezier(.5, .05, .3, 1), top .6s cubic-bezier(.5, .05, .3, 1), opacity .3s ease;
}
.rpd.is-cursor-visible .rpd__cursor { opacity: 1; }

@media (max-width: 460px) {
  .rpd__stage { aspect-ratio: auto; min-height: 440px; }
  .rpdRow__ver { width: 54px; }
  .rpdRow { padding: 7px 6px; font-size: 8.5px; }
}
