/**
 * TaskBuilder - Bulk "Assign Co-workers" dialog (project list), SaaS theme
 * Everything is scoped to the shared popup while it holds the bulk form
 * (#wppm_popup:has(#frm_get_bulk_project_users)), so every other dialog and the
 * single-project user pickers keep their current look.
 * No markup or JS changes: the search autocomplete, the rows it appends
 * (.wppm_user_display_container) and the submitted fields are untouched.
 * Colors from Settings > Appearance > Modal (header/body/footer backgrounds,
 * label/text colors, action button) are applied inline and are never overridden.
 */

/* ===================== Popup frame (only for this dialog) ===================== */
#wppm_popup:has(#frm_get_bulk_project_users) {
  height: auto !important;
  max-width: 580px;
  left: 0;
  right: 0;
  margin-left: auto !important;
  margin-right: auto !important;
  float: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px -12px rgba(15,23,42,.35), 0 2px 8px rgba(15,23,42,.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_title {
  margin: 0;
  padding: 18px 24px !important;
  border-bottom: 1px solid #e5e7eb;
}
#wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_title h3 {
  margin: 0;
  font: 700 17px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
}
#wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_body {
  margin: 0;
  /* Room for the search suggestions without the body scrolling straight away */
  min-height: 300px;
  max-height: calc(100vh - 210px);
  padding: 20px 24px 12px !important;
}
#wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 14px 24px !important;
  border-top: 1px solid #e5e7eb;
}
#wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_footer button {
  width: auto;
  min-width: 96px;
  height: 38px;
  margin: 0;
  padding: 0 18px;
  border-radius: 9px !important;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-shadow: none;
}
#wppm_popup:has(#frm_get_bulk_project_users) .wppm_popup_close {
  border: 1px solid #e5e7eb;
}
#wppm_popup:has(#frm_get_bulk_project_users) .wppm_popup_action:hover {
  filter: brightness(.94);
}

/* ===================== Form ===================== */
#frm_get_bulk_project_users {
  --bau-primary: #4f46e5;
  --bau-primary-light: #eef2ff;
  --bau-ink: #111827;
  --bau-muted: #6b7280;
  --bau-border: #e5e7eb;
  --bau-soft: #f8fafc;
  font-size: 13.5px;
}
#frm_get_bulk_project_users #wppm_get_users {
  position: relative;
}

/* Search box with icon */
#frm_get_bulk_project_users #wppm_user_name {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  margin: 0 0 14px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--bau-border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px 50% / 16px 16px;
  box-shadow: none;
  color: var(--bau-ink);
  font-size: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
#frm_get_bulk_project_users #wppm_user_name:focus {
  outline: none;
  border-color: var(--bau-primary);
  box-shadow: 0 0 0 3px var(--bau-primary-light);
}

/* Search suggestions (jQuery UI autocomplete, appended next to the input) */
#frm_get_bulk_project_users .ui-autocomplete {
  z-index: 10;
  max-height: 240px;
  margin: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--bau-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 36px -12px rgba(16,24,40,.28);
  list-style: none;
}
#frm_get_bulk_project_users .ui-autocomplete .ui-menu-item {
  margin: 0;
  padding: 0;
  border: none;
  list-style: none;
}
#frm_get_bulk_project_users .ui-autocomplete .ui-menu-item-wrapper,
#frm_get_bulk_project_users .ui-autocomplete .ui-menu-item > a {
  display: block;
  margin: 0;
  padding: 8px 10px;
  border: none !important;
  border-radius: 8px;
  background: transparent;
  color: var(--bau-ink);
  font-size: 13.5px;
  line-height: 1.35;
  cursor: pointer;
}
#frm_get_bulk_project_users .ui-autocomplete .ui-state-active,
#frm_get_bulk_project_users .ui-autocomplete .ui-menu-item-wrapper:hover {
  margin: 0;
  background: var(--bau-primary-light) !important;
  color: #3730a3 !important;
}

/* ===================== Selected co-workers ===================== */
#frm_get_bulk_project_users #wppm_bulk_proj_users_display_container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#frm_get_bulk_project_users .wppm_user_display_container {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  padding: 8px 8px 8px 10px !important;
  border: 1px solid var(--bau-border);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  transition: border-color .12s ease, background-color .12s ease;
}
#frm_get_bulk_project_users .wppm_user_display_container:hover {
  border-color: #d1d5db;
  background: var(--bau-soft);
}
#frm_get_bulk_project_users .wppm_user_display_container::before,
#frm_get_bulk_project_users .wppm_user_display_container::after {
  display: none; /* bootstrap .row clearfix */
}
#frm_get_bulk_project_users .wppm_user_display_container > [class*="col-"] {
  width: auto;
  float: none;
  padding: 0;
}

/* Name with an avatar circle */
#frm_get_bulk_project_users .wppm_user_display_container .flex-container {
  display: flex !important;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto !important;
  min-width: 0;
  max-width: none;
  height: auto;
  margin: 0;
  padding: 0 !important;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--bau-ink) !important;
  font-size: 13.5px;
  font-weight: 600;
}
#frm_get_bulk_project_users .wppm_user_display_container .flex-container::before {
  content: "\f110"; /* dashicons-admin-users */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bau-primary-light);
  color: var(--bau-primary);
  font: normal 17px/1 dashicons;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_filter_display_text {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Role select */
#frm_get_bulk_project_users .wppm_user_display_container .wppm_user_role {
  flex: 0 0 150px;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_user_role select {
  width: 100% !important;
  height: 34px !important;
  min-height: 34px !important;
  margin: 0;
  padding: 0 28px 0 10px !important;
  border: 1px solid var(--bau-border) !important;
  border-radius: 8px !important;
  background-color: #fff;
  box-shadow: none !important;
  color: var(--bau-ink);
  font-size: 12.5px !important;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_user_role select:focus {
  outline: none;
  border-color: var(--bau-primary) !important;
  box-shadow: 0 0 0 3px var(--bau-primary-light) !important;
}

/* Remove */
#frm_get_bulk_project_users .wppm_user_display_container .wppm_delete_user_icon {
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center;
  justify-content: center;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_delete_user_icon span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .12s ease;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_delete_user_icon img {
  width: 13px;
  height: 13px;
  opacity: .55;
  transition: opacity .12s ease;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_delete_user_icon span:hover {
  background: #fee2e2;
}
#frm_get_bulk_project_users .wppm_user_display_container .wppm_delete_user_icon span:hover img {
  opacity: 1;
}

/* ===================== Small screens ===================== */
@media (max-width: 600px) {
  #wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_body,
  #wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_title,
  #wppm_popup:has(#frm_get_bulk_project_users) #wppm_popup_footer {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  #frm_get_bulk_project_users .wppm_user_display_container {
    flex-wrap: wrap;
  }
  #frm_get_bulk_project_users .wppm_user_display_container .flex-container {
    flex-basis: calc(100% - 42px) !important;
  }
  #frm_get_bulk_project_users .wppm_user_display_container .wppm_delete_user_icon {
    order: 2;
  }
  #frm_get_bulk_project_users .wppm_user_display_container .wppm_user_role {
    order: 3;
    flex: 1 1 100%;
    padding-left: 42px;
  }
}
