/* ============================================================
   <pb-save-popover> — the "Merken" / Collections picker
   ------------------------------------------------------------
   A singleton, body-appended dropdown anchored to a talent
   card's bookmark star. position:fixed, right-edge aligned to
   the star, opens below by default and flips above (.up) when
   there is no room. The `.open` class drives the entrance
   transition (added on the next frame).

   The visual language (.collpop / .cp-*) mirrors the original
   prototype's picker; every hard-coded value from that
   stylesheet is lifted into a component-scoped custom property
   below so the rest of the rules stay token-driven.
   ============================================================ */

.collpop {
  /* --- component-scoped tokens (the prototype's hard-codes) --- */
  --cp-w: 14.25rem;            /* fixed popover width */
  --cp-anim: 0.16s;         /* open/close transition */
  --cp-pad-y: 0.5625rem;          /* row vertical padding */
  --cp-pad-x: 0.6875rem;         /* row horizontal padding */
  --cp-ic: 1rem;            /* leading / check icon box */
  --cp-ck-svg: 0.875rem;        /* check glyph size */

  position: fixed;
  z-index: var(--z-popover);
  width: var(--cp-w);
  background: var(--surface);
  border: none;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;

  /* Closed state — fades + lifts in from the anchored corner. */
  opacity: 0;
  transform: translateY(-0.25rem) scale(0.98);
  transform-origin: top right;
  transition: opacity var(--cp-anim) var(--ease), transform var(--cp-anim) var(--ease);
}
.collpop.open { opacity: 1; transform: none; }
.collpop.up   { transform-origin: bottom right; }   /* flipped above the star */

/* ---- Menu shell ---- */
.collpop .cp-menu {
  display: flex;
  flex-direction: column;
  padding: 0.3125rem;
}

/* ---- A single option row (Ohne Collection / a collection / Neue …) ---- */
.cp-opt {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  border: none;
  background: transparent;
  padding: var(--cp-pad-y) var(--cp-pad-x);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.cp-opt:hover { background: var(--surface-2); }

/* leading icon (bookmark / folder / folder-plus) */
.cp-opt .cp-opt-ic {
  flex: none;
  width: var(--cp-ic);
  height: var(--cp-ic);
  color: var(--text-faint);
  display: grid;
  place-items: center;
}
.cp-opt .cp-opt-ic svg { width: var(--cp-ic); height: var(--cp-ic); }
.cp-opt.on .cp-opt-ic,
.cp-opt:hover .cp-opt-ic { color: var(--text-soft); }

/* label — truncates with an ellipsis when the name is long */
.cp-opt .cp-opt-t {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* trailing check — hidden until the row is selected */
.cp-opt .cp-opt-ck {
  flex: none;
  width: var(--cp-ic);
  height: var(--cp-ic);
  color: var(--text);
  opacity: 0;
  display: grid;
  place-items: center;
}
.cp-opt .cp-opt-ck svg { width: var(--cp-ck-svg); height: var(--cp-ck-svg); }

/* selected = bold label + visible check */
.cp-opt.on { font-weight: 600; }
.cp-opt.on .cp-opt-ck { opacity: 1; }

/* "Neue Collection …" trigger row */
.cp-opt.new { color: var(--text-soft); }
.cp-opt.new:hover { color: var(--text); }

/* ---- Divider between groups ---- */
.collpop .cp-div {
  height: 0.0625rem;
  background: var(--border);
  margin: 0.3125rem 0.375rem;
}

/* ---- Inline "new collection" input (replaces the .new row) ---- */
.cp-opt.cp-inew {
  cursor: default;
  background: var(--surface-2);
}
.cp-opt.cp-inew .cp-opt-ic { color: var(--text-soft); }
.cp-opt.cp-inew input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text);
}
.cp-opt.cp-inew input::placeholder { color: var(--text-faint); }
