/** @define PLP — InstantSearch + filter/search/sort styling from Figma Brand Overview Page */

/* ─── Design tokens (from Figma Brand Overview Page) ─────────────────────── */
.ProductsOverview {
  --plp-border:      rgba(0, 0, 0, 0.1);
  --plp-radius:      0.625rem;
  --plp-primary:     #030213;
  --plp-foreground:  #0a0a0a;
  --plp-muted-fg:    #717182;
  --plp-bg:          #ffffff;
  --plp-input-bg:    #f3f3f5;
  --plp-secondary:   #f1f1f5;
  --plp-ring:        rgba(113, 113, 130, 0.25);
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.ProductsOverview {
  position: relative;
}

.ProductsOverview-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.ProductsOverview-sidebar {
  display: none;
  width: 16rem;
  flex-shrink: 0;
}

@media (min-width: 64rem) {
  .ProductsOverview-sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }
}

/* Mobile drawer */
.ProductsOverview-sidebar.active {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: 16rem;
  height: 100vh;
  max-height: 100vh;
  background: var(--plp-bg);
  z-index: 9999;
  border-right: 1px solid var(--plp-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.ProductsOverview-sidebarContent {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.ProductsOverview-sidebarFooter {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--plp-border);
}

/* ─── Mobile overlay ──────────────────────────────────────────────────────── */
.ProductsOverview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
}

.ProductsOverview-overlay:not([hidden]) {
  display: block;
}

/* ─── Mobile toggle button ────────────────────────────────────────────────── */
.ProductsOverview-mobileToggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--plp-border);
  border-radius: var(--plp-radius);
  background: var(--plp-bg);
  font-size: 0.875rem;
  color: var(--plp-foreground);
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: background-color 0.15s ease;
}

.ProductsOverview-mobileToggle:hover {
  background: var(--plp-secondary);
}

@media (min-width: 64rem) {
  .ProductsOverview-mobileToggle {
    display: none;
  }
}

/* ─── Filter sections ─────────────────────────────────────────────────────── */
.ProductsOverview-filterSection {
  border-bottom: 1px solid var(--plp-border);
  padding-block: 1.5rem;
}

.ProductsOverview-filterSection:first-child {
  padding-top: 0;
}

.ProductsOverview-filterSection:last-of-type {
  border-bottom: none;
}

/* Section toggle button */
.ProductsOverview-filterToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--plp-foreground);
  line-height: 1.4;
}

.ProductsOverview-filterToggle:hover {
  color: var(--plp-primary);
}

/* Chevron icon inside toggle */
.ProductsOverview-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--plp-muted-fg);
}

.ProductsOverview-filterToggle[aria-expanded="false"] .ProductsOverview-chevron {
  transform: rotate(-90deg);
}

/* Hide facet when collapsed */
.ProductsOverview-facet[hidden] {
  display: none;
}

/* ─── Close sidebar button ────────────────────────────────────────────────── */
.ProductsOverview-closeSidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--plp-border);
  border-radius: var(--plp-radius);
  background: none;
  font-size: 0.875rem;
  color: var(--plp-muted-fg);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  margin-top: 0.75rem;
}

.ProductsOverview-closeSidebar:hover {
  background: var(--plp-secondary);
  color: var(--plp-foreground);
}

@media (min-width: 64rem) {
  .ProductsOverview-closeSidebar {
    display: none;
  }
}

/* ─── Main content area ───────────────────────────────────────────────────── */
.ProductsOverview-main {
  flex: 1;
  min-width: 0;
}

/* ─── Toolbar: search + sort row ─────────────────────────────────────────── */
.ProductsOverview-toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ProductsOverview-searchBox {
  flex: 1;
  min-width: 0;
}

.ProductsOverview-sortBy {
  flex-shrink: 0;
}

/* ─── InstantSearch: SearchBox ────────────────────────────────────────────── */
.ProductsOverview-searchBox .ais-SearchBox-form {
  position: relative;
  display: flex;
  align-items: center;
}

.ProductsOverview-searchBox .ais-SearchBox-input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border: 1px solid var(--plp-border);
  border-radius: var(--plp-radius);
  background: var(--plp-bg);
  font-size: 0.875rem;
  color: var(--plp-foreground);
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.ProductsOverview-searchBox .ais-SearchBox-input::placeholder {
  color: var(--plp-muted-fg);
}

.ProductsOverview-searchBox .ais-SearchBox-input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--plp-ring);
}

/* Submit button — positioned as the search icon on the left */
.ProductsOverview-searchBox .ais-SearchBox-submit {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plp-muted-fg);
  cursor: pointer;
  z-index: 1;
}

.ProductsOverview-searchBox .ais-SearchBox-submit:focus {
  outline: none;
}

.ProductsOverview-searchBox .ais-SearchBox-submitIcon {
  width: 1rem;
  height: 1rem;
}

/* Reset (×) button — right side */
.ProductsOverview-searchBox .ais-SearchBox-reset {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plp-muted-fg);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.ProductsOverview-searchBox .ais-SearchBox-input:not(:placeholder-shown) ~ .ais-SearchBox-reset,
.ProductsOverview-searchBox .ais-SearchBox-reset:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.ProductsOverview-searchBox .ais-SearchBox-reset:focus {
  outline: none;
}

.ProductsOverview-searchBox .ais-SearchBox-resetIcon {
  width: 0.875rem;
  height: 0.875rem;
}

/* ─── InstantSearch: SortBy ───────────────────────────────────────────────── */
.ProductsOverview-sortBy .ais-SortBy-select {
  padding: 0.625rem 1rem;
  border: 1px solid var(--plp-border);
  border-radius: var(--plp-radius);
  background: var(--plp-bg);
  font-size: 0.875rem;
  color: var(--plp-foreground);
  cursor: pointer;
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
  background-image: 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='%23717182' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ProductsOverview-sortBy .ais-SortBy-select:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--plp-ring);
}

/* ─── InstantSearch: RefinementList (Brand, Compliance, Price) ────────────── */
.ProductsOverview-facet .ais-RefinementList-list,
.ProductsOverview-facet .ais-HierarchicalMenu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Nested hierarchical list */
.ProductsOverview-facet .ais-HierarchicalMenu-list--child {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

.ProductsOverview-facet .ais-RefinementList-item,
.ProductsOverview-facet .ais-HierarchicalMenu-item {
  display: flex;
}

/* Checkbox + label row */
.ProductsOverview-facet .ais-RefinementList-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  width: 100%;
}

.ProductsOverview-facet .ais-RefinementList-label:hover .ais-RefinementList-labelText {
  color: var(--plp-foreground);
}

/* Checkbox */
.ProductsOverview-facet .ais-RefinementList-checkbox {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--plp-border);
  background: var(--plp-bg);
  accent-color: var(--plp-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}

.ProductsOverview-facet .ais-RefinementList-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--plp-ring);
}

/* Label text */
.ProductsOverview-facet .ais-RefinementList-labelText {
  font-size: 0.875rem;
  color: var(--plp-muted-fg);
  transition: color 0.15s ease;
  line-height: 1.4;
}

/* Selected item */
.ProductsOverview-facet .ais-RefinementList-item--selected .ais-RefinementList-labelText {
  color: var(--plp-foreground);
  font-weight: 500;
}

/* Count badge */
.ProductsOverview-facet .ais-RefinementList-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: #50505D;
  background: var(--plp-secondary);
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Show more button */
.ProductsOverview-facet .ais-RefinementList-showMore {
  display: inline-flex;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0;
  background: none;
  border: none;
  font-size: 0.8125rem;
  color: var(--plp-muted-fg);
  cursor: pointer;
  transition: color 0.15s ease;
}

.ProductsOverview-facet .ais-RefinementList-showMore:hover {
  color: var(--plp-foreground);
}

/* ─── InstantSearch: HierarchicalMenu (Collections) ──────────────────────── */
.ProductsOverview-facet .ais-HierarchicalMenu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--plp-muted-fg);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
  width: 100%;
}

.ProductsOverview-facet .ais-HierarchicalMenu-link:hover {
  color: var(--plp-foreground);
}

.ProductsOverview-facet .ais-HierarchicalMenu-item--selected > div > .ais-HierarchicalMenu-link,
.ProductsOverview-facet .ais-HierarchicalMenu-item--selected > .ais-HierarchicalMenu-link {
  color: var(--plp-foreground);
  font-weight: 500;
}

.ProductsOverview-facet .ais-HierarchicalMenu-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--plp-muted-fg);
  background: var(--plp-secondary);
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
  flex-shrink: 0;
}

/* ─── InstantSearch: ClearRefinements ─────────────────────────────────────── */
#clear-filters-btn-container .ais-ClearRefinements-button {
  /*display: flex;*/
  /*align-items: center;*/
  /*justify-content: center;*/
  /*width: 100%;*/
  /*padding: 0.5rem 1rem;*/
  /*background: none;*/
  /*font-size: 0.875rem;*/
  /*color: var(--plp-muted-fg);*/
  /*cursor: pointer;*/
  /*transition: color 0.15s ease;*/
  /*gap: 0.5rem;*/
  /*border: 1px solid currentColor;*/
  /*border-radius: 5px;*/
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--plp-border);
  border-radius: var(--plp-radius);
  background: none;
  font-size: 0.875rem;
  color: var(--plp-muted-fg);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  margin-top: 0.75rem;
}

#clear-filters-btn-container .ais-ClearRefinements-button:hover {
  color: var(--plp-foreground);
}

#clear-filters-btn-container .ais-ClearRefinements-button--disabled {
  display: none;
}

.ProductsOverview .ais-RefinementList-showMore--disabled {
  display: none;
}

/* ─── InstantSearch: InfiniteHits grid ────────────────────────────────────── */
.ProductsOverview-hits .ais-InfiniteHits-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

@media (min-width: 48rem) {
  .ProductsOverview-hits .ais-InfiniteHits-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 80rem) {
  .ProductsOverview-hits .ais-InfiniteHits-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

.ProductsOverview-hits .ais-InfiniteHits-loadMore--disabled {
  display: none;
}

.ProductsOverview-hits .ais-InfiniteHits-item {
  display: flex;
  flex-direction: column;
}
