/**
 * @file
 * Typesense V2 Catalog styles.
 */

/* Box sizing for all elements */
.typesense-v2-catalog *,
.typesense-v2-catalog *::before,
.typesense-v2-catalog *::after {
  box-sizing: border-box;
}

/* Layout */
.typesense-v2-catalog {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  overflow-x: hidden;
  width: 100%;
}

.typesense-v2-main {
  min-width: 0;
  width: 100%;
}

@media (max-width: 991px) {
  .typesense-v2-catalog {
    padding: 0.5rem;
  }
}

@media (max-width: 575px) {
  .typesense-v2-catalog {
    padding: 0.25rem;
  }
}

.typesense-v2-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
}

@media (max-width: 991px) {
  .typesense-v2-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Mobile sidebar - hidden by default */
  .typesense-v2-sidebar {
    display: none;
  }

}

/* Mobile filter toggle button - hidden on desktop */
.typesense-v2-filter-toggle {
  display: none;
}

@media (max-width: 991px) {
  .typesense-v2-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
  }

  .typesense-v2-filter-toggle:hover {
    border-color: #999;
    background: #f5f5f5;
  }

  .typesense-v2-filter-toggle svg {
    width: 18px;
    height: 18px;
  }

  .typesense-v2-filter-count {
    background: #0066cc;
    color: #fff;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
  }
}

/* Mobile filter overlay styles */
.typesense-v2-backdrop {
  display: none;
}

.typesense-v2-filter-header {
  display: none;
}

@media (max-width: 991px) {
  /* Backdrop */
  .typesense-v2-backdrop.is-open {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  /* Sidebar when open */
  .typesense-v2-sidebar.is-open {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    z-index: 100001;
    background: #fff;
    overflow-y: auto;
    padding: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
  }

  /* Filter header */
  .typesense-v2-sidebar.is-open .typesense-v2-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 50px;
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    z-index: 1;
  }

  .typesense-v2-filter-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
  }

  .typesense-v2-filter-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    color: #333;
  }

  .typesense-v2-filter-close:hover {
    background: #e0e0e0;
  }

  .typesense-v2-filter-close svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
  }

  /* Filter content padding when sidebar is open */
  .typesense-v2-sidebar.is-open .typesense-v2-facet:first-of-type {
    padding-top: 1rem;
  }

  .typesense-v2-sidebar.is-open .typesense-v2-facet {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Breadcrumb */
.typesense-v2-breadcrumb {
  margin-bottom: 1.5rem;
}

.typesense-v2-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.typesense-v2-breadcrumb li:not(:last-child)::after {
  content: '›';
  margin-left: 0.5rem;
  color: #666;
}

.typesense-v2-breadcrumb a {
  color: #0066cc;
  text-decoration: none;
}

.typesense-v2-breadcrumb a:hover {
  text-decoration: underline;
}

/* Sidebar */
.typesense-v2-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.typesense-v2-facet {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.typesense-v2-facet:last-child {
  border-bottom: none;
}

.typesense-v2-facet h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

/* Header */
.typesense-v2-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .typesense-v2-header {
    flex-wrap: nowrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

.typesense-v2-stats {
  flex: 1;
  font-size: 0.875rem;
  color: #666;
  white-space: nowrap;
}

.typesense-v2-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}

.typesense-v2-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .typesense-v2-sort {
    gap: 0.75rem;
    white-space: nowrap;
    flex-wrap: nowrap;
  }
}

.typesense-v2-sort-label {
  font-size: 0.875rem;
  color: #666;
  display: none;
}

@media (min-width: 576px) {
  .typesense-v2-sort-label {
    display: block;
  }
}

.typesense-v2-sort-buttons {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

@media (min-width: 576px) {
  .typesense-v2-sort-buttons {
    gap: 0.5rem;
  }
}

.typesense-v2-sort-btn {
  all: unset;
  padding: 0.35rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 50px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.typesense-v2-sort-btn:hover {
  border-color: #999;
  color: #333;
}

.typesense-v2-sort-btn.is-active {
  border-color: #0077a3;
  color: #0077a3;
  font-weight: 600;
  background-color: #e6f4f8;
}

.typesense-v2-per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.typesense-v2-per-page label {
  font-size: 0.875rem;
  color: #666;
}

/* Product Grid - 4 columns on desktop, 2 on mobile */
.typesense-v2-products {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(170px,1fr));
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 576px) {
  .typesense-v2-products {
    gap: 1.25rem;
  }
}

@media (min-width: 640px) {
  .typesense-v2-products {
    gap: 1.5rem;
  }
}


/* Product Card */
.typesense-v2-product-card {
  position: relative;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: visible;
  transition: box-shadow 0.2s, transform 0.2s;
}

.typesense-v2-product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.typesense-v2-product-card.is-sold-out {
  opacity: 0.85;
}

.typesense-v2-product-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.typesense-v2-product-image {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f5f5f5;
  border-radius: 8px 8px 0 0;
}

.typesense-v2-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.typesense-v2-product-card:hover .typesense-v2-product-image img {
  transform: scale(1.05);
}

/* Badges */
.typesense-v2-product-badges {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge--sale {
  background: #e53935;
  color: #fff;
}

.badge--discount {
  background: #e53935;
  color: #fff;
}

.badge--bestseller {
  background: #ff9800;
  color: #fff;
}

.badge--recommended {
  background: #4caf50;
  color: #fff;
}

/* Free delivery badge - SVG image positioned at bottom right of card */
.typesense-v2-free-delivery-badge {
  position: absolute;
  right: -8px;
  top: -12px;
  font-size: 0;
  color: transparent;
  width: 69px;
  height: 37px;
  display: block;
  background-image: url('/themes/custom/spred/images/icons/free-delivery.svg');
  background-size: cover;
  z-index: 1;
}

@media (min-width: 768px) {
  .typesense-v2-free-delivery-badge {
    right: -12px;
    width: 81px;
    height: 41px;
    top: -17px;
  }
}

.typesense-v2-product-info {
  padding:18px 8px 8px 8px;
  position: relative;
}

@media (min-width: 768px) {
  .typesense-v2-product-info {
    padding: 24px 16px 16px 16px;;
  }
}


.badge--sold-out {
  background: #c62828;
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  padding: 0 0.25rem;
  border-radius: 3px;
  border: 1px solid #b71c1c;
  margin-bottom: 0.25rem;
}

/* Product Info */
.typesense-v2-product-info {
  padding: 1rem;
}

.typesense-v2-product-manufacturer {
  display: block;
  font-size: 0.75rem;
  color: #555;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.typesense-v2-product-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Price */
.typesense-v2-product-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.price--current {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
}

.price--sale {
  color: #c62828;
}

.price--old {
  font-size: 0.875rem;
  color: #666;
  text-decoration: line-through;
}

.price--discount {
  font-size: 0.75rem;
  font-weight: 600;
  color: #e53935;
  background: #ffebee;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

/* No Results */
.typesense-v2-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

/* Loading State */
.typesense-v2-hits.is-loading {
  position: relative;
  pointer-events: none;
}

.typesense-v2-hits.is-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 10;
}

.typesense-v2-hits.is-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid #e0e0e0;
  border-top-color: #0066cc;
  border-radius: 50%;
  z-index: 11;
  animation: typesense-spin 0.8s linear infinite;
}

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

/* Pagination */
.typesense-v2-pagination {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
}

@media (max-width: 575px) {
  .typesense-v2-pagination {
    margin-top: 1rem;
  }
}

.typesense-v2-pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  background: #fff;
  transition: background-color 0.2s, border-color 0.2s;
}

.typesense-v2-pagination-link:hover {
  background: #f5f5f5;
  border-color: #999;
}

.typesense-v2-pagination-current {
  background: #0066cc;
  border-color: #0066cc;
  color: #fff;
}

.typesense-v2-pagination-dots {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  color: #666;
}

.typesense-v2-pagination-prev,
.typesense-v2-pagination-next {
  padding: 0 1rem;
}

/* Current Filters */
.typesense-v2-current-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.typesense-v2-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: #f0f0f0;
  border-radius: 4px;
  font-size: 0.875rem;
}

.typesense-v2-clear-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: #999;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s;
}

.typesense-v2-clear-filter:hover {
  background: #e53935;
}

/* Facet List */
.typesense-v2-facet-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.typesense-v2-facet-item {
  padding: 0.25rem 0;
}

.typesense-v2-facet-item.is-selected > a {
  font-weight: 600;
  color: #0066cc;
}

.typesense-v2-facet-category,
.typesense-v2-facet-manufacturer {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.typesense-v2-facet-category:hover,
.typesense-v2-facet-manufacturer:hover {
  color: #0066cc;
}

.typesense-v2-facet-count {
  margin-left: auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  color: #999;
  font-size: 0.875rem;
}

/* Search Box in Header */
.typesense-v2-header .typesense-v2-search-box-wrapper {
  position: relative;
  flex: 0 0 220px;
}

.typesense-v2-searchbox {
  position: relative;
  display: flex;
  align-items: center;
}

.typesense-v2-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.typesense-v2-search-icon svg {
  width: 16px;
  height: 16px;
}

.typesense-v2-searchbox .typesense-v2-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.875rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.typesense-v2-searchbox .typesense-v2-search-input:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.typesense-v2-searchbox .typesense-v2-search-input:focus + .typesense-v2-search-icon,
.typesense-v2-searchbox .typesense-v2-search-input:not(:placeholder-shown) + .typesense-v2-search-icon {
  color: #0066cc;
}

.typesense-v2-searchbox .typesense-v2-search-input::placeholder {
  color: #999;
}

/* Filter Search Input (no autocomplete) */
.typesense-v2-search-input--filter {
  padding-right: 2.5rem;
}

.typesense-v2-search-submit {
  position: absolute;
  right: 0.25rem;
  top: 8px;
  background: #0066cc;
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.typesense-v2-search-submit svg {
  width: 14px;
  height: 14px;
}

/* Search Loading State */
.typesense-v2-searchbox.is-searching .typesense-v2-search-submit {
  background: #999;
  pointer-events: none;
}

.typesense-v2-searchbox.is-searching .typesense-v2-search-submit svg {
  display: none;
}

.typesense-v2-searchbox.is-searching .typesense-v2-search-submit::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: typesense-spin 0.6s linear infinite;
}

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

/* Smooth product grid transitions */
.typesense-v2-hits {
  transition: opacity 0.15s ease-out;
}

.typesense-v2-hits.is-updating {
  opacity: 0.6;
}

/* Price Range Slider */
.typesense-v2-price-slider {
  padding: 0.5rem 0;
}

.typesense-v2-price-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #333;
}

.typesense-v2-price-separator {
  color: #999;
}

.typesense-v2-price-currency {
  color: #666;
  font-weight: 400;
  font-size: 0.8125rem;
}

.typesense-v2-range-container {
  position: relative;
  height: 24px;
  margin-bottom: 1rem;
}

.typesense-v2-range-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  transform: translateY(-50%);
}

.typesense-v2-range-fill {
  position: absolute;
  height: 100%;
  background: #0066cc;
  border-radius: 2px;
}

.typesense-v2-range-container input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
}

.typesense-v2-range-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 2px solid #0066cc;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}

.typesense-v2-range-container input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.typesense-v2-range-container input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.15);
  background: #0066cc;
  border-color: #0066cc;
}

.typesense-v2-range-container input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #fff;
  border: 2px solid #0066cc;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.typesense-v2-range-container input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.1);
}

.typesense-v2-price-apply {
  width: 100%;
  padding: 0.625rem 1rem;
  border: none;
  background: #0066cc;
  color: #fff;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.typesense-v2-price-apply:hover {
  background: #0052a3;
}

.typesense-v2-price-apply:active {
  background: #004080;
}

/* Clear All Link */
.typesense-v2-clear-all-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 0;
  text-decoration: none;
  color: #0066cc;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.typesense-v2-clear-all-link:hover {
  color: #0052a3;
  text-decoration: underline;
}

/* Select dropdowns */
.typesense-v2-sort-select,
.typesense-v2-perpage-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 0.875rem;
  cursor: pointer;
  min-width: 120px;
}

.typesense-v2-sort-select:hover,
.typesense-v2-perpage-select:hover {
  border-color: #999;
}

.typesense-v2-sort-select:focus,
.typesense-v2-perpage-select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

/* SSR content is replaced by InstantSearch, these are just fallback styles */

/* InstantSearch Hits Grid - same responsive grid as SSR */
.ais-Hits-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

@media (min-width: 576px) {
  .ais-Hits-list {
    gap: 1.25rem;
  }
}

@media (min-width: 768px) {
  .ais-Hits-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 992px) {
  .ais-Hits-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

.ais-Hits-item {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* InstantSearch widget overrides */
.ais-SearchBox-form {
  display: flex;
  gap: 0.5rem;
}

.ais-SearchBox-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 1rem;
}

.ais-SearchBox-submit,
.ais-SearchBox-reset {
  padding: 0.75rem;
  border: none;
  background: #f5f5f5;
  border-radius: 4px;
  cursor: pointer;
}

.ais-RefinementList-item,
.ais-HierarchicalMenu-item {
  padding: 0.25rem 0;
}

.ais-RefinementList-checkbox,
.ais-ToggleRefinement-checkbox {
  margin-right: 0.5rem;
}

.ais-RefinementList-count,
.ais-HierarchicalMenu-count {
  margin-left: auto;
  color: #999;
  font-size: 0.875rem;
}

.ais-Pagination-list {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ais-Pagination-item {
  display: inline-block;
}

.ais-Pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s;
}

.ais-Pagination-link:hover {
  background: #f5f5f5;
}

.ais-Pagination-item--selected .ais-Pagination-link {
  background: #0066cc;
  border-color: #0066cc;
  color: #fff;
}

.ais-Pagination-item--disabled .ais-Pagination-link {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Sort and Per Page dropdowns */
.ais-SortBy-select,
.ais-HitsPerPage-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 0.875rem;
  cursor: pointer;
  min-width: 120px;
}

.ais-SortBy-select:hover,
.ais-HitsPerPage-select:hover {
  border-color: #999;
}

.ais-SortBy-select:focus,
.ais-HitsPerPage-select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

/* Hierarchical Menu */
.ais-HierarchicalMenu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ais-HierarchicalMenu-item {
  padding: 0.25rem 0;
}

.ais-HierarchicalMenu-item--parent > .ais-HierarchicalMenu-link {
  font-weight: 600;
}

.ais-HierarchicalMenu-list--child {
  padding-left: 1rem;
  margin-top: 0.25rem;
}

.ais-HierarchicalMenu-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
  padding: 0.25rem 0;
}

.ais-HierarchicalMenu-link:hover {
  color: #0066cc;
}

.ais-HierarchicalMenu-item--selected > .ais-HierarchicalMenu-link {
  font-weight: 600;
  color: #0066cc;
}

.ais-HierarchicalMenu-count {
  margin-left: auto;
  padding-left: 0.5rem;
  color: #999;
  font-size: 0.875rem;
}

/* Refinement List */
.ais-RefinementList-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ais-RefinementList-item {
  padding: 0.25rem 0;
}

.ais-RefinementList-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.ais-RefinementList-label:hover {
  color: #0066cc;
}

.ais-RefinementList-checkbox {
  margin-right: 0.5rem;
}

.ais-RefinementList-labelText {
  flex: 1;
}

.ais-RefinementList-count {
  margin-left: auto;
  padding-left: 0.5rem;
  color: #999;
  font-size: 0.875rem;
}

.ais-RefinementList-showMore {
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  border: none;
  background: none;
  color: #0066cc;
  font-size: 0.875rem;
  cursor: pointer;
}

.ais-RefinementList-showMore:hover {
  text-decoration: underline;
}

/* Searchable Refinement List */
.ais-RefinementList-searchBox {
  margin-bottom: 0.75rem;
}

.ais-RefinementList-searchBox .ais-SearchBox-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 0.875rem;
}

.ais-RefinementList-searchBox .ais-SearchBox-submit,
.ais-RefinementList-searchBox .ais-SearchBox-reset {
  display: none;
}

/* Range Slider */
.ais-RangeSlider {
  padding: 0 0.5rem;
}

/* Toggle Refinement */
.ais-ToggleRefinement-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0;
}

.ais-ToggleRefinement-checkbox {
  margin-right: 0.5rem;
}

/* Current Refinements */
.ais-CurrentRefinements-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ais-CurrentRefinements-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.ais-CurrentRefinements-label {
  font-weight: 600;
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
}

.ais-CurrentRefinements-category {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: #f0f0f0;
  border-radius: 4px;
  font-size: 0.875rem;
}

.ais-CurrentRefinements-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: none;
  color: #666;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.ais-CurrentRefinements-delete:hover {
  color: #e53935;
}

/* Clear Refinements */
.ais-ClearRefinements-button {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.ais-ClearRefinements-button:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #999;
}

.ais-ClearRefinements-button--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Show More */
.ais-HierarchicalMenu-showMore {
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  border: none;
  background: none;
  color: #0066cc;
  font-size: 0.875rem;
  cursor: pointer;
}

.ais-HierarchicalMenu-showMore:hover {
  text-decoration: underline;
}

/* Category Grid (Parent Categories) */
.typesense-v2-category-page {
  padding: 1rem 0;
}

.typesense-v2-category-description {
  margin-bottom: 2rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #444;
}

.typesense-v2-category-description p {
  margin: 0 0 1rem;
}

.typesense-v2-category-description p:last-child {
  margin-bottom: 0;
}

.typesense-v2-subcategories {
  margin-top: 1rem;
}

.typesense-v2-subcategories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .typesense-v2-subcategories-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (min-width: 1200px) {
  .typesense-v2-subcategories-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.typesense-v2-subcategory-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.typesense-v2-subcategory-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.typesense-v2-subcategory-image {
  aspect-ratio: 1;
  overflow: hidden;
  background: #f5f5f5;
}

.typesense-v2-subcategory-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.typesense-v2-subcategory-card:hover .typesense-v2-subcategory-image img {
  transform: scale(1.05);
}

.typesense-v2-subcategory-image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
}

.typesense-v2-subcategory-image--placeholder svg {
  width: 48px;
  height: 48px;
}

.typesense-v2-subcategory-info {
  padding: 0.75rem 1rem;
  text-align: center;
}

.typesense-v2-subcategory-name {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  color: #333;
}

/* Price facet - no border since attribute facets have their own */
.typesense-v2-facet--price {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0.5rem;
}

/* Toggle Facets */
.typesense-v2-facet--toggles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.typesense-v2-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.375rem 0;
}

.typesense-v2-toggle input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.typesense-v2-toggle-label {
  font-size: 0.875rem;
  color: #333;
}

.typesense-v2-toggle-count {
  color: #666;
  font-size: 0.875rem;
}

.typesense-v2-toggle.is-active .typesense-v2-toggle-label {
  font-weight: 600;
  color: #0066cc;
}

/* Attribute Facets */
.typesense-v2-facet--attribute {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.typesense-v2-facet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  cursor: pointer;
}

.typesense-v2-facet-toggle {
  all: unset;
  padding: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.typesense-v2-facet-toggle svg {
  width: 16px;
  height: 16px;
  color: #666;
}

.typesense-v2-facet-toggle[aria-expanded="true"] {
  transform: rotate(180deg);
}

/* Collapsed Facet List */
.typesense-v2-facet-list--collapsed {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.typesense-v2-facet-list--expanded {
  max-height: none;
}

/* Checkbox Facet Items */
.typesense-v2-facet-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem 0;
  font-size: 0.875rem;
}

.typesense-v2-facet-checkbox input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.typesense-v2-facet-value {
  flex: 1;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typesense-v2-facet-checkbox:hover .typesense-v2-facet-value {
  color: #0066cc;
}

.typesense-v2-facet-item.is-selected .typesense-v2-facet-value {
  font-weight: 600;
  color: #0066cc;
}

/* Show More Button */
.typesense-v2-facet-more {
  padding-top: 0.5rem;
}

.typesense-v2-show-more {
  all: unset;
  display: block;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  color: #0066cc;
  cursor: pointer;
  text-decoration: underline;
  text-transform: none;
}

.typesense-v2-show-more:hover {
  color: #004d99;
}

/* Extra facet items (hidden by default, shown when expanded) */
.typesense-v2-facet-item--extra {
  display: none;
}

.typesense-v2-facet.is-expanded .typesense-v2-facet-item--extra {
  display: block;
}

/* Categories Show More Button */
.typesense-v2-facet--categories .typesense-v2-facet-item--hidden {
  display: none;
}

.typesense-v2-facet--categories.is-expanded .typesense-v2-facet-item--hidden {
  display: block;
}

/* Add more spacing to category items */
.typesense-v2-facet--categories .typesense-v2-facet-item {
  padding: 0.5rem 0;
}

.typesense-v2-show-more-categories {
  all: unset;
  display: block;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  color: #0066cc;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 0.5rem;
}

.typesense-v2-show-more-categories:hover {
  color: #004d99;
}

.typesense-v2-show-more-categories .typesense-v2-show-less-text {
  display: none;
}

.typesense-v2-facet--categories.is-expanded .typesense-v2-show-more-categories .typesense-v2-show-more-text {
  display: none;
}

.typesense-v2-facet--categories.is-expanded .typesense-v2-show-more-categories .typesense-v2-show-less-text {
  display: inline;
}

/* Favorite Heart Button */
.typesense-v2-favorite {
  position: absolute;
  z-index: 1;
  right: 0.5rem;
  top: 0.5rem;
  font-size: 0;
  color: transparent;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  outline: none;
  box-shadow: none;
  display: block;
  background-color: transparent;
  background-image: url('/themes/custom/spred/images/icons/heart-outline-gray.svg');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.typesense-v2-favorite:focus,
.typesense-v2-favorite:focus-visible {
  outline: none;
  box-shadow: none;
}

.typesense-v2-favorite:hover {
  background-image: url('/themes/custom/spred/images/icons/heart-outline-red.svg');
  transform: scale(1.1);
}

.typesense-v2-favorite.is-active {
  background-image: url('/themes/custom/spred/images/icons/heart-filled-red.svg');
}

.typesense-v2-favorite.is-active:hover {
  background-image: url('/themes/custom/spred/images/icons/heart-outline-gray.svg');
}
