/**
 * The Bharat Book - Live Real-Time Search Suggestions & Autocomplete Styles
 * Works on Customer Storefront & IMS Admin Across Desktop, Laptop & Mobile
 */

.tbb-suggest-container {
  position: relative !important;
  overflow: visible !important;
}

.inv-search-wrap,
.catalog-filter-card,
.catalog-filter-form,
.filter-search-box,
.hero-search-form,
.search-input-group,
.search-box,
.mobile-nav-search {
  position: relative !important;
  overflow: visible !important;
}

.tbb-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 320px;
  max-width: 620px;
  max-height: 440px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.05);
  z-index: 99999;
  display: none;
  padding: 6px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  scrollbar-width: thin;
  text-align: left;
}

.tbb-search-suggestions::-webkit-scrollbar {
  width: 6px;
}
.tbb-search-suggestions::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Section Header */
.tbb-suggest-section-title {
  padding: 8px 14px 4px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tbb-suggest-section-title i {
  color: #0284c7;
  font-size: 12px;
}

/* Category Suggestions */
.tbb-suggest-categories-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px 10px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.tbb-suggest-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.tbb-suggest-cat-chip:hover,
.tbb-suggest-cat-chip.selected {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
}
.tbb-suggest-cat-chip i {
  font-size: 11px;
}

/* Book Item */
.tbb-suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
  cursor: pointer;
}
.tbb-suggest-item:last-child {
  border-bottom: none;
}
.tbb-suggest-item:hover,
.tbb-suggest-item.selected {
  background: #f8fafc;
}
.tbb-suggest-thumb {
  width: 42px;
  height: 56px;
  border-radius: 5px;
  background: #0a1f38;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.tbb-suggest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tbb-suggest-thumb-fallback {
  color: #94a3b8;
  font-size: 16px;
}
.tbb-suggest-info {
  flex: 1;
  min-width: 0;
}
.tbb-suggest-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.tbb-suggest-title .tbb-highlight {
  background: #fef08a;
  color: #854d0e;
  font-weight: 700;
  border-radius: 2px;
  padding: 0 2px;
}
.tbb-suggest-meta {
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tbb-suggest-cat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Identifiers: ISBN & SKU Chips */
.tbb-suggest-code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  color: #475569;
}
.tbb-suggest-code-chip .tbb-highlight {
  background: #fed7aa;
  color: #9a3412;
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}

/* Stock Badges */
.tbb-suggest-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.tbb-suggest-stock.in-stock {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.tbb-suggest-stock.out-stock {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecdd3;
}

/* Pricing Column */
.tbb-suggest-price {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  flex-shrink: 0;
  text-align: right;
  line-height: 1.25;
}
.tbb-suggest-mrp {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 400;
}
.tbb-suggest-rent {
  display: block;
  font-size: 10.5px;
  color: #0284c7;
  font-weight: 600;
}

/* View All Footer */
.tbb-suggest-footer {
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: #0284c7;
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
}
.tbb-suggest-footer:hover,
.tbb-suggest-footer.selected {
  background: #f1f5f9;
  color: #0369a1;
}

/* Empty State / Loading State */
.tbb-suggest-empty {
  padding: 18px 16px;
  text-align: center;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.5;
}
.tbb-suggest-empty i {
  font-size: 22px;
  color: #94a3b8;
  margin-bottom: 6px;
  display: block;
}
.tbb-suggest-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: tbbSpin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes tbbSpin {
  to { transform: rotate(360deg); }
}

/* Mobile specific styling */
@media (max-width: 768px) {
  .tbb-search-suggestions {
    min-width: 280px;
    max-height: 55vh;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  }
  .tbb-suggest-item {
    padding: 8px 12px;
  }
  .tbb-suggest-title {
    font-size: 13px;
  }
}
