/* Fanor · Header — Buscador (form de productos WooCommerce) + dropdown de sugerencias */

/* Las variables viven en el wrapper para que las herede el form Y el panel de
   sugerencias (el panel es hermano del form, no su hijo). */
.fanor-hdr-buscador-wrap {
  --hdr-rojo:   #CC0000;
  --hdr-rojo-d: #A80000;
  --hdr-borde:  #E0E0E0;
  --hdr-texto:  #1A1A1A;
  --hdr-hover:  #F7F7F7;
  --hdr-x-bg:   #C7C7CC;
  --hdr-x-bg-h: #8E8E93;
  --hdr-x-ic:   #FFFFFF;
  --hdr-x-size: 22px;

  position: relative;
  width: 100%;
  min-width: 0;
}

.fanor-hdr-buscador {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  height: 44px;
  background: #fff;
  border: 1px solid var(--hdr-borde);
  border-radius: 4px;
  overflow: hidden;
  font-family: var(--fanor-font-body);
}

.fanor-hdr-buscador svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fanor-hdr-buscador__input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: 0 !important;
  color: var(--hdr-texto);
  font-family: inherit;
  font-size: 14px;
  padding: 0 16px;
}

/* Oculta la "X" nativa del navegador para type=search (Chrome/Safari/Edge la pintan
   en escritorio cuando hay texto): dejamos solo nuestra X personalizada. */
.fanor-hdr-buscador__input::-webkit-search-cancel-button,
.fanor-hdr-buscador__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.fanor-hdr-buscador__input::-ms-clear,
.fanor-hdr-buscador__input::-ms-reveal {
  display: none;
}

.fanor-hdr-buscador__input::placeholder {
  color: #8D8D8D;
  opacity: 1;
}

.fanor-hdr-buscador__submit {
  flex: 0 0 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--hdr-rojo) !important;
  border: 0 !important;
  color: #fff !important;
  cursor: pointer;
}

.fanor-hdr-buscador__submit:hover,
.fanor-hdr-buscador__submit:focus,
.fanor-hdr-buscador__submit:active {
  background: var(--hdr-rojo-d) !important;
  color: #fff !important;
}

.fanor-hdr-buscador__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #fff;
}

.fanor-hdr-buscador__icon i {
  font-size: 18px;
  line-height: 1;
}

/* ── Botón "X" para limpiar (estilo Apple: círculo gris, oscurece al hover) ── */
.fanor-hdr-buscador__clear {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--hdr-x-size, 22px);
  height: var(--hdr-x-size, 22px);
  margin-right: 8px;
  padding: 0;
  border-radius: 50%;
  background: var(--hdr-x-bg, #C7C7CC) !important;
  color: var(--hdr-x-ic, #FFFFFF);
  cursor: pointer;
  transition: background .15s ease;
}

.fanor-hdr-buscador__clear[hidden] {
  display: none;
}

.fanor-hdr-buscador__clear-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62%;
  height: 62%;
}

.fanor-hdr-buscador__clear-ic i {
  font-size: calc(var(--hdr-x-size, 22px) * .6);
  line-height: 1;
}

/* El oscurecido al hover solo en escritorio (hover real) y blindado con !important
   para que no se cuele el hover rojo/rosa del tema/Elementor; en táctil no se pega. */
@media (hover: hover) {
  .fanor-hdr-buscador__clear:hover,
  .fanor-hdr-buscador__clear:focus-visible {
    background: var(--hdr-x-bg-h, #8E8E93) !important;
  }
}

/* ===== Panel de sugerencias (flota sobre el contenido, no lo empuja) ===== */
.fanor-sug {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 120;
  background: #fff;
  border: 1px solid #E6E6E6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
  animation: fanorSugDrop .15s ease;
  font-family: var(--fanor-font-body);
}

.fanor-sug__label {
  padding: 11px 16px 6px;
  font-family: var(--fanor-font-display);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #444;
}

.fanor-sug__sep {
  height: 1px;
  background: #F0F0F0;
  margin: 6px 0;
}

.fanor-sug__cat,
.fanor-sug__prod {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 16px;
  border: 0;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.fanor-sug__cat:hover,
.fanor-sug__prod:hover {
  background: var(--hdr-hover);
}

.fanor-sug__catic {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #FCEAEA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--hdr-rojo);
}

.fanor-sug__catic svg,
.fanor-sug__thumb svg,
.fanor-sug__arrow svg {
  display: block;
}

.fanor-sug__catname {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1A1A1A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fanor-sug__count {
  font-size: 12px;
  color: #999;
  flex-shrink: 0;
}

.fanor-sug__thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid #EEEEEE;
  background: #FAFAFA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: #C9C9C9;
}

.fanor-sug__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fanor-sug__info {
  flex: 1;
  min-width: 0;
}

.fanor-sug__name {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: #1A1A1A;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fanor-sug__meta {
  display: block;
  font-size: 11.5px;
  color: #999;
  margin-top: 2px;
}

.fanor-sug__all {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 0;
  border-top: 1px solid #F0F0F0;
  background: #FAFAFA;
  cursor: pointer;
  font-family: var(--fanor-font-display);
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--hdr-rojo);
}

.fanor-sug__all:hover {
  background: #F2F2F2;
}

.fanor-sug__arrow {
  display: inline-flex;
  color: var(--hdr-rojo);
}

@keyframes fanorSugDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Móvil: form a ancho completo, un poco más compacto; el panel reduce tamaños. */
@media (max-width: 767px) {
  .fanor-hdr-buscador {
    height: 42px;
  }
  .fanor-hdr-buscador__input {
    font-size: 14px;
    padding: 0 14px;
  }
  .fanor-hdr-buscador__submit {
    flex-basis: 48px;
  }

  .fanor-sug {
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  }
  .fanor-sug__label {
    padding: 10px 14px 5px;
    font-size: 10.5px;
  }
  .fanor-sug__sep {
    margin: 5px 0;
  }
  .fanor-sug__cat,
  .fanor-sug__prod {
    padding: 9px 14px;
    gap: 12px;
  }
  .fanor-sug__catic {
    width: 32px;
    height: 32px;
  }
  .fanor-sug__catic svg {
    width: 16px;
    height: 16px;
  }
  .fanor-sug__count {
    font-size: 11.5px;
  }
  .fanor-sug__thumb {
    width: 40px;
    height: 40px;
  }
  .fanor-sug__name {
    font-size: 13px;
  }
  .fanor-sug__meta {
    font-size: 11px;
  }
  .fanor-sug__all {
    font-size: 12px;
    gap: 7px;
  }
}

/* Evita el auto-zoom de iOS Safari al enfocar el campo: Safari hace zoom si el
   font-size del input es <16px. En dispositivos táctiles (cualquier móvil/tablet,
   independiente del ancho) forzamos 16px; en escritorio (ratón) se queda en 14px.
   Va al final para ganar por orden de fuente a la regla móvil de 14px. */
@media (pointer: coarse) {
  .fanor-hdr-buscador__input {
    font-size: 16px;
  }
  /* En táctil el panel persiste al ocultar el teclado (lo maneja el JS); acotamos su
     altura para poder verlo/scrollear aunque haya muchos resultados. */
  .fanor-sug {
    max-height: 70vh;
    overflow-y: auto;
  }
}
