/* ============================================================
   CRL PARTS · BUSCADOR YWCAS DEL HEADER
   Snippet: CRL - Header
   ------------------------------------------------------------
   Solo clases semanticas (ywcas-*, lapilliUI-*).
   NUNCA usar los hashes css-XXXXXX ni e83suct0: los regenera
   Emotion en cada actualizacion del plugin.
   ============================================================ */

/* ---- 1. Texto escrito: blanco ---- */
html body .ywcas-classic-search .lapilliUI-Input__field,
html body .ywcas-input-field .lapilliUI-Input__field,
html body .ywcas-block-components-search-field input{
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
  caret-color: #2688E4 !important;
  background: transparent !important;
  font-family: 'Roboto', sans-serif !important;
}

/* ---- 2. Placeholder mas tenue ---- */
html body .ywcas-classic-search .lapilliUI-Input__field::placeholder,
html body .ywcas-input-field .lapilliUI-Input__field::placeholder{
  color: #94A3B8 !important;
  -webkit-text-fill-color: #94A3B8 !important;
  opacity: 1 !important;
}

/* ---- 3. Fondo y borde del campo ---- */
html body .ywcas-classic-search .lapilliUI-Input__backdrop{
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(38, 136, 228, 0.45) !important;
  border-radius: 8px !important;
  transition: border-color 0.2s ease !important;
}

html body .ywcas-classic-search .ywcas-input-field:focus-within .lapilliUI-Input__backdrop{
  border-color: #2688E4 !important;
}

/* ---- 4. Icono de lupa ---- */
html body .ywcas-submit-wrapper,
html body .ywcas-submit-wrapper svg,
html body .lapilliUI-Input__endAdornment svg{
  color: #94A3B8 !important;
  fill: currentColor !important;
  transition: color 0.2s ease !important;
}

html body .ywcas-submit-wrapper:hover,
html body .ywcas-submit-wrapper:hover svg{
  color: #2688E4 !important;
}

/* ---- 5. Autocompletado de Chrome ---- */
html body .ywcas-classic-search .lapilliUI-Input__field:-webkit-autofill{
  -webkit-text-fill-color: #FFFFFF !important;
  -webkit-box-shadow: inset 0 0 0 1000px #05080D !important;
  transition: background-color 9999s ease-in-out 0s !important;
}


/* ============================================================
   CRL PARTS · BUSCADOR YWCAS · PANEL DESPLEGABLE
   Snippet: CRL - Header
   ------------------------------------------------------------
   El panel es un PORTAL colgado de body, no vive dentro del
   header. Por eso se ancla desde .ywcas-popover-results en la
   raiz y no como descendiente del buscador.
   Nunca usar los hashes css-XXXXXX ni e83suct0: Emotion los
   regenera en cada actualizacion del plugin.
   ============================================================ */

/* ---- 1. Contenedor del portal: fondo blanco ---- */
html body .ywcas-popover-results{
  background: #FFFFFF !important;
  border: 1px solid #E5E7EB !important;
  border-radius: 10px !important;
  box-shadow: 0 14px 36px rgba(5, 8, 13, 0.20) !important;
  overflow: hidden auto !important;
  max-height: 70vh !important;
  z-index: 100000 !important;
}

html body .ywcas-popover-results .popover-content{
  background: #FFFFFF !important;
  padding: 16px !important;
}

/* ---- 2. Red de seguridad: todo el texto legible ---- */
html body .ywcas-popover-results,
html body .ywcas-popover-results *{
  color: #05080D !important;
}

/* ---- 3. Titulo "Tendencias" ---- */
html body .ywcas-popover-results .ywcas-popular-searches__title{
  color: #6B7280 !important;
  font-family: 'Roboto', sans-serif !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  margin: 0 0 12px 0 !important;
  padding: 0 !important;
}

/* ---- 4. Fila de pildoras ---- */
html body .ywcas-popover-results .ywcas-popular-searches-items{
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ---- 5. Cada pildora ---- */
html body .ywcas-popover-results button.ywcas-popular-searches-item{
  display: inline-flex !important;
  align-items: center !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 7px 15px !important;
  background: #F5F7FA !important;
  border: 1px solid #E5E7EB !important;
  border-radius: 100px !important;
  color: #4B5563 !important;
  font-family: 'Roboto', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  transition: background 0.2s ease, border-color 0.2s ease,
              color 0.2s ease !important;
}

html body .ywcas-popover-results button.ywcas-popular-searches-item:hover{
  background: #075DA7 !important;
  border-color: #075DA7 !important;
  color: #FFFFFF !important;
}

/* ---- 6. Resultados de producto ---- */
html body .ywcas-popover-results .ywcas-result-item,
html body .ywcas-popover-results .ywcas-results-item,
html body .ywcas-popover-results li{
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 6px !important;
  border-bottom: 1px solid #E5E7EB !important;
  border-radius: 8px !important;
  list-style: none !important;
  transition: background 0.2s ease !important;
}

html body .ywcas-popover-results .ywcas-result-item:last-child,
html body .ywcas-popover-results li:last-child{
  border-bottom: none !important;
}

html body .ywcas-popover-results .ywcas-result-item:hover,
html body .ywcas-popover-results li:hover{
  background: #F5F7FA !important;
}

html body .ywcas-popover-results img{
  width: 46px !important;
  height: 46px !important;
  object-fit: contain !important;
  border-radius: 6px !important;
  flex-shrink: 0 !important;
}

/* Precio y coincidencia resaltada en azul CRL */
html body .ywcas-popover-results .price,
html body .ywcas-popover-results .amount,
html body .ywcas-popover-results .woocommerce-Price-amount bdi,
html body .ywcas-popover-results strong,
html body .ywcas-popover-results mark{
  color: #075DA7 !important;
  font-weight: 700 !important;
  background: transparent !important;
}

/* ---- 7. Barra de desplazamiento ---- */
html body .ywcas-popover-results::-webkit-scrollbar{
  width: 6px !important;
}

html body .ywcas-popover-results::-webkit-scrollbar-track{
  background: #F5F7FA !important;
}

html body .ywcas-popover-results::-webkit-scrollbar-thumb{
  background: #94A3B8 !important;
  border-radius: 3px !important;
}

/* ---- 8. Ancho del panel: evitar que el grid lo estire ----
   Los items de un CSS Grid llevan min-width:auto y no se
   encogen bajo el ancho de su contenido. Con titulos largos
   sin wrap, el grid arrastra el panel a ancho completo.
   Se corrige con min-width:0 en la cadena + wrap del texto. */

html body .ywcas-popover-results{
  width: 440px !important;
  max-width: calc(100vw - 32px) !important;
  box-sizing: border-box !important;
}

html body .ywcas-popover-results .popover-content{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

html body .ywcas-popover-results .ywcas-search-results,
html body .ywcas-popover-results .ywcas-search-results-grid{
  display: grid !important;
  grid-template-columns: 1fr !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 0 !important;
  box-sizing: border-box !important;
}

/* La clave: sin esto el item no cede ancho */
html body .ywcas-popover-results .search-result-item,
html body .ywcas-popover-results .search-result-item *{
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Titulos largos en varias lineas en vez de estirar el panel */
html body .ywcas-popover-results .search-result-item a,
html body .ywcas-popover-results .search-result-item h2,
html body .ywcas-popover-results .search-result-item h3,
html body .ywcas-popover-results .search-result-item p,
html body .ywcas-popover-results .search-result-item span{
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: none !important;
}

/* Separador del plugin con la paleta CRL */
html body .ywcas-popover-results hr.ywcas-separator{
  background-color: #E5E7EB !important;
  color: #E5E7EB !important;
  border: none !important;
  height: 1px !important;
  margin: 10px 0 !important;
}