/*
 * search-form-modern.css — Phase 1 of SEARCH-FORM-IMPLEMENTATION-PLAN.md
 *
 * FLUSS COPY (flussreisen.de, 2026-11-16): Zentrale prod file, recoloured only.
 * --sf-blue keeps its NAME (it is referenced ~12x) but holds the Fluss brand
 * green #50751D (darker shade of rgb(95,139,35); AA for text and white-on).
 *
 * Styles for the new #search-row / .search-row form.
 * All rules are scoped to .search-row (or inside @media).
 * CSS variables live on .search-row, NOT on :root (avoids global token collisions).
 *
 * Load order: after /style.css and /css/print.css, before SumoSelect CSS.
 */

/* ================================================================
   1. DESIGN TOKENS (scoped to .search-row)
   ================================================================ */

.search-row {
    --sf-blue:        #50751D;       /* FLUSS: brand green (Zentrale: #0070AE) */
    --sf-orange:      #FC9F19;       /* borders, badges, fills only — not text */
    --sf-orange-text: #c5810f;       /* AA-compliant text on white (≥ 4.5:1) */
    --sf-gray-bg:     #f5f5f5;
    --sf-border:      #ddd;
    --sf-text:        #333;
    --sf-muted:       #666;
    --sf-light:       #999;
    --sf-radius:      3px;

    /* Uniform control geometry — applied identically to <input type="date"> and
       .SumoSelect .CaptionCont so date pickers and SumoSelect-rendered selects
       share the same outer dimensions. 2.6rem accommodates the native date-input
       chrome (calendar icon + text) in Chrome/Edge/Firefox without clipping. */
    --sf-control-height: 2.6rem;
    --sf-control-pad-y:  0.3rem;
    --sf-control-pad-x:  0.6rem;
}

/* ================================================================
   2. SECTION BASE
   ================================================================ */

.search-row {
    background: var(--sf-gray-bg);
    padding-bottom: 0.75rem;
}

.search-row .search-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sf-text);
    margin: 0.75rem 0 0.5rem;
    line-height: 1.3;
}

/* ================================================================
   3. PRIMARY ROW — 5-col CSS Grid
   Override the legacy float-based .col system for this row only.
   ================================================================ */

/* ID-prefixed selectors to defeat any legacy `.row .col` float rules without
   resorting to !important. #search-row IS the section; .search-primary-filters
   is the wrap inside the form. */
#search-row .search-primary-filters {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    /* DO NOT override margin-left/right — .wrap (grid.css:137) uses
       `margin: 0 auto` for centering; killing those margins left-aligns
       the primary row and breaks the page layout. */
}

/* Reset legacy .col float and width so grid controls layout */
#search-row .search-primary-filters > .col {
    float: none;
    width: auto;
    padding: 0;
    margin: 0;
    /* Grid items default to min-width:auto, which forbids a 1fr track from                                                          
    shrinking below the item's min-content. On iOS, native <input type="date">                                                    
    has a wide intrinsic min-content and won't shrink, so on a narrow (single-                                                    
    column) viewport the track is forced wider than the screen → horizontal                                                       
    overflow. min-width:0 lets the track shrink and the date input's width:100%                                                   
    then fills the clamped track. */                                                                                              
    min-width: 0;
}

/* Suppress the .group clearfix pseudo-elements on the primary-row grid.
   `.group::before` / `.group::after { content:""; display:table; }` (grid.css:1885)
   exists to clear floats — but inside a CSS Grid container, pseudo-elements with
   `content` BECOME GRID ITEMS, eating two tracks (one before all .col, one after).
   With repeat(5, 1fr) and 5 .col cells, the ::before takes track 1, pushing the
   first 4 cells into tracks 2-5 of row 1 and wrapping the 5th cell to row 2.
   Suppress them here — clearfix is irrelevant in grid layout anyway. */
#search-row .search-primary-filters::before,
#search-row .search-primary-filters::after {
    content: none;
    display: none;
}

/* ================================================================
   4. INPUT WRAPPERS (labels + inputs)
   ================================================================ */

.search-row .input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-row .input-wrapper label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sf-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.search-row .input-wrapper label .far {
    color: var(--sf-blue);
}

/* #search-row prefix matches the specificity of legacy grid.css `#search-row
   input[type=date]` (line 360) — without the ID, the legacy rule's 1px border
   and 5px padding leak in and the date input renders taller than .CaptionCont
   even with `height` declared here. search-form-modern.css loads after grid.css
   in the cascade, so equal-specificity selectors here win cleanly.
   min-height/max-height clamp around `height` defeat browser intrinsic minimums
   that Chrome and Edge sometimes apply to native date inputs (the calendar-icon
   + text glyph cell wants ~30px of content area; without an explicit ceiling
   the input can grow taller than 2.6rem even with `height` set). */
#search-row input[type="date"],
.search-row input[type="date"] {
    width: 100%;
    height: var(--sf-control-height);
    min-height: var(--sf-control-height);
    max-height: var(--sf-control-height);
    padding: var(--sf-control-pad-y) var(--sf-control-pad-x);
    border: 2px solid var(--sf-border);
    border-radius: var(--sf-radius);
    background: #fff;
    color: var(--sf-text);
    font-size: 0.9rem;
    line-height: 1.2;
    /* !important: on iOS the date input was computing box-sizing:content-box, so                                                   
       width:100% + 9.6px×2 padding overflowed its grid track by ~19px (≈9px page                                                   
       scroll). Forcing border-box makes width:100% include the padding so it fits. */                                              
    box-sizing: border-box;                                                                                              
    margin: 0;
    vertical-align: middle;
    /* Force native chrome (incl. WebKit calendar icon) — some legacy stylesheets
       in this repo set -webkit-appearance: none on inputs which can hide the
       icon. The vendor-prefixed `auto` is needed because the unprefixed
       `appearance: auto` doesn't override `-webkit-appearance: none` in WebKit. */
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
}

/* Ensure the native calendar-picker icon stays visible and clickable on Chrome
   and Edge (WebKit/Blink). Forced with !important because some upstream styles
   in this project zero out the icon's opacity, and we cannot trace which.
   The icon itself is rendered by the user-agent — we are NOT styling its glyph. */
#search-row input[type="date"]::-webkit-calendar-picker-indicator,
.search-row input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
    cursor: pointer !important;
    margin-left: 0.25rem;
    width: 1.2rem;
    height: 1.2rem;
    pointer-events: auto !important;
}

/* Also defeat any `appearance: none` that may leak in via legacy stylesheets,
   even with vendor prefixes. !important here matters because at least one
   upstream rule we have not been able to locate is removing the icon. */
#search-row input[type="date"],
.search-row input[type="date"] {
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
    appearance: auto !important;
}

.search-row input[type="date"]:focus-visible {
    outline: 2px solid var(--sf-orange);
    outline-offset: 2px;
    border-color: var(--sf-blue);
}

/* Programmatic highlight: when picking "Früheste Anreise" auto-advances to
   "Späteste Rückkehr" (setupDateCoupling in search-form-handler.js), a plain
   .focus() does NOT trigger :focus-visible, so the field shows no cue and the
   opened picker looks orphaned. This class is toggled from JS to make the
   handed-off field unmistakable. */
#search-row input[type="date"].sf-date-active,
.search-row input[type="date"].sf-date-active {
    outline: 2px solid var(--sf-orange);
    outline-offset: 2px;
    border-color: var(--sf-blue);
    box-shadow: 0 0 0 4px rgba(252, 159, 25, 0.20);
    animation: sf-date-pulse 1.1s ease-out 2;
}

/* Pulse the handed-off field a couple of times so it reads as "tap me next" —
   important on iOS, where the second native picker cannot be auto-opened (no
   transient user activation), so the user must tap the highlighted field. */
@keyframes sf-date-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(252, 159, 25, 0.45); }
    70%  { box-shadow: 0 0 0 8px rgba(252, 159, 25, 0.00); }
    100% { box-shadow: 0 0 0 4px rgba(252, 159, 25, 0.20); }
}

/* Keep the handed-off field clear of the viewport edge when it's scrolled to
   the top (search-form-handler.js advanceToEd). Bump this if a sticky header
   ever overlaps it. */
#search-row .input-wrapper,
.search-row .input-wrapper {
    scroll-margin-top: 1rem;
}

/* Left-align the date value. iOS WebKit renders the value via
   ::-webkit-date-and-time-value, which is CENTERED by default (desktop Chrome
   left-aligns it), so the field reads centered only on iPhone Safari/Chrome.
   Force left on both the input and the WebKit value pseudo so it matches desktop. */
#search-row input[type="date"],
.search-row input[type="date"] {
    text-align: left;
}
#search-row input[type="date"]::-webkit-date-and-time-value,
.search-row input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
}

/* iOS/touch overflow fix: the rules above force `-webkit-appearance: auto`
   !important to keep the native calendar icon visible on DESKTOP. But on iOS
   WebKit (Safari AND Chrome on iPhone — all iOS browsers are WebKit), forcing
   native appearance makes <input type="date"> ignore `width: 100%` and render at
   its wide intrinsic size, overflowing the viewport horizontally.
   On touch devices the whole field taps to open the native picker, so the desktop
   calendar-icon is unnecessary here — drop native appearance so width is honored.
   Scoped to `pointer: coarse` so desktop (fine pointer) keeps the icon. */
@media (pointer: coarse) {
    #search-row input[type="date"],
    .search-row input[type="date"] {
        -webkit-appearance: none !important;                                                                                        
        -moz-appearance: none !important;                                                                                           
        appearance: none !important;    
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* ================================================================
   5. FILTER TOGGLE BUTTON
   ================================================================ */

.search-row .search-filter-toggle-row {
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
}

.search-row .btn-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.4rem 0.9rem;
    border: 2px solid var(--sf-orange);
    border-radius: var(--sf-radius);
    background: #fff;
    color: var(--sf-orange-text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.search-row .btn-filter-toggle:hover,
.search-row .btn-filter-toggle:focus-visible {
    background: var(--sf-orange);
    color: #fff;
    outline: 2px solid var(--sf-orange-text);
    outline-offset: 2px;
}

.search-row .btn-filter-toggle[aria-expanded="true"] {
    background: var(--sf-orange);
    color: #fff;
}

.search-row .btn-filter-toggle .active-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3em;
    height: 1.3em;
    padding: 0 0.3em;
    border-radius: 999px;
    background: var(--sf-blue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

/* Hidden when count is 0 — Phase 3 JS removes hidden attr when count > 0 */
.search-row .btn-filter-toggle .active-filter-count[hidden] {
    display: none;
}

/* ================================================================
   6. ADVANCED PANEL
   ================================================================ */

/* No-JS fallback: `hidden` attr keeps panel hidden when JS hasn't run.
   On JS init (search-form-handler.js) the `hidden` attr is removed and the
   panel switches to `.panel-collapsed` state, which can be animated. */
.search-row .advanced-filters-panel[hidden] {
    display: none;
}

.search-row .advanced-filters-panel {
    border-top: 2px solid var(--sf-orange);
    padding: 0.75rem 0 0.25rem;
    margin-top: 0.25rem;
    /* Phase 4: animate collapse via max-height. Generous cap accommodates
       the 7-cell advanced-panel content without clipping. ALL properties
       that differ between open/collapsed states must be in the transition
       list — without padding/margin/border-color here, those properties
       jump instantly when the class is toggled, producing a visible
       border-flicker artifact on close (the orange border disappeared a
       frame before max-height began to shrink). */
    overflow: hidden;
    max-height: 60rem;
    transition:
        max-height 220ms ease-out,
        padding-top 220ms ease-out,
        padding-bottom 220ms ease-out,
        margin-top 220ms ease-out,
        border-top-color 220ms ease-out;
}

/* Collapsed state (set on init + on close). max-height: 0 hides the panel
   visually; aria-hidden hides it from assistive tech (set by JS). */
.search-row .advanced-filters-panel.panel-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-top: 1px transparent;
}

/* Once the open transition completes, `.panel-overflowable` lets the
   absolutely-positioned SumoSelect dropdowns extend below the panel without
   being clipped at the panel boundary. JS adds this class on transitionend
   (max-height) and removes it before starting the close animation so the
   shrinking max-height correctly clips content during the transition. */
.search-row .advanced-filters-panel.panel-overflowable {
    overflow: visible;
}

/* Honour user motion preference — skip the transition entirely for users
   who set `prefers-reduced-motion: reduce`. They still get the visual
   collapse/expand, just instantly. */
@media (prefers-reduced-motion: reduce) {
    .search-row .advanced-filters-panel {
        transition: none;
    }
}

/* Advanced panel — 4-column CSS Grid (mirrors the primary-row approach).
   Replaces the legacy float-based `.col.slot-25` (23.8% width + 1.6% left margin
   except first-child) which left every wrap-row's first item offset by 1.6%
   because it was not :first-child of the parent. Grid lets every row start at
   column 1 cleanly. */
#search-row .advanced-filters-panel > .wrap.group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* Suppress .group clearfix pseudo-elements — same reason as the primary row:
   they would become extra grid items and shift the first .col into column 2. */
#search-row .advanced-filters-panel > .wrap.group::before,
#search-row .advanced-filters-panel > .wrap.group::after {
    content: none;
    display: none;
}

/* Reset legacy float / width / margin on .col.slot-25 inside the panel so the
   grid can size each cell uniformly. */
#search-row .advanced-filters-panel .col.slot-25 {
    float: none;
    width: auto;
    padding: 0;
    margin: 0;
    /* Same iOS date-input / grid min-content overflow guard as the primary row. */                                                 
    min-width: 0; 
}

/* ================================================================
   7. SUMOSELECT OVERRIDES (scoped to .search-row)
   Re-skin to match the new design language without touching sumoselect.css.
   ================================================================ */

/* Selector strategy: the SumoSelect plugin's wrapper <div class="SumoSelect">
   does NOT carry the original <select>'s `sumo-select-multi` / `sumo-select-simple`
   class — the plugin copies that class to an inner span instead. So the older
   `.search-row .SumoSelect.sumo-select-multi > .CaptionCont` selectors never
   matched at runtime and the rendered CaptionCont fell back to sumoselect.css
   defaults (1px border, 14px min-height, padding 5px 8px from .SelectBox).
   Diagnostic page (debug-control-height.php) measured 31.44px instead of the
   2.6rem (41.6px) we want. Drop the sub-class qualifier; #search-row prefix
   matches grid.css `#search-row …` specificity tier and wins cleanly. */
#search-row .SumoSelect > .CaptionCont,
.search-row .SumoSelect > .CaptionCont {
    border: 2px solid var(--sf-border);
    border-radius: var(--sf-radius);
    background: #fff;
    height: var(--sf-control-height);
    min-height: var(--sf-control-height);
    max-height: var(--sf-control-height);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: var(--sf-control-pad-y) var(--sf-control-pad-x);
    margin: 0;
}

#search-row .SumoSelect > .CaptionCont > span,
.search-row .SumoSelect > .CaptionCont > span {
    color: var(--sf-text);
    font-size: 0.9rem;
}

/* Open state — highlight border with brand colour */
#search-row .SumoSelect.open > .CaptionCont,
.search-row .SumoSelect.open > .CaptionCont {
    border-color: var(--sf-blue);
    border-radius: var(--sf-radius) var(--sf-radius) 0 0;
}

/* Dropdown panel */
.search-row .SumoSelect > .optWrapper {
    border: 2px solid var(--sf-blue);
    border-top: none;
    border-radius: 0 0 var(--sf-radius) var(--sf-radius);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    /* [2026-08-12] WAS z-index:200, which LOWERED the panel below the vendor's
       own 1000 (sumoselect.css:32) and put it under two fixed elements, so both
       painted over any open dropdown — reported on mobile, but it affected
       every search-row select on every page and both breakpoints:
         #scrollTopBtn  z-index:1000  (includes/scroll-top-btn.php:17)
         #side-offer    z-index:999   (includes/side-offer.php:63)
         sticky header  z-index:999   (critical/header.css, navigation.css)
       1001 clears all three and stays far below fancybox (99991+) and the
       Cookiebot banner, which must keep winning. An open dropdown is a
       transient overlay: it SHOULD outrank persistent page furniture.
       This alone did NOT resolve the reported overlay — the height cap below
       is the fix that did. Kept because it is independently correct (it also
       clears the sticky header at 999) and costs nothing. */
    z-index: 1001;
    }

  /* [2026-08-12] Anchor the panel to the BOTTOM EDGE of its own field (the vendor's
     `top: 30px` assumes a 30px caption; ours is ~42px).
     [2026-11-09] NOT on the floating modal: prod's init.js still floats the generic
     multi-selects on touch (floatWidth 100000), and the vendor positions that modal
     with `top:0; bottom:0; margin:auto`. `top:100%` overrode it and pushed the modal
     off the bottom of the screen, so no dropdown opened on Android. */
  .search-row .SumoSelect > .optWrapper:not(.isFloating) {
      top: 100%;
  }

/* Floating modal — RETAINED BUT CURRENTLY INERT. [2026-08-12, rev4]
   Every branch in init.js now sets `floatWidth: 0`, so `is_floating`
   (`$(window).width() <= floatWidth`) can never be true and `.isFloating` is
   never applied. Kept deliberately: it is the sizing half of the documented
   rollback (restore `useNativeSelect ? 100000 : 400` in init.js and this rule
   comes back to life). If you are debugging a floating panel and this rule
   seems to do nothing, check floatWidth first. */
/* .search-row .SumoSelect > .optWrapper.isFloating {
    max-height: 70%;
} */

/* Hide the fixed page furniture while a search dropdown is open.
   -------------------------------------------------------------------------
   Hooked on OUR OWN `body.kz-dropdown-open` (set in init.js on
   sumo:opening / cleared on sumo:closed), NOT the plugin's
   `body.sumoStopScroll`. Reason: sumoStopScroll is added only on the FLOATING
   branch of showOpts(), and nothing floats any more — these rules would have
   gone silently inert, which is the worst kind of regression because a rule
   that stops matching leaves no trace. The vendor also pairs that class with
   `overflow:hidden`, which would wrongly lock page scrolling for an anchored
   dropdown.

   The three fixed elements that sat over the panel:
     #scrollTopBtn    scroll-top-btn.php   fixed, z-index 1000
     #side-offer      side-offer.php       fixed, z-index 999 (30 € Gutschein)
     [class*="wgt-"]  wawsome a11y widget  injected at runtime
   wawsome is DISABLED in dev/repo and ACTIVE on prod (meta.php ~486), so its
   rule CANNOT be verified locally — verify on prod after deploy, and check it
   COMES BACK on close. The repo defines no `wgt-` class of its own (checked),
   so the namespace match is safe. `!important` only on that one: it is
   third-party and may carry inline styles, which a plain rule would lose to.
   Ours win on specificity (1,1,1) without it.

   MOBILE ONLY — [2026-08-12 fix]. These rules were briefly unscoped and hid the
   furniture on desktop too, which is wrong: on a desktop the dropdown is a small
   panel anchored under its field and the `z-index:1001` above already puts it over
   #scrollTopBtn (1000), #side-offer (999) and the sticky header (999). Nothing
   overlaps, so there is nothing to hide, and blanking the page furniture every
   time someone opens a select is just startling.
   The regression came from swapping the hook: the previous
   `body.sumoStopScroll` was added by the plugin ONLY on the floating branch, so
   it was implicitly mobile-only. `body.kz-dropdown-open` is set unconditionally,
   so the breakpoint has to be stated here instead.
   768px matches the furniture's own breakpoint — `#side-offer` becomes the bottom
   bar and `#scrollTopBtn` moves left at exactly `max-width:768px` (side-offer.php,
   scroll-top-btn.php). Keep the three in sync if any of them moves.
   Kept in CSS rather than gating the class in JS on purpose: a media query
   re-evaluates on resize and rotation for free, whereas a JS check would freeze
   whatever was true when the dropdown opened. */
@media screen and (max-width: 768px) {
    body.kz-dropdown-open #scrollTopBtn,
    body.kz-dropdown-open #side-offer {
        display: none;
    }

    body.kz-dropdown-open [class*="wgt-"] {
        display: none !important;
    }
}


/* Checkmark / highlight colour for selected items */
.search-row .SumoSelect > .optWrapper > .options li.opt.selected span i,
.search-row .SumoSelect > .optWrapper > .options li.opt:hover span i {
    background: var(--sf-orange);
    border-color: var(--sf-orange);
}

/* Focus-visible ring on the SumoSelect caption */
.search-row .SumoSelect > .CaptionCont:focus-visible {
    outline: 2px solid var(--sf-orange);
    outline-offset: 2px;
}

/* Fallback focus ring on the native select (shown when SumoSelect is absent) */
.search-row select:focus-visible {
    outline: 2px solid var(--sf-orange);
    outline-offset: 2px;
}

/* Hidden option used by Phase 3 JS cascade (data-hidden attribute on option elements) */
.search-row .SumoSelect .options li.opt[data-hidden] {
    display: none;
}

/* ================================================================
   8. ACTION ROW
   ================================================================ */

.search-row .search-action-row {
    align-items: center;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.search-row .search-action-row .col.slot-50.ta-right p {
    margin: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Reset button — subtle link style */
.search-row .btn-reset {
    background: none;
    border: none;
    padding: 0;
    color: var(--sf-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.search-row .btn-reset:hover,
.search-row .btn-reset:focus-visible {
    color: var(--sf-blue);
    outline: 2px solid var(--sf-orange);
    outline-offset: 2px;
}

/* Submit button — reuses site-wide .button--primary; minor spacing tweak.
   Fluss: grid.css styles only input[type=submit] and a.button, not <button>
   (Zentrale's grid.css has "button, a.button"), so the base look is set here. */
.search-row .gobalsearch-submit {
    -webkit-appearance: none;
    border: none;
    cursor: pointer;
    color: #fff;
    border-radius: 3px;
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ================================================================
   9. ACTIVE FILTER CHIPS
   ================================================================ */

.search-row .active-filters-row[hidden] {
    display: none;
}

.search-row .active-filters-row {
    padding: 0.4rem 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.search-row .filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
}

.search-row .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--sf-blue);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.5;
    /* Show the FULL value (e.g. long "Hafen (via)" station names) and keep the ×
       reachable. The previous nowrap + overflow:hidden + max-width:220px clipped
       the × off long chips on BOTH desktop and mobile. The × is a flex-shrink:0
       sibling, so letting the label wrap keeps it visible at the chip's edge. */
    max-width: 100%;
    white-space: normal;
}

.search-row .filter-chip__label {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Recognized-term chip — Phase 5. White bg, blue text, dashed border.
   ::after adds " (aus Suchtext)" to visually distinguish auto-recognised chips. */
.search-row .filter-chip--recognized {
    background: #fff;
    color: var(--sf-blue);
    border: 1px dashed var(--sf-blue);
}

.search-row .filter-chip--recognized::after {
    content: " (aus Suchtext)";
    font-size: .75em;
    opacity: .7;
}

/* Harbour-group chip [2026-08-12] — "clear this whole group" for #starthafen.
   It sits NEXT TO the individual port chips, not instead of them, so it has to be
   visually distinct or it reads as just another port. Orange = action, matching the
   form's accent, versus the blue filter chips.
   No `--recognized` interaction: the group chip is never rendered with that class
   (renderChips builds it separately and hard-codes its className), so the two
   backgrounds cannot collide. */
.search-row .filter-chip--group {
    background: var(--sf-orange);
    color: #333;
}


.search-row .filter-chip button {
    background: none;
    border: none;
    color: inherit;
    padding: 0 0 0 0.15em;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    opacity: 0.8;
    flex-shrink: 0;
}

.search-row .filter-chip button:hover {
    opacity: 1;
}

/* ================================================================
   10. SCREEN-READER ONLY UTILITY
   ================================================================ */

.search-row .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ================================================================
   11. LOADING SPINNER (Phase 3 will add/remove .results-loading class)
   ================================================================ */

.search-row .results-loading::after {
    content: '';
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    border: 2px solid var(--sf-border);
    border-top-color: var(--sf-blue);
    border-radius: 50%;
    animation: sf-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-left: 0.5em;
}

@keyframes sf-spin {
    to { transform: rotate(360deg); }
}

/* ================================================================
   12. RESPONSIVE BREAKPOINTS
   ================================================================ */

/* Tablet: 2-column primary + advanced rows */
@media (max-width: 1086px) {
    #search-row .search-primary-filters,
    #search-row .advanced-filters-panel > .wrap.group {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: single-column */
@media (max-width: 768px) {
    #search-row .search-primary-filters,
    #search-row .advanced-filters-panel > .wrap.group {
        grid-template-columns: 1fr;
    }

    .search-row .search-action-row .col.slot-50 {
        width: 100%;
        text-align: left;
        margin-bottom: 0.5rem;
    }

    .search-row .search-action-row .col.slot-50.ta-right p {
        justify-content: flex-start;
    }

    .search-row .btn-filter-toggle {
        width: 100%;
        justify-content: center;
    }
}

/* ================================================================
     MOBILE LISTING-PAGE SEARCH FORM (collapsed + toggle)
     ================================================================
     On listing pages (NOT the Startseite hero) grid.css hides #search-row
     below 768px. We re-show it here as a collapsible panel: chips on top, a
     toggle button, then the form (collapsed by default). The Startseite is
     excluded in PHP (no toggle, no .search-collapsed, keeps inline display:block).
     ================================================================ */

/* Desktop / tablet: the mobile toggle never shows. */
.btn-search-mobile-toggle {
    display: none;
}

@media (max-width: 767px) {
    /* ID+class beats grid.css's `#search-row { display:none }` regardless of
       stylesheet load order. */
    #search-row.search-row {
        display: flex;
        flex-direction: column;
    }

    /* Re-order the existing children: chips first, toggle, then the form. */
    #search-row #active-filters     { order: 1; }
    #search-row .btn-search-mobile-toggle { order: 2; }
    #search-row #globalsearchform   { order: 3; }

    /* Show + style the toggle (mirrors .btn-filter-toggle). */
    #search-row .btn-search-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        margin: 0 0 0.75rem;
        padding: 0.75rem 1rem;
        background: var(--sf-blue, #50751D);
        color: #fff;
        border: none;
        border-radius: 4px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
    }
    #search-row .btn-search-mobile-toggle .fa {
        font-size: 0.95em;
    }

    /* Collapsed state: hide the form body; chips + toggle remain. */
    #search-row.search-collapsed #globalsearchform {
        display: none;
    }

    /* Full-text wrapping chips are handled by the base .filter-chip rule (so the ×
    stays reachable on desktop too). Mobile only needs a bigger, easier-to-hit ×. */
    #search-row .filter-chip__remove {
        font-size: 1.15rem;
        padding: 0.05em 0.1em 0.05em 0.35em;
    }
}

/* ================================================================
     Z-INDEX FIX FOR ADVANCED-PANEL DROPDOWNS
     ================================================================
     The advanced filter panel's bottom-row SumoSelect dropdowns open
     downward and extend past the panel into the .search-action-row's
     area (when .panel-overflowable removes overflow:hidden after the
     open animation). Without explicit stacking, the action-row paints
     on top because it's later in DOM order. Lift the panel above the
     action-row when ANY dropdown inside it is open.
     ================================================================ */

  .search-row .advanced-filters-panel {
      position: relative;
      z-index: 10;
  }

  .search-row .search-action-row {
      position: relative;
      z-index: 1;
  }

  /* Defense-in-depth: ensure dropdowns are never clipped when the panel is open.
     The .panel-overflowable class should handle this via a transitionend handler,
     but on prod that handler isn't firing reliably. This rule covers all cases:
     any panel that isn't .panel-collapsed allows overflow. */
  .search-row .advanced-filters-panel:not(.panel-collapsed) {
      overflow: visible;
  }

  .search-mandatory-msg {
      color: #FC9F19;
      font-weight: 600;
      margin: 0.5rem 0 0;
      font-size: .85rem !important;
  }
  .search-mandatory-msg[hidden] { display: none !important; }
  .search-mandatory-msg { display: block !important; }
  .search-mandatory-msg .fa { margin-right: 0.35rem; }

  /* Locked mandatory chip — its × is greyed and shows a not-allowed cursor. */
  .filter-chip--locked .filter-chip__remove {
      opacity: 0.3;
      cursor: not-allowed;
  }
  /* Locked mandatory chip — clearly marked + not deletable. */
  .filter-chip--locked {
      background: #fdecea;
      border: 1px solid #e6b0aa;
  }
  .filter-chip__lock {
      margin-right: 0.35rem;
      color: #FC9F19;
  }
  .filter-chip--locked .filter-chip__remove {
      opacity: 0.35;
      cursor: not-allowed;
  }

  /* Submit button when no mandatory filter is chosen — signals action needed.
     Stays clickable (error-on-submit), just visually muted. */
  .gobalsearch-submit.btn--needs-filter {
      background: #9aa0a6;
      border-color: #9aa0a6;
      cursor: not-allowed;
  }

  html.sf-infinite-scroll-on div.pagination {
      display: none;
  }

/* ---------------------------------------------------------------------------
   Starthafen curated dropdown (2026-08-11)
   Spec: docs/superpowers/specs/2026-08-11-starthafen-curation-design.md
   Scoped to .sumo_starthafen — SumoSelect stamps the wrapper with sumo_<name>.
   .SumoSelect markup is shared by every select in the form, so an unscoped rule
   would restyle all of them.
   --------------------------------------------------------------------------- */

/* Optgroup headings ("Hafengruppen" / "Beliebte Häfen" / "Alle Häfen"; on #harbour
   "Hafengruppen" / "Häfen" / "Weitere Häfen" — added 2026-09-15). */
.SumoSelect.sumo_starthafen .optWrapper ul.options > li.group > label,
.SumoSelect.sumo_harbour .optWrapper ul.options > li.group > label {
    display: block;
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #777;
}

/* Group presets read as shortcuts, not as ports. Keyed on the sf-sh-group class
   copied from the <option> onto the <li>, NOT on optgroup position — reordering
   the blocks in search-row.php must not silently restyle the wrong rows. */
.SumoSelect.sumo_starthafen .optWrapper ul.options li.opt.sf-sh-group,
.SumoSelect.sumo_harbour .optWrapper ul.options li.opt.sf-hb-group {
    font-weight: 600;
}
