/* Birectory Header Search: buscador compacto del header. */

.bhs {
  --bhs-primary: #ff9100;
  --bhs-text: #0b1733;
  --bhs-muted: #6b7280;
  --bhs-border: #e5e7eb;
  align-items: center;
  display: flex;
  margin-right: 16px;
  position: relative;
}

.bhs[hidden] {
  display: none !important;
}

.bhs__toggle {
  align-items: center;
  background: transparent;
  border: 1px solid var(--bhs-border);
  border-radius: 50%;
  color: var(--bhs-text);
  cursor: pointer;
  display: none;
  height: 40px;
  justify-content: center;
  padding: 0;
  width: 40px;
}

.bhs__toggle:hover,
.bhs__toggle:focus-visible,
.bhs.is-open .bhs__toggle {
  border-color: var(--bhs-primary);
  color: var(--bhs-primary);
  outline: none;
}

.bhs__panel {
  position: relative;
}

/* Search Lab da a este formulario el ancho del buscador grande; aquí lo hacemos compacto. */
.bhs .bhs__form.directorist-universal-search__form {
  align-items: center !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  margin: 0 !important;
  max-width: none !important;
  width: 440px !important;
}

.bhs__field {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  position: relative;
}

.bhs__icon {
  color: var(--bhs-muted);
  left: 14px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.bhs .bhs__input {
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border: 1px solid var(--bhs-border);
  border-radius: 999px;
  box-shadow: none;
  box-sizing: border-box;
  color: var(--bhs-text);
  font-family: inherit;
  font-size: 14px;
  height: 40px;
  margin: 0;
  min-width: 0;
  outline: none;
  padding: 0 14px 0 40px;
  width: 100%;
}

.bhs .bhs__input::-webkit-search-cancel-button {
  cursor: pointer;
}

.bhs .bhs__input:focus {
  border-color: var(--bhs-primary);
  box-shadow: 0 0 0 3px rgba(255, 145, 0, .15);
}

.bhs .birectory-us-filter-button,
.bhs .bhs__submit.dir-universal-search__button {
  border-radius: 999px !important;
  flex: 0 0 auto !important;
  font-size: 13px !important;
  height: 40px !important;
  min-width: 0 !important;
  width: auto !important;
}

.bhs .birectory-us-filter-button {
  padding: 0 12px !important;
}

.bhs .bhs__submit.dir-universal-search__button {
  background: var(--bhs-primary);
  border-color: var(--bhs-primary);
  padding: 0 16px !important;
}

/* Desplegable de sugerencias */
.bhs__dropdown {
  background: #fff;
  border: 1px solid var(--bhs-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(11, 23, 51, .12);
  box-sizing: border-box;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 420px;
  z-index: 10000;
}

.bhs__dropdown[hidden] {
  display: none !important;
}

.bhs__section + .bhs__section {
  border-top: 1px solid var(--bhs-border);
  margin-top: 6px;
  padding-top: 6px;
}

.bhs__heading {
  color: var(--bhs-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  margin: 6px 8px;
  text-transform: uppercase;
}

.bhs__dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bhs__item {
  align-items: center;
  border-radius: 8px;
  color: var(--bhs-text) !important;
  display: flex;
  gap: 12px;
  padding: 8px;
  text-decoration: none !important;
}

.bhs__item:hover,
.bhs__item:focus,
.bhs__all:hover,
.bhs__all:focus {
  background: #fff7ed;
  outline: none;
}

.bhs__thumb {
  align-items: center;
  background: #f3f4f6;
  border-radius: 8px;
  color: var(--bhs-muted);
  display: flex;
  flex: 0 0 48px;
  font-weight: 600;
  height: 38px;
  justify-content: center;
  overflow: hidden;
}

.bhs__thumb img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

/* Categorías: miniatura de Productos (bolsa) o Servicios (apretón de manos). */
.bhs__thumb--cat {
  background: transparent;
  border-radius: 50%;
  flex-basis: 40px;
  height: 40px;
  margin: 0 4px;
}

.bhs__thumb--cat img {
  object-fit: cover;
}

.bhs__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bhs__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bhs__meta {
  color: var(--bhs-muted);
  font-size: 12px;
  line-height: 1.3;
}

.bhs__empty {
  color: var(--bhs-muted);
  font-size: 14px;
  margin: 8px;
}

.bhs__all {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--bhs-primary);
  cursor: pointer;
  display: block;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
  padding: 10px 8px;
  text-align: left;
  width: 100%;
}

.bhs__loading {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 16px;
}

.bhs__loading span {
  animation: bhs-pulse 1s infinite ease-in-out;
  background: var(--bhs-primary);
  border-radius: 50%;
  height: 8px;
  opacity: .3;
  width: 8px;
}

.bhs__loading span:nth-child(2) { animation-delay: .15s; }
.bhs__loading span:nth-child(3) { animation-delay: .3s; }

@keyframes bhs-pulse {
  50% { opacity: 1; }
}

/* Entre 1400 y 1599 px el hueco es justo: campo más estrecho y Filtros solo con icono. */
@media (max-width: 1599px) {
  .bhs .bhs__form.directorist-universal-search__form {
    width: 340px !important;
  }

  .bhs .birectory-us-filter-button {
    padding: 0 !important;
    width: 40px !important;
  }

  .bhs .birectory-us-filter-button > span {
    display: none !important;
  }

  .bhs .birectory-us-filter-button::before {
    background: currentColor;
    content: "";
    height: 18px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0'/%3E%3Ccircle cx='16' cy='6' r='2'/%3E%3Ccircle cx='10' cy='12' r='2'/%3E%3Ccircle cx='18' cy='18' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0'/%3E%3Ccircle cx='16' cy='6' r='2'/%3E%3Ccircle cx='10' cy='12' r='2'/%3E%3Ccircle cx='18' cy='18' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
    width: 18px;
  }
}

/* Por debajo de 1400 px no cabe junto al menú: una lupa que abre el buscador bajo el header. */
@media (max-width: 1399px) {
  .bhs {
    margin-right: 10px;
  }

  .bhs__toggle {
    display: inline-flex;
  }

  .bhs__panel {
    background: #fff;
    box-shadow: 0 12px 24px rgba(11, 23, 51, .12);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 12px 16px 16px;
    position: fixed;
    right: 0;
    top: 70px;
    z-index: 9999;
  }

  .bhs.is-open .bhs__panel {
    display: block;
  }

  .bhs .bhs__form.directorist-universal-search__form {
    margin: 0 auto !important;
    max-width: 760px !important;
    width: 100% !important;
  }

  .bhs .birectory-us-filter-button {
    padding: 0 12px !important;
    width: auto !important;
  }

  .bhs .birectory-us-filter-button > span {
    display: inline !important;
  }

  .bhs .birectory-us-filter-button::before {
    content: none;
  }

  .bhs__dropdown {
    border: 0;
    box-shadow: none;
    margin: 8px auto 0;
    max-height: 60vh;
    max-width: 760px;
    padding: 0;
    position: static;
    width: 100%;
  }
}

@media (max-width: 575px) {
  .bhs .bhs__form.directorist-universal-search__form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .bhs__field {
    grid-column: 1 / -1;
  }

  .bhs .bhs__input {
    font-size: 16px;
    height: 44px;
  }

  .bhs .birectory-us-filter-button,
  .bhs .bhs__submit.dir-universal-search__button {
    height: 42px !important;
    width: 100% !important;
  }
}
