/* Alpha Search: powered by Typesense. Isolated .aps-* / #aps-results styling only.
 * Header placement, Elementor/widget sizing, menus and body scroll locking
 * remain the responsibility of the existing header and integration script.
 * Runtime may set --aps-header-offset, --aps-viewport-height,
 * --aps-visible-height and/or --aps-panel-bottom on the panel or an ancestor.
 */

.aps-header-search,
.aps-header-form,
.aps-results {
  font-family: inherit;
  color: #fff;
  box-sizing: border-box;
}

.aps-header-search {
  width: 100%;
  min-width: 0;
}

.aps-header-form *,
.aps-header-form *::before,
.aps-header-form *::after,
#aps-results *,
#aps-results *::before,
#aps-results *::after {
  box-sizing: border-box;
}

.aps-header-form {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  margin: 0;
  padding: 0;
  background: #1b1b1b !important;
  border: 1px solid #505050;
  border-radius: 4px;
  box-shadow: none;
}

.aps-header-form:focus-within {
  border-color: #c62828;
  outline: 2px solid #c62828;
  outline-offset: 2px;
}

.aps-input-wrap,
.aps-input-wrapper {
  display: flex;
  align-items: center;
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 44px;
}

.aps-header-form :is(.aps-input, .aps-search-input, .aps-header-input) {
  display: block;
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  max-width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 10px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #fff !important;
  caret-color: #fff;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}

.aps-header-form :is(.aps-input, .aps-search-input, .aps-header-input)::placeholder {
  color: #bbb;
  opacity: 1;
}

/* The labelled custom clear button replaces Safari's native search cancel. */
.aps-header-form :is(.aps-input, .aps-search-input, .aps-header-input)::-webkit-search-cancel-button,
.aps-header-form :is(.aps-input, .aps-search-input, .aps-header-input)::-webkit-search-decoration {
  display: none;
  appearance: none;
  -webkit-appearance: none;
}

.aps-header-form :is(.aps-submit, .aps-search-submit, .aps-clear, .aps-search-clear) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff !important;
  font: inherit;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
}

.aps-header-form :is(.aps-submit, .aps-search-submit) {
  order: -1;
  background: #c62828 !important;
  border-radius: 3px 0 0 3px;
}

.aps-header-form :is(.aps-clear, .aps-search-clear) {
  border-radius: 0 3px 3px 0;
}

.aps-header-form :is(.aps-submit, .aps-search-submit, .aps-clear, .aps-search-clear) svg {
  display: block;
  width: 20px;
  height: 20px;
  color: #fff;
  fill: none;
  flex-shrink: 0;
}

.aps-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.aps-header-form[hidden],
.aps-header-form [hidden],
.aps-header-search[hidden],
.aps-results[hidden],
#aps-results[hidden],
#aps-results [hidden] {
  display: none !important;
}

#aps-results,
.aps-results {
  position: fixed;
  top: var(--aps-header-offset, 140px);
  right: 0;
  bottom: var(--aps-panel-bottom, 0px);
  left: 0;
  z-index: 9000;
  width: 100%;
  max-height: calc(var(--aps-visible-height, var(--aps-viewport-height, 100vh)) - var(--aps-header-offset, 140px));
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #0a0a0a;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: dark;
  isolation: isolate;
}

@supports (height: 100dvh) {
  #aps-results,
  .aps-results {
    max-height: calc(var(--aps-visible-height, var(--aps-viewport-height, 100dvh)) - var(--aps-header-offset, 140px));
  }
}

.aps-shell {
  width: 100%;
  max-width: 1320px;
  min-width: 0;
  margin: 0 auto;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.aps-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 0 0 24px;
  padding: 0 0 16px;
  border-bottom: 1px solid #333;
}

.aps-toolbar-heading,
.aps-heading-wrap {
  flex: 1 1 240px;
  min-width: 0;
}

.aps-heading,
.aps-results-heading,
.aps-query {
  margin: 0;
  color: #fff;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.aps-result-count,
.aps-count,
.aps-toolbar-count {
  margin: 4px 0 0;
  color: #bbb;
  font-size: 14px;
  line-height: 1.5;
}

.aps-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  min-width: 0;
}

.aps-filters {
  min-width: 0;
  padding: 16px;
  background: #111;
  border: 1px solid #333;
  border-radius: 4px;
  color: #fff;
}

.aps-filters-heading,
.aps-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 16px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.aps-facet {
  margin: 0 0 20px;
  padding: 0 0 20px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid #333;
}

.aps-facet:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.aps-facet-heading {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.aps-facet-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.aps-facet-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 6px 4px;
  border-radius: 3px;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.aps-facet-option input[type="checkbox"],
.aps-facet-option input[type="radio"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #c62828;
  cursor: pointer;
}

.aps-facet-label {
  flex: 1 1 auto;
  min-width: 0;
}

.aps-facet-count {
  margin-left: auto;
  color: #bbb;
  font-size: 13px;
  white-space: nowrap;
}

.aps-facet-empty,
.aps-filter-help {
  margin: 8px 0;
  color: #bbb;
  font-size: 14px;
}

.aps-price-range,
.aps-price-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.aps-price-label,
.aps-price-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: #bbb;
  font-size: 14px;
}

.aps-price-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 9px 10px;
  background: #1b1b1b !important;
  color: #fff !important;
  border: 1px solid #505050;
  border-radius: 4px;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  box-shadow: none;
}

.aps-price-input::placeholder {
  color: #bbb;
  opacity: 1;
}

.aps-main {
  min-width: 0;
}

.aps-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  margin: 0 0 16px;
}

.aps-sort-wrap,
.aps-sort-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  color: #bbb;
  font-size: 14px;
}

.aps-sort {
  width: auto;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 9px 32px 9px 12px;
  border: 1px solid #505050;
  border-radius: 4px;
  background-color: #1b1b1b !important;
  color: #fff !important;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  color-scheme: dark;
  box-shadow: none;
  cursor: pointer;
}

.aps-sort option {
  background: #1b1b1b;
  color: #fff;
}

.aps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.aps-product-card {
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #333;
  border-radius: 4px;
  background: #111;
  color: #fff;
}

.aps-product-card:focus-within {
  border-color: #c62828;
  outline: 2px solid #c62828;
  outline-offset: 2px;
}

.aps-product-link {
  display: block;
  height: 100%;
  min-width: 0;
  padding: 0 0 16px;
  color: #fff !important;
  text-decoration: none !important;
}

.aps-product-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 200px;
  margin: 0 0 14px;
  padding: 10px;
  object-fit: contain;
  object-position: center;
  background: #fff;
  border: 0;
  border-radius: 0;
}

/* Also support an image wrapper rather than an img carrying the class. */
.aps-product-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center;
}

.aps-product-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  min-height: 4.2em;
  margin: 0 14px 10px;
  padding: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.aps-product-price {
  display: block;
  margin: 0 14px 6px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.aps-product-price del {
  color: #bbb;
  font-size: 14px;
  font-weight: 400;
}

.aps-product-price ins {
  color: #fff;
  background: transparent;
  text-decoration: none;
}

.aps-product-meta,
.aps-product-rating,
.aps-star-text {
  margin: 0 14px;
  color: #bbb;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.aps-product-meta + .aps-product-meta {
  margin-top: 4px;
}

.aps-button,
.aps-close,
.aps-close-button,
.aps-filters-toggle,
.aps-mobile-filters,
.aps-filters-close,
.aps-price-apply,
.aps-apply,
.aps-reset,
.aps-clear-filters,
.aps-retry,
.aps-pagination button,
.aps-pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #1b1b1b;
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none !important;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
}

.aps-price-apply,
.aps-apply,
.aps-retry,
.aps-button-primary {
  background: #c62828;
  border-color: #c62828;
  color: #fff;
}

.aps-price-apply,
.aps-apply {
  width: 100%;
}

.aps-close,
.aps-close-button,
.aps-filters-close {
  flex-shrink: 0;
}

.aps-close svg,
.aps-close-button svg,
.aps-filters-close svg,
.aps-filters-toggle svg,
.aps-mobile-filters svg {
  width: 20px;
  height: 20px;
  color: #fff;
  fill: currentColor;
  flex-shrink: 0;
}

.aps-filters-toggle,
.aps-mobile-filters,
.aps-filters-close,
.aps-filters-backdrop {
  display: none;
}

.aps-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.aps-pagination [aria-current="page"],
.aps-pagination .aps-page-current,
.aps-pagination .aps-active {
  background: #c62828;
  border-color: #c62828;
  color: #fff;
}

.aps-pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 44px;
  color: #bbb;
}

.aps-status,
.aps-loading,
.aps-error,
.aps-empty {
  margin: 0 0 16px;
  padding: 24px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #111;
  color: #fff;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.aps-status:empty {
  display: none;
}

.aps-status-heading,
.aps-error-heading,
.aps-empty-heading {
  margin: 0 0 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.aps-status-message,
.aps-error-message,
.aps-empty-message,
.aps-loading-message {
  margin: 0 0 12px;
  color: #bbb;
}

.aps-error {
  border-left: 3px solid #c62828;
}

.aps-loading-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: #c62828;
  vertical-align: middle;
}

.aps-header-form :is(.aps-submit, .aps-search-submit, .aps-clear, .aps-search-clear):focus-visible,
#aps-results :is(button, a, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid #c62828;
  outline-offset: 3px;
}

.aps-facet-option:focus-within {
  outline: 2px solid #c62828;
  outline-offset: 2px;
}

.aps-header-form :is(button, input):disabled,
#aps-results :is(button, input, select):disabled,
#aps-results [aria-disabled="true"] {
  opacity: 0.65;
  cursor: not-allowed;
}

.aps-header-form[aria-busy="true"],
.aps-main[aria-busy="true"] {
  cursor: progress;
}

@media (hover: hover) {
  .aps-product-card:hover {
    border-color: #c62828;
  }

  .aps-header-form :is(.aps-submit, .aps-search-submit):hover:not(:disabled) {
    background: #a91f1f !important;
  }

  .aps-header-form :is(.aps-clear, .aps-search-clear):hover:not(:disabled) {
    background: #333;
  }

  #aps-results :is(.aps-button, .aps-close, .aps-close-button, .aps-filters-toggle, .aps-mobile-filters, .aps-filters-close, .aps-reset, .aps-clear-filters):hover:not(:disabled):not([aria-disabled="true"]),
  .aps-pagination :is(button, a):hover:not(:disabled):not([aria-disabled="true"]) {
    border-color: #c62828;
    background: #292020;
  }

  #aps-results :is(.aps-price-apply, .aps-apply, .aps-retry, .aps-button-primary):hover:not(:disabled) {
    background: #a91f1f;
    border-color: #a91f1f;
  }

  .aps-facet-option:hover {
    background: #1b1b1b;
  }
}

@media (max-width: 1100px) {
  .aps-layout {
    gap: 20px;
  }

  .aps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 767px) {
  .aps-shell {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .aps-toolbar {
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .aps-toolbar-heading,
  .aps-heading-wrap {
    flex-basis: 180px;
  }

  .aps-heading,
  .aps-results-heading,
  .aps-query {
    font-size: 20px;
  }

  .aps-layout {
    display: block;
  }

  .aps-filters-toggle,
  .aps-mobile-filters {
    display: inline-flex;
  }

  .aps-filters {
    display: none;
    position: fixed;
    top: var(--aps-header-offset, 140px);
    bottom: var(--aps-panel-bottom, 0px);
    left: 0;
    z-index: 9003;
    width: min(340px, 90vw);
    max-width: 90vw;
    max-height: calc(var(--aps-visible-height, var(--aps-viewport-height, 100vh)) - var(--aps-header-offset, 140px));
    margin: 0;
    padding: 16px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    background: #111;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.5);
  }

  .aps-filters-close {
    display: inline-flex;
    margin-left: auto;
  }

  .aps-filters-backdrop {
    position: fixed;
    top: var(--aps-header-offset, 140px);
    right: 0;
    bottom: var(--aps-panel-bottom, 0px);
    left: 0;
    z-index: 9002;
    width: 100%;
    max-height: calc(var(--aps-visible-height, var(--aps-viewport-height, 100vh)) - var(--aps-header-offset, 140px));
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.75);
  }

  #aps-results.aps-filters-open .aps-filters,
  .aps-results.aps-filters-open .aps-filters,
  #aps-results.aps-filters-open .aps-filters-backdrop,
  .aps-results.aps-filters-open .aps-filters-backdrop {
    display: block;
  }

  .aps-controls {
    gap: 10px;
    margin-bottom: 12px;
  }

  .aps-sort-wrap,
  .aps-sort-label {
    max-width: 100%;
  }

  .aps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .aps-product-image {
    height: 140px;
    margin-bottom: 10px;
    padding: 8px;
  }

  .aps-product-link {
    padding-bottom: 12px;
  }

  .aps-product-title {
    margin: 0 10px 8px;
    font-size: 14px;
    line-height: 1.4;
  }

  .aps-product-price {
    margin: 0 10px 6px;
    font-size: 16px;
  }

  .aps-product-meta,
  .aps-product-rating,
  .aps-star-text {
    margin-right: 10px;
    margin-left: 10px;
    font-size: 12px;
  }

  .aps-status,
  .aps-loading,
  .aps-error,
  .aps-empty {
    padding: 18px;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 767px) {
    .aps-filters,
    .aps-filters-backdrop {
      max-height: calc(var(--aps-visible-height, var(--aps-viewport-height, 100dvh)) - var(--aps-header-offset, 140px));
    }
  }
}

@media (max-width: 359px) {
  .aps-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .aps-sort-wrap,
  .aps-sort-label,
  .aps-sort {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aps-header-form *,
  #aps-results * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Confirmed PHP/JS interface names. These aliases intentionally stay scoped. */
.aps-panel-inner {
  width: 100%;
  max-width: 1320px;
  min-width: 0;
  margin: 0 auto;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.aps-header-form #aps-product-query {
  display: block;
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  max-width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 10px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #fff !important;
  caret-color: #fff;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}

.aps-header-form #aps-product-query::placeholder {
  color: #bbb;
  opacity: 1;
}

.aps-header-form #aps-product-query::-webkit-search-cancel-button,
.aps-header-form #aps-product-query::-webkit-search-decoration {
  display: none;
  -webkit-appearance: none;
}

.aps-query-label {
  margin: 4px 0 0;
  color: #bbb;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.aps-toolbar > .aps-heading {
  flex: 1 1 220px;
  min-width: 0;
}

.aps-results-content {
  min-width: 0;
}

.aps-results-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  margin: 0 0 16px;
}

.aps-filters-title {
  margin: 0 0 16px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.aps-facet-options,
.aps-rating-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.aps-facet-note {
  margin: 8px 0;
  color: #bbb;
  font-size: 13px;
  line-height: 1.5;
}

.aps-facet-search,
.aps-price-min,
.aps-price-max {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #1b1b1b !important;
  color: #fff !important;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  box-shadow: none;
}

.aps-facet-search {
  margin-bottom: 10px;
}

.aps-facet-search::placeholder,
.aps-price-min::placeholder,
.aps-price-max::placeholder {
  color: #bbb;
  opacity: 1;
}

.aps-price-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: #bbb;
  font-size: 14px;
}

.aps-filter-toggle,
.aps-filter-close,
.aps-apply-price,
.aps-clear-price,
.aps-reset-filters,
.aps-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #1b1b1b;
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
}

.aps-filter-toggle,
.aps-filter-close {
  display: none;
  flex-shrink: 0;
}

.aps-filter-toggle svg,
.aps-filter-close svg {
  width: 20px;
  height: 20px;
  color: #fff;
  fill: currentColor;
}

.aps-apply-price {
  background: #c62828;
  border-color: #c62828;
}

.aps-apply-price,
.aps-clear-price,
.aps-reset-filters {
  width: 100%;
  margin-top: 8px;
}

.aps-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.aps-active-filters:empty {
  display: none;
}

.aps-filter-chip {
  justify-content: space-between;
  border-color: #c62828;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.aps-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 200px;
  margin-bottom: 14px;
  padding: 16px;
  background: #fff;
  color: #444;
  font-size: 14px;
  text-align: center;
}

.aps-pagination .aps-current-page {
  background: #c62828;
  border-color: #c62828;
  color: #fff;
}

.aps-page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 44px;
  color: #bbb;
}

.aps-pagination-summary {
  flex-basis: 100%;
  margin-top: 8px;
  color: #bbb;
  font-size: 14px;
  text-align: center;
}

.aps-results.aps-is-loading,
#aps-results.aps-is-loading {
  cursor: progress;
}

@media (hover: hover) {
  #aps-results :is(.aps-filter-toggle, .aps-filter-close, .aps-clear-price, .aps-reset-filters, .aps-filter-chip):hover:not(:disabled) {
    border-color: #c62828;
    background: #292020;
  }

  .aps-apply-price:hover:not(:disabled) {
    background: #a91f1f;
    border-color: #a91f1f;
  }
}

@media (max-width: 767px) {
  .aps-panel-inner {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .aps-toolbar > .aps-heading {
    flex-basis: 180px;
  }

  .aps-filter-toggle,
  .aps-filter-close {
    display: inline-flex;
  }

  .aps-filter-close {
    margin: 0 0 16px auto;
  }

  .aps-filters.is-open {
    display: block;
  }

  .aps-results-topbar {
    gap: 10px;
    margin-bottom: 12px;
  }

  .aps-image-placeholder {
    height: 140px;
    margin-bottom: 10px;
  }
}

/* Native WooCommerce result-card actions and verified inventory-source badges. */
.aps-product-card {
  display: flex;
  flex-direction: column;
}

.aps-product-card .aps-product-link {
  flex: 1 1 auto;
  height: auto;
}

.aps-product-actions {
  /* Woo inserts .added_to_cart immediately after the native action anchor.
     Reserve its touch-sized row on every card, including before addition. */
  display: grid;
  grid-template-rows: minmax(64px, auto) 44px;
  row-gap: 4px;
  flex: 0 0 auto;
  margin: 0 14px 14px;
}

.aps-product-card .aps-product-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 28px);
  min-height: 44px;
  margin: 0 14px 14px;
  padding: 10px 12px;
  border: 1px solid #c62828;
  border-radius: 4px;
  background: #c62828 !important;
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none !important;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  box-sizing: border-box;
  cursor: pointer;
}

.aps-product-actions .aps-product-action {
  width: 100%;
  /* Native Select options can wrap on a 390px two-column grid. */
  min-height: 64px;
  margin: 0;
}

.aps-product-card .aps-product-action:hover,
.aps-product-card .aps-product-action:focus-visible {
  border-color: #e04444;
  background: #a51f1f !important;
  outline: 2px solid #c62828;
  outline-offset: 2px;
}

.aps-product-card .aps-product-action.loading {
  opacity: 0.7;
}

.aps-product-card a.added_to_cart {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-row: 2;
  min-height: 44px;
  margin: 0;
  padding: 6px 8px;
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  text-decoration: underline;
  text-transform: none;
  touch-action: manipulation;
}

#aps-results .aps-product-title,
#aps-results .aps-product-meta,
#aps-results .aps-product-rating {
  /* Do not force uppercase or title-case brand/model names and acronyms. */
  text-transform: none;
  letter-spacing: normal;
  font-family: inherit;
}

.aps-product-card .aps-availability-badge {
  display: inline-block;
  align-self: flex-start;
  width: fit-content;
  max-width: calc(100% - 28px);
  margin: 0 14px 10px;
  padding: 4px 8px;
  border: 1px solid #505050;
  border-radius: 3px;
  background: #252525;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.aps-product-card .aps-availability-in-store {
  border-color: #c62828;
}
