/* TagBuilder search box — desktop inline + full-screen mobile overlay */

:root {
  --tb-search-height: 40px;
  --tb-search-radius: 9999px;
  --tb-search-bg: #f1f5f9;
  --tb-search-bg-focus: #ffffff;
  --tb-search-border: #e2e8f0;
  --tb-search-border-focus: #2783f2;
  --tb-search-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.12);
  --tb-search-shadow-focus: 0 0 0 3px rgba(39, 131, 242, 0.2);
}

/* ---------- Inline desktop search ---------- */
.tb-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
}
.tb-search--desktop {
  display: flex;
  align-items: center;
}

.tb-search-input-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}
.tb-search-input-wrap svg.tb-search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #64748b;
  pointer-events: none;
}
.tb-search-input {
  width: 100%;
  height: var(--tb-search-height);
  padding: 0 16px 0 42px;
  border: 1px solid var(--tb-search-border);
  border-radius: var(--tb-search-radius);
  background: var(--tb-search-bg);
  font-size: 15px;
  color: #0f172a;
  transition: background .15s, border-color .15s, box-shadow .15s;
  outline: none;
}
.tb-search-input::placeholder { color: #94a3b8; }
.tb-search-input:focus {
  background: var(--tb-search-bg-focus);
  border-color: var(--tb-search-border-focus);
  box-shadow: var(--tb-search-shadow-focus);
}

/* ---------- Dropdown ---------- */
.tb-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--tb-search-border);
  border-radius: 12px;
  box-shadow: var(--tb-search-shadow);
  display: none;
  overflow: hidden;
  z-index: 60;
  max-height: 60vh;
  overflow-y: auto;
}
.tb-search-results.is-open { display: block; }

.tb-search-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.tb-search-item {
  padding: 0;
  margin: 0;
}
.tb-search-item-link {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  color: #0f172a;
  text-decoration: none;
  transition: background .1s;
}
.tb-search-item-link:hover,
.tb-search-item.is-active > .tb-search-item-link {
  background: #eef5ff;
  color: #1f6adf;
}
.tb-search-item-name {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-search-item-meta {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}
.tb-search-item-price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
  white-space: nowrap;
}

.tb-search-seeall {
  border-top: 1px solid var(--tb-search-border);
  margin-top: 4px;
}
.tb-search-seeall a {
  display: block;
  padding: 12px 14px;
  color: #1f6adf;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: #f8fafc;
}
.tb-search-seeall a:hover { background: #eef5ff; }

.tb-search-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: #64748b;
}
.tb-search-empty a {
  color: #1f6adf;
  font-weight: 600;
  text-decoration: none;
}

.tb-search-recent-header {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  text-transform: uppercase;
}

/* ---------- Mobile search icon button in header ---------- */
.tb-search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--tb-search-border);
  background: #fff;
  color: #475569;
  cursor: pointer;
}
.tb-search-trigger:hover { color: #1f6adf; border-color: #bfdbfe; }

/* ---------- Mobile full-screen overlay ---------- */
.tb-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
.tb-search-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.tb-search-overlay-panel {
  background: #fff;
  padding: 12px 12px 0;
  min-height: 68px;
  border-bottom: 1px solid var(--tb-search-border);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(-8px);
  transition: transform .18s;
}
.tb-search-overlay.is-open .tb-search-overlay-panel {
  transform: translateY(0);
}
.tb-search-overlay-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tb-search-overlay .tb-search--overlay {
  flex: 1 1 auto;
  position: relative;
}
.tb-search-overlay .tb-search-results {
  position: relative;
  top: 0;
  margin-top: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-height: none;
  background: #fff;
}

/* Body lock when overlay open (desktop users don't need this but doesn't hurt) */
body.tb-search-open { overflow: hidden; }
