/*
 * df-bnb-searchresults.css
 * ------------------------
 * Styles for template-dfbnb-search.php. Relies on the CSS custom
 * properties defined in df-bnb-shell.css (--panel, --stroke,
 * --text, --muted, etc.) so the results page automatically adopts
 * the active brand's palette.
 */

/* Body background is set by df-bnb-shell.css via :has(#df-bnb-shell[data-active])
   so we don't override it here — just inherit text colour from the shell. */
.dfbnb-search-page {
  color: var(--text);
}

.dfbnb-search-shell {
  min-height: 100vh;
  color: var(--text);
}

.dfbnb-search-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

/* ---------------------------------------------------------------
   Header + input
   --------------------------------------------------------------- */

.dfbnb-search-header {
  text-align: center;
  margin-bottom: 24px;
}

.dfbnb-search-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--text);
}

.dfbnb-search-inputwrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  background: var(--panel2);
  border: 1px solid var(--stroke2);
  border-radius: 12px;
  padding: 4px 8px 4px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dfbnb-search-inputwrap:focus-within {
  border-color: var(--text);
}

.dfbnb-search-icon {
  flex: 0 0 auto;
  opacity: 0.7;
  margin-right: 10px;
  color: var(--text);
}

#dfbnbSearchResultsInput {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 15px;
  padding: 12px 0;
  line-height: 1.4;
  width: 100%;
}

#dfbnbSearchResultsInput::placeholder {
  color: var(--muted);
  opacity: 1;
}

.dfbnb-search-clear {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.dfbnb-search-clear:hover {
  background: var(--panel);
  color: var(--text);
}

/* ---------------------------------------------------------------
   Brand scope chips (All / BnB / DF)
   - Sit between the input and the count/tabs so switching scope
     feels like a top-level filter, not a sub-tab.
   - Each brand chip tinted to its palette so BnB reads dark and
     DF reads parchment-cream when active.
   --------------------------------------------------------------- */

.dfbnb-search-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 18px 0 6px;
}

.dfbnb-search-brand-chip {
  background: transparent;
  border: 1px solid var(--stroke2);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dfbnb-search-brand-chip:hover {
  color: var(--text);
  border-color: var(--text);
}

.dfbnb-search-brand-chip.is-active {
  color: var(--text);
  border-color: var(--text);
  background: var(--panel2);
  font-weight: 600;
}

/* Brand-tinted active state: BnB = dark, DF = warm cream. Uses the
   brand palette variables already exposed by df-bnb-shell.css. */
.dfbnb-search-brand-chip.is-brand-bnb.is-active {
  background: var(--bnb-panel2, #1f1f1f);
  color: var(--bnb-text, #ffffff);
  border-color: var(--bnb-stroke2, #444);
}

.dfbnb-search-brand-chip.is-brand-df.is-active {
  background: var(--df-panel2, #f6efe2);
  color: var(--df-text, #1a120e);
  border-color: var(--df-stroke2, #b5a48a);
}

/* ---------------------------------------------------------------
   Count + tabs
   --------------------------------------------------------------- */

.dfbnb-search-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 10px 0 6px;
  min-height: 20px;
}

.dfbnb-search-count {
  color: var(--muted);
  font-size: 13px;
}

.dfbnb-search-count strong {
  color: var(--text);
  font-weight: 600;
}

/* Tabs sit inside their own cream panel so the strip reads as a
   contained control the way the category/browse bars do elsewhere
   on the site, rather than a naked underline. */
.dfbnb-search-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  margin-bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--r2);
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}

.dfbnb-search-tab {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.dfbnb-search-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, rgba(255,255,255,0.04) calc(100% - var(--mixPct)), rgba(26,18,14,0.06) var(--mixPct));
}

.dfbnb-search-tab.is-active {
  color: var(--accent);
  background: color-mix(in srgb, rgba(214,134,63,0.12) calc(100% - var(--mixPct)), rgba(32,93,88,0.12) var(--mixPct));
  font-weight: 900;
}

.dfbnb-search-tab-count {
  opacity: 0.75;
  margin-left: 4px;
  font-weight: 700;
}

/* Narrow viewports: six pills on a single flex row overflows every
   phone (even before we added All Rewards / Checklist). Switch to a
   2-column grid so the six tabs lay out as a clean 2×3 with no
   horizontal scroll, no cutoff, and labels centered. Desktop layout
   is unchanged. */
@media (max-width: 700px) {
  .dfbnb-search-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    overflow-x: visible;
    -webkit-overflow-scrolling: auto;
  }
  .dfbnb-search-tab {
    white-space: normal;
    text-align: center;
    padding: 10px 8px;
    line-height: 1.25;
  }
}

/* ---------------------------------------------------------------
   Result cards
   - Matches the #dfbnbCatResults a.card pattern used on the
     category/hub pages: cream panel on brown, accent-coloured
     title, soft drop shadow, subtle hover lift.
   --------------------------------------------------------------- */

.dfbnb-search-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dfbnb-search-card {
  display: block;
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0,0,0,0.45);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.dfbnb-search-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, rgba(214,134,63,0.55) calc(100% - var(--mixPct)), rgba(32,93,88,0.55) var(--mixPct));
  background: color-mix(in srgb, rgba(214,134,63,0.08) calc(100% - var(--mixPct)), rgba(32,93,88,0.08) var(--mixPct));
}

.dfbnb-search-card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.25;
}

.dfbnb-search-card-title a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.dfbnb-search-card-title a:hover {
  border-bottom-color: var(--accent);
}

.dfbnb-search-card-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dfbnb-search-card-snippet {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

/* Keyword highlight — shared with the predictive dropdown and the
   server-rendered snippets. The mix favours the yellow so it still
   reads against the cream (DF) panel without going washed-out. */
.bnb-hl,
.dfbnb-search-card mark,
.dfbnb-search-card-snippet mark {
  background: color-mix(in srgb, #ffd166 78%, var(--panel));
  color: var(--text);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 700;
}

/* ---------------------------------------------------------------
   States
   --------------------------------------------------------------- */

.dfbnb-search-empty,
.dfbnb-search-loading {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 40px 20px;
}

/* ---------------------------------------------------------------
   Predictive dropdown (home page + shell bar) — shared mark styles
   so the highlight colour matches between dropdown and results page.
   --------------------------------------------------------------- */
.search-suggestions .search-suggestion-item mark,
.search-suggestions .search-suggestion-item mark.bnb-hl {
  background: color-mix(in srgb, #ffd166 55%, var(--panel));
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

.search-suggestions .search-all-row:focus {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

/* Responsive */
@media (max-width: 600px) {
  .dfbnb-search-main { padding: 28px 16px 64px; }
  .dfbnb-search-title { font-size: 22px; }
  .dfbnb-search-card-title { font-size: 16px; }
}
