/* Search-Results — Layout für die Suche-View (suche::page_1).
 *
 * Eingehängt vom Preprocess auf suche::page_1 (Library 'search_results').
 *
 * Strategie: .search-head erbt visuell von .tax-head (gleiche Memphis-Karte,
 * weicher cyan-Schatten, Squiggle-Titel). Die Filter-Pillen unter dem
 * Titel sitzen an derselben Stelle und nutzen dieselben Token wie
 * .year-filter — nur dass hier Inhaltstypen statt Jahren getoggelt werden.
 *
 * Selektoren, die NICHT in tax_head.css oder style.css vorkommen.
 * Memory-Regel 'feedback_use_drupal_native': Sort-Dropdown bleibt das
 * native Drupal-<select>, nur visuell auf Memphis-Look getrimmt.
 */

/* ========== SEARCH-HEAD ==========
 * Gleiche Karte wie .tax-head — wir setzen aber explizite Werte statt
 * @extend, damit Suche-Page funktioniert wenn tax_head-Library nicht
 * mitgeladen ist. (Beide Libraries werden vom Preprocess attached, aber
 * Reihenfolge ist nicht garantiert.)
 */
.search-head {
  background: #fff;
  border-radius: 14px;
  padding: 24px 26px 22px;
  margin-bottom: 22px;
  position: relative;
  box-shadow:
    6px 7px 0 color-mix(in oklab, #2ec5d7 70%, transparent),
    0 1px 0 rgba(45, 42, 80, 0.08);
}

.search-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px 18px;
  margin: 0 0 4px;
}

.search-title {
  font-family: var(--ff-display);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.0;
  margin: 0;
  position: relative;
}

.search-title .squiggle {
  display: block;
  width: 100%;
  max-width: 220px;
  height: 8px;
  margin-top: 8px;
  color: var(--accent);
}

/* Suchbegriff wird im Titel hervorgehoben — kein farbiger BG, nur fett
 * (User-Feedback aus chat6: keine rote Unterlegung). */
.search-title em {
  font-style: normal;
  font-weight: 800;
  color: var(--ink);
}

.search-meta {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
  /* Sitzt im DOM nach der Form/Toolbar, wird per CSS-Layout hochgezogen.
   * Siehe Regel weiter unten: .search-head als Grid-Container ordnet
   * Meta + Toolbar in eine Zeile. */
}
.search-meta strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.search-meta em {
  font-style: italic;
  color: var(--ink);
}

/* ========== TYPE-FILTER (Pillen) ==========
 * Sitzt unten in der search-head, an derselben Stelle wie .year-filter
 * auf tax-head-Karten. Visuell identisch — Drupal liefert hier die
 * exposed-form-Checkboxes, wir bauen sie per CSS auf Pillen um.
 *
 * Die Exposed-Form wird über das Twig-Override (views-view--suche--
 * page-1.html.twig) in den search-head-Block eingehängt, NICHT als
 * separater .view-filters-Div oberhalb der Results.
 */
.type-filter {
  display: flex;
  align-items: center;
  gap: 4px 2px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed rgba(45, 42, 80, 0.18);
}

.type-filter-label {
  font-family: var(--ff-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  margin-right: 8px;
  padding: 5px 0;
  flex-shrink: 0;
}

/* Die Pillen — analog zu .year-filter a, aber gegen Drupal-Checkbox-
 * Markup gestylt (input + label nebeneinander). */
.type-filter .pill {
  font-family: var(--ff-display);
  font-size: 14.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  /* Bootstrap-Trap: colors.css setzt globales a/label-Color, deshalb !important
   * (Memory bootstrap_important_traps). */
  color: var(--ink-soft) !important;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  user-select: none;
}

.type-filter .pill:hover {
  background: #f4f3f8;
  color: var(--ink) !important;
}

.type-filter .pill.on {
  background: var(--ink);
  color: #fff !important;
  transform: rotate(-1.5deg);
}

.type-filter .pill.all.on {
  background: var(--accent);
}

/* Drupal-Checkbox-Input verstecken — der <label> wird zur klickbaren Pille. */
.type-filter input[type="checkbox"] {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* ========== SUCHFELD im search-head: Pillen-Pattern ==========
 * Markup kommt aus views-exposed-form--suche--page-1.html.twig
 * (sauberer Twig-Override mit semantischer Trennung statt
 * monolithischem {{ form }}-Render).
 *
 * Struktur:
 *   .search-pill                          ← die graue Pille
 *     .search-pill__icon                    ← Lupe (SVG)
 *     .search-pill__input                   ← Input (Drupal form-item)
 *     .search-pill__actions                 ← X-Reset + Suchen-Submit
 *   .search-toolbar                       ← Zeile drunter
 *     .search-toolbar__sort                 ← Sort-Dropdown
 */

/* Die Pille — gleicher Pattern wie .search-bar in der Design-Vorlage:
 * 1.5px transparent Border immer da (kein Layout-Shift beim Focus),
 * Focus tauscht Border-Color auf --ink + BG auf weiss. */
.search-pill {
  display: flex;
  align-items: center;
  background: #eff2f6;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 12px;
  margin: 18px 0 0;
  transition: border-color .15s ease, background .15s ease;
}
.search-pill:focus-within {
  background: #fff;
  border-color: var(--ink);
}

.search-pill__icon {
  display: inline-flex;
  align-items: center;
  color: rgba(45, 42, 80, 0.55);
  flex-shrink: 0;
}

.search-pill__input {
  flex: 1;
  min-width: 0;
}
.search-pill__input .form-item {
  margin: 0;
}
.search-pill__input label {
  display: none;
}

/* Input transparent, kein Border, Pille bringt den BG */
.search-pill__input input[name="search_api_fulltext"].form-control {
  width: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 8px 0 !important;
  margin: 0 !important;
  font: inherit;
  font-size: 18px !important;
  font-weight: 500;
  color: var(--ink);
  background: transparent !important;
  height: auto !important;
  box-shadow: none !important;
}
.search-pill__input input[name="search_api_fulltext"].form-control:focus {
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
}
.search-pill__input input[name="search_api_fulltext"]::placeholder {
  color: var(--ink-mute);
  font-weight: 400;
}

/* Buttons in der Pille — X (Reset) klein-rund, Suchen (Submit) breit */
.search-pill__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.search-pill__actions button.btn,
.search-pill__actions .button {
  /* Bootstrap-Defaults aufweichen, aber NICHT BG auf transparent setzen
   * - sonst gewinnt das gegen die spezifischeren ID-Regeln unten. */
  border: 0 !important;
  font: inherit;
  cursor: pointer;
  margin: 0 !important;
}

.search-pill__actions #edit-reset-suche {
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background-color: rgba(45, 42, 80, 0.1) !important;
  border-color: transparent !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease, color .15s ease;
}
.search-pill__actions #edit-reset-suche:hover {
  background-color: var(--ink) !important;
  color: #fff !important;
}

.search-pill__actions #edit-submit-suche {
  background-color: var(--ink) !important;
  border-color: var(--ink) !important;
  color: #fff !important;
  padding: 7px 18px !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  transition: background-color .15s ease;
}
.search-pill__actions #edit-submit-suche:hover {
  background-color: color-mix(in oklab, var(--ink) 85%, #fff) !important;
  border-color: color-mix(in oklab, var(--ink) 85%, #fff) !important;
}

/* ========== TOOLBAR (Zeile mit Sort-Dropdown) ==========
 * Sitzt unter der Suchpille, optisch rechtsbuendig. Treffer-Anzeige
 * rendert das views-view-Template separat (.search-meta).
 */
.search-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 14px;
}

/* Meta + Toolbar in eine Zeile: DOM-Order ist Pille -> Toolbar -> Meta.
 * Loesung: search-toolbar wird flex-Container mit zwei Items (sort rechts),
 * search-meta wird per absolute-Positionierung in dieselbe Zeile gehoben.
 * (search-head ist position:relative am Anfang dieser Datei) */
.search-head .search-meta {
  position: absolute;
  left: 26px;
  /* Toolbar margin-top ist 14px, Toolbar-Hoehe ca. 30px;
   * Toolbar sitzt am unteren Ende der Pille + 14px gap.
   * Meta zentrieren auf Toolbar-Hoehe via bottom anchor. */
  bottom: 26px;
  margin: 0;
  /* Lass Platz fuer Sort-Dropdown rechts */
  max-width: calc(100% - 280px);
}
.search-toolbar__sort .form-item {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ========== RESULT-CARDS ==========
 * Horizontale Card-Liste — Layout-DNA aus der Design-Vorlage
 * (.result-card), Schriften/Farben/Abstaende aus event_row.css und
 * den Theme-Tokens (--ink, --ff-display, etc.) damit es zur Site passt.
 *
 * Markup kommt aus dem Custom-Text-Twig im View-Field "nothing":
 *   .views-row.mb-4
 *     .views-field-nothing > .field-content
 *       .card > .row.g-0
 *         .col-md-4.result-thumb          ← Bild oder Empty-Placeholder
 *         .col-md-8 > .card-body
 *           .result-type                  ← Inhaltstyp-Pille (Veranstaltung etc.)
 *           h4 > a                        ← Titel (Link to entity)
 *           (Excerpt aus search_api_excerpt mit <mark>-Highlights)
 *           .author > p.card-text > small ← Datum
 */

/* Card-Container: weisser Hintergrund, dezenter Border, weiches Hover-Lift */
.view-id-suche.view-display-id-page_1 .views-row {
  margin-bottom: 14px;
}
.view-id-suche.view-display-id-page_1 .views-row .card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(45, 42, 80, 0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}
.view-id-suche.view-display-id-page_1 .views-row .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 42, 80, 0.08);
}

/* Thumb-Spalte: feste Breite analog Vorlage (240px → wir nehmen 200px,
 * fuegt sich besser in das Theme-Grid ein) */
.view-id-suche.view-display-id-page_1 .result-thumb {
  flex: 0 0 240px;
  max-width: 240px;
  background: color-mix(in oklab, var(--ink) 6%, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding: 0;
  overflow: hidden;
}
.view-id-suche.view-display-id-page_1 .result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0; /* Bootstrap rounded-start overriden */
  margin: 0; /* bootstrap_barrio field.css setzt margin-bottom: 1em auf
                .field--type-image img, das gibt grauen Spalt unter dem
                Bild weil .result-thumb-BG durchscheint. */
}

/* Empty-Placeholder wenn kein Bild — gestreift, wie event_row */
.view-id-suche.view-display-id-page_1 .result-thumb-empty {
  width: 100%;
  height: 100%;
  min-height: 120px;
  background: repeating-linear-gradient(
    45deg,
    color-mix(in oklab, var(--ink) 4%, #fff),
    color-mix(in oklab, var(--ink) 4%, #fff) 4px,
    color-mix(in oklab, var(--ink) 8%, #fff) 4px,
    color-mix(in oklab, var(--ink) 8%, #fff) 8px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
}

/* Body: muss die volle Card-Hoehe (= Bildhoehe) einnehmen und Inhalt
 * vertikal zentrieren, sonst klafft unter der Text-Kolumne ein grauer
 * Spalt vom Thumb-BG der durchscheint. */
.view-id-suche.view-display-id-page_1 .col-md-8 {
  flex: 1;
  display: flex;
}
.view-id-suche.view-display-id-page_1 .card-body {
  padding: 18px 22px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

/* Meta-Zeile unten: Inhaltstyp · Datum, eine Zeile, gleiche Schrift */
.view-id-suche.view-display-id-page_1 .result-meta {
  margin-top: 4px;
  font-family: var(--ff-display);
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.view-id-suche.view-display-id-page_1 .result-meta .result-type {
  color: var(--ink-mute);
  font-weight: 600;
}
.view-id-suche.view-display-id-page_1 .result-meta .meta-sep {
  opacity: 0.55;
}
.view-id-suche.view-display-id-page_1 .result-meta .result-date {
  color: var(--ink-mute);
}

/* Titel — wie event-row__title, etwas groesser fuer Search-Results */
.view-id-suche.view-display-id-page_1 .card-body h4 {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.view-id-suche.view-display-id-page_1 .card-body h4 a {
  color: inherit !important;
  text-decoration: none !important;
  border-bottom: 0 !important;
}
.view-id-suche.view-display-id-page_1 .card-body h4 a:hover {
  color: var(--accent) !important;
}

/* Excerpt-Wrapper kommt aus dem Card-Twig (.result-excerpt). Drei
 * Zeilen + Ellipsis. Highlights kommen via <mark>-Tag (Search API
 * Highlight-Processor mit Prefix <mark> / Suffix </mark> konfiguriert,
 * statt dem Default <strong> der mit .search-meta strong kollidiert
 * hatte). */
.view-id-suche.view-display-id-page_1 .card-body {
  font-family: var(--ff-display);
}
.view-id-suche.view-display-id-page_1 .result-excerpt {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Highlight-Marker auf Excerpt UND Titel der Search-Results.
 * Rosa-pastell BG (--accent mit ~18% Alpha), Ink-Farbe. Erbt nichts
 * von Bootstrap-Default (gelb), wir setzen alle relevanten Properties
 * explizit. */
.view-id-suche.view-display-id-page_1 .result-excerpt mark,
.view-id-suche.view-display-id-page_1 .card-title mark {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: inherit;
  padding: 0 4px;
  border-radius: 3px;
}


/* Responsive: ab schmal, Thumb obendrueber statt links */
@media (max-width: 720px) {
  .view-id-suche.view-display-id-page_1 .row.g-0 {
    flex-direction: column;
  }
  .view-id-suche.view-display-id-page_1 .result-thumb {
    flex: 0 0 auto;
    max-width: 100%;
    width: 100%;
    height: 180px;
  }
}

.search-head input[name="search_api_fulltext"]::placeholder {
  color: var(--ink-mute);
  font-weight: 400;
}

/* Drupal-Core js-hide Helper (BEF setzt das auf .form-actions wenn
 * Autosubmit aktiv ist und 'Hide submit when auto-submit on' angehakt
 * ist). Core-CSS hidden.module.css wird hier nicht immer geladen. */
.search-head .form-actions.js-hide,
.search-pill__actions.js-hide {
  display: none;
}

/* ========== SORT-DROPDOWN ==========
 * Drupal-natives <select> auf Memphis-Look getrimmt — kein eigenes JS.
 */
.search-head .form-item-sort-by {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-head .form-item-sort-by label {
  font-family: var(--ff-display);
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 500;
  margin: 0;
}

.search-head select[name="sort_by"] {
  appearance: none;
  -webkit-appearance: none;
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%232d2a50' d='M0 0l5 6 5-6z'/></svg>")
    no-repeat right 12px center;
  border: 1px solid rgba(45, 42, 80, 0.18);
  border-radius: 8px;
  padding: 6px 30px 6px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search-head select[name="sort_by"]:hover {
  border-color: color-mix(in oklab, var(--ink) 30%, rgba(45, 42, 80, 0.18));
}

.search-head select[name="sort_by"]:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ink) 8%, transparent);
}

/* ========== AUTOCOMPLETE-DROPDOWN ==========
 * search_api_autocomplete rendert seine Vorschläge in einem
 * jQuery-UI-Autocomplete-Container — visuell auf unsere Memphis-Optik
 * gebracht. Selektoren werden erst nach erster Verifikation final
 * gesetzt (Modul-Markup im Browser inspizieren).
 *
 * Stub — wird in Block B Schritt "Autocomplete-Dropdown stylen"
 * gefüllt.
 */

/* Nav-Lupe bleibt auch auf der Suche-Page sichtbar — User-Feedback:
 * konsistente Nav-Position ist wichtiger als doppeltes Feld zu vermeiden. */

/* ========== RESPONSIVE ========== */
@media (max-width: 720px) {
  .search-head { padding: 22px 22px 20px; }
  .search-title { font-size: 30px; }
  .search-head .views-exposed-form { flex-direction: column; }
  .search-head .form-actions { justify-content: flex-end; }
  .type-filter .pill { font-size: 13.5px; padding: 4px 8px; }
}
