/**
 * BlackDoctor.org Predictive Search — Dropdown Styles
 *
 * BEM flat selectors only — no nesting.
 * Block: .predictive-search
 *
 * @version 1.0.0
 */

/* =====================================================================
   BREAKDANCE OVERRIDE — prevent parent from clipping the dropdown
   ===================================================================== */

.bde-search-form .search-form__container {
  overflow: visible !important;
}

/* =====================================================================
   DROPDOWN CONTAINER
   ===================================================================== */

.predictive-search-dropdown {
  position: absolute;
  top: 100%;
  margin-top: 7px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Decorative bottom bar — signals more content below */
.predictive-search-dropdown::after {
  content: '';
  display: block;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--hcl-brand-9);
  border-radius: 0 0 7px 7px;
  box-shadow: 0 -8px 16px rgba(var(--hcl-brand-9), 0.3),
              0 -4px 12px rgba(0, 128, 128, 0.15);
}

/* =====================================================================
   SUGGESTION ITEM
   ===================================================================== */

.predictive-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.15s ease;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
}

.predictive-search-item:last-child {
  border-bottom: none;
}

.predictive-search-item:hover {
  background-color: #f0f7ff;
  text-decoration: none;
  color: #333;
}

.predictive-search-item[aria-selected="true"] {
  background-color: #f0f7ff;
}

/* =====================================================================
   ITEM ICON
   ===================================================================== */

.predictive-search-item__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.predictive-search-item--category .predictive-search-item__icon {
  color: #0066cc;
}

.predictive-search-item--tag .predictive-search-item__icon {
  color: var(--hcl-brand-12);
}

.predictive-search-item--post .predictive-search-item__icon {
  color: var(--hcl-brand-9);
}

/* =====================================================================
   ITEM CONTENT
   ===================================================================== */

.predictive-search-item__content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.predictive-search-item__name {
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
}

.predictive-search-item__name strong {
  font-weight: 700;
  color: var(--hcl-brand-12);
}

.predictive-search-item__meta {
  display: block;
  font-size: 11px;
  color: #999;
  text-transform: capitalize;
  margin-top: 2px;
  line-height: 1.3;
}

/* =====================================================================
   API BADGE (for results from WP Engine Find API)
   ===================================================================== */

.predictive-search-item__api-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7c3aed;
  background: #ede9fe;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

/* =====================================================================
   TYPE MODIFIERS
   ===================================================================== */

.predictive-search-item--category:hover {
  background-color: #e8f4fd;
}

.predictive-search-item--tag:hover {
  background-color: var(--hcl-brand-3);
}

.predictive-search-item--post:hover {
  background-color: var(--hcl-brand-5);
}

.predictive-search-item--category[aria-selected="true"] {
  background-color: #e8f4fd;
}

.predictive-search-item--tag[aria-selected="true"] {
  background-color: var(--hcl-brand-3);
}

.predictive-search-item--post[aria-selected="true"] {
  background-color: var(--hcl-brand-5);
}

/* =====================================================================
   SCROLLBAR (subtle)
   ===================================================================== */

.predictive-search-dropdown::-webkit-scrollbar {
  width: 6px;
}

.predictive-search-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.predictive-search-dropdown::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.predictive-search-dropdown::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* =====================================================================
   MOBILE RESPONSIVE
   ===================================================================== */

@media (max-width: 768px) {
  .predictive-search-dropdown {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    border: none;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  }

  .predictive-search-item {
    padding: 14px 16px;
  }

  .predictive-search-item:nth-child(n+4) {
    display: none;
  }

  .predictive-search-item__name {
    font-size: 15px;
  }

  .predictive-search-item__meta {
    font-size: 12px;
  }
}

/* =====================================================================
   ACCESSIBILITY — focus-visible
   ===================================================================== */

.predictive-search-item:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: -2px;
}

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

@media (prefers-reduced-motion: reduce) {
  .predictive-search-item {
    transition: none;
  }
}
