/* =====================================================================
   listings.css — Listings page (listings.html) specific styles.
   Extracted verbatim from listings.html's inline <style> block on
   2026-09-03 (HANDOFF open item #2). Loaded AFTER style.css, so it may
   override the shared design system. Bump its ?v= in listings.html when
   you edit it.
   ===================================================================== */
        /* Listings Page Specific Styles */
        body {
            background-color: var(--bg-light);
        }

        /* Accessible-but-hidden page heading (the visible H1 was removed with the hero) */
        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0 0 0 0);
            clip-path: inset(50%);
            white-space: nowrap;
            border: 0;
        }

        /* Condensed brand strip: a slow, decorative logo marquee replacing the old hero.
           padding-top clears the fixed 73px header so the navy still sits behind it. */
        .brand-strip {
            background-color: var(--primary-dark);
            background-image: linear-gradient(135deg, rgba(15, 41, 66, 0.95) 0%, rgba(10, 17, 24, 0.98) 100%);
            padding-top: 73px;
            overflow: hidden;
        }

        .brand-marquee-viewport {
            height: 73px;
            display: flex;
            align-items: center;
            overflow: hidden;
        }

        /* Two identical tracks; translating the pair by -50% lands exactly on the
           start of the second copy, so the loop seam is invisible. */
        .brand-marquee {
            display: flex;
            width: max-content;
            animation: brand-drift 70s linear infinite;
            will-change: transform;
        }

        .brand-track {
            display: flex;
            align-items: center;
            gap: 50px;
            padding-right: 50px;
            flex: none;
        }

        .brand-logo {
            height: 17px;
            width: auto;
            flex: none;
            opacity: 0.3;
        }

        .brand-logo text {
            font-family: var(--font-headings);
            font-weight: 600;
            font-size: 22px;
            letter-spacing: 1.5px;
            fill: #ffffff;
        }

        @keyframes brand-drift {
            from { transform: translateX(0); }
            to { transform: translateX(-50%); }
        }

        @media (prefers-reduced-motion: reduce) {
            .brand-marquee {
                animation: none;
            }
        }

        /* Filter Control Bar */
        .filter-section {
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            /* Must match the real header height (.header-container 72px + 1px border)
               at every breakpoint, or the bar tucks under the header when pinned. */
            top: 73px;
            z-index: 30;
            box-shadow: var(--shadow-sm);
            padding: 16px 24px;
            transition: var(--transition-fast);
        }

        .filter-container {
            max-width: 1200px;
            margin: 0 auto;
        }

        /* ---- Unified filter bar (identical at every scroll position / viewport) ---- */
        .filter-bar {
            display: flex;
            align-items: center;
            gap: 12px;
            touch-action: manipulation;
            /* Anchor for #search-suggestions, which spans the full bar width. */
            position: relative;
        }

        .btn-open-filters {
            position: relative;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            padding: 12px 20px;
            font-family: var(--font-body);
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-dark);
            cursor: pointer;
            transition: var(--transition-fast);
            /* Stop long-press text selection / double-tap zoom on the label */
            -webkit-user-select: none;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }

        .btn-open-filters:hover {
            border-color: var(--primary-light);
            color: var(--primary-link);
        }

        .filter-count-badge {
            background-color: var(--accent-gold);
            color: var(--primary-dark);
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
            font-weight: 800;
        }

        /* Search input styling */
        .search-box-wrapper {
            position: relative;
            flex: 1;
            width: 0;
            min-width: 0;
        }

        .search-box-wrapper .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            pointer-events: none;
            display: flex;
            align-items: center;
        }

        .search-box-wrapper input {
            width: 100%;
            padding: 0 40px 0 42px;       /* was 12px top and bottom: the height below gives the same box and centres the text */
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: max(16px, 1rem);   /* 16px minimum: iOS zooms the page on focus below it (ee.css, last section) */
            height: 45px;                 /* the box it had at 0.95rem with that padding: only the text grew */
            color: var(--text-dark);
            outline: none;
            transition: var(--transition-fast);
        }

        .search-box-wrapper input:focus {
            border-color: var(--primary-light);
            box-shadow: 0 0 0 3px rgba(0, 164, 228, 0.15);
        }

        .search-box-wrapper .clear-search-btn {
            position: absolute;
            right: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            font-size: 1.2rem;
            line-height: 1;
            display: none;
            cursor: pointer;
            transition: var(--transition-fast);
        }

        .search-box-wrapper .clear-search-btn:hover {
            color: var(--text-dark);
        }

        /* Dropdown filters */
        .select-filter-wrapper {
            position: relative;
            min-width: 160px;
            flex: 0 1 auto;
        }

        .select-filter-wrapper select {
            width: 100%;
            padding: 0 36px 0 16px;       /* was 12px top and bottom; see height */
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: max(16px, 1rem);   /* 16px minimum (ee.css, last section) */
            height: 43px;                 /* the box it had at 0.9rem with 12px padding; 16px text needs the padding's room or a select cuts its descenders */
            font-weight: 500;
            color: var(--text-dark);
            background-color: var(--bg-white);
            cursor: pointer;
            outline: none;
            appearance: none;
            transition: var(--transition-fast);
        }

        .select-filter-wrapper select:focus,
        .select-filter-wrapper select:hover {
            border-color: var(--primary-light);
        }

        .select-filter-wrapper::after {
            content: '';
            position: absolute;
            right: 14px;
            top: 50%;
            transform: translateY(-50%);
            width: 8px;
            height: 5px;
            background-color: var(--text-muted);
            clip-path: polygon(100% 0, 0 0, 50% 100%);
            pointer-events: none;
        }

        .price-presets {
            display: flex;
            flex-direction: column;
            gap: 6px;
            border-top: 1px solid var(--border-color);
            padding-top: 12px;
        }

        .price-preset-option {
            font-size: 0.85rem;
            color: var(--primary-link);
            text-align: left;
            padding: 4px 0;
            transition: var(--transition-fast);
        }

        .price-preset-option:hover {
            color: var(--primary-dark);
            text-decoration: underline;
        }

        /* Active Filters Tags Row */
        .active-filters-row {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            padding-bottom: 24px;
            border-bottom: 1px solid var(--border-color);
        }

        .active-filters-row:empty {
            display: none;
            padding-bottom: 0;
            border-bottom: none;
        }

        .filter-tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background-color: rgba(0, 164, 228, 0.08);
            color: var(--primary-link);
            font-size: 0.8rem;
            font-weight: 600;
            padding: 6px 12px;
            border-radius: 20px;
            border: 1px solid rgba(0, 164, 228, 0.15);
            transition: var(--transition-fast);
        }

        .filter-tag:hover {
            background-color: rgba(0, 164, 228, 0.15);
        }

        .filter-tag button {
            color: var(--primary-link);
            font-size: 1rem;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
        }

        .filter-tag button:hover {
            color: var(--primary-dark);
        }

        .clear-all-filters {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-muted);
            margin-left: 8px;
            transition: var(--transition-fast);
        }

        .clear-all-filters:hover {
            color: var(--primary-link);
            text-decoration: underline;
        }

        /* Autocomplete Suggestions box — anchored to .filter-bar, so it spans the
           full bar (search field + Filters button) at every breakpoint. */
        .search-suggestions-box {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            margin-top: 6px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow-lg);
            max-height: 350px;
            overflow-y: auto;
            z-index: 50;
            display: none;
            padding: 8px 0;
        }

        .search-suggestions-box.show {
            display: block;
        }

        .suggestion-group-title {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            color: var(--text-muted);
            padding: 8px 16px 4px;
            letter-spacing: 0.5px;
        }

        .suggestion-item {
            padding: 10px 16px;
            font-size: 0.9rem;
            color: var(--text-dark);
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: var(--transition-fast);
        }

        .suggestion-item:hover {
            background-color: var(--bg-light);
            color: var(--primary-link);
        }

        .suggestion-item span.count {
            font-size: 0.8rem;
            color: var(--text-muted);
            background-color: rgba(0, 0, 0, 0.05);
            padding: 2px 6px;
            border-radius: 4px;
        }

        /* Backdrop dimmer for search focus */
        .search-dim-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(15, 41, 66, 0.4);
            backdrop-filter: blur(4px);
            z-index: 25;
            display: none;
            opacity: 0;
            transition: opacity var(--transition-fast);
        }

        .search-dim-backdrop.show {
            display: block;
            opacity: 1;
        }

        /* Listings Layout Main Grid */
        .listings-layout {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 24px 80px;
        }

        .listings-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
        }

        .listings-count {
            font-family: var(--font-headings);
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--primary-dark);
        }

        .listings-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 24px;
            margin-bottom: 48px;
        }

        /* Empty state styling */
        .empty-listings-state {
            grid-column: 1 / -1;
            background-color: var(--bg-white);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            padding: 60px 24px;
            text-align: center;
            box-shadow: var(--shadow-sm);
        }

        .empty-listings-state svg {
            color: var(--text-muted);
            margin-bottom: 16px;
            opacity: 0.5;
        }

        .empty-listings-state h3 {
            font-family: var(--font-headings);
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 8px;
            color: var(--primary-dark);
        }

        .empty-listings-state p {
            color: var(--text-muted);
            margin-bottom: 24px;
            max-width: 450px;
            margin-left: auto;
            margin-right: auto;
        }

        /* Inventory card styles are shared in style.css */

        /* Pagination area */
        .pagination-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 16px;
            margin-top: 20px;
        }

        .pagination-progress {
            font-size: 0.9rem;
            color: var(--text-muted);
        }

        .progress-bar-track {
            width: 200px;
            height: 4px;
            background-color: var(--border-color);
            border-radius: 2px;
            margin-top: 6px;
            overflow: hidden;
        }

        .progress-bar-fill {
            height: 100%;
            background-color: var(--primary-light);
            width: 0%;
            transition: width var(--transition-fast);
        }

        .btn-load-more {
            background-color: var(--primary-dark);
            color: var(--text-light);
            border-radius: var(--radius-sm);
            padding: 14px 40px;
            font-size: 0.95rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
            box-shadow: var(--shadow-md);
            transition: var(--transition-fast);
        }

        .btn-load-more:hover {
            background-color: var(--primary-fill);
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

        .spinner {
            width: 18px;
            height: 18px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: var(--text-light);
            animation: spin 0.8s linear infinite;
            display: none;
        }

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

        /* More Filters Slide-out Drawer Panel */
        .drawer-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(15, 41, 66, 0.4);
            backdrop-filter: blur(4px);
            z-index: 100;
            display: none;
            opacity: 0;
            transition: opacity var(--transition-medium);
        }

        .drawer-overlay.show {
            display: block;
            opacity: 1;
        }

        .filters-drawer {
            position: fixed;
            top: 0;
            right: -420px;
            width: 100%;
            max-width: 420px;
            height: 100%;
            background-color: var(--bg-white);
            z-index: 110;
            box-shadow: var(--shadow-lg);
            display: flex;
            flex-direction: column;
            transition: right var(--transition-medium) cubic-bezier(0.16, 1, 0.3, 1);
        }

        .filters-drawer.show {
            right: 0;
        }

        .drawer-header {
            padding: 24px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .drawer-header h2 {
            font-family: var(--font-headings);
            font-size: 1.35rem;
            font-weight: 700;
            color: var(--primary-dark);
        }

        /* NOTE: this drawer is the same component as the Build & Price
           selections drawer in build.css §4b (~lines 991-1098) — same class
           names, same transitions, deliberately kept in sync. The two copies
           are not merged yet (deferred to the EE merge); if you change one,
           change the other. The 44px tap target and the safe-area footer
           padding below were ported from build.css on 2026-09-03. */
        .btn-close-drawer {
            font-size: 1.8rem;
            color: var(--text-muted);
            line-height: 1;
            /* 44px tap target */
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition-fast);
        }

        .btn-close-drawer:hover {
            color: var(--text-dark);
        }

        .drawer-body {
            padding: 24px;
            overflow-y: auto;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            gap: 28px;
        }

        .filter-group-title {
            font-family: var(--font-headings);
            font-size: 1rem;
            font-weight: 700;
            color: var(--primary-dark);
            margin-bottom: 12px;
        }

        .filter-group .select-filter-wrapper {
            width: 100%;
            min-width: 0;
        }

        /* Pill Buttons Selector */
        .pill-selector {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .pill-option {
            background-color: var(--bg-light);
            border: 1px solid var(--border-color);
            color: var(--text-dark);
            padding: 10px 16px;
            border-radius: 24px;
            font-size: 0.85rem;
            font-weight: 500;
            transition: var(--transition-fast);
        }

        .pill-option:hover {
            border-color: var(--primary-light);
        }

        .pill-option.active {
            background-color: var(--primary-fill);
            border-color: var(--primary-fill);
            color: var(--text-light);
            font-weight: 600;
        }

        /* Range slider inputs styles */
        .range-inputs-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .range-fields {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .range-fields input {
            width: 100%;
            padding: 0 10px;              /* was 10px all round; see height */
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: max(16px, 1rem);   /* 16px minimum (ee.css, last section) */
            height: 39px;                 /* the box it had at 0.9rem with that padding */
            outline: none;
        }

        /* the hints keep their old size: "Max (e.g. 15000)" at 16px does not
           fit the half-width field of a 320px drawer */
        .range-fields input::placeholder { font-size: 0.9rem; }

        .range-fields input:focus {
            border-color: var(--primary-light);
        }

        .range-fields span {
            color: var(--text-muted);
            font-size: 0.9rem;
        }

        .drawer-footer {
            /* env() keeps the buttons clear of the iOS home indicator (ported
               from build.css §4b). */
            padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
            border-top: 1px solid var(--border-color);
            display: flex;
            gap: 12px;
        }

        /* Apply carries the count badge, so give it the wider share of the row */
        .drawer-footer #btn-apply-drawer {
            flex: 1.4;
        }

        /* Live preview of how many RVs the current drawer selection would match.
           Pill (not circle) so 3-digit counts fit; navy-on-gold mirrors the
           gold-on-navy badge language of the Filters button. */
        .apply-count-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 22px;
            height: 20px;
            padding: 0 7px;
            border-radius: 999px;
            background-color: rgba(15, 41, 66, 0.16);
            color: var(--primary-dark);
            font-size: 0.75rem;
            font-weight: 800;
            line-height: 1;
        }

        .drawer-footer .btn {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            white-space: nowrap;
            padding: 14px 12px;
            font-weight: 600;
            border-radius: var(--radius-sm);
            text-align: center;
        }

        /* Responsive Breakpoints */
        @media (max-width: 1024px) {
            .listings-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 20px;
            }
            /* Header is 73px at all breakpoints, so the sticky offset does not change */
        }

        @media (max-width: 768px) {
            .brand-marquee-viewport {
                height: 45px;
            }
            .brand-logo {
                height: 13px;
            }
            .brand-track {
                gap: 31px;
                padding-right: 31px;
            }
            .filter-section {
                /* Symmetric breathing room above/below the search field */
                padding: 14px 16px;
            }
            .filter-bar {
                gap: 8px;
            }
            /* Icon-only Filters control: square ~44px tap target, badge tucked into
               the corner (the "Filters" word is hidden; aria-label names it). */
            .btn-open-filters {
                width: 44px;
                height: 44px;
                padding: 0;
                gap: 0;
                justify-content: center;
            }
            .btn-open-filters .btn-open-filters-label {
                display: none;
            }
            .btn-open-filters svg {
                width: 18px;
                height: 18px;
            }
            .filter-count-badge {
                position: absolute;
                top: -6px;
                right: -6px;
                box-shadow: 0 0 0 2px var(--bg-white);
            }
            .search-box-wrapper input {
                padding: 0 32px 0 38px;   /* was 11px top and bottom */
                /* no smaller font here: 16px minimum (ee.css, last section).
                   height = the box it had at 0.9rem; the placeholder keeps
                   that size, or the scoped ones ("Search pre-owned
                   inventory") no longer fit a 390px screen. */
                height: 41px;
            }
            .search-box-wrapper input::placeholder { font-size: 0.9rem; }
            .search-box-wrapper .search-icon {
                left: 12px;
            }
            .listings-layout {
                padding: 24px 16px 60px;
            }
            .listings-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
            .filters-drawer {
                max-width: 100%;
                right: -100%;
            }
        }

        /* ---- Floating, page-scoped search toolbar (EE site/.listings-v2) ----
           Owner request 2026-09-25: the full-bleed bar docked under the header
           read as a SITE-WIDE search. The EE template now places the same
           .filter-section inside <main>, between the intro and the grid, with
           the --floating modifier: an inset card aligned to the grid, sticky
           with a visible gap below the fixed 73px header, and - because its
           containing block is <main> - it scrolls away with the listings
           instead of following the visitor into the footer.
           The prototype (redesign/listings.html) still uses the unmodified
           body-level bar above; nothing here applies to it. Kept at the END of
           the file so it wins over the base + 768px .filter-section rules. */
        .filter-section--floating {
            position: sticky;
            top: calc(73px + 12px);
            z-index: 30;
            margin: 0 0 24px;
            padding: 12px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-md);
        }

        .filter-section--floating .filter-container {
            max-width: none;
        }

        /* While the search is focused the backdrop dims EVERYTHING, header
           included (header z 100 < backdrop 101 < toolbar 102; the drawer at
           110 and brand overlay at 200 cannot be open at the same time), so the
           only lit control is the one scoped to these listings. */
        .search-dim-backdrop--over-header {
            z-index: 101;
        }

        .filter-section--floating.is-search-active {
            z-index: 102;
        }

        /* The clear control is a real <button> in the EE markup now (it was a
           click-only span); keep the old glyph geometry and give it a
           comfortable hit area. */
        .filter-section--floating .clear-search-btn {
            padding: 4px 6px;
            right: 8px;
            color: var(--text-muted);
            font-size: 1.3rem;
            border-radius: 6px;
        }

        .filter-section--floating .search-box-wrapper input {
            text-overflow: ellipsis;
        }

        @media (max-width: 768px) {
            .filter-section--floating {
                top: calc(73px + 8px);
                margin-bottom: 16px;
                padding: 8px;
                border-radius: 12px;
            }
        }
