/* Meilisearch Live Search */
.bb-form-quick-search .bb-quick-search-results {
  border-radius: 0 0 12px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-top: none;
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.bb-form-quick-search .bb-quick-search-results::-webkit-scrollbar {
  width: 5px;
}

.bb-form-quick-search .bb-quick-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.bb-form-quick-search .bb-quick-search-results::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 10px;
}

/* Loading spinner */
.bb-form-quick-search .ms-live-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 10px;
  color: #6b7280;
  font-size: 13px;
}

.bb-form-quick-search .ms-live-search-loading .ms-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--tp-theme-1, #0989ff);
  border-radius: 50%;
  animation: ms-spin 0.6s linear infinite;
}

@keyframes ms-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Correction / Did you mean */
.ms-live-search-correction {
  padding: 10px 16px;
  background: #fef9e7;
  border-bottom: 1px solid #fde68a;
  font-size: 13px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ms-live-search-correction .ms-suggestion-link {
  color: var(--tp-theme-1, #0989ff);
  font-weight: 600;
  text-decoration: underline;
}

/* Product list */
.ms-live-search-list {
  padding: 6px 0;
}

/* Product item */
.ms-live-search-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}

.ms-live-search-item:last-child {
  border-bottom: none;
}

.ms-live-search-item:hover,
.ms-live-search-item.ms-active {
  background-color: #f0f7ff;
}

/* Product image */
.ms-live-search-item-image {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ms-live-search-item-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Product body */
.ms-live-search-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ms-live-search-item-name {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-live-search-item-name mark {
  background: #fef08a;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* Inline SKU in product name */
.ms-item-sku {
  font-weight: 400;
  font-size: 12px;
  color: #6b7280;
  margin-left: 4px;
}

/* SKU on separate line */
.ms-live-search-item-sku {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
}

.ms-live-search-item-sku-label {
  font-weight: 400;
  color: #6b7280;
}

.ms-live-search-item-sku-value {
  font-weight: 400;
  font-size: 12px;
  color: #495057;
}

/* Price */
.ms-live-search-item-price {
  text-align: right;
  white-space: nowrap;
  min-width: fit-content;
}

.ms-live-search-item-price-inline {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  text-align: left;
  white-space: normal;
}

.ms-live-search-item-price-label,
.ms-live-search-item-price-unit {
  font-size: 13px;
  color: #374151;
}

.ms-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.ms-price-current {
  font-size: 14px;
  font-weight: 600;
  color: var(--tp-theme-1, #0989ff);
}

.ms-price-current-inline {
  color: #111827;
}

.ms-price-original {
  font-size: 11px;
  color: #9ca3af;
  text-decoration: line-through;
}

/* Suggestions */
.ms-live-search-suggestions {
  padding: 10px 16px;
  border-top: 1px solid #f3f4f6;
  font-size: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ms-suggestions-label {
  color: #6b7280;
}

.ms-suggestion-link {
  color: var(--tp-theme-1, #0989ff);
  text-decoration: none;
  padding: 2px 8px;
  background: #eff6ff;
  border-radius: 12px;
  font-size: 12px;
  transition: background-color 0.15s ease;
}

.ms-suggestion-link:hover {
  background: #dbeafe;
  color: var(--tp-theme-1, #0989ff);
}

/* Footer - View all */
.ms-live-search-footer {
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
  text-align: center;
}

.ms-view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--tp-theme-1, #0989ff);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: gap 0.2s ease;
}

.ms-view-all-link:hover {
  gap: 10px;
  color: var(--tp-theme-1, #0989ff);
}

/* Fallback section */
.ms-live-search-fallback {
  border-top: 1px solid #f3f4f6;
  padding-top: 4px;
}

.ms-fallback-title {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
}

/* Empty state */
.ms-live-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 8px;
  color: #9ca3af;
}

.ms-live-search-empty i {
  font-size: 28px;
  opacity: 0.5;
}

.ms-live-search-empty span {
  font-size: 13px;
}

/* Keyboard navigation hint */
.ms-live-search-hint {
  padding: 6px 16px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  color: #9ca3af;
}

.ms-live-search-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  font-size: 10px;
  font-family: inherit;
  color: #6b7280;
}

/* Responsive */
@media (max-width: 575px) {
  .ms-live-search-item-image {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .ms-live-search-item {
    padding: 8px 12px;
    gap: 10px;
  }

  .ms-live-search-item-name {
    font-size: 13px;
  }

  .ms-price-current {
    font-size: 13px;
  }
}

/* Fix: Show filter sidebar inline on desktop when layout has sidebar columns */
@media (min-width: 992px) {

  .col-xl-3>.bb-filter-offcanvas-area,
  .col-lg-4>.bb-filter-offcanvas-area {
    position: static !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
    overflow-y: visible !important;
    z-index: auto !important;
    background: none !important;
    transition: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
  }

  .col-xl-3>.bb-filter-offcanvas-area .bb-filter-offcanvas-close,
  .col-lg-4>.bb-filter-offcanvas-area .bb-filter-offcanvas-close {
    display: none !important;
  }

  .col-xl-3>.bb-filter-offcanvas-area .bb-filter-offcanvas-wrapper,
  .col-lg-4>.bb-filter-offcanvas-area .bb-filter-offcanvas-wrapper {
    padding: 0 !important;
  }
}

/* Meilisearch simplified search bar */
.ms-search-full-width {
  width: 100% !important;
}

/* =========================================
   Product Group (parent + variant rows)
   ========================================= */
.ms-product-group {
  border-bottom: 1px solid #f0f0f0;
}

.ms-product-group:last-child {
  border-bottom: none;
}

.ms-product-group>.ms-live-search-item {
  border-bottom: none;
}

/* =========================================
   Variants List (tree-style sub-items)
   ========================================= */
.ms-variants-list {
  padding: 0 16px 8px;
  padding-left: 36px;
}

/* Individual variant row */
.ms-variant-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  text-decoration: none;
  color: #495057;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.ms-variant-row:hover {
  background-color: #f8f9fa;
  color: #212529;
  text-decoration: none;
}

/* Branch icon */
.ms-variant-branch {
  color: #adb5bd;
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}

/* Variant label (attributes) */
.ms-variant-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #495057;
  font-size: 13px;
}

.ms-variant-row:hover .ms-variant-label {
  color: #212529;
}

/* Variant SKU in parentheses (right-aligned) */
.ms-variant-sku {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 12px;
  font-size: 12px;
  color: #868e96;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  white-space: nowrap;
}

/* "More" row */
.ms-variant-row-more {
  color: #868e96;
}

.ms-variant-row-more:hover {
  color: var(--tp-theme-1, #c2185b);
}

.ms-variant-more-label {
  font-size: 12px;
  font-style: italic;
}

/* Responsive variants */
@media (max-width: 575px) {
  .ms-variants-list {
    padding-left: 24px;
  }

  .ms-variant-row {
    padding: 5px 8px;
    font-size: 12px;
  }

  .ms-variant-label {
    font-size: 12px;
  }

  .ms-variant-sku {
    font-size: 11px;
  }
}

/* Matching variant highlighting (search relevance) */
.ms-variant-row-matching {
  background-color: rgba(194, 24, 91, 0.08);
  border-left: 3px solid var(--tp-theme-1, #c2185b);
  font-weight: 600;
  color: #212529;
}

.ms-variant-row-matching:hover {
  background-color: rgba(194, 24, 91, 0.14);
}

.ms-variant-row-matching .ms-variant-label {
  color: #212529;
}

.ms-variant-match-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  background-color: var(--tp-theme-1, #c2185b);
  color: #fff;
  line-height: 1.2;
}

.ms-variant-highlight {
  background-color: #fff3bf;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* Full-line highlight: the matched variant label is wrapped entirely in <mark>, so let
   it fill the whole label width (respecting the label's ellipsis truncation) instead of
   only hugging the text. */
.ms-variant-label > .ms-variant-highlight {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

.ms-variants-list-has-match {
  border-radius: 6px;
}
