/**
 * BBF Search Widget Styles
 * Panel-Layout mit Sidebar + Ergebnisse
 *
 * @author bbfdesign.de
 * @version 2.0.0
 */

/* ===== Root / Variables ===== */
/*
 * Two-tier CSS Custom Properties:
 * --bbf-user-* are set inline from admin settings (via <style id="bbf-search-vars">)
 * --bbf-* are the computed values with fallbacks, used throughout the CSS
 */
#bbf-search-root,
.bbf-search {
  /* User-configurable (overridden via inline <style>) */
  --bbf-accent: var(--bbf-user-accent, #0066cc);
  --bbf-accent-hover: color-mix(in srgb, var(--bbf-accent) 85%, black);
  --bbf-accent-light: color-mix(in srgb, var(--bbf-accent) 10%, white);
  --bbf-radius: var(--bbf-user-radius, 12px);
  --bbf-overlay-opacity: var(--bbf-user-overlay, 0.5);

  /* Brand / theme */
  --bbf-primary: #fffc00;
  --bbf-primary-dark: #b0c020;

  /* Semantic tokens */
  --bbf-bg: #ffffff;
  --bbf-bg-secondary: #f8f9fa;
  --bbf-bg-hover: #f5f5f5;
  --bbf-text: #1a1a1a;
  --bbf-text-muted: #666;
  --bbf-text-secondary: #6c757d;
  --bbf-border: #e2e8f0;
  --bbf-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --bbf-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  font-family: 'InputMonoCompressed';
  position: relative;
  z-index: 999999;
  line-height: 1.5;
  box-sizing: border-box;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  #bbf-search-root,
  .bbf-search {
    --bbf-bg: #1e1e2e;
    --bbf-bg-secondary: #2a2a3e;
    --bbf-bg-hover: #2f2f42;
    --bbf-text: #e2e8f0;
    --bbf-text-muted: #94a3b8;
    --bbf-text-secondary: #94a3b8;
    --bbf-border: #374151;
    --bbf-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --bbf-accent-hover: color-mix(in srgb, var(--bbf-accent) 85%, white);
    --bbf-accent-light: color-mix(in srgb, var(--bbf-accent) 15%, #1e1e2e);
  }
}

#bbf-search-root *,
#bbf-search-root *::before,
#bbf-search-root *::after {
  box-sizing: border-box;
}

/* Reset all list styles inside the widget to prevent theme bleed-through */
#bbf-search-root ul,
#bbf-search-root ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

#bbf-search-root li {
  list-style: none;
  margin: 0;
  padding: 0;
}

#bbf-search-root li::before,
#bbf-search-root li::after {
  content: none;
  display: none;
}

/* Prevent any theme ::before/::after bullets on result elements */
.bbf-search-results *::before,
.bbf-search-results *::after,
.bbf-search-sections *::before,
.bbf-search-sections *::after {
  content: none !important;
  display: none !important;
}

/* Exception: allow our own pseudo-elements */
.bbf-spinner::after {
  content: "" !important;
  display: block !important;
}

.bbf-badge-new::before,
.bbf-badge-top::before {
  content: revert !important;
  display: revert !important;
}

/* ===== State-driven visibility ===== */

/* Panel/Backdrop: hidden by default, shown via .bbf-open */
.bbf-search-panel { display: none; }
.bbf-open .bbf-search-panel { display: flex; }
.bbf-search-backdrop { display: none; }
.bbf-open .bbf-search-backdrop { display: block; }

/* Clear button: hidden by default, shown when query exists */
.bbf-search-clear { display: none !important; }
.bbf-has-query .bbf-search-clear { display: flex !important; }

/* Body scroll lock (applied to <html>) */
html.bbf-scroll-locked { overflow: hidden; }
html.bbf-scroll-locked body {
  position: fixed;
  left: 0;
  right: 0;
  overflow: hidden;
  top: var(--bbf-scroll-y, 0);
}

/* Card metadata (moved from inline styles) */
.bbf-card-mfr { font-size: 11px; color: #667eea; line-height: 1.2; }
.bbf-card-sku { font-size: 11px; color: #999; line-height: 1.2; }
.bbf-card-rating { font-size: 12px; color: #f5a623; line-height: 1.2; }

/* ===== Input Bar ===== */
.bbf-search-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bbf-search-ico {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--bbf-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bbf-search-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== Backdrop ===== */
.bbf-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999998;
  animation: bbf-fade-in 0.15s ease;
    backdrop-filter: blur(7px);
}

@keyframes bbf-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== Panel (Overlay / Modal) ===== */
.bbf-search-panel {
  position: fixed;
  z-index: 999999;
  background: var(--bbf-bg);
  border-radius: var(--bbf-radius);
  box-shadow: var(--bbf-shadow);
  overflow: hidden;
  flex-direction: column;
  isolation: isolate;
}

@keyframes bbf-panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Panel Head ---- */
.bbf-search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 0px solid var(--bbf-border);
  flex-shrink: 0;
}

/* Modal search input row */
.bbf-search-panel-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  background: var(--bbf-bg-hover);
  border: 1px solid var(--bbf-border);
  border-radius: 8px;
  padding: 8px 14px;
  transition: border-color 0.15s ease;
}

.bbf-search-panel-input-wrap:focus-within {
  border-color: var(--bbf-primary);
}

.bbf-search-panel-title-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--bbf-text-muted);
  display: flex;
  align-items: center;
}

.bbf-search-panel-title-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* The actual search input inside the modal */
.bbf-search-panel-input-wrap .bbf-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 2px 0;
  font-size: 16px;
  color: var(--bbf-text);
  outline: none;
  min-width: 0;
  font-weight: 500;
}

.bbf-search-panel-input-wrap .bbf-search-input::placeholder {
  color: var(--bbf-text-muted);
  font-weight: 400;
}

/* Clear button inside modal input */
.bbf-search-panel-input-wrap .bbf-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bbf-text-muted);
  border-radius: 50%;
  flex-shrink: 0;
  transition: color 0.15s;
}

.bbf-search-panel-input-wrap .bbf-search-clear:hover {
  color: var(--bbf-text);
}

.bbf-search-panel-input-wrap .bbf-search-clear svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Trigger input in header (read-only, just opens modal) */
.bbf-search-trigger {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 15px;
  color: inherit;
  outline: none;
  width: 100%;
  min-width: 0;
  cursor: pointer;
}

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

.bbf-search-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bbf-text);
  border-radius: 6px;
  transition: background 0.15s;
}

.bbf-search-panel-close:hover {
  background: var(--bbf-bg-hover);
}

.bbf-search-panel-close svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ---- Panel Body (Sidebar + Results) ---- */
.bbf-search-panel-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ===== Sidebar / Sections ===== */
.bbf-search-sections {
  flex-shrink: 0;
  width: 250px;
  padding:15px 20px;
  border-right: 0px solid var(--bbf-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
h2.bbf-search-title {
    margin-bottom: 0;
}
.bbf-search-panel-head .bbf-search-panel-input-wrap {
	background: transparent;
	border: 1px solid #ebeae8;
    border-radius: 30px;
}
aside.bbf-search-sections button.bbf-section{
    width: auto;
    border: none;
    background: #000000;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    border-radius: 0;
    padding: 7px 10px;
    display: flex;
    justify-content: flex-start;
    width: auto;
    max-width: max-content;
    margin-bottom: 5px;
}
aside.bbf-search-sections button.bbf-section.bbf-active {
    background: #fffc00;
    color: #000;
}
.bbf-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  margin: 0;
  background: none;
  border: 2px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--bbf-text);
  transition: all 0.15s ease;
  text-align: left;
  line-height: 1.3;
  font-family: inherit;
}

.bbf-section:hover {
  background: var(--bbf-bg-hover);
}

.bbf-section.bbf-active {
  border-color: var(--bbf-text);
  background: var(--bbf-bg);
}

.bbf-section-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bbf-section-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.bbf-section-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bbf-section-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bbf-section-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--bbf-text-muted);
  margin-left: 4px;
}

/* ===== Results Area ===== */
.bbf-search-results {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 16px 24px 24px;
}

/* ---- Results Header ---- */
.bbf-results-head {
  margin-bottom: 16px;
}

.bbf-results-query {
  font-size: 14px;
  color: var(--bbf-text-muted);
}

.bbf-results-query strong {
  color: var(--bbf-text);
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* ---- Block (Section Group) ---- */
.bbf-block {
  margin-bottom: 24px;
}

.bbf-block:last-child {
  margin-bottom: 0;
}

.bbf-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 5px;
  border-bottom: 0px solid var(--bbf-border);
}
main.bbf-search-results section.bbf-block {
    padding: 0px 0 25px 0;
    border-bottom: 1px solid #484848;
}
.bbf-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--bbf-text);
}

.bbf-block-title svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.bbf-block-meta {
  font-size: 13px;
  color: var(--bbf-text-muted);
  white-space: nowrap;
}
/* bbf-facets-hidden: fully hide facets panel when not applicable */
h2.bbf-search-title span.bg-greay {
    display: inline-block;
}
/* ===== Product Cards Grid ===== */
.bbf-products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.bbf-card {
  display: flex;
  flex-direction: column;
  background: var(--bbf-bg-hover);
  border-radius: var(--bbf-radius);
  text-decoration: none;
  color: var(--bbf-text);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  border: 1px solid transparent;
}

.bbf-card:hover {
  border-color: var(--bbf-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.bbf-card.bbf-selected {
  border-color: var(--bbf-primary);
  box-shadow: 0 0 0 2px rgba(200, 216, 48, 0.3);
}

.bbf-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eee;
  overflow: hidden;
}

.bbf-prod-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease;
}

/* Lazy image: show placeholder SVG (4:3 ratio, fills card media) */
.bbf-prod-img.bbf-lazy {
  object-fit: cover;
}

/* Placeholder state (onerror or missing image) — same as real image, no gaps */
.bbf-prod-img.ph {
  object-fit: cover;
}

/* div placeholder (no image URL in index at all) */
div.bbf-prod-img.ph {
  background: #f0f0f0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 300'%3E%3Crect fill='%23f0f0f0' width='400' height='300'/%3E%3Cg transform='translate(200,140)' text-anchor='middle'%3E%3Crect x='-28' y='-28' width='56' height='56' rx='8' fill='none' stroke='%23ccc' stroke-width='2'/%3E%3Ccircle cx='-12' cy='-12' r='5' fill='none' stroke='%23ccc' stroke-width='2'/%3E%3Cpath d='M28 10L12-6-4 10-28 10' fill='none' stroke='%23ccc' stroke-width='2' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.bbf-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--bbf-primary);
  color: var(--bbf-text);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.bbf-card-body {
  padding: 10px 12px 12px;
}

.bbf-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bbf-text);
}

.bbf-card-title em {
  font-style: normal;
  background: rgba(200, 216, 48, 0.3);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.bbf-card-sub {
  font-size: 12px;
  color: var(--bbf-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bbf-card-price {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--bbf-text);
}

/* ===== List Items (Pages, FAQ, etc.) ===== */
.bbf-list {
  display: flex;
  flex-direction: column;
}

.bbf-row {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--bbf-text);
  border-bottom: 1px solid var(--bbf-border);
  transition: background 0.12s;
}

.bbf-row:last-child {
  border-bottom: none;
}

.bbf-row:hover {
  background: var(--bbf-bg-hover);
}

.bbf-row.bbf-selected {
  background: rgba(200, 216, 48, 0.1);
}

.bbf-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bbf-row-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: #000;
}
main.bbf-search-results .bbf-row-sub {
    display: none;
}
main.bbf-search-results .bbf-row-top span.bbf-type {
    display: none;
}
main.bbf-search-results .bbf-list a.bbf-row.bbf-selectable {
    background: #ebeae8;
    border: none;
    margin-bottom: 10px;
}
main.bbf-search-results .bbf-list a.bbf-row.bbf-selectable:last-child{
    margin-bottom: 0px;
}
main.bbf-search-results .bbf-list a.bbf-row.bbf-selectable .bbf-row-title {
    color: #000;
    font-weight: 400;
}
.bbf-block-meta {
    color: #000;
    font-size: 14px;
}
.bbf-row-title em {
  font-style: normal;
  background: rgba(200, 216, 48, 0.3);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.bbf-type {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--bbf-text-muted);
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bbf-faq-group {
  font-size: 11px;
  font-weight: 500;
  color: var(--bbf-text-muted);
  margin-left: 8px;
  opacity: 0.7;
}
.bbf-faq-group::before {
  content: "›";
  margin-right: 4px;
}

.bbf-row-sub {
  font-size: 12px;
  color: var(--bbf-text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Highlight matched words in snippets */
.bbf-row-sub em,
.bbf-card-sub em,
.bbf-row-title em,
.bbf-card-title em {
  font-style: normal;
  font-weight: 700;
  color: var(--bbf-text);
  background: rgba(200, 216, 48, 0.25);
  padding: 0 1px;
  border-radius: 2px;
}

/* ===== States ===== */

/* Hint */
.bbf-search-hint {
  padding: 40px 20px;
  text-align: center;
  color: var(--bbf-text-muted);
  font-size: 14px;
}

.bbf-search-hint strong {
  color: var(--bbf-text);
}

/* Loading */
.bbf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--bbf-text-muted);
  font-size: 14px;
  gap: 10px;
}

.bbf-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bbf-border);
  border-top-color: var(--bbf-primary);
  border-radius: 50%;
  animation: bbf-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes bbf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty / No Results */
.bbf-empty {
  padding: 48px 20px;
  text-align: center;
}

.bbf-empty-ico {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--bbf-border);
}

.bbf-empty-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bbf-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--bbf-text);
  margin-bottom: 6px;
}

.bbf-empty-sub {
  font-size: 14px;
  color: var(--bbf-text-muted);
}

.bbf-empty-sub strong {
  color: var(--bbf-text);
}

/* Error */
.bbf-error {
  padding: 30px 20px;
  text-align: center;
  color: #e74c3c;
  font-size: 14px;
}

.bbf-error-text {
  margin-bottom: 12px;
}

.bbf-error-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--bbf-border);
  border-radius: 6px;
  background: var(--bbf-bg);
  color: var(--bbf-text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bbf-error-retry:hover {
  background: var(--bbf-bg-hover);
  border-color: var(--bbf-text-muted);
}

/* Show More (per section) */
.bbf-show-more,
.bbf-load-more {
  display: block;
  width: 100%;
  padding: 10px 16px;
  margin-top: 8px;
  background: var(--bbf-bg-hover);
  border: 1px solid var(--bbf-border);
  border-radius: 6px;
  color: var(--bbf-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
  z-index: 2;
}

.bbf-show-more:hover,
.bbf-load-more:hover {
  background: var(--bbf-primary);
  border-color: var(--bbf-primary);
}

.bbf-load-more:disabled {
  opacity: 0.6;
  cursor: wait;
}
/* Position hack removed — layout-specific CSS handles positioning */
.bbf-card-body .bbf-card-sub {
    display: none;
}
.bbf-products a.bbf-card {
    background: transparent;
    border: 1px solid #ddd;
}
.bbf-products a.bbf-card  .bbf-card-title {
    font-size: 14px;
    color: #000;
}
span.bbf-search-count-wrap span.bbf-section-count {
    margin-left: 2px;
    color: #fff;
    margin-right: 2px;
    font-weight: 500;
}
span.bbf-search-count-wrap {
    margin-left: 12px;
}
aside.bbf-search-sections button.bbf-section.bbf-active span.bbf-section-count {
    color: #000;
}
aside.bbf-search-sections button.bbf-section svg{
	filter: brightness(0) saturate(100%) invert(92%) sepia(20%) saturate(4676%) hue-rotate(4deg) brightness(114%) contrast(104%);
}
aside.bbf-search-sections button.bbf-section.bbf-active svg {
    filter: brightness(1);
}
/* ===== Mobile (Full Screen) ===== */
@media (max-width: 768px) {
  .bbf-search-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0;
    animation: bbf-panel-in-mobile 0.2s ease;
  }

  @keyframes bbf-panel-in-mobile {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Sticky panel head on mobile */
  .bbf-search-panel-head {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  /* Bigger close button for touch */
  .bbf-search-panel-close {
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 4px;
  }

  .bbf-search-panel-body {
    flex-direction: column;
  }

  .bbf-search-sections {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    border-right: none;
    border-bottom: 1px solid var(--bbf-border);
    padding: 10px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .bbf-sections-dyn {
    display: contents;
  }

  .bbf-section {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .bbf-search-results {
    padding: 12px 16px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .bbf-products {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .bbf-card-title {
    font-size: 12px;
  }

  .bbf-card-price {
    font-size: 13px;
  }
}

/* Small phones */
@media (max-width: 420px) {
  .bbf-products {
    grid-template-columns: 1fr;
  }
}

/* ===== Scrollbar styling ===== */
.bbf-search-results::-webkit-scrollbar {
  width: 6px;
}

.bbf-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.bbf-search-results::-webkit-scrollbar-thumb {
  background: var(--bbf-border);
  border-radius: 3px;
}

.bbf-search-results::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* ===== Facets Panel (inside sidebar) ===== */
.bbf-facets-panel {
    padding: 12px 0 0;
    margin-top: 8px;
    border-top: 0px solid var(--bbf-border);
    top: 0;
    transition: opacity 0.2s ease, max-height 0.3s ease;
    overflow: hidden;
}
.bbf-facets-panel span.bbf-facets-title {
    font-weight: 700;
    font-size: 20px;
    font-family: var(--font);
}
.bbf-facets-panel.bbf-facets-hidden {
  display: none;
}
.bbf-facet-group-body span.bbf-facet-val {
    font-family: var(--font);
    color: #000!important;
    font-size: 14px;
    opacity: 1;
}
.bbf-facet-group-body span.bbf-facet-check {
    color: transparent;
    width: 14px;
    height: 14px;
    background: transparent;
    border: 1px solid #000;
}
.bbf-facet-group-body  button.bbf-facet-value {
    padding-left: 0;
    padding-right: 0;
}
.bbf-facet-group-body .bbf-facet-active {
    background: transparent;
}
.bbf-facet-group-body .bbf-facet-active span.bbf-facet-check {
    background: #000;
    border-color: #000;
}
.bbf-results-head .bbf-results-query {
    font-weight: 500;
    font-family: var(--font);
    color: #000;
}
.bbf-facets-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    padding-bottom: 0;
    border-bottom: 0px solid var(--bbf-border);
}
.bbf-facet-group span.bbf-facet-group-label {
    font-size: 16px;
    color: #000;
    font-weight: 500;
    font-family: var(--font);
}
.bbf-facets-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--bbf-text);
}

.bbf-facets-clear {
  background: none;
  border: none;
  font-size: 11px;
  color: #667eea;
  cursor: pointer;
  padding: 0;
}
.bbf-facets-clear:hover {
  text-decoration: underline;
}

/* Facet group */
.bbf-facet-group {
  margin-bottom: 14px;
}

.bbf-facet-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.bbf-facet-group-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--bbf-text);
}

.bbf-facet-active-count {
  display: inline-block;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  margin-left: 4px;
}

.bbf-facet-group-toggle {
  color: var(--bbf-text-muted);
  transition: transform 0.2s;
}

.bbf-facet-group.bbf-collapsed .bbf-facet-group-toggle {
  transform: rotate(-90deg);
}

.bbf-facet-group.bbf-collapsed .bbf-facet-group-body {
  display: none;
}

.bbf-facet-group-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

/* Facet value button */
.bbf-facet-value {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--bbf-text);
  text-align: left;
  transition: background 0.1s;
}
.bbf-facet-value:hover {
  background: var(--bbf-hover);
}
.bbf-facet-value.bbf-facet-active {
  background: #eef0ff;
  font-weight: 600;
}

.bbf-facet-check {
  font-size: 13px;
  color: var(--bbf-text-muted);
  flex-shrink: 0;
  width: 16px;
}
.bbf-facet-active .bbf-facet-check {
  color: #667eea;
}

.bbf-facet-val {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bbf-facet-cnt {
  color: var(--bbf-text-muted);
  font-size: 11px;
  flex-shrink: 0;
}

.bbf-facet-more {
  background: none;
  border: none;
  font-size: 11px;
  color: #667eea;
  cursor: pointer;
  padding: 4px 6px;
  text-align: left;
}
.bbf-facet-more:hover {
  text-decoration: underline;
}

/* Active facets chips bar */
.bbf-active-facets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0px 0px 20px 0;
    align-items: center;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.bbf-active-facet-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fffc00;
    border: 1px solid #fffc00;
    border-radius: 16px;
    padding: 3px 10px;
    font-size: 11px;
    color: #000;
    font-family: var(--font);
}
.bbf-active-facets button.bbf-active-facets-clear-all {
    background: #000;
    color: #fff;
    padding: 4px 15px;
    border-radius: 30px;
    text-decoration: none;
    font-family: var(--font);
}
.bbf-active-facet-chip strong {
  font-weight: 600;
}

.bbf-active-facet-remove {
  background: none;
  border: none;
  font-size: 14px;
  color: #667eea;
  cursor: pointer;
  padding: 0 0 0 2px;
  line-height: 1;
}
.bbf-active-facet-remove:hover {
  color: #dc3545;
}

.bbf-active-facets-clear-all {
  background: none;
  border: none;
  font-size: 11px;
  color: #dc3545;
  cursor: pointer;
  padding: 0;
}
.bbf-active-facets-clear-all:hover {
  text-decoration: underline;
}

/* ===== Responsive: Facets ===== */
@media (max-width: 768px) {
  .bbf-facets-panel {
    display: none;
  }
  .bbf-active-facets {
    padding: 8px 12px 0;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .bbf-facets-panel {
    padding: 8px 0 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT SYSTEM — Animations, Variants & Responsive
   ═══════════════════════════════════════════════════════════════════ */

/* ===== Shared Animations ===== */

/* Floating: slide down */
@keyframes bbf-floating-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modal: scale up from center */
@keyframes bbf-modal-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Sidebar: slide from right */
@keyframes bbf-sidebar-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* Fullscreen: staggered entrance */
@keyframes bbf-fs-bg {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes bbf-fs-input {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bbf-fs-content {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Staggered card entrance (all layouts) */
@keyframes bbf-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bbf-card {
  animation: bbf-card-in 0.3s ease both;
  animation-delay: calc(var(--bbf-card-index, 0) * 50ms);
}

/* Reduced motion: respect user preference */
@media (prefers-reduced-motion: reduce) {
  .bbf-search *,
  .bbf-search *::before,
  .bbf-search *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Layout 2: Modal (Default) ===== */

[data-layout="modal"] .bbf-search-panel {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 780px;
  max-height: 85vh;
  border-radius: 0;
  animation: bbf-modal-in 0.2s ease;
}

[data-layout="modal"] .bbf-products {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
  [data-layout="modal"] .bbf-products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  [data-layout="modal"] .bbf-search-panel {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    animation: bbf-panel-in-mobile 0.2s ease;
  }
  [data-layout="modal"] .bbf-products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  [data-layout="modal"] .bbf-products {
    grid-template-columns: 1fr;
  }
}

/* ===== Layout 1: Floating Dropdown ===== */

[data-layout="floating"] .bbf-search-panel {
  position: fixed;
  top: var(--bbf-float-top, 60px);
  left: var(--bbf-float-left, 50%);
  width: var(--bbf-float-width, 680px);
  max-width: 680px;
  max-height: var(--bbf-float-max-height, 70vh);
  border-radius: var(--bbf-radius);
  animation: bbf-floating-in 0.2s ease;
}

/* Floating: no backdrop on desktop */
[data-layout="floating"] .bbf-search-backdrop {
  display: none;
}

/* Floating: no body scroll lock on desktop */
[data-layout="floating"] ~ .bbf-scroll-locked-marker { display: none; }

/* Floating: 2-column body layout (sidebar + main) */
[data-layout="floating"] .bbf-search-panel-body {
  display: flex;
}

[data-layout="floating"] .bbf-search-sections {
  width: 200px;
  flex-shrink: 0;
}

[data-layout="floating"] .bbf-products {
  grid-template-columns: repeat(2, 1fr);
}

/* Floating footer */
.bbf-floating-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--bbf-border);
  background: var(--bbf-bg-secondary);
  font-size: 13px;
  color: var(--bbf-text-muted);
  flex-shrink: 0;
}

.bbf-floating-footer a {
  color: var(--bbf-accent);
  text-decoration: none;
  font-weight: 600;
}

.bbf-floating-footer a:hover {
  text-decoration: underline;
}

/* Floating mobile: becomes fullscreen-like */
@media (max-width: 768px) {
  [data-layout="floating"] .bbf-search-panel {
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    animation: bbf-panel-in-mobile 0.2s ease;
  }
  /* Show backdrop on mobile for floating */
  [data-layout="floating"] .bbf-open .bbf-search-backdrop {
    display: block;
  }
  [data-layout="floating"] .bbf-search-sections {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    border-right: none;
    border-bottom: 1px solid var(--bbf-border);
    overflow-x: auto;
  }
}

/* ===== Layout 3: Sidebar (Right Panel) ===== */

[data-layout="sidebar"] .bbf-search-panel {
  position: fixed;
  right: 0;
  top: 0;
  left: auto;
  height: 100vh;
  height: 100dvh;
  width: 520px;
  max-width: 90vw;
  max-height: none;
  border-radius: 0;
  animation: bbf-sidebar-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(var(--bbf-sidebar-swipe-x, 0));
}

/* Sidebar: sticky head */
[data-layout="sidebar"] .bbf-search-panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bbf-bg);
}

/* Sidebar: vertical category nav with badges */
[data-layout="sidebar"] .bbf-search-sections {
  width: 100%;
  flex-direction: column;
  border-right: none;
  border-bottom: 1px solid var(--bbf-border);
  padding: 8px 16px;
  overflow-y: auto;
  max-height: 160px;
}

[data-layout="sidebar"] .bbf-search-panel-body {
  flex-direction: column;
  overflow-y: auto;
}

[data-layout="sidebar"] .bbf-products {
  grid-template-columns: repeat(2, 1fr);
}

/* Sidebar mobile: full width */
@media (max-width: 768px) {
  [data-layout="sidebar"] .bbf-search-panel {
    width: 100%;
    max-width: none;
  }
  [data-layout="sidebar"] .bbf-search-sections {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    gap: 6px;
  }
  [data-layout="sidebar"] .bbf-section {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ===== Layout 4: Fullscreen (Immersive) ===== */

[data-layout="fullscreen"] .bbf-search-panel,
.bbf-layout-fullscreen .bbf-search-panel {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  border-radius: 0;
  max-height: none;
  width: 100%;
  height: 100%;
  animation: bbf-fs-bg 0.3s ease;
}

/* Fullscreen: no separate backdrop (panel IS the background) */
[data-layout="fullscreen"] .bbf-search-backdrop,
.bbf-layout-fullscreen .bbf-search-backdrop {
  display: none !important;
}

/* Fullscreen: large centered search input */
[data-layout="fullscreen"] .bbf-search-panel-head,
.bbf-layout-fullscreen .bbf-search-panel-head {
  padding: 32px 40px 24px;
  justify-content: center;
  border-bottom: none;
  animation: bbf-fs-input 0.3s ease 0.1s both;
}

[data-layout="fullscreen"] .bbf-search-panel-input-wrap,
.bbf-layout-fullscreen .bbf-search-panel-input-wrap {
  max-width: 640px;
  width: 100%;
}

[data-layout="fullscreen"] .bbf-search-panel-input-wrap .bbf-search-input,
.bbf-layout-fullscreen .bbf-search-panel-input-wrap .bbf-search-input {
  font-size: 1.5rem;
  padding: 8px 0;
  font-weight: 400;
}

/* Fullscreen: animated underline on input */
.bbf-fs-input-underline {
  height: 2px;
  background: var(--bbf-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 2px;
}

[data-layout="fullscreen"] .bbf-search-panel-input-wrap:focus-within .bbf-fs-input-underline,
.bbf-layout-fullscreen .bbf-search-panel-input-wrap:focus-within .bbf-fs-input-underline {
  transform: scaleX(1);
}

/* Fullscreen: body animation */
[data-layout="fullscreen"] .bbf-search-panel-body,
.bbf-layout-fullscreen .bbf-search-panel-body {
  animation: bbf-fs-content 0.3s ease 0.2s both;
}

/* Fullscreen: horizontal tab pills for sections */
[data-layout="fullscreen"] .bbf-search-sections,
.bbf-layout-fullscreen .bbf-search-sections {
  width: 100%;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  border-right: none;
  border-bottom: 1px solid var(--bbf-border);
  padding: 12px 24px;
  gap: 8px;
}

[data-layout="fullscreen"] .bbf-section,
.bbf-layout-fullscreen .bbf-section {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
}

/* Fullscreen: 4-column product grid */
[data-layout="fullscreen"] .bbf-products,
.bbf-layout-fullscreen .bbf-products {
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Fullscreen: card hover effect */
[data-layout="fullscreen"] .bbf-card:hover,
.bbf-layout-fullscreen .bbf-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Fullscreen: close button */
[data-layout="fullscreen"] .bbf-search-panel-close,
.bbf-layout-fullscreen .bbf-search-panel-close {
  position: absolute;
  top: 24px;
  right: 24px;
}

/* Fullscreen: center results */
[data-layout="fullscreen"] .bbf-search-results,
.bbf-layout-fullscreen .bbf-search-results {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 40px 40px;
}

@media (max-width: 1024px) {
  [data-layout="fullscreen"] .bbf-products,
  .bbf-layout-fullscreen .bbf-products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  [data-layout="fullscreen"] .bbf-products,
  .bbf-layout-fullscreen .bbf-products {
    grid-template-columns: repeat(2, 1fr);
  }
  [data-layout="fullscreen"] .bbf-search-panel-head,
  .bbf-layout-fullscreen .bbf-search-panel-head {
    padding: 16px 16px 12px;
  }
  [data-layout="fullscreen"] .bbf-search-panel-input-wrap .bbf-search-input,
  .bbf-layout-fullscreen .bbf-search-panel-input-wrap .bbf-search-input {
    font-size: 1.2rem;
  }
  [data-layout="fullscreen"] .bbf-search-results,
  .bbf-layout-fullscreen .bbf-search-results {
    padding: 12px 16px 16px;
  }
  [data-layout="fullscreen"] .bbf-search-panel-close,
  .bbf-layout-fullscreen .bbf-search-panel-close {
    top: 12px;
    right: 12px;
  }
}

@media (max-width: 420px) {
  [data-layout="fullscreen"] .bbf-products,
  .bbf-layout-fullscreen .bbf-products {
    grid-template-columns: 1fr;
  }
}

/* Fullscreen: break stacking context so panel can overlay shop nav */
[data-layout="fullscreen"],
.bbf-layout-fullscreen {
  position: static !important;
  z-index: auto !important;
}

[data-layout="fullscreen"] .bbf-search-panel,
.bbf-layout-fullscreen .bbf-search-panel {
  z-index: 10000000 !important;
}

/* ============================================================
   FULLSCREEN LAYOUT FIX
   Overrides above rules to fix sections/results width split
   ============================================================ */

/* Panel-body: ROW bleibt – sections als linke Sidebar */
[data-layout="fullscreen"] .bbf-search-panel-body,
.bbf-layout-fullscreen .bbf-search-panel-body {
  flex-direction: row !important;
  overflow: hidden;
  height: 100%;
}

/* Sections = linke Sidebar mit fester Breite, Column-Layout */
[data-layout="fullscreen"] .bbf-search-sections,
.bbf-layout-fullscreen .bbf-search-sections {
  flex: 0 0 260px !important;
  width: 260px !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--bbf-border, #e5e7eb);
  border-bottom: none !important;
  padding: 16px 0 !important;
  gap: 0 !important;
}

/* Kategorietabs: vertikal in der Sidebar */
[data-layout="fullscreen"] .bbf-sections-nav,
.bbf-layout-fullscreen .bbf-sections-nav {
  flex-direction: column !important;
  width: 100%;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--bbf-border, #e5e7eb);
  gap: 2px;
}

[data-layout="fullscreen"] .bbf-section,
.bbf-layout-fullscreen .bbf-section {
  width: 100% !important;
  text-align: left !important;
  padding: 7px 12px !important;
  border-radius: 6px !important;
}

/* Facetten-Panel direkt unterhalb der Kategorietabs */
[data-layout="fullscreen"] .bbf-facets-panel,
.bbf-layout-fullscreen .bbf-facets-panel {
  flex: 1 !important;
  width: 100% !important;
  padding: 12px !important;
  overflow-y: auto;
}

/* Ergebnisse: restliche Breite */
[data-layout="fullscreen"] .bbf-search-results,
.bbf-layout-fullscreen .bbf-search-results {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow-y: auto;
  padding: 24px 32px !important;
}

/* Produktgrid: 3 Spalten default, 4 auf großen Screens */
[data-layout="fullscreen"] .bbf-products,
.bbf-layout-fullscreen .bbf-products {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px !important;
}

@media (min-width: 1400px) {
  [data-layout="fullscreen"] .bbf-products,
  .bbf-layout-fullscreen .bbf-products {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (max-width: 900px) {
  [data-layout="fullscreen"] .bbf-products,
  .bbf-layout-fullscreen .bbf-products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [data-layout="fullscreen"] .bbf-search-sections,
  .bbf-layout-fullscreen .bbf-search-sections {
    flex: 0 0 200px !important;
    width: 200px !important;
  }
}

/* Mobile: Sidebar wird zur Tab-Leiste oben */
@media (max-width: 640px) {
  [data-layout="fullscreen"] .bbf-search-panel-body,
  .bbf-layout-fullscreen .bbf-search-panel-body {
    flex-direction: column !important;
  }
  [data-layout="fullscreen"] .bbf-search-sections,
  .bbf-layout-fullscreen .bbf-search-sections {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    flex-direction: row !important;
    border-right: none !important;
    border-bottom: 1px solid var(--bbf-border, #e5e7eb) !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px !important;
  }
  [data-layout="fullscreen"] .bbf-sections-nav,
  .bbf-layout-fullscreen .bbf-sections-nav {
    flex-direction: row !important;
    border-bottom: none;
    padding: 0;
  }
  [data-layout="fullscreen"] .bbf-section,
  .bbf-layout-fullscreen .bbf-section {
    width: auto !important;
    white-space: nowrap;
  }
  [data-layout="fullscreen"] .bbf-facets-panel,
  .bbf-layout-fullscreen .bbf-facets-panel {
    display: none !important;
  }
}

/* ===== Trending Styles ===== */

/* Trending list (Modal, Sidebar) */
/* ===== Trending List Items (Modal, Sidebar) ===== */

.bbf-trending-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bbf-trending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--bbf-text);
}

.bbf-trending-item:hover {
  background: var(--bbf-bg-hover);
}

.bbf-trending-ico {
  width: 14px;
  height: 14px;
  color: var(--bbf-text-muted);
  flex-shrink: 0;
  opacity: 0.6;
}

.bbf-trending-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== Trending Pills (Floating, Fullscreen) ===== */

.bbf-trending-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
}

.bbf-trending-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bbf-bg-secondary);
  border: 1px solid var(--bbf-border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--bbf-text);
  transition: all 0.15s;
  white-space: nowrap;
}

.bbf-trending-pill:hover {
  background: var(--bbf-accent-light);
  border-color: var(--bbf-accent);
  color: var(--bbf-accent);
}

.bbf-trending-pill svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.5;
}

/* ===== Trending & Recent: Two-Column Layout ===== */

.bbf-trending-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 8px 0;
}

.bbf-trending-columns > .bbf-trending-col:first-child {
  border-right: 1px solid var(--bbf-border);
  padding-right: 20px;
}

.bbf-trending-columns > .bbf-trending-col:last-child {
  padding-left: 20px;
}

/* Single column when only one exists */
.bbf-trending-columns > .bbf-trending-col:only-child {
  border-right: none;
  padding-right: 0;
  padding-left: 0;
}

@media (max-width: 600px) {
  .bbf-trending-columns {
    grid-template-columns: 1fr;
  }
  .bbf-trending-columns > .bbf-trending-col:first-child {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--bbf-border);
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
  .bbf-trending-columns > .bbf-trending-col:last-child {
    padding-left: 0;
  }
}

.bbf-trending-col {
  min-width: 0;
}

/* Section header */
.bbf-trending-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bbf-trending-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--bbf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0;
}

/* Clear button */
.bbf-recent-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bbf-bg-hover);
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--bbf-text-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 12px;
  transition: all 0.15s;
}

.bbf-recent-clear-btn svg {
  width: 11px;
  height: 11px;
}

.bbf-recent-clear-btn:hover {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
}

/* Legacy clear button */
.bbf-recent-clear {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--bbf-text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.bbf-recent-clear:hover {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
}

/* Recent search item (list variant) */
.bbf-recent-item {
  position: relative;
  padding-right: 32px;
}

/* Remove button on individual recent search */
.bbf-recent-remove {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--bbf-text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bbf-recent-item:hover .bbf-recent-remove,
.bbf-recent-remove:focus-visible {
  opacity: 1;
}

.bbf-recent-remove:hover {
  color: #dc3545;
}

.bbf-recent-remove svg {
  width: 14px;
  height: 14px;
}

/* Recent pill variant (Floating, Fullscreen) */
.bbf-recent-pill {
  position: relative;
  padding-right: 28px;
}

.bbf-recent-pill .bbf-recent-remove {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
  opacity: 0;
}

.bbf-recent-pill:hover .bbf-recent-remove {
  opacity: 1;
}

/* ===== Trend direction icons ===== */

.bbf-trend-up {
  color: #22c55e;
}

.bbf-trend-down {
  color: #ef4444;
}

.bbf-trend-stable {
  color: var(--bbf-text-muted);
}

.bbf-trend-promoted {
  color: var(--bbf-accent, #0066cc);
}

.bbf-trend-suggested {
  color: var(--bbf-accent, #0066cc);
  opacity: 0.7;
}

/* ===== Correction Bar ("Meinten Sie?") ===== */

.bbf-correction-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bbf-bg-alt, #f8f9fa);
  border-bottom: 1px solid var(--bbf-border, #e5e7eb);
  font-size: 0.9rem;
}

.bbf-correction-label {
  color: var(--bbf-text-muted, #6b7280);
}

.bbf-correction-link {
  color: var(--bbf-accent, #0066cc);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.bbf-correction-link:hover {
  text-decoration: underline;
}

/* ===== Banners ===== */

.bbf-banner {
  margin: 8px 0;
  border-radius: var(--bbf-radius, 12px);
  overflow: hidden;
}

.bbf-banner-link {
  display: block;
}

.bbf-banner-img {
  width: 100%;
  height: auto;
  display: block;
}

.bbf-banner-top {
  margin-bottom: 12px;
}

.bbf-banner-between {
  margin: 12px 0;
}

.bbf-banner-sidebar {
  margin-top: 12px;
}

/* ===== Out-of-Stock Badge ===== */

.bbf-badge-oos {
  background: #dc3545 !important;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.bbf-card.bbf-oos {
  position: relative;
}

/* ===== Wizard Overlay ===== */

.bbf-wizard-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.bbf-wizard-panel {
  background: var(--bbf-bg, #fff);
  border-radius: var(--bbf-radius, 12px);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.bbf-wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 12px;
}

.bbf-wizard-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--bbf-text, #1a1a1a);
}

.bbf-wizard-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--bbf-text-muted, #6b7280);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.bbf-wizard-close:hover {
  color: var(--bbf-text, #1a1a1a);
}

.bbf-wizard-progress {
  height: 4px;
  background: var(--bbf-border, #e5e7eb);
  margin: 0 24px;
  border-radius: 2px;
  overflow: hidden;
}

.bbf-wizard-progress-bar {
  height: 100%;
  background: var(--bbf-accent, #0066cc);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.bbf-wizard-step-info {
  padding: 12px 24px 0;
  font-size: 0.8rem;
  color: var(--bbf-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bbf-wizard-question {
  padding: 8px 24px 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bbf-text, #1a1a1a);
}

.bbf-wizard-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 0 24px 20px;
}

.bbf-wizard-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--bbf-border, #e5e7eb);
  border-radius: 10px;
  background: var(--bbf-bg, #fff);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bbf-text, #1a1a1a);
  text-align: center;
}

.bbf-wizard-option:hover {
  border-color: var(--bbf-accent, #0066cc);
  background: var(--bbf-bg-alt, #f0f7ff);
}

.bbf-wizard-opt-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
}

.bbf-wizard-actions {
  display: flex;
  justify-content: space-between;
  padding: 0 24px 20px;
  gap: 10px;
}

.bbf-wizard-back,
.bbf-wizard-skip {
  padding: 8px 20px;
  border: 1px solid var(--bbf-border, #e5e7eb);
  border-radius: 8px;
  background: var(--bbf-bg, #fff);
  color: var(--bbf-text-muted, #6b7280);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.bbf-wizard-back:hover,
.bbf-wizard-skip:hover {
  background: var(--bbf-bg-alt, #f8f9fa);
}

@media (max-width: 480px) {
  .bbf-wizard-options {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Autocomplete Suggestions Bar ===== */

.bbf-suggestions-bar {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--bbf-border);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.bbf-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--bbf-text);
  text-align: left;
  border-radius: 6px;
  transition: background 0.15s;
  width: 100%;
}

.bbf-suggestion-item:hover {
  background: var(--bbf-bg-hover);
}

.bbf-suggestion-ico {
  width: 16px;
  height: 16px;
  color: var(--bbf-text-muted);
  flex-shrink: 0;
}

.bbf-suggestion-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bbf-suggestion-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bbf-suggestion-text strong {
  font-weight: 700;
}

.bbf-suggestion-count {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--bbf-text-muted);
}

/* ===== Typewriter cursor (Fullscreen) ===== */

.bbf-typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--bbf-text);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: bbf-blink 1s step-end infinite;
}

@keyframes bbf-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== Focus trap visual indicator ===== */
.bbf-search-panel:focus-visible {
  outline: 2px solid var(--bbf-accent);
  outline-offset: -2px;
}

/* ===== iOS zoom prevention on form focus =====
 * iOS Safari auto-zooms when a focused input has a computed font-size
 * below 16 px — disruptive and ugly on mobile. We cannot fix it via
 * meta-viewport (maximum-scale=1 breaks accessibility), so we raise
 * the font-size on every plugin-bound input + the native JTL mobile
 * typeahead and the OPC filter field at the < lg breakpoint.
 *
 * twitter-typeahead's .tt-hint is a phantom sibling <input> positioned
 * behind the real input. Its own stylesheet ships 14 px, which is
 * enough to trigger the zoom even when the real input is already 16 px.
 * Covering every tt-* input variant prevents the zoom from sneaking
 * in via focus events we don't control. (JS-side we also destroy the
 * typeahead, but CSS stays a belt-and-suspenders guard for cases where
 * the typeahead plugin is not loaded as jQuery extension.)
 *
 * line-height is normalised so the taller font-size doesn't visibly
 * bump the input box height.
 */
@media (max-width: 991.98px) {
  .bbf-search-trigger,
  .bbf-search-input,
  input[name="qs"],
  #search-header-mobile-top,
  #search-header-mobile-top + .tt-hint,
  #search-header-desktop,
  #search-header-mobile,
  .twitter-typeahead .tt-input,
  .twitter-typeahead .tt-hint,
  #opc-filter-search,
  input[type="search"].opc-filter-control,
  form.main-search input[type="text"],
  form.main-search input[type="search"] {
    font-size: 16px !important;
    line-height: 1.4 !important;
  }
}

/* ===== Mobile fullscreen-sheet (class-driven) =====
 * bbfdesign's child template mounts <div id="bbf-search-root"> inside
 * a Bootstrap d-none-d-lg-block nav slot that's hidden on < lg.
 * bbfRelocateRootIfHidden (JS, runs on init + every openPanel) moves
 * the root to <body> for mobile viewports; openPanel then adds the
 * class .bbf-search--mobile-fixed which owns the fullscreen layout.
 *
 * The rule deliberately uses !important everywhere because the mobile
 * plugin root ends up as a direct child of <body> where upstream theme
 * CSS can reach it with specificity 0,1,0 via #bbf-search-root.
 * Desktop is unaffected — the class is never added (matchMedia guard
 * in openPanel) and this rule never fires.
 */
.bbf-search--mobile-fixed {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100vw !important;
  z-index: 2147483000 !important;   /* above any sticky header the theme may layer */
  overflow-y: auto !important;
  background: #fff;
}
.bbf-search--mobile-fixed .bbf-search-panel {
  max-width: 100%;
}

/* ===== Horizontal-overflow guard on mobile =====
 * The Winterberg bbfdesign template has absolute-positioned elements
 * inside .slide / .pp-card / .kk-reslider-items that extend ~96 px
 * past the viewport on narrow screens. html{overflow-x:hidden} is
 * already set globally, but iOS Safari propagates the overhang onto
 * the body — the user can still touch-swipe the page sideways.
 *
 * `overflow-x: clip` is stricter than hidden: it suppresses the
 * scrollport entirely, so no scrollable ancestor reports the extra
 * width, and sticky/fixed children work normally. Fallback via the
 * second declaration for browsers that don't yet support `clip`.
 *
 * Component-level caps catch the specific offenders so the slider
 * arrows / info badges / banner images don't poke outside the
 * viewport even if some outer container ever reverts to visible.
 *
 * NOTE: this is a global CSS guard living in a plugin CSS file. If
 * a legit layout elsewhere in the shop depends on horizontal scroll
 * within <body>, remove the body rule and keep only the component
 * caps below.
 */
@media (max-width: 991.98px) {
  /* Component-level caps for the offenders (slider arrows / info badges /
     banner imgs that escape the viewport). No html/body width or
     max-width here on purpose: width:100vw includes the scrollbar gutter
     and was observed to add a few px of horizontal overflow rather than
     fix it. Theme owns body/html sizing. */
  .slide,
  .slide-image,
  .slide-link,
  .pp-card,
  .pp-card__info-badge,
  .kk-image-banner,
  .kk-reslider,
  .kk-reslider-items,
  .kk-product-pipeline-slider-item {
    max-width: 100%;
  }
  .kk-reslider-items {
    overflow: hidden;
  }
}
