/* Skjul tema-sidebar når Algolia er aktiv */
.algolia-shop-wrapper ~ .shop-sidebar,
.algolia-shop-wrapper ~ #secondary,
.tax-product_cat .shop-sidebar,
.tax-product_cat #shop-sidebar,
.tax-product_cat #secondary,
.tax-product_cat .sidebar-widgets,
.tax-product_cat .sidebar-inner,
.tax-product_tag .shop-sidebar,
.tax-product_tag #shop-sidebar,
.tax-product_tag #secondary,
.tax-product_tag .sidebar-widgets,
.tax-product_tag .sidebar-inner,
body[class*="tax-pa_"] .shop-sidebar,
body[class*="tax-pa_"] #shop-sidebar,
body[class*="tax-pa_"] #secondary,
body[class*="tax-pa_"] .sidebar-widgets,
body[class*="tax-pa_"] .sidebar-inner,
#shop-sidebar:has(.sidebar-inner) {
  display: none !important;
}

.tax-product_cat .content-area,
.tax-product_cat .large-9,
.tax-product_cat .col-fit,
.tax-product_cat .col.large-9,
.tax-product_tag .content-area,
.tax-product_tag .large-9,
.tax-product_tag .col-fit,
.tax-product_tag .col.large-9,
body[class*="tax-pa_"] .content-area,
body[class*="tax-pa_"] .large-9,
body[class*="tax-pa_"] .col-fit,
body[class*="tax-pa_"] .col.large-9 {
  width: 100% !important;
  flex-basis: 100% !important;
  max-width: 100% !important;
}

.tax-product_cat .large-3.col,
.tax-product_cat .col.large-3,
.tax-product_cat .is-sidebar,
.tax-product_tag .large-3.col,
.tax-product_tag .col.large-3,
.tax-product_tag .is-sidebar,
body[class*="tax-pa_"] .large-3.col,
body[class*="tax-pa_"] .col.large-3,
body[class*="tax-pa_"] .is-sidebar {
  display: none !important;
}

.tax-product_cat .woocommerce-ordering,
.tax-product_tag .woocommerce-ordering,
body[class*="tax-pa_"] .woocommerce-ordering {
  display: none !important;
}

/* Layout wrapper */
.algolia-shop-wrapper {
  margin: 0 auto;
  padding: 2rem clamp(1rem, 3vw, 3rem);
}

.algolia-shop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.algolia-shop-header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tablet/mobil: stats på egen række, filter venstre + sort højre på næste række */
@media (max-width: 960px) {
  .algolia-shop-header {
    flex-direction: column;
    align-items: stretch;
  }
  .algolia-shop-header-controls {
    justify-content: space-between;
    width: 100%;
  }
  .algolia-shop-header-controls .algolia-mobile-filter-btn {
    order: 1;
  }
  .algolia-shop-header-controls #algolia-shop-sort {
    order: 2;
  }
}

#algolia-shop-sort .ais-SortBy-select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0 2rem 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

#algolia-shop-sort .ais-SortBy-select:hover {
  border-color: #9ca3af;
}

#algolia-shop-sort .ais-SortBy-select:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

/* Layout: sidebar + content */
.algolia-shop-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2rem;
}

/* Sidebar */
.algolia-shop-sidebar {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  align-self: start;
}

.algolia-facet-block + .algolia-facet-block {
  margin-top: 1.5rem;
}

.algolia-facet-block h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
  color: #555;
}

/* Fjern bullets på facet-lister */
.algolia-shop-sidebar .ais-RefinementList-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.algolia-shop-sidebar .ais-RefinementList-item {
  margin: 0;
  padding: 0;
  list-style: none;
}

.algolia-shop-sidebar .ais-RefinementList-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.2rem 0;
  font-size: 0.875rem;
  line-height: 1.3;
  cursor: pointer;
}

.algolia-shop-sidebar .ais-RefinementList-checkbox {
  flex-shrink: 0;
  margin: 0;
  margin-top: 0.15rem;
}

.algolia-shop-sidebar .ais-RefinementList-labelText {
  flex: 1;
  min-width: 0;
}

/* Locked item (preset-filter — kan ikke ændres af bruger) */
.algolia-shop-sidebar .ais-RefinementList-item.algolia-facet-item-locked {
  pointer-events: none;
  opacity: 0.65;
}

.algolia-shop-sidebar .ais-RefinementList-item.algolia-facet-item-locked .ais-RefinementList-labelText {
  font-weight: 600;
}

/* Fjern facet-counts (80, 64, osv.) */
.algolia-shop-sidebar .ais-RefinementList-count {
  display: none;
}

/* Grid – vi styler selve Hits-listen */
.algolia-shop-hits .ais-Hits-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  list-style: none;    /* fjerner 1., 2., ... */
  margin: 0;
  padding: 0;
}

/* Fjern evt. rest-list-style på items */
.algolia-shop-hits .ais-Hits-item {
  list-style: none;
  margin: 0;
}

/* Breakpoints */
@media (min-width: 768px) {
  .algolia-shop-hits .ais-Hits-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .algolia-shop-hits .ais-Hits-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .algolia-shop-hits .ais-Hits-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .algolia-shop-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .algolia-shop-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
  }

  .algolia-shop-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .algolia-sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
  }

  .algolia-sidebar-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #555;
    padding: 0 0.25rem;
    line-height: 1;
  }

  .algolia-mobile-filter-btn {
    display: inline-flex;
  }
}

@media (min-width: 961px) {
  .algolia-sidebar-mobile-header {
    display: none;
  }

  .algolia-mobile-filter-btn {
    display: none;
  }
}

/* Mobile overlay */
.algolia-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.algolia-mobile-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

body.algolia-sidebar-open {
  overflow: hidden;
}

/* Mobile filter-knap */
.algolia-mobile-filter-btn {
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.algolia-mobile-filter-btn:hover {
  border-color: #9ca3af;
}

.algolia-mobile-filter-btn svg {
  flex-shrink: 0;
}

/* Produktkort */
.algolia-product-card {
  position: relative;
  background: #ffffff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Wishlist-knap (Flatsome + YITH) */
.algolia-product-card .image-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
}

.algolia-product-card .image-tools.show-on-hover {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.algolia-product-card:hover .image-tools.show-on-hover,
.algolia-product-card .image-tools.show-on-hover:focus-within {
  opacity: 1;
  pointer-events: auto;
}

/* Touch-enheder: vis altid hjertet (ingen hover) */
@media (hover: none) {
  .algolia-product-card .image-tools.show-on-hover {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Wishlist-knap states */
.algolia-product-card .wishlist-button.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.algolia-product-card .wishlist-button.is-added {
  background: #fbbf24;
  border-color: #fbbf24;
  color: #fff;
}

.algolia-product-card-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  flex: 1;
}


.algolia-product-image-wrap {
  position: relative;
  padding-top: 130%;
  background: white;
  overflow: hidden;
}

.algolia-product-image-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.algolia-product-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 0.8rem;
}

/* Out-of-stock overlay */
.algolia-out-of-stock-overlay {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  background: rgba(31, 41, 55, 0.75);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  padding: 0.6rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 2;
}

.algolia-product-card.is-out-of-stock .algolia-product-image-wrap img {
  filter: grayscale(0.4);
  opacity: 0.85;
}

.algolia-product-body {
  padding: 0.9rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.algolia-product-title {
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
  color: #111827;
  max-height: 2.6em;
  overflow: hidden;
}

.algolia-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.algolia-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
}

.algolia-badge-rarity {
  background: #eef2ff;
  color: #4338ca;
}

.algolia-badge-stock {
  background: #dcfce7;
  color: #166534;
}

.algolia-product-price {
  margin-top: 0.2rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.algolia-product-price-old {
  text-decoration: line-through;
  color: #9ca3af;
  font-weight: 400;
}

.algolia-product-price-current {
  font-weight: 700;
  color: #111827;
}


.algolia-product-desc {
  margin: 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.algolia-add-to-cart,
.algolia-read-more {
  margin: 0 0.5rem 1rem;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 0.25rem;
  background: white;
  border: 2px solid #fcd34d;
  font-size: 0.65em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: #fcd34d;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}

@media (min-width: 768px) {
  .algolia-add-to-cart,
  .algolia-read-more {
    font-size: 0.8em;
    height: 44px;
    padding: 0 1.5rem;
    margin: 0 0.9rem 1rem;
    margin-top: auto;
  }
}

.algolia-add-to-cart:hover,
.algolia-read-more:hover {
  background: #fbbf24;
  border-color: #fbbf24;
  transform: translateY(-1px);
  color: white;
}

.algolia-add-to-cart.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.algolia-add-to-cart.is-added {
  background: #16a34a;
  border-color: #16a34a;
  color: white;
}

/* Skjul WooCommerce "Se kurv" link */
.algolia-product-card .added_to_cart {
  display: none !important;
}


/* Hover */
.algolia-product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

/* Pagination */
.algolia-shop-pagination {
  margin-top: 1.75rem;
  display: flex;
  justify-content: center;
}

.ais-Pagination-list {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.ais-Pagination-item {
  list-style: none;
}

.ais-Pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  font-size: 0.8rem;
  text-decoration: none;
  color: #374151;
}

.ais-Pagination-item--selected .ais-Pagination-link {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}


/* ===== ACCORDION STYLING ===== */
.algolia-facet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}

.algolia-facet-header h3 {
  margin: 0;
}

.algolia-facet-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #fbbf24;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.algolia-facet-toggle {
  width: 20px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
}

.algolia-facet-toggle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #555;
  border-bottom: 2px solid #555;
  transform: translate(-50%, -30%) rotate(-135deg);
  transition: transform 0.2s ease;
}

.algolia-facet-block.is-collapsed .algolia-facet-toggle::before {
  transform: translate(-50%, -70%) rotate(45deg);
}

.algolia-facet-content {
  max-height: 300px;
  overflow-y: auto;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.algolia-facet-block.is-collapsed .algolia-facet-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.algolia-facet-block.is-empty {
  display: none;
}


/* ===== PRIS-SLIDER (rheostat) ===== */
#algolia-price-slider {
  padding: 0 10px 0.5rem;
  overflow: hidden;
}

.ais-RangeSlider {
  padding: 1rem 0;
}

.rheostat {
  position: relative;
  height: 24px;
  cursor: pointer;
}

.rheostat-background {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  margin-top: -2px;
  background: #e5e7eb;
  border-radius: 999px;
}

.rheostat-progress {
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  background: #fbbf24;
  border-radius: 999px;
}

.rheostat-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  padding: 0;
  border: 2px solid #fbbf24;
  border-radius: 50%;
  background: #fff;
  cursor: grab;
  outline: none;
  z-index: 1;
}

.rheostat-handle:hover {
  border-color: #f59e0b;
}

.rheostat-handle:focus,
.rheostat-handle:active {
  cursor: grabbing;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.2);
}

.rheostat-tooltip,
.ais-RangeSlider-pit {
  display: none;
}

/* ===== PRIS-RANGE ===== */
.ais-RangeInput-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.ais-RangeInput-label {
  flex: 1;
  min-width: 0;
}

.ais-RangeInput-input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: #374151;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.ais-RangeInput-input:focus {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.ais-RangeInput-separator {
  flex-shrink: 0;
  color: #6b7280;
  font-size: 0.8rem;
}

.ais-RangeInput-submit {
  display: none;
  flex-basis: 100%;
  flex-shrink: 0;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#algolia-price-facet.is-editing .ais-RangeInput-submit {
  display: inline-block;
}

.ais-RangeInput-submit:hover {
  border-color: #fbbf24;
  background: #fffbeb;
}

/* ===== NULSTIL FILTRE ===== */
.algolia-sidebar-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.ais-ClearRefinements-button {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  color: #374151;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ais-ClearRefinements-button:not(.ais-ClearRefinements-button--disabled):hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

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

/* ===== CLIENT-SIDE FACET SEARCH ===== */
.algolia-facet-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.algolia-facet-search:focus {
  border-color: #9ca3af;
}

.algolia-facet-search::placeholder {
  color: #9ca3af;
}


/* ===== LOADING SPINNER ===== */
.algolia-shop-main {
  position: relative;
  min-height: 80vh;
}

.algolia-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.algolia-loading-overlay.is-loading {
  opacity: 1;
  visibility: visible;
}

.algolia-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: algolia-spin 0.8s linear infinite;
}

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