/* Suggestions Button */
.ai-content-suggestions--enabled .button--primary,
.ai-content-suggestions--enabled .button--primary:not(:focus),
.ai-content-suggestions.form-submit {
  background-image: url("../../../icons/ai_spark_icon_red.svg");
  background-position: 8px 8px;
  background-size: 25px;
  background-repeat: no-repeat;
  padding-left: 40px !important;
}
.ai-content-suggestions--enabled .button--primary:hover,
.ai-content-suggestions.form-submit:hover {
  background-image: url("../../../icons/ai_spark_icon_purple.svg");
}

/* Long text */
.field--type-text-long.ai-content-suggestions--enabled .form-textarea-wrapper {
  position: relative;
}
/* Long text AI function indicator */
.field--type-text-long.ai-content-suggestions--enabled .form-textarea-wrapper::after {
  top: 56px;
}
/* Long text button positioning */
.field--type-text-long.ai-content-suggestions--enabled:has(.ck-focused) .filter-wrapper {
  float: right;
}

.field--type-string.field--name-title.ai-content-suggestions--enabled *:has( > .form-element)::after {
  top: 44px;
}

.field--type-string.field--name-title.ai-content-suggestions--enabled *:has( > .form-element) {
  flex-grow: 1;
}

/* Short text */
.field--type-string.ai-content-suggestions--enabled *:has( > .form-element),
.field--type-string-long.ai-content-suggestions--enabled *:has( > .form-element) {
  position: relative;
}
.field--type-string.ai-content-suggestions--enabled .ai-content-suggestions.button,
.field--type-string-long.ai-content-suggestions--enabled .ai-content-suggestions.button,
.field--type-string.ai-content-suggestions--enabled .field-widget-action-widget-button {
  margin-left: 16px;
}
.field--type-string.ai-content-suggestions--enabled,
.field--type-string-long.ai-content-suggestions--enabled {
  position: relative;
  display: flex;
  align-items: center;
}
.field--type-string.ai-content-suggestions--enabled *:has( > .form-element)::after {
  top: 36px;
}
.field--type-string-long.ai-content-suggestions--enabled .form-textarea-wrapper::after {
  bottom: 10px;
}

/* AI function indicator */
.field--type-string.ai-content-suggestions--on-focus *:has( > .form-element)::after,
.field--type-string-long.ai-content-suggestions--on-focus .form-textarea-wrapper::after,
.field--type-text-long.ai-content-suggestions--on-focus .form-textarea-wrapper::after {
  content: "AI Function";
  pointer-events: none;
  font-size: 14px;
  color: #afafaa;
  font-weight: 500;
  display: block;
  position: absolute;
  right: 12px;
  background-image: url("../../../icons/ai_spark.svg");
  background-position: 8px;
  background-size: 16px;
  padding-left: 32px;
  background-color: white;
  background-repeat: no-repeat;
  opacity: 1;
  transition: all 0.25s ease-in-out;
}
.field--type-string.ai-content-suggestions--on-focus:has(input:focus) .form-item::after,
.field--type-string-long.ai-content-suggestions--on-focus:has(textarea:focus) .form-textarea-wrapper::after,
.field--type-text-long.ai-content-suggestions--on-focus:has(.ck-focused) .form-textarea-wrapper::after {
  opacity: 0;
}

/* Only show button when fields are focused */
.ai-content-suggestions--on-focus .field-widget-action-widget-button {
  display: none;
}

.field--type-string.ai-content-suggestions--on-focus:has(input:focus) .field-widget-action-widget-button,
.field--type-text-long.ai-content-suggestions--on-focus:has(.ck-focused) .field-widget-action-widget-button,
.field--type-string.ai-content-suggestions--on-focus:has(input:focus) .ai-content-suggestions.button,
.field--type-string-long.ai-content-suggestions--on-focus:has(textarea:focus) .ai-content-suggestions.button,
.field--type-text-long.ai-content-suggestions--on-focus:has(.ck-focused) .ai-content-suggestions.button {
  display: block;
}
