/**
 * SEARCH AUTOCOMPLETE STYLES
 * Autocomplete dropdown for the header search field.
 * Explicit values to guarantee visibility against the green navbar.
 */

/* =============================================
   CONTAINER & POSITIONING
   ============================================= */

.sp-autocomplete {
  position: relative;
}

.sp-autocomplete__dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 9999;
  background: #ffffff;
  border: 1px solid #c8cfd6;
  border-radius: 0 0 0.625rem 0.625rem;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.08);
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  /* Smooth appearance */
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.sp-autocomplete__dropdown--visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* =============================================
   SUGGESTION ITEMS
   ============================================= */

.sp-autocomplete__item {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #1a1a1a;
  line-height: 1.5;
  transition: background-color 120ms ease;
  border-bottom: 1px solid #eef0f2;
  gap: 0.625rem;
  text-decoration: none;
  background: #ffffff;
}

.sp-autocomplete__item:last-child {
  border-bottom: none;
}

.sp-autocomplete__item:hover,
.sp-autocomplete__item--active {
  background-color: #e8f5e9;
}

.sp-autocomplete__item:active {
  background-color: #c8e6c9;
}

.sp-autocomplete__item-icon {
  flex-shrink: 0;
  color: var(--sp-color-primary);
  font-size: 0.8rem;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}

.sp-autocomplete__item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #333333;
}

/* Highlight the matching portion of the suggestion */
.sp-autocomplete__item-text strong {
  font-weight: 700;
  color: var(--sp-color-primary);
}

/* =============================================
   STATUS MESSAGES (loading, no results, error)
   ============================================= */

.sp-autocomplete__status {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: #6c757d;
  text-align: center;
  font-style: italic;
  background: #ffffff;
}

/* =============================================
   ACCESSIBILITY
   ============================================= */

.sp-autocomplete__dropdown[role="listbox"] {
  outline: none;
}

.sp-autocomplete__item[role="option"][aria-selected="true"] {
  background-color: #e8f5e9;
  outline: 2px solid var(--sp-color-primary);
  outline-offset: -2px;
}

/* =============================================
   MOBILE OPTIMIZATIONS
   ============================================= */

@media (max-width: 768px) {
  .sp-autocomplete__dropdown {
    max-height: 50vh;
    border-radius: 0 0 0.375rem 0.375rem;
    left: -0.5rem;
    right: -0.5rem;
  }

  .sp-autocomplete__item {
    padding: 0.75rem 0.75rem;
    font-size: 0.9rem;
    min-height: 48px;
  }
}

/* =============================================
   REDUCED MOTION
   ============================================= */

@media (prefers-reduced-motion: reduce) {
  .sp-autocomplete__dropdown {
    transition: none;
    transform: none;
  }
}

/* =============================================
   DARK MODE — Force light appearance
   The dropdown always sits over the green navbar,
   so we keep it white regardless of system theme.
   ============================================= */
