/* =========================================================================
   BUDGET OWNER DEMO (#budgetOwnerDemo).
   See src/components/BudgetOwnerDemo.astro for the storyboard.
   Timeline: public/js/budget-owner-demo.js toggles `is-*` classes and
   positions `.bod__cursor` at runtime.

   A single steady scene (no crossfade — same pattern as
   BudgetMultiplayerDemo/BudgetVarianceDemo): Ana Silva's own Customer
   Success budget page, organized by account.

   The --bod-* palette mirrors the PRODUCT (webapp_v3 src/styles/_theme.scss),
   same likeness rules and exact values as every other demo on this page.
   ========================================================================= */

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

/* standard product-demo dimensions (matches .bdd__stage / .btc__stage /
   .pf-visual-ph — the hero demo is the one exception, sized larger). */
.bod__stage {
  position: relative; overflow: hidden; width: 100%;
  aspect-ratio: 3 / 2; min-height: 380px; max-width: 640px; margin: 0 auto;
  background: var(--bod-canvas);
  display: flex; flex-direction: column;
  transition: opacity .5s ease;
}
.bod.is-out .bod__stage { opacity: 0; }

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

.bod__pane { flex: 1; min-height: 0; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; }

/* ---------- panel header — owner avatar chip, same language as the
   homepage hero demo's .bdHead/.bdUser ---------- */
.bodHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.bodHead__owner { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--bod-ink); }
.bodHead__owner i {
  width: 18px; height: 18px; border-radius: 50%; font-style: normal;
  font-size: 7.5px; font-weight: 700; color: #fff; background: var(--c);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.bodHead__lock { font-size: 9.5px; color: var(--bod-ink2); }
.bodHead__title { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--bod-ink); }

/* ---------- card grid — same card-style table as the rest of the page:
   shaded header row, full cell borders, rounded card. ---------- */
.bodGrid {
  display: grid; grid-template-columns: 1fr 70px 90px;
  background: var(--bod-card); border: 1px solid var(--bod-border); border-radius: 8px;
  overflow: hidden; max-width: 100%;
}
.bodCell {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 7px 8px; font-size: 10px; color: var(--bod-ink2);
  border-bottom: 1px solid var(--bod-line); border-right: 1px solid var(--bod-line);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .3s ease;
}
.bodCell--head { background: var(--bod-head); font-weight: 500; border-bottom: 1px solid var(--bod-border); }
.bodCell--label { justify-content: flex-start; gap: 4px; font-weight: 600; color: var(--bod-ink); }
.bodCell--val { font-variant-numeric: tabular-nums; position: relative; }
/* last column — no border-right (not nth-child: the expand row's single
   full-width child throws off any positional count of the grid's cells). */
.bodCell--status, .bodCell--substatus { justify-content: center; position: relative; border-right: none; }
.bod__chev { display: inline-block; width: 10px; color: var(--bod-ink2); font-size: 9px; transform: rotate(90deg); }

/* Software & Tools' vendor-level detail — always open (not a toggle in
   this demo, just the shape of the data: an account with vendor rows
   under it). */
.bodExpandRow { grid-column: 1 / -1; }
.bodSubgrid { display: grid; grid-template-columns: 1fr 70px 90px; }
.bodCell--sublabel { justify-content: flex-start; padding-left: 22px; font-weight: 400; font-size: 9.5px; background: var(--bod-canvas); }
.bodCell--subval { background: var(--bod-canvas); font-size: 9.5px; }
.bodCell--substatus { background: var(--bod-canvas); }

/* comment badge overlaid on the Zendesk value cell (the classic
   spreadsheet-cell-comment corner marker), plus the floating bubble it
   reveals — positioned by the JS driver like .bodStatusMenu, with a tail
   pointing down at whichever cell it's anchored to. */
.bodCell--subval { position: relative; }
.bod__commentBtn {
  position: absolute; top: -4px; right: -3px;
  font-size: 8px; line-height: 1; opacity: .8;
}
.bodCommentBubble {
  position: absolute; z-index: 8; max-width: 130px;
  opacity: 0; pointer-events: none; transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
  display: flex; align-items: flex-start; gap: 6px;
  padding: 6px 9px; font-size: 9px; line-height: 1.4; color: var(--bod-ink);
  background: var(--bod-accent-soft); border: 1px solid #CFC7EF; border-radius: 8px;
  box-shadow: 0 6px 16px rgba(20, 19, 15, .12);
}
.bodCommentBubble::after {
  content: ''; position: absolute; top: 100%; left: var(--tail-left, 50%);
  width: 8px; height: 8px; background: var(--bod-accent-soft);
  border-right: 1px solid #CFC7EF; border-bottom: 1px solid #CFC7EF;
  transform: translateY(-50%) rotate(45deg);
}
.bod.is-zd-commented .bodCommentBubble { opacity: 1; transform: none; }
.bodCommentBubble i {
  width: 14px; height: 14px; border-radius: 50%; font-style: normal;
  font-size: 6px; font-weight: 700; color: #fff; background: var(--c);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}

/* new vendor row — hidden until "+ Add vendor" is clicked, then grows
   open and gets typed into. */
.bodNewVendorWrap { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.bod.is-row-inserted .bodNewVendorWrap { max-height: 32px; }

/* "+ Add vendor" action row — same load-more language as
   BudgetDetailDemo's "142 more accounts" row. Hides once clicked. */
.bodCell--addvendor {
  grid-column: 1 / -1; justify-content: flex-start;
  padding: 6px 8px 6px 22px; color: var(--bod-accent); font-weight: 600;
  background: var(--bod-canvas); border-right: none;
  transition: transform .15s ease;
}
.bod.is-press-add .bodCell--addvendor { transform: scale(.97); }
.bod.is-row-inserted .bodCell--addvendor { display: none; }

/* ---------- status pills + dropdown ---------- */
.bodPill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 8.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  opacity: 0; transform: scale(.9); transition: opacity .25s ease, transform .25s ease;
}
.bodPill.is-shown { opacity: 1; transform: none; }
.bodPill--committed { color: var(--bod-green); background: var(--bod-green-soft); }
.bodPill--planned { color: var(--bod-ink2); background: var(--bod-head); border: 1px solid var(--bod-border); }
.bodPill__dot { width: 5px; height: 5px; border-radius: 50%; flex: none; background: currentColor; }

.bod.is-press-status [data-el="sfStatus"],
.bod.is-press-status [data-el="zdStatus"],
.bod.is-press-status [data-el="faStatus"] { background: var(--bod-head); }

/* one shared dropdown, repositioned by the JS driver over whichever
   Status cell is active. */
.bodStatusMenu {
  position: absolute; z-index: 8; width: 92px;
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  background: var(--bod-card); border: 1px solid var(--bod-border); border-radius: 6px;
  box-shadow: 0 6px 16px rgba(20, 19, 15, .12);
  padding: 4px; display: flex; flex-direction: column; gap: 1px;
}
.bod.is-menu-open .bodStatusMenu { opacity: 1; transform: none; }
.bodStatusMenu__opt {
  display: flex; align-items: center; gap: 6px;
  font-size: 9.5px; color: var(--bod-ink); padding: 5px 6px; border-radius: 4px;
  transition: background .15s ease;
}
.bodStatusMenu__opt--committed .bodPill__dot { background: var(--bod-green); }
.bodStatusMenu__opt--planned .bodPill__dot { background: var(--bod-ink2); }
.bod.is-menu-committed .bodStatusMenu__opt--committed,
.bod.is-menu-planned .bodStatusMenu__opt--planned { background: var(--bod-head); }

/* generic "being edited" cue for any vendor-detail value cell
   (element-scoped, not root-scoped) — used by Zendesk's edit and the new
   Fin.Ai row's initial entry. */
.bodCell.is-editing {
  outline: 1.5px solid var(--bod-accent); outline-offset: -1.5px;
  background: var(--bod-accent-soft);
  animation: bodCellPulse .8s ease-out;
}
@keyframes bodCellPulse {
  0% { box-shadow: 0 0 0 0 rgba(106, 91, 198, .45); }
  70% { box-shadow: 0 0 0 6px rgba(106, 91, 198, 0); }
  100% { box-shadow: 0 0 0 0 rgba(106, 91, 198, 0); }
}

/* ---------- cursor — positioned at runtime (JS sets left/top in px via
   getBoundingClientRect against .bod__stage), not hardcoded CSS
   percentages: this scene has several distinct click targets, and a
   measure-once-hardcode-forever percentage goes stale the moment row
   content changes (as it has repeatedly elsewhere on this page). ---------- */
.bod__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;
}
.bod.is-cursor-visible .bod__cursor { opacity: 1; }
