/**
 * AI Search Suggestions Styles
 *
 * 1. Sparkle icon for suggestion items in the dropdown.
 * 2. Animated rotating placeholder overlay.
 */

/* -----------------------------------------------------------------------
   Suggestion sparkle icon
   ----------------------------------------------------------------------- */

.hfse-ai-form .ai_suggested_search_item {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f11e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.912 5.813L20 10.229l-4.544 3.522L17.176 20 12 16.399 6.824 20l1.72-6.249L4 10.229l6.088-1.416z'/%3E%3C/svg%3E") !important;
  background-size: 18px 18px !important;
  background-position: 12px 12px !important;
  background-repeat: no-repeat !important;
}

/* -----------------------------------------------------------------------
   Hide native placeholder — our rotator replaces it
   ----------------------------------------------------------------------- */

.hfse-ai-form .ai_search_input::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

/* -----------------------------------------------------------------------
   Rotating placeholder overlay
   ----------------------------------------------------------------------- */

.ai-placeholder-rotator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.25s ease;
}

/* Hidden state — when input has focus, value, or voice is active. */
.ai-placeholder-rotator.ai-placeholder-hidden {
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Each text span — positioned absolutely so both occupy the same space. */
.ai-placeholder-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  line-height: 50px;
  color: #999;
  /* Match the input's left padding — 48px when mic is present, 20px default. */
  padding-left: 48px;
  padding-right: 20px;
  transform: translateY(0);
  opacity: 1;
  transition: transform 420ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 420ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

/* Fallback when mic is not present. */
.hfse-ai-form:not(.ai-voice-enabled) .ai-placeholder-text {
  padding-left: 20px;
}

/* Exit: slide up and fade out. */
.ai-placeholder-text.ai-placeholder-exit {
  transform: translateY(-80%);
  opacity: 0;
}

/* Below: parked off-screen below, transitions disabled so repositioning is instant. */
.ai-placeholder-text.ai-placeholder-below {
  transform: translateY(60%);
  opacity: 0;
  transition: none !important;
}

/* -----------------------------------------------------------------------
   First-visit onboarding tip
   ----------------------------------------------------------------------- */

.ai-search-onboarding-tip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: #1d2327;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-search-onboarding-tip.ai-search-tip-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Arrow pointing up toward the search input. */
.ai-search-onboarding-tip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #1d2327;
}

.ai-search-tip-text {
  flex: 1;
}

.ai-search-tip-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 18px;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s ease;
}

.ai-search-tip-close:hover {
  color: #fff;
}

/* Responsive: stack below on small screens. */
@media (max-width: 600px) {
  .ai-search-onboarding-tip {
    white-space: normal;
    left: 0;
    right: 0;
    transform: translateX(0) translateY(-4px);
    font-size: 12px;
  }
  .ai-search-onboarding-tip.ai-search-tip-visible {
    transform: translateX(0) translateY(0);
  }
  .ai-search-onboarding-tip::before {
    left: 24px;
    transform: none;
  }
}
