/**
 * Phase 6 — Search & discovery
 */

/* —— Search bar —— */
.bc-search {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.bc-search--compact {
  max-width: var(--bc-container);
  margin: 0 auto var(--bc-space-4);
  padding: 0 var(--bc-space-4);
}

.bc-search__form {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--bc-space-2);
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-pill);
  padding: var(--bc-space-2);
  box-shadow: var(--bc-shadow-sm);
}

.bc-search--hero .bc-search__form {
  padding: var(--bc-space-3);
  box-shadow: var(--bc-shadow);
  border-radius: var(--bc-radius-lg);
}

.bc-search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.bc-search__type {
  flex: 0 0 auto;
  min-width: 120px;
  height: 44px;
  padding: 0 var(--bc-space-3);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-pill);
  font-family: var(--bc-font);
  font-size: var(--bc-text-sm);
  font-weight: 600;
  background: var(--bc-bg);
  color: var(--bc-text);
}

.bc-search__input {
  flex: 1 1 200px;
  min-width: 0;
  height: 44px;
  padding: 0 var(--bc-space-4);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-pill);
  font-family: var(--bc-font);
  font-size: var(--bc-text-base);
}

.bc-search__input:focus {
  outline: none;
  border-color: var(--bc-accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

.bc-search__submit {
  flex: 0 0 auto;
  width: auto;
  min-width: 100px;
  height: 44px;
  border-radius: var(--bc-radius-pill);
  padding: 0 var(--bc-space-5);
}

.bc-search__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius);
  box-shadow: var(--bc-shadow-hover);
  max-height: 360px;
  overflow-y: auto;
}

.bc-search__results:not([hidden]) {
  display: block;
}

.bc-search__empty,
.bc-search__loading {
  padding: var(--bc-space-5);
  text-align: center;
  font-size: var(--bc-text-sm);
  color: var(--bc-muted);
}

.bc-search-hit {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: var(--bc-space-3);
  align-items: center;
  padding: var(--bc-space-3) var(--bc-space-4);
  border-bottom: 1px solid var(--bc-border);
  text-decoration: none;
  color: inherit;
  transition: background var(--bc-ease);
}

.bc-search-hit:last-child {
  border-bottom: none;
}

.bc-search-hit:hover,
.bc-search-hit:focus {
  background: var(--bc-accent-light);
}

.bc-search-hit__img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: var(--bc-bg);
  border-radius: var(--bc-radius-sm);
}

.bc-search-hit__title {
  font-size: var(--bc-text-sm);
  font-weight: 700;
  color: var(--bc-text);
  margin: 0 0 4px;
  line-height: 1.35;
}

.bc-search-hit__meta {
  font-size: var(--bc-text-xs);
  color: var(--bc-muted);
  margin: 0;
}

.bc-search-hit__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.bc-search-hit__btn {
  font-size: 11px;
  padding: 6px 10px;
  min-height: 32px;
  white-space: nowrap;
}

/* Sticky compact bar below header */
.bc-search-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 90;
  padding: var(--bc-space-3) 0;
  background: rgba(244, 246, 249, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bc-border);
}

/* —— Category cards (counts) —— */
.category-card__count {
  display: inline-block;
  margin-top: var(--bc-space-2);
  font-size: var(--bc-text-xs);
  font-weight: 700;
}

.category-card--carrier {
  background: linear-gradient(160deg, #fff 0%, var(--bc-accent-light) 100%);
}

.category-card--stroller {
  background: linear-gradient(160deg, #fff 0%, var(--bc-compare-light) 100%);
}

/* —— Listing card score / shop —— */
.card-image {
  position: relative;
}

.bc-score-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 8px;
  background: var(--bc-accent);
  color: #fff;
  border-radius: var(--bc-radius-sm);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: var(--bc-shadow-sm);
}

.bc-score-badge small {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.9;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--bc-space-2);
  margin: var(--bc-space-2) 0 var(--bc-space-3);
}

.card-meta-row .card-brand {
  margin: 0;
}

.bc-shop-label {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--bc-radius-pill);
  background: var(--bc-bg);
  color: var(--bc-muted);
}

.bc-shop-label--rakuten {
  background: #fff0f0;
  color: #bf0000;
}

.bc-shop-label--amazon {
  background: #fff8e6;
  color: #e67b00;
}

.bc-shop-label--yahoo {
  background: #fff0f6;
  color: #d4007f;
}

.buy-btn .bc-shop-label {
  margin-left: 4px;
}

@media (max-width: 768px) {
  .bc-search__form {
    border-radius: var(--bc-radius);
  }

  .bc-search__type,
  .bc-search__input,
  .bc-search__submit {
    border-radius: var(--bc-radius-sm);
    width: 100%;
  }

  .bc-search-hit {
    grid-template-columns: 48px 1fr;
  }

  .bc-search-hit__actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
}
