/* ============================================================================
   16. App components (port of the legacy funeraloffice set)
   ----------------------------------------------------------------------------
   Data-driven in-app blocks rendered by components/{board,feed,stepper,tasks,
   calendar,related_list,page_nav,link_cta,collection_cards,donation_wall,
   record_photo,doc}.rs. Same flat hairline language as the rest of the theme:
   cards, hairline borders, small radii, mono micro-labels, realtime reloads
   via `data-entity`.
   ========================================================================== */

/* ---- 16a. Kanban board -------------------------------------------------- */

.board {
  display: grid;
  gap: 1rem;
}

.board-columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15rem, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

/* Flat — no panel/border around the column. The reference board has no
   boxed columns at all: just a header, a hairline rule under it, and cards
   floating in open space. A boxed column here was extra chrome the
   reference never had. */
.board-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--ta-r);
  transition: background-color 140ms ease;
}

.board-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem 0.6rem;
  border-bottom: 1px solid var(--ta-border);
}

.board-col-head h3 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* A small categorical dot ahead of each column's name — pure CSS, cycling
   through a fixed palette by column position so a board never needs the
   caller to assign per-status colours. */
.board-col-head h3::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.45em;
  border-radius: 50%;
  background: var(--ta-faint);
  vertical-align: middle;
}

.board-col:nth-of-type(6n + 1) .board-col-head h3::before { background: #8a8f98; }
.board-col:nth-of-type(6n + 2) .board-col-head h3::before { background: #3a6df0; }
.board-col:nth-of-type(6n + 3) .board-col-head h3::before { background: #b7791f; }
.board-col:nth-of-type(6n + 4) .board-col-head h3::before { background: #7c5cd6; }
.board-col:nth-of-type(6n + 5) .board-col-head h3::before { background: #1f9d55; }
.board-col:nth-of-type(6n + 6) .board-col-head h3::before { background: #d64545; }

.board-count {
  color: var(--ta-muted);
  font-family: var(--ta-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.board-col-body {
  display: grid;
  align-content: start;
  gap: 0.1rem;
  padding: 0.25rem 0.25rem 0.6rem;
  min-height: 2rem;
}

/* Borderless row, not a boxed card — the reference board has no card
   background/border at all, just a photo+text row with a quiet hover
   wash, same as a contact list rather than a product grid. */
.board-card {
  border-radius: var(--ta-r-sm);
  transition: background-color 120ms ease;
}

.board-card:hover {
  background: var(--ta-surface-2);
}

.board-card-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.board-card-link:hover {
  text-decoration: none;
}

/* Photo sits to the left of the text, like a contact row — the reference
   board never puts the photo above the title (that's a product-thumbnail
   layout, not a person-record layout). */
.board-card-photo {
  display: block;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface-2);
  object-fit: cover;
}

.board-card-body {
  min-width: 0;
}

.board-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card-sub {
  margin-top: 0.1rem;
  color: var(--ta-muted);
  font-family: var(--ta-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The reference board is drag-only — no per-card select/button. Ours needs
   a no-JS fallback (board.js drives the real drag-and-drop), but showing
   that fallback *unconditionally* is what made every card look cluttered
   next to the reference: a form is not a card. `html.no-js` starts on
   every page load and is stripped by an inline boot script the instant JS
   runs (see THEME_BOOT_SCRIPT in renderer.rs) — so this only ever shows up
   when script genuinely didn't execute, not as a flash-then-hide. */
.board-move {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.no-js .board-move {
  display: flex;
}

.board-move select {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface);
  color: var(--ta-text);
  font: inherit;
  font-size: 0.8rem;
}

.board-move button {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface);
  color: var(--ta-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.board-move button:hover {
  border-color: var(--ta-accent);
  color: var(--ta-accent);
}

/* --- 16a. Kanban board: drag-and-drop -------------------------------- */
/* The card is the grab surface, like the legacy board: grab on hover,
   grabbing while held, and a dimmed copy left behind mid-drag. */
.board-card[draggable="true"] {
  cursor: grab;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.board-card[draggable="true"]:active {
  cursor: grabbing;
}

.board-card.is-dragging {
  opacity: 0.4;
}

/* The hovered column lights up so the drop target is never a guess — a
   soft accent wash and a padded outline that only appears while dragging
   (the column stays flat/borderless at rest). */
.board-col.is-over {
  padding: 0.4rem;
  margin: -0.4rem;
  outline: 1px solid color-mix(in srgb, var(--ta-accent) 60%, var(--ta-border));
  background: color-mix(in srgb, var(--ta-accent) 14%, var(--ta-surface-2));
}

/* An empty stage keeps its full column and a visible "Empty" placeholder
   (the JS swaps it to "Move to …" while a drag hovers the column). */
.board-empty {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  color: var(--ta-muted);
  font-size: 0.8rem;
  text-align: center;
  transition: border-color 140ms ease, color 140ms ease;
}

.board-col.is-over .board-empty {
  border-color: color-mix(in srgb, var(--ta-accent) 60%, var(--ta-border));
  color: var(--ta-accent);
}

/* A rejected move snaps back and says why, instead of silently undoing on
   the next refresh. */
.board-move-error {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ta-err) 30%, var(--ta-border));
  border-radius: var(--ta-r-sm);
  background: color-mix(in srgb, var(--ta-err) 8%, transparent);
  color: var(--ta-err);
  font-size: 0.85rem;
}

/* The touch-drag ghost: fixed so the column's own overflow can't clip it,
   pointer-events none so elementFromPoint reads the column underneath. */
.board-drag-ghost {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 80vw;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface);
  color: var(--ta-text);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--ta-shadow);
}

