/*!
 * Biwem Search Autocomplete — Frontend stylesheet
 * Version: 1.0.0
 * License: GPL v2 or later
 *
 * Provides styling for the autocomplete dropdown attached to the theme's
 * search box, plus the [wcsa_search_autocomplete] shortcode.
 */

/* ════════════════════════════════════════════════════════════════════════
   Autocomplete dropdown (attached to the theme search input)
   ════════════════════════════════════════════════════════════════════════ */

.wcsa-suggestions {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin: 0;
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
  list-style: none;
  font-family: inherit;
  font-size: 14px;
  color: #1f2937;
  box-sizing: border-box;
}

/* WebKit scrollbar styling — rounded thumb matching the Pro version */
.wcsa-suggestions::-webkit-scrollbar {
  width: 12px;
}
.wcsa-suggestions::-webkit-scrollbar-track {
  background: transparent;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}
.wcsa-suggestions::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.wcsa-suggestions li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  border-bottom: none;
  margin: 0;
  color: #1f2937;
}

.wcsa-suggestions li:last-child {
  border-bottom: none;
}

.wcsa-suggestions li:hover,
.wcsa-suggestions li.wcsa-selected {
  background: #f9fafb;
}

.wcsa-suggestions li .wcsa-thumb {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  background-color: #f3f4f6;
  display: block;
}

/* Fallback magnifying-glass icon — used when product has no thumbnail
   or when "Show thumbnails" is OFF. Matches the Pro version exactly:
   16×16px inline icon (no boxed background), painted via CSS mask so
   the color can be controlled by a single CSS rule. */
.wcsa-suggestions li .wcsa-icon-search {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
  flex-shrink: 0;
  background-color: #1f2937;
  /* Classic filled magnifier (Google/eBay style) — same SVG path
     used by the Pro version. */
  -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M10%202a8%208%200%201%200%205.293%2013.707l4.5%204.5a1%201%200%200%200%201.414-1.414l-4.5-4.5A8%208%200%200%200%2010%202zm0%202a6%206%200%201%201%200%2012A6%206%200%200%201%2010%204z%22%2F%3E%3C%2Fsvg%3E") no-repeat center center;
          mask: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M10%202a8%208%200%201%200%205.293%2013.707l4.5%204.5a1%201%200%200%200%201.414-1.414l-4.5-4.5A8%208%200%200%200%2010%202zm0%202a6%206%200%201%201%200%2012A6%206%200%200%201%2010%204z%22%2F%3E%3C%2Fsvg%3E") no-repeat center center;
  -webkit-mask-size: contain;
          mask-size: contain;
}

.wcsa-suggestions li .wcsa-icon-search svg {
  display: none;
}

.wcsa-suggestions li .wcsa-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bold-highlight portion (the "rest" after the user's typed prefix). */
.wcsa-suggestions li .wcsa-title strong {
  font-weight: 700;
  color: inherit;
}

/* ─── Price block ──────────────────────────────────────────────────────
   The server can return raw WooCommerce price HTML, which includes:
     - regular price:  <span class="woocommerce-Price-amount">€19.90</span>
     - on sale:        <del>€29.90</del><ins>€19.90</ins>
   We style all three states here. The price color follows the dedicated
   --wcsa-price-color CSS variable, which is set by the PHP layer based
   on whether the custom searchbar is enabled:
     - Custom searchbar ON  → --wcsa-price-color = --wcsa-cb-accent
     - Custom searchbar OFF → --wcsa-price-color = dropdown_price_color
                              option (so the price stays on-brand even
                              when the dropdown attaches to a theme
                              searchbar that has its own styling).
   The fallback to --wcsa-cb-accent keeps backward compatibility with
   older inline CSS that didn't yet emit --wcsa-price-color.
   ──────────────────────────────────────────────────────────────────── */
.wcsa-suggestions li .wcsa-price {
  display: inline-block;
  margin-left: auto;
  font-weight: 600;
  font-size: 13px;
  color: var(--wcsa-price-color, var(--wcsa-cb-accent, #8BC34A));
  white-space: nowrap;
  flex-shrink: 0;
}

/* Crossed-out previous price (when a product is on sale) */
.wcsa-suggestions li .wcsa-price del,
.wcsa-suggestions li .wcsa-price del .woocommerce-Price-amount {
  color: #9ca3af;
  font-weight: 400;
  text-decoration: line-through;
  margin-right: 6px;
}

/* New (discounted) sale price — uses the dedicated price color so the
   highlight stays consistent with the regular price above */
.wcsa-suggestions li .wcsa-price ins,
.wcsa-suggestions li .wcsa-price ins .woocommerce-Price-amount {
  text-decoration: none;
  color: var(--wcsa-price-color, var(--wcsa-cb-accent, #8BC34A));
  font-weight: 700;
}

/* Reset any inherited weirdness on the WooCommerce-rendered price span */
.wcsa-suggestions li .wcsa-price .woocommerce-Price-amount {
  font-style: normal !important;
  color: inherit;
}

/* "Da" / "From" prefix on variable-product price ranges */
.wcsa-suggestions li .wcsa-price .from {
  color: inherit;
  font-weight: 400;
  margin-right: 4px;
}

.wcsa-suggestions li .wcsa-no-result {
  color: #9ca3af;
  font-style: italic;
}

.wcsa-loading {
  padding: 14px;
  text-align: center;
  color: #9ca3af;
  font-style: italic;
}

/* ── Loading row with spinner (when loading indicator is ON) ── */

.wcsa-suggestions .wcsa-loading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #6b7280;
  opacity: 0.85;
}

.wcsa-suggestions .wcsa-loading-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: wcsa-spin 0.6s linear infinite;
  flex-shrink: 0;
}

.wcsa-suggestions .wcsa-loading-text {
  flex: 1;
  min-width: 0;
}

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

/* ════════════════════════════════════════════════════════════════════════
   Shortcode search bar [wcsa_search_autocomplete]
   ════════════════════════════════════════════════════════════════════════
   Mirrors the Pro version's styling exactly. The bar:
     - fills the FULL width of its parent column/container (width:100%,
       no max-width cap). The page builder (WPBakery, Elementor, Divi,
       Gutenberg) controls outer width and side margins, NOT this CSS.
     - applies all box styling (border, background, radius, shadow,
       padding) on the FORM itself — NOT on the input. The input has
       no border/outline/background of its own; it simply fills the
       internal space.
     - puts the lens icon inside the submit button on the right, with
       a subtle vertical divider (YouTube/Amazon pattern).
     - on :focus-within, the OUTER border changes color and a soft halo
       appears OUTSIDE the bar (no inner borders, no inner shadows).
   ════════════════════════════════════════════════════════════════════════ */

.wcsa-custom-bar {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  margin: 12px 0;
  position: relative;
  font-family: inherit;
  box-sizing: border-box;
  /* When the dropdown is open, raise the bar so it sits above any sticky
     header / overlay from the theme that would otherwise cover it. */
  z-index: 9998;
}
.wcsa-custom-bar * {
  box-sizing: border-box;
}

/* Force the suggestions dropdown to fill the FULL bar width (left edge
   to right edge), regardless of content width or any theme stylesheet
   override that targets `form ul` / `.search-form ul`. */
/* When the dropdown is anchored INSIDE the custom shortcode bar, anchor
   it to the bar's bottom edge with a tiny gap (2px) and force it to span
   the full bar width. The !important rules win against any theme reset
   that targets `form ul` / `.search-form ul` (Storefront, Woodmart, etc.). */
form.wcsa-custom-bar > ul.wcsa-suggestions,
.wcsa-custom-bar > .wcsa-suggestions {
  position: absolute !important;
  top: calc(100% + 2px) !important;
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Aggressive reset for input + submit button so no browser-native
   border, outline, focus ring, or box-shadow ever appears inside the bar.
   The bar is a SINGLE unified element with one outer border; the lens icon
   inside the submit button is the only chrome on the right. */
.wcsa-custom-bar .wcsa-cb-input,
.wcsa-custom-bar .wcsa-shortcode-input,
.wcsa-custom-bar .wcsa-cb-submit {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  font-family: inherit !important;
}
.wcsa-custom-bar .wcsa-cb-input:focus,
.wcsa-custom-bar .wcsa-cb-input:focus-visible,
.wcsa-custom-bar .wcsa-shortcode-input:focus,
.wcsa-custom-bar .wcsa-shortcode-input:focus-visible,
.wcsa-custom-bar .wcsa-cb-submit:focus,
.wcsa-custom-bar .wcsa-cb-submit:focus-visible,
.wcsa-custom-bar .wcsa-cb-submit:active {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.wcsa-custom-bar .wcsa-cb-input,
.wcsa-custom-bar .wcsa-shortcode-input {
  flex: 1 1 auto;
  font-size: 15px;
  color: #1a1a1a !important;
  min-width: 0;
}
.wcsa-custom-bar .wcsa-cb-input::placeholder,
.wcsa-custom-bar .wcsa-shortcode-input::placeholder {
  color: #999;
  opacity: 1;
}

/* Hide the native search input clear (X) button so it doesn't conflict
   with our submit button. */
.wcsa-custom-bar .wcsa-cb-input::-webkit-search-cancel-button,
.wcsa-custom-bar .wcsa-shortcode-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* The submit button is icon-only (no visible label). The text "Search"
   lives as screen-reader-text inside the button + aria-label, for a11y. */
.wcsa-custom-bar .wcsa-cb-submit {
  flex-shrink: 0;
  cursor: pointer;
  color: #6b7280 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease;
}
.wcsa-custom-bar .wcsa-cb-submit:hover {
  color: var(--wcsa-cb-accent, #8BC34A) !important;
}
.wcsa-custom-bar .wcsa-cb-submit:active {
  transform: translateY(1px);
}

/* The lens icon span sits inside the submit button. */
.wcsa-custom-bar .wcsa-cb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wcsa-custom-bar .wcsa-cb-icon svg {
  display: block;
}

/* ─── STYLE 1: Minimal ──────────────────────────────────────────────────
   Clean, thin border, no shadow, square corners. Lens icon inside the
   submit button on the right with a subtle vertical divider.
   ──────────────────────────────────────────────────────────────────── */
.wcsa-custom-bar.wcsa-style-minimal {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  padding: 0 0 0 14px;
  height: 42px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.wcsa-custom-bar.wcsa-style-minimal:focus-within {
  border-color: var(--wcsa-cb-accent, #8BC34A);
  box-shadow: 0 0 0 3px var(--wcsa-cb-halo, rgba(139, 195, 74, 0.22));
}
.wcsa-custom-bar.wcsa-style-minimal .wcsa-cb-input,
.wcsa-custom-bar.wcsa-style-minimal .wcsa-shortcode-input {
  height: 100%;
  padding: 0 8px;
}
.wcsa-custom-bar.wcsa-style-minimal .wcsa-cb-submit {
  height: 60%;
  padding: 0 14px;
  border-left: 1px solid #d1d5db !important;
}

/* ─── STYLE 2: Rounded ──────────────────────────────────────────────────
   Pill shape, light grey background. Focus highlight with the Biwem
   green halo (Google-like aesthetic).
   ──────────────────────────────────────────────────────────────────── */
.wcsa-custom-bar.wcsa-style-rounded {
  background: #f3f4f6;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0 0 0 22px;
  height: 48px;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.wcsa-custom-bar.wcsa-style-rounded:focus-within {
  background: #fff;
  border-color: var(--wcsa-cb-accent, #8BC34A);
  box-shadow: 0 0 0 4px var(--wcsa-cb-halo, rgba(139, 195, 74, 0.22));
}
.wcsa-custom-bar.wcsa-style-rounded .wcsa-cb-input,
.wcsa-custom-bar.wcsa-style-rounded .wcsa-shortcode-input {
  height: 100%;
  padding: 0 8px;
}
.wcsa-custom-bar.wcsa-style-rounded .wcsa-cb-submit {
  height: 60%;
  padding: 0 16px 0 14px;
  border-left: 1px solid #d1d5db !important;
}

/* ─── STYLE 3: Bold ─────────────────────────────────────────────────────
   Soft drop shadow, rounded corners. Focus halo in Biwem green
   (premium e-commerce aesthetic).
   ──────────────────────────────────────────────────────────────────── */
.wcsa-custom-bar.wcsa-style-bold {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 0 0 0 18px;
  height: 52px;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.wcsa-custom-bar.wcsa-style-bold:focus-within {
  border-color: var(--wcsa-cb-accent, #8BC34A);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 0 4px var(--wcsa-cb-halo, rgba(139, 195, 74, 0.22));
}
.wcsa-custom-bar.wcsa-style-bold .wcsa-cb-input,
.wcsa-custom-bar.wcsa-style-bold .wcsa-shortcode-input {
  height: 100%;
  padding: 0 8px;
  font-size: 16px;
  font-weight: 500;
}
.wcsa-custom-bar.wcsa-style-bold .wcsa-cb-submit {
  height: 60%;
  padding: 0 16px;
  border-left: 1px solid #e5e7eb !important;
}

/* Mobile responsiveness — slightly compact heights for the two taller styles */
@media (max-width: 480px) {
  .wcsa-custom-bar.wcsa-style-bold {
    height: 46px;
  }
  .wcsa-custom-bar.wcsa-style-rounded {
    height: 44px;
  }
}

/* Screen reader only text (used by labels and button text) */
.wcsa-custom-bar .screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  -webkit-clip-path: inset(50%);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* ════════════════════════════════════════════════════════════════════════
   Mobile focus mode (fullscreen search overlay)
   ════════════════════════════════════════════════════════════════════════
   When the user taps the search input on a mobile viewport (≤768px), the
   input expands to fill the screen so the on-screen keyboard doesn't
   crowd the layout. The JS adds:
     - .wcsa-focus-target.wcsa-fullscreen   on the wrapper that holds the input
     - body.wcsa-focus-active body.wcsa-focus-mobile   on the <body>

   The wrapper acts as a fixed-position overlay covering the viewport. The
   close (X) button sits in the top-right corner.
   ════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* When focus mode is active on mobile, prevent the underlying page from scrolling */
  body.wcsa-focus-active.wcsa-focus-mobile {
    overflow: hidden;
  }

  /* Same stacking-context lift for the rare no-Shadow-DOM fallback bar, whose
     light-DOM .wcsa-custom-bar also carries z-index:9998. (Theme search bars
     have no such z-index, so they already escape to the root correctly.) */
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-custom-bar {
    z-index: 2147483646 !important;
  }

  /* The wrapper around the input becomes a fixed fullscreen overlay */
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 2147483646;
    padding: 14px 56px 14px 14px;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    border: none;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  /* The overlay intentionally COVERS the WP admin bar for a true fullscreen
     experience; the very high z-index above keeps it over the admin bar and any
     sticky theme header. (Logged-out visitors have no admin bar at all.) */

  /* The search input inside the fullscreen wrapper expands to fill it */
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen input[type="search"],
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen input[name="s"],
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen input.s,
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen .wcsa-shortcode-input {
    width: 100% !important;
    max-width: 100% !important;
    height: 48px !important;
    font-size: 16px !important;
    /* 16px prevents iOS auto-zoom on focus */
    padding: 0 14px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    background: #fff !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    outline: none !important;
  }

  /* Close button (X) — fixed in the top-right corner of the overlay */
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen .wcsa-focus-close {
    position: absolute;
    top: 18px;
    right: 14px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
    transition: background 0.15s ease;
  }
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen .wcsa-focus-close:hover,
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-focus-target.wcsa-fullscreen .wcsa-focus-close:focus {
    background: #e5e7eb;
    outline: none;
  }

  /* Suggestion dropdown spans full width inside the overlay */
  body.wcsa-focus-active.wcsa-focus-mobile .wcsa-suggestions {
    position: fixed !important;
    top: 76px !important;
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    max-height: calc(100vh - 100px) !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    /* Must be ABOVE the fullscreen wrapper (z-index 99999) so it's
       visible inside the overlay. The wrapper covers the entire viewport
       so anything below 99999 would be hidden. */
    z-index: 2147483647 !important;
  }

  /* ── Shadow DOM bar: same fullscreen focus, keyed off the host class via
        :host(...), because the body.* ancestor selectors above cannot cross the
        shadow boundary. These rules take effect only inside the shadow root. ── */

  /* CRITICAL: the in-shadow search form (.wcsa-custom-bar) carries
     position:relative + z-index:9998, so it creates its OWN stacking context.
     The fullscreen overlay below sits INSIDE that form, so its huge z-index is
     clamped to the form's 9998 — which is BELOW the WP admin bar (99999). Lifting
     the form's context above the admin bar lets the overlay finally cover it. */
  :host(.wcsa-focus-host) .wcsa-custom-bar {
    z-index: 2147483646 !important;
  }
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 2147483646;
    padding: 14px 56px 14px 14px;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    border: none;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen input[type="search"],
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen input[name="s"],
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen .wcsa-cb-input {
    width: 100% !important;
    max-width: 100% !important;
    height: 48px !important;
    font-size: 16px !important;
    padding: 0 14px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    background: #fff !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    outline: none !important;
  }
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen .wcsa-focus-close {
    position: absolute;
    top: 18px;
    right: 14px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
    transition: background 0.15s ease;
  }
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen .wcsa-focus-close:hover,
  :host(.wcsa-focus-host) .wcsa-focus-target.wcsa-fullscreen .wcsa-focus-close:focus {
    background: #e5e7eb;
    outline: none;
  }
  :host(.wcsa-focus-host) .wcsa-suggestions {
    position: fixed !important;
    top: 76px !important;
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    max-height: calc(100vh - 100px) !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    z-index: 2147483647 !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   v1.0.0_Fix40 — Out-of-stock badge
   ════════════════════════════════════════════════════════════════════════
   Small pill next to the product title in the dropdown when the
   product is currently out of stock. Colors come from CSS variables
   set by the admin in Display Options (background + text), so the
   badge stays on-brand without rebuilding the plugin.

   The badge sits inline next to the title and shrinks gracefully on
   small dropdowns — title text gets ellipsis before the badge does.
   ════════════════════════════════════════════════════════════════════════ */
.wcsa-suggestions li .wcsa-oos-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--wcsa-oos-bg, #fef2f2);
  color: var(--wcsa-oos-text, #991b1b);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  vertical-align: middle;
  flex-shrink: 0;
}

/* =====================================================================
   v1.0.6 — "Most searched terms" (I Termini più ricercati)
   Block pinned at the top of the dropdown: small title + clickable
   buttons. It's a <div> inside the suggestions <ul>, so we reset the
   inherited "li" look and give it a minimal chip style.

   Colors / radius / text size come from the CSS variables generated
   server-side from the settings; the fallbacks below are the stock
   look, so an install that never customizes anything is unaffected.
   The padding is in "em" on purpose: the button grows or shrinks by
   itself with the text size — no separate size control needed.
   ===================================================================== */
.wcsa-suggestions .wcsa-popular-terms {
  list-style: none;
  padding: 10px 12px 8px;
  margin: 0;
  background: #fff;
  border-bottom: 1px solid #eee;
  cursor: default;
  text-transform: none;
}
.wcsa-suggestions .wcsa-pop-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #6b7280;
  margin: 0 0 7px;
  text-transform: none;
}
.wcsa-suggestions .wcsa-pop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wcsa-suggestions .wcsa-pop-chip {
  display: inline-block;
  font: inherit;
  font-size: var(--wcsa-pop-font, 13px);
  line-height: 1.2;
  text-transform: none;
  color: #4b5563;
  background: var(--wcsa-pop-bg, #f3f6ee);
  border: 1px solid var(--wcsa-pop-border, #d7e3c4);
  border-radius: var(--wcsa-pop-radius, 999px);
  padding: .38em .92em;
  margin: 0;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  -webkit-appearance: none;
  appearance: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wcsa-suggestions .wcsa-pop-chip:hover,
.wcsa-suggestions .wcsa-pop-chip:focus {
  background: var(--wcsa-pop-bg-hover, #8BC34A);
  border-color: var(--wcsa-pop-border-hover, #8BC34A);
  color: #fff;
  outline: none;
}
