/* ==========================================================================
   WK Search - Woodmart Sticky Loader Fix
   The Woodmart sticky loader in AJAX-injected content shows a "(" character
   when its CSS isn't loaded. We hide it by default since we don't need it.
   ========================================================================== */
.wk-search__results .wd-sticky-loader {
  display: none !important;
}

/* ==========================================================================
   WK Search — results heading & landing with ?q=
   ========================================================================== */
.wk-search-results-heading {
  margin: 0 0 18px;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.25;
}

.wk-search--hide-query-input .wk-search-primary-query {
  display: none !important;
}

/* Screen-reader / layout-off query field when [wk_search_config show_query="0"]. */
.wk-search-query-input--concealed {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   WK Search - Layout
   ========================================================================== */

/*
 * Stretch to full content width: parent flex/grid with align-items/justify-items start
 * (common in Elementor) otherwise shrink-wraps this block to intrinsic width → everything
 * hugging the left. Same symptom when PJAX/ajax-shop swaps omit the stretched context.
 */
.wk-search[data-component="wk-search"],
.elementor-shortcode > .wk-search[data-component="wk-search"],
.elementor-widget-shortcode .wk-search[data-component="wk-search"] {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.wk-search [data-wk-search-results],
.wk-search .woocommerce[data-wk-search-results] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  float: none;
  clear: both;
}

.wk-search .wk-search-mixed-results,
.wk-search .wk-search-content-results,
.wk-search .wk-search-mixed-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.wk-search__layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.wk-search__facets {
  width: 260px;
  flex: 0 0 260px;
}

.wk-search__results {
  flex: 1 1 auto;
  min-width: 0;
}

.wk-search--no-facets .wk-search__layout {
  gap: 0;
}

.wk-search--no-facets .wk-search__facets {
  display: none !important;
}

.wk-search--no-facets .wk-search__results {
  flex: 1 1 100%;
  width: 100%;
}

.wk-search [data-wk-search-form] {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wk-search [data-wk-search-mode] {
  min-width: 130px;
}

.wk-search [data-wk-search-scope] {
  display: none;
}

.wk-search-scope-tabs {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin: 28px 0 18px;
  border-bottom: 1px solid #d8d8d8;
}

.wk-search-scope-tab {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 12px 10px;
  color: #a5a5a5;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 10px 10px 0 0;
  font: inherit;
  font-size: 28px;
  line-height: 1.1;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.wk-search-scope-tab:hover,
.wk-search-scope-tab.is-active {
  color: #111;
}

.wk-search-scope-tab.is-active {
  color: #fff;
  border-bottom-color: var(--wd-primary-color, #7ab38b);
  background: var(--wd-primary-color, #7ab38b);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}

.wk-search-scope-tab__count {
  display: inline-block;
  margin-left: 6px;
  font-size: 18px;
  color: #7d7d7d;
}

.wk-search-scope-tab.is-active .wk-search-scope-tab__count {
  color: rgba(255,255,255,.86);
}

.wk-search-image-row {
  margin-top: 10px;
}

.wk-search-image-row input {
  width: 100%;
}

/* ==========================================================================
   WK Search - Facet Sidebar
   ========================================================================== */
.wk-search-facets-container {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}

/* Individual Facet Group */
.wk-search-facet {
  border-bottom: 1px solid #e8e8e8;
}

.wk-search-facet:last-child {
  border-bottom: none;
}

/* Facet Title (Accordion Header) */
.wk-search-facet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  background: #fafafa;
  transition: background 0.2s ease;
  user-select: none;
}

.wk-search-facet-title:hover {
  background: #f0f0f0;
}

/* Arrow indicator */
.wk-search-facet-title::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  margin-left: 10px;
}

.wk-search-facet.wd-opened .wk-search-facet-title::after {
  transform: rotate(-135deg);
}

/* Facet Dropdown (Collapsible Content) */
.wk-search-facet .wd-pf-dropdown {
  display: none;
  padding: 0;
  background: #fff;
}

.wk-search-facet.wd-opened .wd-pf-dropdown {
  display: block;
}

/* Facet Items List */
.wk-search-facet-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 280px;
  overflow-y: auto;
}

.wk-search-facet-list li {
  margin: 0;
  padding: 0;
}

/* Facet Item Label */
.wk-search-facet-list label {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.wk-search-facet-list label:hover {
  background: #f5f5f5;
  color: #222;
}

/* Checkbox Styling */
.wk-search-facet-list input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-radius: 3px;
  margin-right: 10px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.wk-search-facet-list input[type="checkbox"]:hover {
  border-color: #999;
}

.wk-search-facet-list input[type="checkbox"]:checked {
  background: #333;
  border-color: #333;
}

.wk-search-facet-list input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Value Text */
.wk-search-facet-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Count Badge */
.wk-search-facet-count {
  margin-left: 6px;
  font-size: 11px;
  color: #999;
  flex-shrink: 0;
}

/* ==========================================================================
   WK Search - Active Filters (Chips)
   ========================================================================== */
.wk-search-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.wk-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wk-search-chip:hover {
  background: #eee;
  border-color: #ccc;
}

.wk-search-chip::after {
  content: '×';
  font-size: 14px;
  font-weight: 400;
  color: #888;
  line-height: 1;
}

.wk-search-chip:hover::after {
  color: #333;
}

.wk-search-variant-summary {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.wk-search-variant-summary__group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fff;
}

.wk-search-variant-summary__label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.wk-search-variant-summary__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 999px;
  color: #333;
  font-size: 12px;
  text-decoration: none;
}

.wk-search-variant-summary__item img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

/* ==========================================================================
   WK Search - Clear Filters Button
   ========================================================================== */
.wk-search-clear-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wk-search-clear-btn:hover {
  background: #f5f5f5;
  color: #333;
  border-color: #ccc;
}

.wk-search-clear-btn[hidden] {
  display: none;
}

/* ==========================================================================
   WK Search - Result Count Bar
   ========================================================================== */
.wk-search-result-count {
  margin: 0 0 28px;
  padding: 0;
  color: #111;
  border-bottom: 0;
  font-size: 20px;
  line-height: 1.35;
}

.wk-search-result-count[hidden] {
  display: none;
}

.wk-search-result-count [data-wk-search-count] {
  font-weight: 600;
  color: #333;
}

/* ==========================================================================
   WK Search - Loading bar (thin progress strip while fetching)
   ========================================================================== */
.wk-search-loading-bar {
  position: relative;
  width: 100%;
  height: 4px;
  margin: 0 0 14px;
  background: #efefef;
  border-radius: 999px;
  overflow: hidden;
}

.wk-search-loading-bar[hidden] {
  display: none;
}

.wk-search-loading-bar__indicator {
  position: absolute;
  left: -35%;
  top: 0;
  width: 35%;
  height: 100%;
  background: var(--color-gray-900, #222);
  border-radius: inherit;
}

.wk-search-loading-bar.is-active .wk-search-loading-bar__indicator {
  animation: wk-loading-bar-slide 1.1s ease-in-out infinite;
}

@keyframes wk-loading-bar-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}

/* ==========================================================================
   WK Search - Loading (Woodmart .wd-loader — animation via :after + --wd-anim-state)
   ========================================================================== */
.wk-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--color-gray-300, #888);
}

.wk-search-loading[hidden] {
  display: none;
}

.wk-search-loading:not([hidden]) .wd-loader {
  --wd-anim-state: running;
}

.wk-search-load-more:not([hidden]) .wd-loader {
  --wd-anim-state: running;
}

.wk-search-loading .wd-loader:after,
.wk-search-load-more .wd-loader:after {
  vertical-align: middle;
}

/* ==========================================================================
   WK Search - Admin Debug Panel
   ========================================================================== */
.wk-search-debug {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #e5c97f;
  border-radius: 8px;
  background: #fff9e8;
}

.wk-search-debug__header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 8px 0 10px;
  font-size: 12px;
  color: #4d432b;
}

.wk-search-debug__header strong {
  font-size: 13px;
  color: #332b17;
}

.wk-search-debug__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #332b17;
}

.wk-search-debug__summary::-webkit-details-marker {
  display: none;
}

.wk-search-debug__hint {
  font-size: 11px;
  color: #7c6e49;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.wk-search-debug__details[open] .wk-search-debug__hint {
  visibility: hidden;
}

.wk-search-debug__table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

.wk-search-debug__table-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #4d432b;
}

.wk-search-debug__table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #fff;
}

.wk-search-debug__table th,
.wk-search-debug__table td {
  padding: 6px 8px;
  border: 1px solid #f0e6c8;
  text-align: left;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.wk-search-debug__table th {
  background: #fff5d6;
  color: #584a28;
  font-weight: 600;
}

.wk-search-debug__raw-title {
  margin: 10px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #4d432b;
}

.wk-search-debug__raw {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #f0e6c8;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  line-height: 1.4;
}

/* ==========================================================================
   WK Search - Responsive
   ========================================================================== */
@media (max-width: 991px) {
  .wk-search__layout {
    flex-direction: column;
    gap: 20px;
  }

  .wk-search__facets {
    width: 100%;
    flex: 0 0 auto;
    order: -1;
  }

  /* Collapse all facets on mobile by default */
  .wk-search-facet:not(.wd-opened) .wd-pf-dropdown {
    display: none;
  }

  .wk-search-facet-list {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .wk-search-facet-title {
    padding: 12px 14px;
    font-size: 13px;
  }

  .wk-search-facet-list label {
    padding: 7px 14px;
    font-size: 12px;
  }

  .wk-search-facet-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  .wk-search-chip {
    padding: 5px 10px;
    font-size: 11px;
  }
}


/* ==========================================================================
   WK Search - Infinite scroll load-more spinner
   ========================================================================== */
.wk-search-load-more {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0 8px;
  min-height: 60px; /* keep sentinel tall enough for IntersectionObserver */
}

.wk-search-load-more[hidden] {
  display: none;
}

/* ==========================================================================
   WK Search - Scrollbar Styling (for facet lists)
   ========================================================================== */
.wk-search-facet-list::-webkit-scrollbar {
  width: 6px;
}

.wk-search-facet-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.wk-search-facet-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.wk-search-facet-list::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* ==========================================================================
   WK Search - Content and mixed results
   ========================================================================== */
.wk-search-mixed-results {
  display: grid;
  gap: 28px;
}

.wk-search-mixed-title {
  margin: 0 0 16px;
  font-size: 20px;
}

.wk-search-content-results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.wk-search-content-card {
  min-width: 0;
  position: relative;
  background: #f7f7f7;
  border: 1px solid #ececec;
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.wk-search-content-card:hover {
  transform: translateY(-2px);
  background: #f2f2f2;
  border-color: #e0e0e0;
}

.wk-search-content-card__link {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px;
  color: inherit;
  text-decoration: none;
}

.wk-search-result-has-delete {
  position: relative;
}

.wk-search-delete-doc {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  padding: 4px 8px;
  border: 1px solid #d44;
  border-radius: 4px;
  background: rgba(255,255,255,.95);
  color: #a40000;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
}

.wk-search-delete-doc:hover {
  background: #ffeaea;
}

.wk-search-delete-doc.is-loading,
.wk-search-delete-doc:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.wk-search-content-card__type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-bottom: 8px;
  padding: 4px 10px;
  color: #333;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
}

.wk-search-content-card__title {
  margin: 0;
  color: #111;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.26;
}

.wk-search-content-card__excerpt {
  margin: 10px 0 0;
  color: #5b5b5b;
  font-size: 15px;
  line-height: 1.5;
}

.wk-search-content-card__media {
  display: block;
  align-self: stretch;
}

.wk-search-content-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 110px;
  max-height: 130px;
  border-radius: 8px;
  object-fit: cover;
}

.wk-search-content-card__body {
  min-width: 0;
}

.wk-search-content-card mark {
  padding: 0 .12em;
  background: #fff2ab;
  color: #111;
  border-radius: 2px;
}

.wk-search-content-card--no-image .wk-search-content-card__link {
  grid-template-columns: 1fr;
}

.wk-search--content-scope .wk-search__layout {
  gap: 0;
}

.wk-search--content-scope .wk-search__facets {
  display: none !important;
}

/* Variation / needle info under title (WK Search product grid from Typesense) */
.wk-search__results .wk-search-loop-variant-name {
  display: block;
  margin-top: 0.28em;
  font-size: 0.88em;
  line-height: 1.3;
  font-weight: 500;
  color: color-mix(in srgb, var(--color-gray-700, #555) 88%, #000);
}

@media (max-width: 575px) {
  .wk-search-scope-tab {
    font-size: 22px;
  }

  .wk-search-content-card__link {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .wk-search-content-card__media img {
    max-height: 180px;
  }

  .wk-search-content-card__title {
    font-size: 19px;
  }
}
