/* ===== "On behalf of" user picker (admin resource forms) ===== */
.behalf-picker {
  position: relative;
}

.behalf-search-row {
  position: relative;
  display: flex;
  align-items: center;
}

.behalf-search-icon {
  position: absolute;
  left: 12px;
  font-size: 20px;
  color: var(--md-on-surface-variant);
  pointer-events: none;
}

.behalf-search-input {
  padding-left: 40px !important;
  width: 100%;
}

.behalf-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--md-surface-container-high, #fff);
  border: 1px solid var(--md-outline-variant, #e0e0e0);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 20;
  padding: 4px;
}

.behalf-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.behalf-result:hover,
.behalf-result:focus {
  background: var(--md-surface-container, #f0f0f0);
}

.behalf-result-avatar,
.behalf-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--md-primary-container, #dbeafe);
  color: var(--md-on-primary-container, #1e40af);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.behalf-result-avatar img,
.behalf-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.behalf-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.behalf-result-name {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.behalf-result-handle {
  font-size: 0.75rem;
  color: var(--md-on-surface-variant);
}

.behalf-empty {
  padding: 12px;
  text-align: center;
  color: var(--md-on-surface-variant);
  font-size: 0.8125rem;
}

.behalf-selection {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--md-secondary-container, #e0e7ff);
  color: var(--md-on-secondary-container, #1e3a8a);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--md-primary, #1b6ef3) 20%, transparent);
}

.behalf-avatar {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}

.behalf-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.behalf-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.behalf-handle {
  font-size: 0.8125rem;
  opacity: 0.85;
}

.behalf-clear {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.behalf-clear:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

/* ===== @-mention autocomplete dropdown (author fields) ===== */
.mention-wrap {
  position: relative;
  display: block;
}

.mention-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--md-surface-container-high, #fff);
  border: 1px solid var(--md-outline-variant, #e0e0e0);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 30;
  padding: 4px;
}

.mention-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.mention-result:hover,
.mention-result.active {
  background: var(--md-surface-container, #f0f0f0);
}

.mention-result-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--md-primary-container, #dbeafe);
  color: var(--md-on-primary-container, #1e40af);
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.mention-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mention-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mention-result-name {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-result-handle {
  font-size: 0.75rem;
  color: var(--md-on-surface-variant);
}

/* Dark theme adjustments */
[data-theme="dark"] .behalf-results,
[data-theme="dark"] .mention-dropdown {
  background: var(--md-surface-container-high, #2a2a2a);
  border-color: var(--md-outline-variant, #444);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .behalf-result:hover,
[data-theme="dark"] .behalf-result:focus,
[data-theme="dark"] .mention-result:hover,
[data-theme="dark"] .mention-result.active {
  background: var(--md-surface-container, #383838);
}

[data-theme="dark"] .behalf-selection {
  background: var(--md-secondary-container, #1e293b);
  color: var(--md-on-secondary-container, #cbd5e1);
  border-color: color-mix(in srgb, var(--md-primary, #60a5fa) 30%, transparent);
}

[data-theme="dark"] .behalf-clear:hover {
  background: rgba(255, 255, 255, 0.1);
}
