/* Farm directory — filter sidebar & custom controls (monochrome editorial) */

:root {
  --b-header-total-height: 132px;
  --b-directory-sidebar-width: clamp(300px, 28vw, 360px);
}

/* Layout */
html.b-editorial body.page-app .app.b-directory {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

html.b-editorial body.page-app .b-directory-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--b-directory-sidebar-width) minmax(0, 1fr);
  border-top: 1px solid #000;
  align-items: stretch;
  width: 100%;
  padding: 0;
  gap: 0;
}

/* Sidebar */
.b-filter-sidebar {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: var(--b-directory-sidebar-width);
  min-width: var(--b-directory-sidebar-width);
  max-width: var(--b-directory-sidebar-width);
  background: #fff;
  border-right: 1px solid #000;
  overflow-x: hidden;
}

html.b-editorial body.page-app .b-filter-sidebar {
  align-self: stretch;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 28px 24px;
}

.b-filter-sidebar.panel.filters {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  grid-template-rows: none;
}

.b-filter-sidebar .panel-head,
.b-filter-sidebar .filters-sheet__header,
.b-filter-sidebar .filters-sheet-backdrop {
  display: none;
}

.b-filter-sidebar__header {
  flex: 0 0 auto;
}

.b-filter-sidebar__header-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.b-filter-status {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 14px;
  padding: 0 0 24px;
  margin-bottom: 22px;
  border-bottom: 1px solid #000;
}

.b-filter-status__text {
  min-width: 0;
}

.b-filter-status__count {
  display: block;
  font-family: var(--b-font-display, "Roboto Condensed", "Arial Narrow", sans-serif);
  font-size: clamp(1.35rem, 1.6vw, 1.75rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: #000;
}

.b-filter-status__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #666;
}

.b-filter-sidebar.panel.filters .b-filter-status__reset.filters-reset__btn,
html.b-editorial body.page-app .b-filter-sidebar .b-filter-status__reset.filters-reset__btn {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1.5px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  display: grid;
  place-items: center;
  gap: 0;
  font: inherit;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.b-filter-sidebar.panel.filters .b-filter-status__reset.filters-reset__btn:hover,
html.b-editorial body.page-app .b-filter-sidebar .b-filter-status__reset.filters-reset__btn:hover {
  background: #000;
  color: #fff;
  border-color: #000;
}

.b-filter-sidebar.panel.filters .b-filter-status__reset.filters-reset__btn:focus-visible,
html.b-editorial body.page-app .b-filter-sidebar .b-filter-status__reset.filters-reset__btn:focus-visible {
  outline: 3px solid #000;
  outline-offset: 3px;
  box-shadow: none;
}

.b-filter-sidebar.panel.filters .b-filter-status__reset.filters-reset__btn:active,
html.b-editorial body.page-app .b-filter-sidebar .b-filter-status__reset.filters-reset__btn:active {
  background: #000;
  color: #fff;
}

.b-filter-sidebar.panel.filters .b-filter-status__reset.filters-reset__btn .ph,
html.b-editorial body.page-app .b-filter-sidebar .b-filter-status__reset.filters-reset__btn .ph {
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
  opacity: 1;
}

.b-filter-status[data-state="empty"] .b-filter-status__count {
  color: #000;
}

/* Nur Mobile-Drawer — auf Desktop ausblenden */
.b-filter-sidebar__close {
  --b-filter-header-btn-size: 2.75rem;
  display: none;
  flex-shrink: 0;
  box-sizing: border-box;
  width: var(--b-filter-header-btn-size, 2.75rem);
  height: var(--b-filter-header-btn-size, 2.75rem);
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1.5px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.b-filter-sidebar__close:hover {
  background: #000;
  color: #fff;
}

.b-filter-sidebar__close .ph {
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
}

@media (max-width: 1200px) {
  .b-filter-status__count {
    font-size: 1.2rem;
  }

  .b-filter-status__hint {
    font-size: 0.58rem;
  }
}

.b-filter-sidebar__scroll {
  flex: 0 0 auto;
  overflow: visible;
  margin: 0 -4px;
  padding: 0 4px;
}

.b-filters {
  display: grid;
}

.b-filter-group {
  padding: 22px 0;
  border-bottom: 1px solid var(--b-line-soft, #d8d8d8);
}

.b-filter-group:last-of-type {
  border-bottom: 0;
}

.b-filter-group__title {
  margin: 0 0 14px;
  font-family: var(--b-font-display, inherit);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #000;
}

.b-filter-group--collapsible > .b-filter-group__toggle {
  width: 100%;
  min-height: 46px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0;
  font-family: var(--b-font-display, inherit);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.b-filter-group--collapsible > .b-filter-group__toggle .b-filter-group__toggle-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.b-filter-chevron {
  flex-shrink: 0;
  font-size: 1.35rem;
  line-height: 1;
  transition: transform 0.16s ease;
}

.b-filter-group--collapsible.is-open > .b-filter-group__toggle .b-filter-chevron,
.variety-group.is-open .b-filter-chevron {
  transform: rotate(180deg);
}

.b-filter-group__body {
  margin-top: 14px;
}

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

/* Custom select */
.b-custom-select {
  position: relative;
  width: 100%;
  z-index: 0;
}

.b-custom-select[data-open="true"] {
  z-index: 200;
}

.b-custom-select + .b-custom-select {
  margin-top: 12px;
}

.b-custom-select__button {
  width: 100%;
  min-height: 50px;
  border: 1.5px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.b-custom-select__button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.b-custom-select__value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  font-weight: 700;
}

.b-custom-select__value .b-flag,
.b-custom-select__list [role="option"] .b-flag {
  flex-shrink: 0;
}

.b-custom-select__chevron {
  flex-shrink: 0;
  color: #000;
}

.b-custom-select[data-open="true"] .b-custom-select__chevron {
  transform: rotate(180deg);
}

.b-custom-select__list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  pointer-events: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1.5px solid #000;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.b-custom-select__list[hidden] {
  display: none;
}

.b-custom-select__list [role="option"] {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #000;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
}

.b-custom-select__list [role="option"][data-disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.b-custom-select__list [role="option"][aria-selected="true"] {
  font-weight: 900;
  background: #e5dfdb;
  color: #000;
}

.b-custom-select__list [role="option"]:hover,
.b-custom-select__list [role="option"][data-active="true"] {
  background: #000;
  color: #fff;
}

.b-custom-select__list [role="option"][aria-selected="true"]:hover,
.b-custom-select__list [role="option"][aria-selected="true"][data-active="true"] {
  background: #e5dfdb;
  color: #000;
}

.b-native-select-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

/* Checkbox rows (coffee types) */
.b-filter-check-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.b-filter-sidebar .b-filter-check-stack .variety-group {
  margin-bottom: 0;
}

.b-filter-check-row,
.b-filter-sidebar .variety-group__head.b-filter-check-row {
  min-height: 48px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1.5px solid #000;
  border-radius: 0;
  margin-bottom: 0;
  padding: 0 14px;
  background: #fff;
  overflow: visible;
}

.b-filter-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #000;
}

.b-filter-check-row__label--family {
  flex: 1;
  cursor: pointer;
}

.b-filter-check-row__label--family input[type="checkbox"] {
  pointer-events: auto;
}

.b-filter-check-row label,
.b-filter-check-row .b-filter-check-row__label {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #000;
  cursor: pointer;
}

.b-filter-check-row__name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b-filter-check-row__count {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #555;
  white-space: nowrap;
}

.b-filter-check-row__toggle,
.b-filter-sidebar .variety-group__toggle.b-filter-check-row__toggle {
  flex-shrink: 0;
  align-self: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  color: #000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.b-filter-sidebar .variety-group__toggle.b-filter-check-row__toggle:hover {
  background: transparent;
  color: #000;
}

.b-filter-sidebar .variety-group__toggle.b-filter-check-row__toggle .ph,
.b-filter-sidebar .variety-group__toggle.b-filter-check-row__toggle .b-filter-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.b-filter-variety-panel {
  border: 0;
  padding: 12px 0 4px;
  min-width: 0;
}

.b-filter-variety-panel[hidden] {
  display: none;
}

.variety-group.is-open .b-filter-variety-panel {
  display: block;
}

/* Cultivation subsections */
.b-filter-subsection + .b-filter-subsection {
  margin-top: 22px;
}

.b-filter-subsection__title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000;
}

/* Range */
.b-range {
  display: grid;
  gap: 12px;
}

.b-range__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #000;
}

.b-range__value {
  font-weight: 700;
  color: #555;
}

.b-filter-sidebar input[type="range"] {
  width: 100%;
  accent-color: #000;
}

.b-filter-sidebar .range-single,
.b-filter-sidebar .range-dual {
  position: relative;
  height: 28px;
}

.b-filter-sidebar .range-single__fill,
.b-filter-sidebar .range-dual__fill {
  background: #000;
}

.b-filter-sidebar .range-single__input,
.b-filter-sidebar .range-dual__input {
  accent-color: #000;
}

/* Filter options (harvest months, features, varieties) */
.b-filter-option-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.b-filter-option-grid:not(.b-filter-harvest-grid) .sub__checks,
.b-filter-option-grid.sub__checks:not(.b-filter-harvest-grid) {
  border-left: 1px dotted #000;
  padding-left: 16px;
}

/* Higher specificity than app.css #filterPanelBody .sub__checks { 1fr } */
.b-filter-sidebar #filterPanelBody .b-filter-harvest-grid.sub__checks,
.b-filter-sidebar #filterPanelBody .b-filter-harvest-grid.sub__checks.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border-left: 0;
  padding-left: 0;
}

.b-filter-sidebar #filterPanelBody .b-filter-variety-panel .b-filter-option-grid.sub__checks {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.b-filter-option-grid.checks {
  grid-template-columns: 1fr;
}

.b-filter-variety-panel .b-filter-option-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.b-filter-option {
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.b-filter-option input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #000;
}

.b-filter-option__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #000;
}

.b-filter-option .ph {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: #000;
}

/* No hover frame from legacy app.css (.sub__check:hover / .check:hover) */
.b-filter-sidebar .sub__check:hover,
.b-filter-sidebar .check:hover,
.b-filter-sidebar .b-filter-option:hover {
  border: 0;
  box-shadow: none;
}

/* Hide legacy form chrome inside sidebar */
.b-filter-sidebar .field > .description:not(.filter-section__head) {
  display: none;
}

.b-filter-sidebar .dropdown .description {
  display: none;
}

.b-filter-sidebar .panel-body {
  padding: 0;
  gap: 0;
}

/* Main content — stabiler Content-Wrapper für Hero, Suche und Ergebnisse */
html.b-editorial body.page-app .b-directory-main {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(32px, 5vw, 72px) clamp(32px, 5vw, 72px) 80px;
}

html.b-editorial body.page-app .b-directory-main__inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  box-sizing: border-box;
}

html.b-editorial body.page-app .b-directory-main__inner > .b-directory-hero,
html.b-editorial body.page-app .b-directory-main__inner .b-directory-search,
html.b-editorial body.page-app .b-directory-main__inner > .b-directory-results,
html.b-editorial body.page-app .b-directory-main__inner > .site-footer,
html.b-editorial body.page-app .b-directory-results > .b-farm-list,
html.b-editorial body.page-app .b-directory-results > .b-results-empty,
html.b-editorial body.page-app .b-directory-results > .b-results-loading {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

html.b-editorial body.page-app .b-directory-main__inner > .b-directory-hero {
  display: block;
  padding-bottom: 28px;
}

html.b-editorial body.page-app .b-directory-main__inner > .b-directory-results {
  display: block;
}

html.b-editorial body.page-app .b-directory-main__inner > .site-footer {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-inline: 0;
}

html.b-editorial body.page-app .b-directory-results .b-results-error {
  width: 100%;
  border: 1.5px solid #000;
  padding: clamp(28px, 4vw, 52px);
  background: #fff;
  box-sizing: border-box;
}

html.b-editorial body.page-app .b-directory-results .b-results-error strong {
  display: block;
  font-family: var(--b-font-display, inherit);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000;
}

html.b-editorial body.page-app .b-directory-results .b-results-error p {
  margin: 12px 0 0;
  color: #555;
  font-size: 1rem;
  line-height: 1.45;
}

/* Focus */
.b-filter-sidebar :focus-visible,
.b-directory-main :focus-visible {
  outline: 3px solid #000;
  outline-offset: 3px;
}

/* Hidden sheet toggle for FAB */
.b-filter-sidebar__sheet-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile drawer */
@media (max-width: 900px) {
  html.b-editorial body.page-app .site-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  html.b-editorial body.page-app .b-directory-layout {
    display: block;
    min-height: auto;
    border-top: 0;
  }

  html.b-editorial body.page-app .b-filter-sidebar,
  html.b-editorial body.page-app .b-filter-sidebar.panel.filters {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
    z-index: 12500;
    width: min(92vw, 420px);
    min-width: 0;
    max-width: min(92vw, 420px);
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    border-right: 1.5px solid #000;
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-bottom: max(24px, calc(24px + env(safe-area-inset-bottom, 0px)));
    background: #fff;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.14);
  }

  .b-filter-sidebar__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.b-filter-open.page-app .b-filter-sidebar,
  html.b-editorial.app--filters-sheet-open body.page-app .b-filter-sidebar,
  html.b-editorial.app--filters-sheet-open body.page-app .b-filter-sidebar.panel.filters {
    transform: translateX(0);
    visibility: visible;
  }

  /* Backdrop nur über Ergebnisbereich — nicht über body::before (liegt sonst über dem Drawer) */
  body.b-filter-open.page-app .b-directory-main::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100lvh;
    z-index: 12400;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: auto;
  }

  body.b-filter-open.page-app .b-filter-sidebar,
  html.b-editorial.app--filters-sheet-open body.page-app .b-filter-sidebar {
    z-index: 12500;
  }

  body.b-filter-open {
    overflow: hidden;
  }

  html.b-editorial body.page-app .b-filter-status {
    padding-bottom: 18px;
    margin-bottom: 18px;
  }

  html.b-editorial body.page-app .b-filter-sidebar__close {
    display: inline-flex;
  }

  html.b-editorial body.page-app .b-directory-main {
    height: auto;
    overflow: visible;
    padding: 32px var(--b-space-page, 1rem) 80px;
  }

  html.b-editorial body.page-app .b-floating-filter {
    display: grid;
  }
}

@media (min-width: 901px) {
  html.b-editorial body.page-app .b-floating-filter {
    display: none;
  }

  html.b-editorial body.page-app .b-filter-sidebar__close {
    display: none !important;
  }
}
