/**
 * @file
 * Exposed form header + filter bar — shared by Search and Publikationen.
 *
 * DOM (after preprocess):
 *   .search-exposed-form                     ← grid container
 *     h1.search-page__title                  ← col 1, row 1
 *     <form.views-exposed-form> [display:contents]
 *       .search-exposed-form__bar-wrapper    ← col 2, row 1
 *         span.search-exposed-form__bar-label
 *         .search-exposed-form__bar (pill)
 *       .search-exposed-form__filters        ← row 2, full width
 */

/* ═══════════════════════════════════════════════════════
   HEADER — 2-column grid
   ═══════════════════════════════════════════════════════ */

.search-exposed-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--spacing-400, 32px);
  row-gap: var(--spacing-1000, 80px);
  max-width: 1720px;
  width: 100%;
  margin-inline: auto;
  margin-block-start: 100px;
}

/* Form transparent to grid — its two container divs become direct grid items */
.view-id-search .views-exposed-form,
.view-id-publikationen .views-exposed-form {
  display: contents;
}

/* H1 — col 1, row 1 */
.search-page__title {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-h1, 36px);
  font-weight: var(--font-weight-bold, 700);
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--trust, #550a2d);
  margin: 0;
}

/* Search bar wrapper (label + pill) — col 2, row 1 */
.search-exposed-form__bar-wrapper {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--spacing-200, 16px);
}

.search-exposed-form__bar-label {
  color: var(--trust, #550a2d);
  font-variant-numeric: slashed-zero;
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-size-Paragraph-paragraph-m, 22px);
  font-style: normal;
  font-weight: var(--font-weight-bold, 700);
  line-height: 1.5;
  letter-spacing: -0.22px;
  white-space: nowrap;
}

/* Filters — row 2, full width, children side by side */
.search-exposed-form__filters {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: var(--spacing-300, 24px);
  position: relative;
  padding-block: var(--spacing-050, 4px);
}

/* Full-viewport-width top and bottom borders */
.search-exposed-form__filters::before,
.search-exposed-form__filters::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: var(--border-width-regular, 2px);
  background: var(--ambience, #ebe6e1);
}

.search-exposed-form__filters::before {
  top: 0;
}

.search-exposed-form__filters::after {
  bottom: 0;
}

.search-exposed-form__filters .js-form-item,
.search-exposed-form__filters .form-item {
  margin: 0;
}

/* Filter toggle button — at the start of the filter bar.
   button__container defaults to inline-size: 100%, override to auto. */
.search-exposed-form__filters .pub-filter-toggle-wrapper {
  flex-shrink: 0;
  inline-size: auto;
}

/* Result count — pushed to the far right of the filter bar. */
.search-exposed-form__filters .pub-result-count {
  margin-inline-start: auto;
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-label-s);
  font-weight: var(--font-weight-bold, 700);
  color: var(--trust, #550a2d);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   PILL — input + submit button
   ═══════════════════════════════════════════════════════ */

.search-exposed-form__bar {
  display: flex;
  align-items: center;
  height: 60px;
  background: var(--white, #ffffff);
  border-radius: var(--border-radius-round, 1000px);
  box-shadow: inset 0 0 0 2px var(--ambience, #ebe6e1);
  padding-inline-end: var(--spacing-100, 8px);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
  overflow: hidden;
  max-width: 480px;
}

.view-id-publikationen .search-exposed-form__bar {
  max-width: 990px;
}

.search-exposed-form__bar:focus-within {
  box-shadow: inset 0 0 0 4px var(--accent, #fa263a);
}

.search-exposed-form__bar .js-form-item,
.search-exposed-form__bar .form-item {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* Hide the Drupal label — accessible but invisible */
.search-exposed-form__bar label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-exposed-form__bar input[type="text"],
.search-exposed-form__bar input[type="search"],
.search-exposed-form__bar .form-text {
  display: block;
  width: 100%;
  height: 60px;
  border: none;
  outline: none;
  background: transparent;
  padding-inline-start: var(--spacing-300, 24px);
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-paragraph-s, 18px);
  font-weight: var(--font-weight-regular, 400);
  letter-spacing: -0.01em;
  color: var(--trust, #550a2d);
  appearance: none;
  -webkit-appearance: none;
}

.search-exposed-form__bar input::placeholder {
  color: var(--ambience-700, #998c80);
}

.search-exposed-form__bar .form-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.search-exposed-form__bar .form-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-round, 1000px);
  background-color: var(--attitude, #ffa0fa);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='6.5' cy='6.5' r='4' stroke='%23550a2d' stroke-width='1.5'/%3E%3Cpath d='M9.5 9.5L13 13' stroke='%23550a2d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  color: transparent;
  font-size: 0;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.3s ease;
  appearance: none;
}

.search-exposed-form__bar .form-submit:hover {
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════
   FILTER TAB BAR
   ═══════════════════════════════════════════════════════ */

.search-exposed-form__filters label {
  display: none;
}

/* Topics select is hidden in the filter bar — JS moves it into the panel */
.view-id-publikationen .search-exposed-form__filters .js-form-item-facet-topics,
.view-id-publikationen .search-exposed-form__filters .form-item-facet-topics {
  display: none;
}

/* ═══════════════════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════════════════ */

.pub-filter-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.view-id-publikationen.is-pub-filter-open .pub-filter-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════
   SLIDE-IN FILTER PANEL
   ═══════════════════════════════════════════════════════ */

.pub-filter-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(470px, 100vw);
  z-index: 100;
  background: var(--white, #ffffff);
  transform: translateX(-100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.view-id-publikationen.is-pub-filter-open .pub-filter-panel {
  transform: translateX(0);
}

/* ── Panel header ─────────────────────────────────────── */

.pub-filter-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-400, 32px) var(--spacing-500, 40px);
  border-bottom: var(--border-width-regular, 2px) solid var(--ambience, #ebe6e1);
}

.pub-filter-panel__reset {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-100, 8px);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: var(--font-weight-bold, 700);
  font-size: var(--text-size-label-s, 16px);
  color: var(--trust, #550a2d);
  line-height: 1.1;
}

.pub-filter-panel__reset:hover {
  opacity: 0.7;
}

.pub-filter-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: var(--spacing-050, 4px);
  cursor: pointer;
  color: var(--trust, #550a2d);
}

.pub-filter-panel__close:hover {
  opacity: 0.7;
}

/* ── Filter sections ──────────────────────────────────── */

.pub-filter-section {
  border-bottom: var(--border-width-regular, 2px) solid var(--ambience, #ebe6e1);
}

.pub-filter-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--spacing-400, 32px) var(--spacing-500, 40px) var(--spacing-400, 32px) var(--spacing-400, 32px);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: var(--font-weight-bold, 700);
  font-size: var(--text-label-m, 20px);
  color: var(--trust, #550a2d);
  line-height: 1.1;
  text-align: left;
}

.pub-filter-section__toggle .icon {
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.pub-filter-section--closed .pub-filter-section__toggle .icon {
  transform: rotate(180deg);
}

.pub-filter-section__content {
  padding: 0 var(--spacing-500, 40px) var(--spacing-500, 40px) var(--spacing-400, 32px);
  overflow: hidden;
}

.pub-filter-section--closed .pub-filter-section__content {
  display: none;
}

/* Hide native Drupal label inside section */
.pub-filter-section__content > label:first-child,
.pub-filter-section__content .js-form-item > label:first-child,
.pub-filter-section__content .form-item > label:first-child {
  display: none;
}

/* ── Topics form-item wrapper ─────────────────────────── */

.pub-filter-panel .js-form-item-facet-topics,
.pub-filter-panel .form-item-facet-topics {
  padding: 0;
  margin: 0;
}

.pub-filter-panel .js-form-item-facet-topics > label,
.pub-filter-panel .form-item-facet-topics > label {
  display: none;
}

/* ── Chip list — flex-wrap container for bosch:chip components ── */

.pub-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Scale to match events panel chips */
.pub-filter-chips .chip {
  --chip-height: 42px;
  --chip-font-size: 14px;
  padding-inline: calc(var(--spacing-300, 24px) * 0.8);
}

.pub-filter-chips .chip__icon {
  width: 13px;
  height: 13px;
}

/* ── Apply button ─────────────────────────────────────── */

.pub-filter-section__apply {
  display: block;
  width: fit-content;
  min-width: 160px;
  margin-top: var(--spacing-400, 32px);
  margin-inline: auto;
  padding: 2px var(--spacing-300, 24px);
  height: 44px;
  border: none;
  border-radius: var(--border-radius-round, 1000px);
  background-color: var(--attitude, #ffa0fa);
  color: var(--trust, #550a2d);
  font-weight: var(--font-weight-bold, 700);
  font-size: var(--text-button-s, 18px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.pub-filter-section__apply:hover {
  background-color: var(--attitude-500, #cc80c8);
}

.search-exposed-form .js-form-item-sort-by {
  display: none;
}

.search-filter {
  display: flex;
  align-items: center;
  gap: var(--spacing-500, 40px);
  overflow-x: auto;
  scrollbar-width: none;
}

.search-filter::-webkit-scrollbar {
  display: none;
}

.search-filter .bef-link,
.search-filter .bef-link:link,
.search-filter .bef-link:visited,
.search-filter .bef-link:hover,
.search-filter .bef-link:focus,
.search-filter .bef-link:active {
  color: var(--trust-trust, #550A2D);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-100, 8px);
  height: 32px;
  padding-block: var(--spacing-100, 8px);
  padding-inline: var(--spacing-025, 2px);
  border-radius: var(--border-radius-s, 2px);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-filter .bef-tab__label {
  color: var(--trust-trust, #550A2D);
  font-variant-numeric: slashed-zero;
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-size-Button-button-text-size-s, 18px);
  font-style: normal;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.18px;
}

.search-filter .bef-link--selected .bef-tab__label {
  font-weight: var(--font-weight-bold, 700);
}

.search-filter .bef-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ambience, #ebe6e1);
  color: var(--trust-trust, #550A2D);
  font-variant-numeric: slashed-zero;
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-label-s);
  font-style: normal;
  font-weight: var(--font-weight-bold, 700);
  line-height: 1.1;
  letter-spacing: -0.16px;
  padding: var(--spacing-050, 4px) var(--spacing-100, 8px);
  border-radius: var(--border-radius-s, 2px);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — pill input width
   ═══════════════════════════════════════════════════════ */

/* Above ~1400px: restore the fixed wide width on the Publikationen pill */
@media (min-width: 1400px) {
  .view-id-publikationen .search-exposed-form__bar input[type="text"],
  .view-id-publikationen .search-exposed-form__bar input[type="search"],
  .view-id-publikationen .search-exposed-form__bar .form-text {
    width: 990px;
  }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Publikationen header/form padding
   ═══════════════════════════════════════════════════════ */

/* Below 1820px: add side padding so content doesn't touch viewport edge */
@media (max-width: 1819px) {
  .search-exposed-form {
    padding-inline: var(--spacing-600, 48px);
  }
}

@media (max-width: 1199px) {
  .search-exposed-form {
    padding-inline: var(--spacing-400, 32px);
    margin-block-start: var(--spacing-600, 48px);
    row-gap: var(--spacing-600, 48px);
  }
}

@media (max-width: 767px) {
  .search-exposed-form {
    grid-template-columns: 1fr;
    padding-inline: var(--spacing-300, 24px);
    margin-block-start: var(--spacing-400, 32px);
    row-gap: var(--spacing-400, 32px);
  }

  .search-page__title {
    grid-column: 1;
    grid-row: 1;
  }

  .search-exposed-form__bar-wrapper {
    grid-column: 1;
    grid-row: 2;
  }
}

/* ═══════════════════════════════════════════════════════
   SELECT — Filterleiste Publikationen
   ═══════════════════════════════════════════════════════ */

.search-exposed-form__filters select {
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23550a2d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  border-radius: var(--border-radius-s, 2px);
  border: var(--border-width-regular, 2px) solid var(--trust-trust, #550A2D);
  opacity: var(--opacity-visible, 1);
  display: inline-flex;
  height: 41px;
  padding: 2px var(--spacing-500, 40px) 3px var(--spacing-400, 32px);
  justify-content: center;
  align-items: center;
  gap: var(--spacing-150, 12px);
  font-family: var(--font-bosch-sans, 'Bosch Sans'), sans-serif;
  font-size: var(--text-paragraph-s, 18px);
  font-weight: var(--font-weight-bold, 700);
  color: var(--trust, #550a2d);
  cursor: pointer;
}
