/* ============================================================
   CBT LIVE SEARCH — Estilos del dropdown de sugerencias
   Agregar al final del cbt-mega-menu.css
   ============================================================ */

/* Wrapper relativo ya lo pone el JS */
.cbt-search-wrapper { position: relative; }

/* ── Dropdown container ── */
.cbt-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 340px;
  max-width: 620px;
  background: #0f0f1a;
  border: 1px solid rgba(107,45,139,0.4);
  border-top: 2px solid #6B2D8B;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 99999;
  overflow: hidden;
  max-height: 520px;
  overflow-y: auto;
}
.cbt-search-dropdown.open { display: block; animation: cbtSDFade .15s ease; }

@keyframes cbtSDFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scrollbar personalizado */
.cbt-search-dropdown::-webkit-scrollbar { width: 5px; }
.cbt-search-dropdown::-webkit-scrollbar-track { background: #111; }
.cbt-search-dropdown::-webkit-scrollbar-thumb { background: #6B2D8B; border-radius: 4px; }

/* ── Sección ── */
.cbt-sd-section { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.cbt-sd-section:last-child { border-bottom: none; }

.cbt-sd-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #888;
  padding: 4px 16px 6px;
}

/* ── Términos (categorías / marcas / etiquetas) ── */
.cbt-sd-terms { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 8px; }

.cbt-sd-term {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(107,45,139,0.18);
  border: 1px solid rgba(107,45,139,0.35);
  border-radius: 20px;
  padding: 5px 12px;
  text-decoration: none !important;
  transition: all .18s ease;
  cursor: pointer;
}
.cbt-sd-term:hover,
.cbt-sd-term.cbt-sd-focused {
  background: rgba(107,45,139,0.45);
  border-color: #6B2D8B;
  transform: translateY(-1px);
}
.cbt-sd-term-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: #c084fc;
  background: rgba(107,45,139,0.35);
  border-radius: 10px;
  padding: 1px 6px;
}
.cbt-sd-term-name {
  font-size: 13px;
  color: #ddd;
  font-weight: 500;
}
.cbt-sd-term-count {
  font-size: 10px;
  color: #888;
}

/* ── Productos ── */
.cbt-sd-products { display: flex; flex-direction: column; }

.cbt-sd-product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  text-decoration: none !important;
  transition: background .15s ease;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cbt-sd-product:last-child { border-bottom: none; }
.cbt-sd-product:hover,
.cbt-sd-product.cbt-sd-focused {
  background: rgba(107,45,139,0.18);
  outline: none;
}

.cbt-sd-product img {
  width: 52px !important;
  height: 52px !important;
  object-fit: contain !important;
  background: #1a1a2e !important;
  border-radius: 6px !important;
  padding: 4px !important;
  flex-shrink: 0;
}

.cbt-sd-product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cbt-sd-product-title {
  font-size: 13px;
  font-weight: 500;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cbt-sd-product-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cbt-sd-cat {
  font-size: 10px;
  color: #c084fc;
  background: rgba(107,45,139,0.2);
  border-radius: 10px;
  padding: 1px 7px;
}
.cbt-sd-sku {
  font-size: 10px;
  color: #888;
}

.cbt-sd-product-price {
  font-size: 14px;
  font-weight: 700;
  color: #c084fc;
  margin-top: 2px;
}
.cbt-sd-product-price del  { color: #e74c3c !important; font-size: 11px; margin-right: 4px; }
.cbt-sd-product-price ins  { color: #FFD700 !important; text-decoration: none; }
.cbt-sd-product-price .woocommerce-Price-amount { font-size: inherit; color: inherit; }

/* ── Highlight del término buscado ── */
mark.cbt-sd-highlight {
  background: transparent;
  color: #FFD700;
  font-weight: 700;
}

/* ── Ver todos ── */
.cbt-sd-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: rgba(107,45,139,0.15);
  color: #c084fc !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid rgba(107,45,139,0.25);
  transition: background .15s ease;
}
.cbt-sd-view-all:hover,
.cbt-sd-view-all.cbt-sd-focused {
  background: rgba(107,45,139,0.35);
  color: #fff !important;
}
.cbt-sd-view-all strong { color: #FFD700; margin: 0 4px; }

/* ── Sin resultados ── */
.cbt-sd-empty {
  padding: 20px 16px;
  text-align: center;
  color: #888;
  font-size: 13px;
}
.cbt-sd-empty strong { color: #FFD700; }

/* ── Loading ── */
.cbt-sd-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: #aaa;
  font-size: 13px;
}
.cbt-sd-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(107,45,139,0.3);
  border-top-color: #6B2D8B;
  border-radius: 50%;
  animation: cbtSpin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes cbtSpin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 600px) {
  .cbt-search-dropdown {
    min-width: unset;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 8px 8px;
  }
}
