/* Search header — sticky */
.search-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--color-canvas);
  padding: 32px var(--screen-padding) 0;
}

/* Screen title — matching SPA */
.search-title {
  font: var(--text-display);
  letter-spacing: -0.5px;
  color: var(--color-text-primary);
  margin-bottom: 14px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-icon {
  position: absolute;
  left: 16px;
  pointer-events: none;
  color: var(--sage-400);
  width: 16px;
  height: 16px;
}

/* Search bar — matches background, sage green accents */
.search-input {
  width: 100%;
  padding: 12px 44px 12px 44px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--badge-radius);
  font-family: var(--font-body);
  font-size: 16px; /* prevents iOS zoom */
  background: var(--color-canvas);
  color: var(--color-text-primary);
  outline: none;
  height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--color-score-green);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-input:focus {
  border-color: var(--color-score-green);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.08);
}

.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  min-width: 44px;
  min-height: 44px;
}

.search-clear svg {
  stroke: var(--color-text-muted);
}

.search-clear:active {
  background: rgba(0, 0, 0, 0.05);
}

/* Category filter pills */
.search-filters {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--screen-padding);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.search-filters::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--tag-radius);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.filter-pill.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.filter-pill:active {
  opacity: 0.8;
}

/* Results list */
.search-results {
  padding: 0 var(--screen-padding);
  padding-bottom: calc(var(--tab-bar-height) + var(--space-md));
}

/* Result row — matching SPA card style */
.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  margin-bottom: var(--space-lg);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 48px;
}

.search-result-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Product image placeholder */
.result-image {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  overflow: hidden;
  padding: 4px;
}

.result-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-image-placeholder {
  color: var(--color-text-muted);
}

/* Product info */
.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--color-text-primary);
  line-height: var(--line-height-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-brand {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  font-weight: 400;
}

/* Score + tier badge */
.result-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.result-score-number {
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--badge-radius);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Empty state */
.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: 56px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.search-empty-state svg {
  opacity: 0.25;
}

.search-no-results {
  text-align: center;
  padding: 56px 24px;
  color: var(--color-text-muted);
  font-size: 15px;
  font-weight: 600;
}

.search-no-results strong {
  color: var(--color-text-primary);
}

/* Loading shimmer */
.search-loading .shimmer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  margin-bottom: var(--card-gap);
}

.shimmer-block {
  background: linear-gradient(90deg, var(--color-canvas) 25%, var(--color-border) 50%, var(--color-canvas) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.shimmer-image {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}

.shimmer-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shimmer-line {
  height: 14px;
}

.shimmer-line-short {
  width: 60%;
}

.shimmer-line-long {
  width: 85%;
}

.shimmer-badge {
  width: 50px;
  height: 24px;
  border-radius: var(--badge-radius);
  flex-shrink: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .shimmer-block {
    animation: none;
    background: var(--color-border);
  }
}
