/* ============================================================
   ACF Smart Filter — Frontend Styles
   ============================================================ */

:root {
  --asf-bg:           #ffffff;
  --asf-bg-hover:     #f5f5f5;
  --asf-border:       #e4e4e4;
  --asf-text:         #1a1a1a;
  --asf-text-muted:   #888;
  --asf-accent:       #2563eb;
  --asf-radius:       5px;
  --asf-transition:   0.15s ease;
  --asf-font:         inherit;
}

/* ================================================================
   Sidebar wrapper
   ================================================================ */
.asf-sidebar {
  font-family: var(--asf-font);
  font-size: 14px;
  color: var(--asf-text);
  width: 100%;
}

/* Header row: "Filters" title + "Clear all" link */
.asf-sidebar__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--asf-text);
  margin-bottom: 4px;
}

.asf-sidebar__title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* "Clear all" — plain link, no button */
.asf-clear-all {
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: opacity var(--asf-transition);
  /* font-size, color, background set via dynamic CSS */
}
.asf-clear-all:hover,
.asf-clear-all:focus { opacity: .65; }
.asf-clear-all.asf-hidden { visibility: hidden; pointer-events: none; }

/* ================================================================
   Filter group — always visible, no toggle
   ================================================================ */
.asf-group {
  padding: 16px 0 4px;
  /* border and border-radius set dynamically via Appearance settings */
}

/* Group header: label left-aligned, badge after it */
.asf-group__header {
  display: flex;
  align-items: center;
  gap: 8px;
  /* justify-content: space-between set via dynamic CSS; badge pushed right via margin-left:auto */
}

.asf-group__label {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--asf-text);
}

.asf-group__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  /* color and background set via dynamic CSS */
}

/* ================================================================
   Checkbox options — left-aligned
   ================================================================ */
.asf-options {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
}

.asf-option {
  margin: 0;
  padding: 0;
}

/* Greyed-out impossible option */
.asf-option--disabled {
  opacity: .38;
  pointer-events: none;
}

.asf-option__label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 4px 2px;
  cursor: pointer;
  border-radius: var(--asf-radius);
  transition: background var(--asf-transition);
  user-select: none;
}
.asf-option__label:hover { background: var(--asf-bg-hover); }

/* Hide the browser's native checkbox */
.asf-option__checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom square checkmark */
.asf-option__checkmark {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border: 1.5px solid #bbb;
  border-radius: 3px;
  background: #fff;
  position: relative;
  transition: background var(--asf-transition), border-color var(--asf-transition);
}
.asf-option__checkmark::after {
  content: '';
  position: absolute;
  display: none;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.asf-option__checkbox:checked + .asf-option__checkmark {
  background: var(--asf-accent);
  border-color: var(--asf-accent);
}
.asf-option__checkbox:checked + .asf-option__checkmark::after {
  display: block;
}
.asf-option__checkbox:focus-visible + .asf-option__checkmark {
  outline: 2px solid var(--asf-accent);
  outline-offset: 2px;
}

.asf-option__text {
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--asf-text);
}
.asf-option--disabled .asf-option__text {
  color: var(--asf-text-muted);
}

/* ================================================================
   Results grid
   ================================================================ */
.asf-results { width: 100%; }

.asf-results__meta {
  font-size: 12px;
  color: var(--asf-text-muted);
  margin-bottom: 16px;
}

.asf-grid {
  list-style: none;
  margin: 0;
  padding: 0 !important;
  display: grid;
  /* grid-template-columns and gap set via dynamic CSS from Weergave settings */
}

/* Card */
.asf-card {
  border: 1px solid var(--asf-border);
  border-radius: var(--asf-radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow var(--asf-transition), transform var(--asf-transition);
}
.asf-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.asf-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.asf-card__image img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.asf-card__body { padding: 12px; }
.asf-card__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 5px;
  line-height: 1.3;
}
.asf-card__meta {
  display: block;
  font-size: 12px;
  color: var(--asf-text-muted);
  margin-top: 3px;
}

/* Empty state */
.asf-results__empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--asf-text-muted);
}
.asf-results__empty svg { display: block; margin: 0 auto 12px; opacity: .3; }
.asf-results__empty p   { margin: 0 0 10px; font-size: 14px; }

/* ================================================================
   Pagination — right-aligned, plain <a> links, no buttons
   [asf_results] embeds it inside the results div.
   [asf_pagination] standalone shortcode shares the same styles.
   ================================================================ */
.asf-pagination {
  display: flex;
  justify-content: flex-end;   /* right-aligned */
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* Standalone pagination shortcode wrapper */
.asf-pagination-standalone {
  width: 100%;
}

/* Every page link */
.asf-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--asf-radius);
  text-decoration: none;
  color: var(--asf-text);
  border: 1px solid var(--asf-border);
  background: #fff;
  line-height: 1;
  transition: background var(--asf-transition), border-color var(--asf-transition), color var(--asf-transition);
}
.asf-page-link:hover,
.asf-page-link:focus {
  background: var(--asf-bg-hover);
  border-color: #bbb;
  color: var(--asf-text);
  text-decoration: none;
}

/* Active page — rendered as <span>, not a link */
.asf-page-link--active {
  background: var(--asf-accent);
  border-color: var(--asf-accent);
  color: #fff;
  font-weight: 700;
  cursor: default;
  pointer-events: none;
}

/* Prev / Next wider */
.asf-page-prev,
.asf-page-next { padding: 0 10px; }

/* ================================================================
   Sidebar footer (Clear all link below filters)
   ================================================================ */
.asf-sidebar__footer {
  padding: 12px 0 4px;
}

/* ================================================================
   Active Filters bar  [asf_active_filters]
   ================================================================ */
.asf-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--asf-font);
}

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

/* Individual chip — now a <span> directly in the flex container */
.asf-active-filters__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--asf-accent-light, #dbeafe);
  border: 1px solid var(--asf-accent, #2563eb);
  border-radius: 999px;
  padding: 3px 8px 3px 10px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--asf-text);
}

.asf-chip__group {
  font-weight: 600;
  opacity: .75;
}

.asf-chip__value {
  /* inherits font */
}

.asf-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--asf-accent, #2563eb);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  font-style: normal;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.asf-chip__remove:hover { opacity: .75; color: #fff; text-decoration: none; }

/* "Clear all filters" link in the bar */
.asf-active-filters__clear {
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  /* font-size, color, background set via dynamic CSS */
}

/* ================================================================
   Mobile filter trigger button
   (visible only below the mobile breakpoint set in Appearance)
   ================================================================ */
.asf-mobile-trigger-wrap {
  display: none; /* shown via media query injected by inline CSS */
}

.asf-mobile-trigger {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--asf-accent, #2563eb);
  color: #fff;
  border-radius: var(--asf-radius, 5px);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.asf-mobile-trigger:hover,
.asf-mobile-trigger:focus {
  opacity: .85;
  color: #fff;
  text-decoration: none;
}

.asf-mobile-trigger__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.3);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
}

/* ================================================================
   Overlay backdrop
   ================================================================ */
.asf-overlay-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.asf-overlay-backdrop.asf-overlay-open {
  display: block;
  opacity: 1;
}

/* ================================================================
   Overlay header & footer (mobile only — hidden on desktop)
   ================================================================ */
.asf-overlay-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--asf-border, #e4e4e4);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.asf-overlay-header__title {
  font-weight: 700;
  font-size: 16px;
}
.asf-overlay-close {
  font-size: 20px;
  color: var(--asf-text, #1a1a1a);
  text-decoration: none;
  line-height: 1;
  opacity: .7;
  transition: opacity 0.15s;
}
.asf-overlay-close:hover { opacity: 1; color: var(--asf-text, #1a1a1a); text-decoration: none; }

.asf-overlay-footer {
  display: none;
  padding: 16px 20px;
  border-top: 1px solid var(--asf-border, #e4e4e4);
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 2;
}

.asf-overlay-apply {
  display: block;
  text-align: center;
  padding: 12px 20px;
  background: var(--asf-accent, #2563eb);
  color: #fff;
  border-radius: var(--asf-radius, 5px);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.15s ease;
}
.asf-overlay-apply:hover,
.asf-overlay-apply:focus {
  opacity: .85;
  color: #fff;
  text-decoration: none;
}

/* ================================================================
   Sidebar in overlay mode (mobile)
   ================================================================ */
.asf-sidebar.asf-overlay-open {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(360px, 92vw);
  max-width: 100vw;
  height: 100dvh;
  overflow-y: auto;
  z-index: 9999;
  background: #fff;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}

/* Before open: slide off-screen to the left */
.asf-sidebar--mobile-hidden {
  position: fixed !important;
  transform: translateX(-110%) !important;
  visibility: hidden;
}

/* ================================================================
   Card token output helpers
   ================================================================ */
.asf-token-label {
  font-weight: 600;
  margin-right: 4px;
  color: var(--asf-text-muted);
  font-size: .9em;
}
.asf-token-value {
  color: var(--asf-text);
}
.asf-card__img {
  width: 100%;
  height: auto;
  display: block;
}
.asf-card__title-link {
  text-decoration: none;
  color: inherit;
}
.asf-card__title-link:hover {
  text-decoration: underline;
}

/* ================================================================
   SKU image gallery (from {sku_images:...} token)
   ================================================================ */
.asf-sku-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.asf-sku-images .asf-sku-img {
  flex: 1 1 auto;
  min-width: 0;
  object-fit: cover;
}
