/**
 * Shop archive filter bar.
 *
 * Deliberately not a form: no dropdowns, no "Bruk filter" button, nothing to
 * submit. One glass card holding rows of chips, each row labelled, so the
 * whole catalogue can be narrowed in a single tap. The chips have the same
 * 8px corners and solid accent as the «Se boken gratis» buttons, and only a
 * tight shadow, so nothing gets clipped where a row scrolls on small screens.
 */

.dp-shop-filters {
  --dp-chip-radius: 8px;

  width: var(--dp-width);
  max-width: 1200px;
  margin: 0 auto 28px;
  padding: 18px 20px 14px;
  border: 1px solid rgba(19, 36, 64, 0.07);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  box-shadow:
    0 14px 40px rgba(57, 44, 115, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.dp-shop-filters__groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dp-shop-filters__group {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.dp-shop-filters__group-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dp-text-muted);
}

.dp-shop-filters__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dp-shop-filters__chip {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid rgba(19, 36, 64, 0.12);
  border-radius: var(--dp-chip-radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(19, 36, 64, 0.05);
  color: #202341;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.18s ease, background 0.18s ease,
    box-shadow 0.2s ease, color 0.18s ease;
}

@media (hover: hover) {
  .dp-shop-filters__chip:not(.is-active):hover {
    border-color: rgba(91, 63, 214, 0.45);
    background: #f7f5ff;
    color: #5b3fd6;
  }
}

.dp-shop-filters__chip:focus-visible {
  outline: 2px solid var(--dp-accent);
  outline-offset: 2px;
}

.dp-shop-filters__chip:active {
  transform: scale(0.97);
}

.dp-shop-filters__chip.is-active {
  border-color: #5b3fd6;
  background: #5b3fd6;
  box-shadow: 0 2px 6px rgba(91, 63, 214, 0.28);
  color: #fff;
}

.dp-shop-filters__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(19, 36, 64, 0.07);
}

.dp-shop-filters__count {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--dp-text-muted);
}

.dp-shop-filters__reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(19, 36, 64, 0.1);
  border-radius: var(--dp-chip-radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--dp-text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.dp-shop-filters__reset:hover {
  border-color: rgba(106, 90, 224, 0.35);
  background: #fff;
  color: var(--dp-accent-strong);
}

.dp-shop-filters__reset[hidden] {
  display: none;
}

/* ── Grid interaction ─────────────────────────────────────────────────── */

.dp-product-tile.is-filtered-out {
  display: none;
}

.dp-product-grid[data-filter-grid] {
  transition: opacity 0.18s ease;
}

.dp-product-grid[data-filter-grid].is-empty {
  display: none;
}

/* ── Empty state ──────────────────────────────────────────────────────── */

.dp-shop-filters__empty {
  width: var(--dp-width);
  max-width: 520px;
  margin: 8px auto 0;
  padding: 32px 28px;
  border: 1px dashed rgba(19, 36, 64, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.dp-shop-filters__empty[hidden] {
  display: none;
}

.dp-shop-filters__empty-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}

.dp-shop-filters__empty-copy {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--dp-text-soft);
}

.dp-shop-filters__empty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--dp-chip-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 100%),
    linear-gradient(135deg, rgba(111, 92, 246, 0.96), rgba(79, 70, 229, 0.97));
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* ── Small screens ────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .dp-shop-filters {
    padding: 16px 0 12px;
    border-radius: 20px;
  }

  .dp-shop-filters__group {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .dp-shop-filters__group-label {
    padding-inline: 16px;
  }

  /* Chips scroll horizontally instead of stacking into four cramped rows
     (only below 360px; wider phones fit, see below). The inline padding
     keeps the first chip in line with the label, scroll-padding stops the
     snap from pulling it flush to the card edge, and the block padding,
     taken back by the negative margin, leaves room for the active shadow. */
  .dp-shop-filters__chips {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
    padding: 2px 16px 8px;
    margin-block: -2px -8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .dp-shop-filters__chips::-webkit-scrollbar {
    display: none;
  }

  .dp-shop-filters__chip {
    flex: 0 0 auto;
    justify-content: center;
    padding-inline: 11px;
    scroll-snap-align: start;
  }

  .dp-shop-filters__foot {
    margin-inline: 16px;
  }
}

/* On phones each row fills the card edge to edge, so the age row fits
   without sideways scrolling down to 360px wide screens. */
@media (max-width: 480px) {
  .dp-shop-filters__chip {
    flex: 1 1 auto;
  }
}

@media (max-width: 380px) {
  .dp-shop-filters__chips {
    gap: 5px;
  }

  .dp-shop-filters__chip {
    padding-inline: 9px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dp-shop-filters__chip,
  .dp-product-grid[data-filter-grid] {
    transition: none;
  }

  .dp-shop-filters__chip:active {
    transform: none;
  }
}
