/* DESIGN (Rennmaus Filter.html): Quick-Chips + Bottom-Sheet + entfernbare Chips.
   Mobile-first. Palette + font sizes are taken 1:1 from the design (the app tokens
   are now the design's creme/brown/terracotta), so this matches the prototype. */

.rmf {
  --rmf-ease: cubic-bezier(0.22, 1, 0.36, 1);
  margin: 0.5rem 0 0.25rem;
}

/* ---------- Quick-Chips pill row ---------- */
.rmf-quickrow {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rmf-quickrow::-webkit-scrollbar {
  display: none;
}
.rmf-pill {
  flex-shrink: 0;
  cursor: pointer;
  font: inherit;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--rmf-ease), border-color 0.15s, color 0.15s, background 0.15s;
}
.rmf-pill:active {
  transform: scale(0.94);
}
.rmf-pill.is-on {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}
.rmf-pill-count {
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rmf-pill-chev {
  font-size: 11px;
  color: var(--color-text-faint);
}

/* ---------- Active filter chips ---------- */
.rmf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.625rem;
}
.rmf-chip {
  --chip: var(--color-accent);
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: color-mix(in srgb, var(--chip) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--chip) 32%, transparent);
  color: color-mix(in srgb, var(--chip) 78%, #2b2723);
  padding: 6px 8px 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  animation: rmfChipIn 0.22s var(--rmf-ease);
  transition: transform 0.1s;
}
.rmf-chip:active {
  transform: scale(0.94);
}
.rmf-chip-cat {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rmf-chip-val {
  font-weight: 700;
}
.rmf-chip-x {
  font-size: 15px;
  line-height: 1;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--chip) 22%, transparent);
  border-radius: 50%;
}
.rmf-chip-clear {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.rmf-chip-clear .rmf-chip-x {
  display: none;
}
@keyframes rmfChipIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Bottom-Sheet ---------- */
.rmf-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(43, 33, 25, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: rmfScrim 0.2s ease;
}
@keyframes rmfScrim {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.rmf-sheet {
  width: 100%;
  max-width: 460px;
  background: var(--color-bg);
  border-radius: 22px 22px 0 0;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(43, 33, 25, 0.25);
  animation: rmfSheetUp 0.32s var(--rmf-ease);
}
@keyframes rmfSheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.rmf-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-text-faint);
  opacity: 0.5;
  margin: 9px auto 4px;
}
.rmf-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 1rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.rmf-sheet-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text);
}
.rmf-sheet-done {
  background: var(--color-accent);
  color: #fff;
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}
.rmf-sheet-body {
  overflow-y: auto;
  padding: 0.5rem 1rem 1.5rem;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Option list (multi-select checkboxes) ---------- */
.rmf-picker {
  display: flex;
  flex-direction: column;
}
.rmf-search {
  width: 100%;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem 0.875rem;
  font: inherit;
  font-size: 1rem;
  color: var(--color-text);
  outline: none;
  margin: 0.25rem 0 0.375rem;
}
.rmf-search:focus {
  border-color: var(--color-accent);
}
.rmf-optlist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}
.rmf-optlist--scroll {
  max-height: 46vh;
  overflow-y: auto;
}
.rmf-opt {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: none;
  border: none;
  font: inherit;
  padding: 0.75rem 0.375rem;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  border-radius: 10px;
  transition: background 0.12s;
}
.rmf-opt:hover {
  background: var(--color-accent-soft);
}
.rmf-opt.is-on {
  font-weight: 700;
}
.rmf-opt-box {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  font-weight: 800;
  transition: background 0.14s, border-color 0.14s;
}
.rmf-opt.is-on .rmf-opt-box {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.rmf-opt-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rmf-opt-sym {
  width: 22px;
  text-align: center;
  font-size: 16px;
  color: var(--color-text-muted);
}
.rmf-opt-label {
  flex: 1;
}
.rmf-empty {
  padding: 1.1rem 0.375rem;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* ---------- Search bar ---------- */
.rmf-searchbar {
  margin-top: 0.75rem;
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.rmf-search-ico {
  padding-left: 0.875rem;
  font-size: 19px;
  color: var(--color-text-faint);
}
.rmf-searchfield {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 16px;
  color: var(--color-text);
  padding: 0.875rem 0.75rem;
  min-width: 0;
}
.rmf-searchfield::placeholder {
  color: var(--color-text-faint);
}
.rmf-search-clear {
  border: none;
  background: var(--color-accent-soft);
  color: var(--color-text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 0.625rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Bar: Externe-Ahnen toggle + Sortieren — two equal-width chips ---------- */
.rm-bar {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

/* Shared pill: both chips are the SAME size (flex: 1 → equal width). */
.rmf-bar-chip {
  flex: 1 1 0;
  min-width: 0;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.rmf-bar-chip:active {
  transform: scale(0.97);
}
/* Externe-Ahnen active state. */
.rmf-bar-chip.is-on {
  background: var(--color-accent-soft);
  border-color: color-mix(in srgb, var(--color-accent) 32%, transparent);
  color: color-mix(in srgb, var(--color-accent) 78%, #2b2723);
}
.rmf-bar-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.rmf-bar-chip-ico {
  color: var(--color-accent);
  font-weight: 800;
}
.rmf-bar-chip-chev {
  font-size: 11px;
  color: var(--color-text-faint);
}

/* Toggle icon circle on the Externe-Ahnen chip (+ → ✓). */
.rmf-chip-toggle-ico {
  font-size: 14px;
  line-height: 1;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
  transition: background 0.15s, color 0.15s;
}
.rmf-bar-chip.is-on .rmf-chip-toggle-ico {
  background: var(--color-accent);
  color: #fff;
}

/* Desktop: the sheet becomes a centered modal rather than a bottom drawer. */
@media (min-width: 768px) {
  .rmf-scrim {
    align-items: center;
  }
  .rmf-sheet {
    border-radius: 18px;
    max-width: 420px;
    max-height: 70vh;
    animation: rmfChipIn 0.2s var(--rmf-ease);
  }
}
