/* Wrapper del buscador (ancla del flotante) */
.adhoc-cpt-search {
  position: relative;
  width: 100%; 
  max-width: 520px;
  transition: width 0.3s ease, max-width 0.3s ease;
}

/* En modo responsive (cuando el input está oculto), el wrapper solo ocupa el ancho del botón */
.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) {
  width: auto;
  max-width: none;
}

/* ===== BARRA (TU CSS ADAPTADO) ===== */
.adhoc-search-bar {
  display: flex;
  line-height: 28px;
  align-items: center;
  position: relative;
  width: 100%;
  justify-content: flex-end;
  transition: width 0.3s ease, justify-content 0.3s ease;
}

/* En modo responsive cerrado, la barra solo ocupa el ancho del botón */
.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) .adhoc-search-bar {
  width: fit-content;
  justify-content: center;
} 
/* Input - siempre visible en desktop, oculto en responsive hasta activar */
.adhoc-search-bar .input {
  width: 100%;
  max-width: 500px;
  height: 40px;
  line-height: 28px;
  padding: 0 1rem;
  padding-left: 2.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  outline: none;
  background-color: #f3f3f4;
  color: #0d0c22;
  transition: all .3s ease, opacity .2s ease, width .3s ease;
  opacity: 1;
  pointer-events: auto;
}

/* Input cuando está cerrado en modo responsive */
.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) .adhoc-search-bar .input {
  width: 0;
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  pointer-events: none;
  border-width: 0;
  overflow: hidden;
}

/* Input cuando está activo en responsive */
.adhoc-cpt-search.adhoc-responsive-mode.is-active .adhoc-search-bar .input {
  width: 100%;
  max-width: 500px;
  padding: 0 1rem;
  padding-left: 2.5rem;
  background-color: #f3f3f4;
  opacity: 1;
  pointer-events: auto;
  border-width: 2px;
}

.adhoc-search-bar .input::placeholder {
  color: #9e9ea7;
}

/* Ocultar la X nativa del input type="search" */
.adhoc-search-bar .input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.adhoc-search-bar .input::-webkit-search-decoration,
.adhoc-search-bar .input::-webkit-search-results-button,
.adhoc-search-bar .input::-webkit-search-results-decoration {
  display: none;
}

.adhoc-search-bar .input:focus,
.adhoc-search-bar .input:hover {
  outline: none;
  border-color: rgba(234, 76, 137, 0.4);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgb(234 76 137 / 10%);
}

/* Botón del icono de búsqueda */
.adhoc-search-icon-btn {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  right: auto;
  background: transparent;
  border: none;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .3s ease;
  z-index: 10;
  pointer-events: none;
  padding: 0;
}

/* Botón visible y clickeable en modo responsive cuando está cerrado */
.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) .adhoc-search-icon-btn {
  position: static;
  background: #f3f3f4;
  border: 2px solid transparent;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  pointer-events: auto;
  flex-shrink: 0;
  transform: none;
}

.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) .adhoc-search-icon-btn:hover {
  background-color: #e8e8ea;
}

.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) .adhoc-search-icon-btn:active {
  transform: scale(0.95);
}

.adhoc-cpt-search.adhoc-responsive-mode:not(.is-active) .adhoc-search-icon-btn:hover .icon {
  fill: #ea4c89;
}

/* Cuando está activo en responsive, volver al posicionamiento absoluto */
.adhoc-cpt-search.adhoc-responsive-mode.is-active .adhoc-search-icon-btn {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: auto;
  height: auto;
  pointer-events: none;
}

.adhoc-search-bar .icon {
  fill: #9e9ea7;
  width: 1rem;
  height: 1rem;
  transition: fill .2s ease;
}

/* ===== PANEL FLOTANTE DE RESULTADOS ===== */
.adhoc-search-floating {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 9999;
  display: none;
}

.adhoc-cpt-search.is-open .adhoc-search-floating {
  display: block;
}

.adhoc-search-floating__inner {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(13, 12, 34, 0.08);
}

/* Items */
.adhoc-search-item {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  border-bottom: 1px solid rgba(13, 12, 34, 0.06);
  transition: 0.2s ease;
}

.adhoc-search-item.has-image {
  display: flex;
  gap: 12px;
  align-items: center;
}

.adhoc-search-item:last-child {
  border-bottom: 0;
}

.adhoc-search-item:hover {
  background: #f7f7f9;
}

.adhoc-search-item__image {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f3f4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adhoc-search-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.adhoc-search-item__content {
  flex: 1;
  min-width: 0;
}

.adhoc-search-item__title {
  display: block;
  font-weight: 600;
  color: #0d0c22;
  font-size: 14px;
  line-height: 1.3;
}

.adhoc-search-item__meta {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.2;
  color: #6b6a78;
  display: flex;
  gap: 6px;
  align-items: center;
}

.adhoc-search-item__category {
  color: #ea4c89;
  font-weight: 500;
}

.adhoc-search-item__price {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #ea4c89;
}

.adhoc-search-item__price .woocommerce-Price-amount {
  color: inherit;
}

/* Estados */
.adhoc-search-empty,
.adhoc-search-loading {
  padding: 14px;
  font-size: 13px;
  color: #6b6a78;
}

/* Responsive - Pantalla completa */
/* El breakpoint se establece dinámicamente por JavaScript */
body.adhoc-search-fullscreen-active {
  overflow: hidden;
}

.adhoc-cpt-search.adhoc-fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  z-index: 99999 !important;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  padding: 20px;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 60px;
  margin: 0 !important;
  transform: none !important;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-bar {
  width: 100% !important;
  max-width: 600px !important;
  position: relative !important;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-bar .input {
  width: 100% !important;
  max-width: 100% !important;
  height: 50px;
  font-size: 16px;
  padding-left: 3rem !important;
  padding-right: 3rem !important;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 1 !important;
  pointer-events: auto !important;
  background-color: #fff !important;
  touch-action: manipulation;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-icon-btn {
  left: 1rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  right: auto !important;
  background: transparent !important;
  border: none !important;
  width: auto !important;
  height: auto !important;
  pointer-events: none !important;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-bar .icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: #9e9ea7;
}

/* Botón de cerrar en modo fullscreen */
.adhoc-search-close {
  display: none;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #9e9ea7;
  transition: color 0.2s;
}

.adhoc-search-close:hover {
  color: #0d0c22;
}

.adhoc-search-close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-close {
  display: block;
}

/* Panel flotante en modo fullscreen */
.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-floating {
  position: relative !important;
  top: 20px !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 600px !important;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-floating__inner {
  max-height: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-item {
  padding: 16px 18px;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-item__title {
  font-size: 15px;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-item__meta {
  font-size: 13px;
  margin-top: 6px;
}

/* Scroll personalizado para el panel en fullscreen */
.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-floating::-webkit-scrollbar {
  width: 8px;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-floating::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-floating::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.adhoc-cpt-search.adhoc-fullscreen-mode .adhoc-search-floating::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
