/*
 * trosearchserver: facet row, active filters, filter drawer and search suggestions.
 *
 * Every token comes from the allfirewalls theme; nothing here introduces a look of its own:
 *   red      #ab191a  active state and highlights only (= .btn-primary, active page)
 *   text     #333     body text and control borders (= .btn-outline-dark)
 *   muted    #6c757d  secondary text (= pager)
 *   hairline #dee2e6  separators (= pager borders)
 *   controls 12.25px, 28px high, square, 1px (= "Ansicht / Sortierung / Artikel pro Seite")
 * The header stays untouched.
 */

/* The drawer and the suggestion box sit outside .trosearchserver, so they carry the tokens too. */
.trosearchserver,
.trosearchserver-drawer,
.trosearchserver-suggest {
    --tro-red: #ab191a;
    --tro-text: #333;
    --tro-muted: #6c757d;
    --tro-line: #dee2e6;
}

/* Lines above the facet row ------------------------------------------------------------------- */

.trosearchserver-didyoumean,
.trosearchserver-relaxed {
    margin: 0 0 12px;
    color: var(--tro-text);
}
.trosearchserver-didyoumean a { color: var(--tro-red); font-weight: 600; }
.trosearchserver-relaxed { color: var(--tro-muted); }

/* Facet row ------------------------------------------------------------------------------------ */

.trosearchserver-facets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 12px 0 0;
    border-top: 1px solid var(--tro-line);
}
/* Category and manufacturer pages: the separator under the category text is already there. */
.trosearchserver[data-list="productList"] .trosearchserver-facets { border-top: 0; padding-top: 0; }

.trosearchserver-facets .trosearchserver-drawer-open { display: inline-flex; align-items: center; gap: 6px; }
.trosearchserver-drawer-label-narrow { display: none; }
/* The theme's icon font, kept at the row's 28px height. */
.trosearchserver-drawer-open .fas { font-size: 11px; line-height: 1; }

/* Facet dropdowns: the theme's dropdown, with a form inside. */
.trosearchserver-facets .dropdown-menu.trosearchserver-facet-menu {
    width: max-content;
    min-width: 260px;
    max-width: min(420px, 90vw);
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 0;
}
.trosearchserver-facet-form { padding: 0 15px; }
.trosearchserver-values { list-style: none; margin: 0; padding: 0; }
.trosearchserver-values label {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin: 0;
    padding: 3px 0;
    font-weight: normal;
    cursor: pointer;
}
.trosearchserver-values input,
.trosearchserver-drawer input[type="checkbox"] { accent-color: var(--tro-red); }
.trosearchserver-value-label { flex: 1; }
.trosearchserver-count { color: var(--tro-muted); padding-left: 8px; white-space: nowrap; }

.trosearchserver-range { display: flex; gap: 8px; margin: 4px 0 10px; }
.trosearchserver-range label { flex: 1; margin: 0; font-weight: normal; color: var(--tro-muted); }
.trosearchserver-range .input-group { margin-top: 2px; }

/* Active filters --------------------------------------------------------------------------------- */

.trosearchserver-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
}
.trosearchserver-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--tro-red);
    color: var(--tro-red);
    font-size: 12.25px;
    line-height: 1.5;
    white-space: nowrap;
}
.trosearchserver-chip:hover,
.trosearchserver-chip:focus { background: var(--tro-red); color: #fff; text-decoration: none; }
.trosearchserver-chip-x { font-size: 15px; line-height: 1; }
.trosearchserver-reset { margin-left: 4px; color: var(--tro-muted); font-size: 12.25px; }
.trosearchserver-reset:hover { color: var(--tro-red); }

.trosearchserver + .listRefine { margin-top: 16px; }

/* Search terms in result titles: the shop's red, no background (titles are bold already). */
mark.trosearchserver-hit { padding: 0; background: none; color: var(--tro-red, #ab191a); }

/* Filter drawer ------------------------------------------------------------------------------------ */

.trosearchserver-drawer { position: fixed; inset: 0; z-index: 2147483000; background: rgba(0, 0, 0, 0.35); }
.trosearchserver-drawer[hidden] { display: none; }
.trosearchserver-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain; /* scrolling past the panel's end doesn't scroll the page behind */
    padding: 0 20px 20px;
    background: #fff;
}
.trosearchserver-drawer-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 12px;
    background: #fff;
    border-bottom: 1px solid var(--tro-line);
}
.trosearchserver-drawer-head .h4 { margin: 0; }
.trosearchserver-drawer-close { padding: 4px 8px; margin-right: -8px; line-height: 1; }
.trosearchserver-drawer-close:focus { outline: none; }
.trosearchserver-drawer-close:focus-visible { outline: 2px solid var(--tro-red); outline-offset: 0; }
.trosearchserver-drawer-facet { border-bottom: 1px solid var(--tro-line); }
.trosearchserver-drawer-facet summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.trosearchserver-drawer-facet summary::-webkit-details-marker { display: none; }
/* The theme's dropdown caret, pointing down when closed and up when open. */
.trosearchserver-drawer-facet summary::after {
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-left: 0.3em solid transparent;
}
.trosearchserver-drawer-facet[open] summary::after { transform: rotate(180deg); }
.trosearchserver-drawer-facet[open] { padding-bottom: 12px; }
/* The drawer's one "Anwenden" button stays in reach at the panel's bottom. */
.trosearchserver-drawer-apply { position: sticky; bottom: -20px; padding: 12px 0 20px; margin-bottom: -20px; background: #fff; }
.trosearchserver-drawer-form { padding: 0; } /* not the dropdown forms' side padding */
/* The page behind an open drawer doesn't scroll. */
body.trosearchserver-drawer-is-open { overflow: hidden; }

/* Phones: the drawer is the filter; a bottom sheet. */
@media (max-width: 767.98px) {
    .trosearchserver-facets .trosearchserver-facet { display: none; }
    .trosearchserver-drawer-label-wide { display: none; }
    .trosearchserver-drawer-label-narrow { display: inline; }
    .trosearchserver-drawer-panel { top: auto; left: 0; width: 100%; max-height: 85vh; }
}

@media (prefers-reduced-motion: no-preference) {
    .trosearchserver-drawer-facet summary::after { transition: transform 0.15s; }
}

/* Search suggestions below the header field: an overlay, so the header doesn't move. ------------------ */

.trosearchserver-suggest {
    position: absolute;
    z-index: 1060;
    max-height: 70vh;
    overflow-y: auto;
    padding: 8px 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    text-align: left;
}
.trosearchserver-suggest[hidden] { display: none; }
.trosearchserver-suggest-heading { padding: 6px 15px 2px; color: #6c757d; font-size: 12.25px; font-weight: 600; }
.trosearchserver-suggest-option { display: flex; align-items: center; gap: 12px; padding: 6px 15px; color: #333; }
.trosearchserver-suggest-option:hover,
.trosearchserver-suggest-option.active { background: #f5f5f5; color: #ab191a; text-decoration: none; }
.trosearchserver-suggest-product img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.trosearchserver-suggest-title {
    flex: 1;
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
.trosearchserver-suggest-price { white-space: nowrap; color: #333; }
.trosearchserver-suggest-all { margin-top: 6px; padding-top: 10px; border-top: 1px solid #dee2e6; font-weight: 600; }
