/* ============================================================
   Filter sheet — full-screen modal for list screen filters + sort.
   Same z-index family as search overlay; opens above pullup/nav.
   Apply commits, X discards, Reset clears within sheet only.
   ============================================================ */

.filter-sheet {
  position: absolute;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity var(--duration-base) var(--easing-standard),
    transform var(--duration-base) var(--easing-standard);
}

.filter-sheet[data-active] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.filter-sheet[hidden] {
  display: none;
}

/* ---------- Header ---------- */

.filter-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  padding-top: max(var(--space-3), env(safe-area-inset-top));
  border-bottom: 1px solid var(--color-border-subtle);
}

.filter-sheet__title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.filter-sheet__close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  transition: background-color var(--duration-fast) var(--easing-standard);
}

.filter-sheet__close:hover {
  background: var(--color-surface-tonal);
}

.filter-sheet__close svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
}

/* ---------- Body ---------- */

.filter-sheet__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4);
}

.filter-sheet__section {
  margin-bottom: var(--space-7);
}

.filter-sheet__section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.filter-sheet__section-sub {
  margin-left: var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-tertiary);
}

/* ---------- Sort options (radio-style) ---------- */

.filter-sheet__sort {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-sheet__sort-option {
  position: relative;
  text-align: left;
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  transition:
    background-color var(--duration-fast) var(--easing-standard),
    border-color var(--duration-fast) var(--easing-standard),
    color var(--duration-fast) var(--easing-standard);
}

.filter-sheet__sort-option:hover {
  border-color: var(--color-border-default);
}

.filter-sheet__sort-option[aria-pressed="true"] {
  background: var(--color-brand-primary-tint);
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
  font-weight: var(--font-weight-medium);
}

.filter-sheet__sort-option[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  right: var(--space-4);
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B5635B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l5 5L20 7'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ---------- Filter chip groups ---------- */

.filter-sheet__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-sheet__chip {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  transition:
    background-color var(--duration-fast) var(--easing-standard),
    color var(--duration-fast) var(--easing-standard),
    border-color var(--duration-fast) var(--easing-standard);
}

.filter-sheet__chip:hover {
  border-color: var(--color-border-default);
}

.filter-sheet__chip[aria-pressed="true"] {
  background: var(--color-brand-primary);
  color: var(--color-text-on-brand);
  border-color: var(--color-brand-primary);
}

/* ---------- Footer ---------- */

/* ---------- Search CTA (below dietary) ---------- */

.filter-sheet__search-cta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-tonal);
  border: 1px dashed var(--color-border-default);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-align: left;
  transition: all var(--duration-fast) var(--easing-standard);
}

.filter-sheet__search-cta:hover {
  background: var(--color-brand-primary-tint);
  border-color: var(--color-brand-primary-soft);
  color: var(--color-brand-primary);
}

.filter-sheet__search-cta svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-sheet__footer {
  flex-shrink: 0;
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
}

.filter-sheet__reset {
  flex: 1;
  height: 48px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  transition: background-color var(--duration-fast) var(--easing-standard);
}

.filter-sheet__reset:hover {
  background: var(--color-surface-tonal);
}

.filter-sheet__apply {
  flex: 2;
  height: 48px;
  background: var(--color-brand-primary);
  color: var(--color-text-on-brand);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  transition: background-color var(--duration-fast) var(--easing-standard);
}

.filter-sheet__apply:hover {
  background: var(--color-brand-primary-hover);
}

/* ---------- Collapsible filter groups (accordion) ---------- */

.filter-sheet__group {
  margin-bottom: 0;
  border-top: 1px solid var(--color-border-subtle);
}

.filter-sheet__group[hidden] { display: none; }

.filter-sheet__group-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4) 0;
  text-align: left;
}

.filter-sheet__group-title {
  flex: 1;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.filter-sheet__group-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-brand-primary);
  color: var(--color-text-on-brand);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.filter-sheet__group-chev {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: var(--color-text-tertiary);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--duration-fast) var(--easing-standard);
}

.filter-sheet__group-head[aria-expanded="true"] .filter-sheet__group-chev {
  transform: rotate(90deg);
}

.filter-sheet__group-body {
  padding-bottom: var(--space-5);
}
