/* ============================================================
   COLLABORATOR PICKER + COLLABORATION BADGES
   Matches the ActGram create-flow inputs (.ctr-input), the
   share-sheet user rows, and the brand cyan (#00AEEF). No
   existing rules are overridden — everything is namespaced.
   ============================================================ */

/* ---------- Picker: selected chips ---------- */
.cbp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cbp-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: #E8F7FD; border: 1px solid rgba(0, 174, 239, 0.22);
  border-radius: 999px; padding: 4px 8px 4px 4px;
  max-width: 100%;
}
.cbp-chip-av {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  background: #E2E8F0; flex-shrink: 0;
}
.cbp-chip-name {
  font-size: 12.5px; font-weight: 700; color: #0F172A;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.cbp-chip .ag-profile-name-verified,
.cbp-chip .ag-profile-badge-premium { transform: scale(0.85); }
.cbp-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border: none; border-radius: 50%;
  background: rgba(15, 23, 42, 0.08); color: #475569;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.cbp-chip-x:hover { background: rgba(220, 38, 38, 0.14); color: #DC2626; }
.cbp-chip-x i { font-size: 12px; }

/* ---------- Picker: input + @ icon ---------- */
/* Explicit typed-text color so search stays readable on the light create forms
   (ctr-input already sets this; keep it here in case a parent theme overrides). */
.cbp-input {
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A;
  caret-color: #0F172A;
}
.cbp-input::placeholder {
  color: #94A3B8 !important;
  -webkit-text-fill-color: #94A3B8;
  opacity: 1;
}
.cbp-at-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #94A3B8; font-size: 16px; pointer-events: none;
}
.cbp-input-wrap:focus-within .cbp-at-icon { color: #00AEEF; }

/* ---------- Picker: dropdown ---------- */
.cbp-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 14px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
  max-height: 280px; overflow-y: auto; z-index: 60;
  -webkit-overflow-scrolling: touch;
}
.cbp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; cursor: pointer;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  transition: background 140ms;
}
.cbp-row:last-child { border-bottom: none; }
.cbp-row:hover, .cbp-row--active { background: #F0FAFF; }
.cbp-row-av {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  background: #E2E8F0; flex-shrink: 0;
}
.cbp-row-meta { flex: 1; min-width: 0; }
.cbp-row-name {
  font-size: 14px; font-weight: 700; color: #0F172A;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.cbp-row-sub {
  font-size: 11.5px; color: #94A3B8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cbp-row-add {
  font-size: 18px; color: #00AEEF; flex-shrink: 0;
}
.cbp-empty {
  padding: 20px 12px; text-align: center; font-size: 13px; color: #94A3B8;
}

/* ============================================================
   COLLABORATION BADGE — Instagram-style "A and B" shared byline.
   Rendered on feed cards, reel overlays, and post-detail headers.
   ============================================================ */
.ag-collab-byline {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-weight: 700;
}
.ag-collab-byline .ag-collab-link,
.ag-collab-author-line .ag-collab-link {
  color: inherit; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 2px;
}
.ag-collab-byline .ag-collab-link:hover,
.ag-collab-author-line .ag-collab-link:hover { text-decoration: underline; }
.ag-collab-link--plain { cursor: default; }
.ag-collab-byline .ag-collab-and,
.ag-collab-author-line .ag-collab-and { font-weight: 500; opacity: 0.72; }
.ag-collab-author-line { display: inline; }

/* Small avatar stack shown next to a collab byline (creator + collaborator) */
.ag-collab-avstack { display: inline-flex; align-items: center; }
.ag-collab-avstack img {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  border: 2px solid #FFFFFF; background: #E2E8F0; margin-left: -8px;
}
.ag-collab-avstack img:first-child { margin-left: 0; }

/* "Collab" pill (feed thumbnail corner / detail meta) */
.ag-collab-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 800; color: #0072B5;
  background: #E8F7FD; border-radius: 999px; padding: 2px 8px;
}
.ag-collab-pill i { font-size: 12px; }

/* Reel overlay variant — legible on dark video */
.reel-collab-byline .ag-collab-link,
.feed-reel-overlay-username .ag-collab-link { color: #FFFFFF; }
.reel-collab-byline .ag-collab-and,
.feed-reel-overlay-username .ag-collab-and { color: rgba(255,255,255,0.8); }
.spotlight-detail .sd-hero-name .ag-collab-link { color: #fff; }
.spotlight-detail .sd-hero-name .ag-collab-and { color: rgba(255,255,255,0.85); }

/* ---------- Optional dark-surface variant ----------
   Only for true dark backgrounds. The director add-media sheet is light
   (white inputs), so do NOT put .cbp-dark on that form — light text on a
   white field made typed names invisible. */
.cbp-dark .cbp-input {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #F1F5F9 !important;
  -webkit-text-fill-color: #F1F5F9;
  caret-color: #F1F5F9;
}
.cbp-dark .cbp-input::placeholder {
  color: rgba(226, 232, 240, 0.5) !important;
  -webkit-text-fill-color: rgba(226, 232, 240, 0.5);
}
.cbp-dark .cbp-at-icon { color: rgba(226, 232, 240, 0.6); }
.cbp-dark .cbp-chip {
  background: rgba(0, 174, 239, 0.16); border-color: rgba(0, 174, 239, 0.32);
}
.cbp-dark .cbp-chip-name { color: #F1F5F9; }
.cbp-dark .cbp-chip-x { background: rgba(255, 255, 255, 0.12); color: #E2E8F0; }

/* Dark-mode friendliness for the dropdown/chip (viewer theme aware) */
@media (prefers-color-scheme: dark) {
  :root[data-theme="dark"] .cbp-dropdown { background: #0F172A; border-color: #1E293B; }
  :root[data-theme="dark"] .cbp-row:hover,
  :root[data-theme="dark"] .cbp-row--active { background: #1E293B; }
  :root[data-theme="dark"] .cbp-row-name { color: #F1F5F9; }
}
