/* ==========================================================================
   FILTER EVERYTHING PLUGIN
   ========================================================================== */

/* ==========================================================================
   1. ACTIVE FILTER CHIPS
   ========================================================================== */

/* Hide active filter chips on desktop */
@media (min-width: 1025px) {
  .widget_wpc_chips_widget {
    display: none !important;
  }
}

/* Selected terms container */
.wpc-custom-selected-terms ul.wpc-filter-chips-list {
  display: flex !important;
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  white-space: normal !important;

  gap: 10px;
  padding: 10px 0 !important;
}

/* Individual selected filter chip */
.wpc-custom-selected-terms ul.wpc-filter-chips-list li.wpc-filter-chip {
  display: inline-block !important;
  float: none !important;
  margin: 0 !important;
}

/* Hide empty selected-terms containers */
.wpc-custom-selected-terms:empty,
.wpc-custom-selected-terms:not(:has(li)) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Failsafe for empty chip lists */
.wpc-filter-chips-list:empty {
  display: none !important;
}

/* ==========================================================================
   2. FILTER WIDGET / SECTIONS
   ========================================================================== */

/* Main widget wrapper */
.widget_wpc_filters_widget .wpc-filters-widget-content {
  padding: 0;
  border-radius: 16px;
}

/* Individual filter section */
.widget_wpc_filters_widget .wpc-filters-section {
  padding: 10px;
  border-radius: 12px;
  background: var(--global-palette8);
}

/* Remove default list margin */
.widget_wpc_filters_widget .wpc-filters-ul-list {
  margin: 0 !important;
}

/*
 * Remove Filter Everything's native 2px top padding:
 * padding: 2px 0 0;
 */
.widget_wpc_filters_widget .wpc-filters-main-wrap ul.wpc-filters-ul-list {
  padding-top: 0 !important;
}

/* ==========================================================================
   3. FILTER TITLES
   ========================================================================== */

/*
 * Filter Everything section titles.
 * Overrides Kadence sidebar widget-title typography only inside this widget.
 */
.primary-sidebar.widget-area .widget_wpc_filters_widget .wpc-filter-title {
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 8px;
}

/* ==========================================================================
   4. COMMON TERM TYPOGRAPHY
   ========================================================================== */

/* Term text */
.widget_wpc_filters_widget .wpc-filter-link {
  font-size: 0.9rem !important;
}

/* Product count */
.widget_wpc_filters_widget .wpc-term-count {
  width: auto !important;

  font-size: 0.7rem !important;
  line-height: 1 !important;
  white-space: nowrap;
}

/* ==========================================================================
   5. STANDARD CHECKBOX FILTERS
   ========================================================================== */

/* Round checkbox / radio control */
.widget_wpc_filters_widget .wpc-filters-main-wrap input[type="checkbox"],
.widget_wpc_filters_widget .wpc-filters-main-wrap input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;

  border-radius: 50%;
}

/* Centered selected indicator */
.widget_wpc_filters_widget .wpc-filters-main-wrap input[type="checkbox"]::after,
.widget_wpc_filters_widget .wpc-filters-main-wrap input[type="radio"]::after {
  position: absolute;

  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 10px;
  height: 10px;

  border: 0;
  border-radius: 50%;
}

/* No trailing spacing after the final checkbox term */
.widget_wpc_filters_widget .wpc-filters-checkboxes li.wpc-term-item {
  margin-bottom: 0 !important;
}

/*
 * Vertical spacing only between consecutive checkbox terms.
 * The first and last items therefore add no unnecessary outer spacing.
 */
.widget_wpc_filters_widget
  .wpc-filters-checkboxes
  li.wpc-term-item
  + li.wpc-term-item {
  margin-top: 8px !important;
}

/*
 * Complete checkbox row:
 * checkbox + text block.
 *
 * flex-start keeps the checkbox aligned with the first text line when
 * a long term wraps onto multiple lines.
 */
.widget_wpc_filters_widget
  .wpc-filters-checkboxes
  .wpc-term-item-content-wrapper {
  display: flex;
  align-items: flex-start !important;
}

/*
 * Label uses only the remaining horizontal space.
 *
 * width: 0 + flex: 1 is intentional:
 * it allows long terms to wrap correctly instead of expanding the row.
 */
.widget_wpc_filters_widget
  .wpc-filters-checkboxes
  .wpc-term-item-content-wrapper
  > label {
  display: block !important;

  flex: 1 1 0 !important;

  width: 0 !important;
  min-width: 0 !important;
  max-width: 100%;

  margin: 0;

  line-height: 1.3;
  white-space: normal !important;
}

/*
 * Checkbox term text stays inline.
 *
 * This allows the count to follow immediately after the final word,
 * including when the term wraps onto a second line.
 */
.widget_wpc_filters_widget .wpc-filters-checkboxes .wpc-filter-link {
  display: inline !important;

  margin-right: 4px !important;

  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
}

/*
 * Checkbox count stays inside the text flow.
 *
 * display:inline prevents it from becoming a separate flex item positioned
 * at the far right of the label.
 */
.widget_wpc_filters_widget .wpc-filters-checkboxes .wpc-term-count {
  display: inline !important;

  width: auto !important;

  margin: 0 !important;
  padding: 0 !important;

  position: relative;
  top: -0.18em;
}

/* ==========================================================================
   5.1 HIERARCHICAL CHILD TERMS
   ========================================================================== */

/*
 * Keep child terms visually closer to their parent.
 *
 * Filter Everything remains responsible for display:none / display:block
 * when opening and closing hierarchy branches.
 */
.widget_wpc_filters_widget
  .wpc-filter-has-hierarchy
  li.wpc-term-item
  > ul.children {
  margin-top: 6px;
  margin-bottom: 12px;
}

/* Slightly smaller child term text */
.widget_wpc_filters_widget
  .wpc-filter-has-hierarchy
  ul.children
  .wpc-filter-link {
  font-size: 0.82rem !important;
}

/* Slightly smaller child term count */
.widget_wpc_filters_widget
  .wpc-filter-has-hierarchy
  ul.children
  .wpc-term-count {
  font-size: 0.65rem !important;
}

/* ==========================================================================
   6. LABEL / BUTTON FILTERS
   Examples: stock status, brands, swatches, etc.
   ========================================================================== */

/*
 * IMPORTANT:
 *
 * Filter Everything already controls the outer Labels layout:
 *
 * display: flex;
 * flex-wrap: wrap;
 * justify-content: flex-start;
 *
 * Do not override that layout here.
 *
 * This allows buttons to remain naturally side-by-side and wrap only when
 * there is no longer enough horizontal space.
 */

/* Vertical spacing between rows of label/button filters */
.widget_wpc_filters_widget .wpc-filters-main-wrap .wpc-filters-labels {
  row-gap: 10px;
}

/* Let the parent row-gap handle vertical spacing */
.widget_wpc_filters_widget
  .wpc-filters-main-wrap
  .wpc-filters-labels
  li.wpc-term-item {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* --------------------------------------------------------------------------
   6.1 TEXT LABEL BUTTONS
   Examples: På lager, Restordre, Utsolgt
   -------------------------------------------------------------------------- */

/*
 * Compact internal padding.
 *
 * Filter Everything normally uses 4px 10px.
 * Talitor uses 4px on all sides.
 */
.widget_wpc_filters_widget
  .wpc-filters-main-wrap
  .wpc-filters-labels
  li.wpc-term-item:not(.wpc-term-has-image)
  label
  .wpc-filter-label-wrapper {
  padding: 4px !important;

  align-items: center !important;
  gap: 4px;
}

/*
 * Text inside label buttons.
 *
 * margin-right is disabled because spacing between text and count is
 * controlled by gap: 4px on the wrapper.
 */
.widget_wpc_filters_widget .wpc-filters-labels .wpc-filter-link {
  margin-right: 0 !important;

  font-size: 0.9rem !important;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   6.2 IMAGE LABEL BUTTONS
   Examples: brand logos
   -------------------------------------------------------------------------- */

/*
 * Image buttons keep zero internal padding.
 *
 * This prevents the generic 4px text-button padding from adding space around
 * the logo itself.
 */
.widget_wpc_filters_widget
  .wpc-filters-main-wrap
  .wpc-filters-labels
  li.wpc-term-item.wpc-term-has-image
  label
  .wpc-filter-label-wrapper {
  padding: 0 !important;

  align-items: center !important;
  gap: 4px;
}

/* --------------------------------------------------------------------------
   6.3 COUNTS INSIDE LABEL BUTTONS
   -------------------------------------------------------------------------- */

/*
 * Keep Filter Everything's native display behaviour.
 *
 * Brand/swatches may use inline-flex natively, so display is deliberately
 * not overridden here.
 */
.widget_wpc_filters_widget .wpc-filters-labels .wpc-term-count {
  width: auto !important;

  margin: 0 !important;
  padding: 0 !important;

  font-size: 0.7rem !important;
  line-height: 1 !important;

  position: relative;
  top: -0.14em;
}

/* ==========================================================================
   7. BRAND IMAGE SIZE
   ========================================================================== */

/*
 * Only dimensions are customized here.
 *
 * Outer positioning and wrapping remain managed by Filter Everything's
 * native Labels layout.
 */
.widget_wpc_filters_widget
  .wpc-filter-has-brands
  .wpc-term-has-image
  .wpc-term-image-wrapper {
  width: 94px;
  height: 42px;
}

/* ==========================================================================
   8. MOBILE FILTER BUTTON
   ========================================================================== */

/* Main mobile filter toggle */
section.widget_wpc_filters_widget
  .wpc-filters-open-button-container
  a.wpc-open-close-filters-button {
  display: inline-block !important;

  margin: 8px 0 !important;
  padding: 0 !important;

  border-radius: 999px !important;
}

/* Mobile button text */
.wpc-open-close-filters-button .wpc-filters-button-text {
  font-size: 0.9rem !important;
}

/* Mobile button inner spacing */
.wpc-open-close-filters-button .wpc-button-inner {
  padding: 6px 12px !important;
}

/* ==========================================================================
   FIBOSEARCH PLUGIN
   ========================================================================== */

/*
 * Hide FiboSearch from the sidebar on mobile/tablet.
 * The main header search remains available.
 */
@media (max-width: 1024px) {
  .sidebar .dgwt-wcas-search-wrapp,
  #secondary .dgwt-wcas-search-wrapp {
    display: none !important;
  }
}
