﻿.catalog-sort {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            gap: 18px;
            margin: 0 0 16px;
        }
        .sort-help,
        .sort-toggle {
            min-height: 36px;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            border: 0;
            border-radius: 4px;
            background: linear-gradient(180deg, #f0322b, #d81717);
            color: #fff;
            padding: 0 14px;
            font: inherit;
            font-weight: 800;
            cursor: pointer;
        }
        .sort-help > span,
        .sort-toggle em {
            font-style: normal;
        }
        .sort-menu { position: relative; }
        .sort-toggle {
            background: transparent;
            border: 1px solid rgba(255, 255, 255, 0.14);
            padding-right: 14px;
        }
        .sort-toggle > span {
            font-size: 26px;
            line-height: 1;
        }
        .sort-options {
            display: none;
            position: absolute;
            top: calc(100% + 10px);
            right: 0;
            z-index: 50;
            min-width: 260px;
            padding: 8px;
            border-radius: 8px;
            background: #fff;
            box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
        }
        .sort-menu.open .sort-options { display: block; }
        .sort-options button {
            width: 100%;
            min-height: 36px;
            display: block;
            border: 0;
            border-radius: 4px;
            background: transparent;
            color: #333;
            padding: 8px 12px;
            text-align: left;
            font: inherit;
            cursor: pointer;
        }
        .sort-options button:hover,
        .sort-options button.active {
            background: #f0f0f0;
        }
        .filter-grid select[data-search-select] {
            position: absolute;
            width: 1px;
            height: 1px;
            opacity: 0;
            pointer-events: none;
        }
        .search-select {
            position: relative;
            min-height: 46px;
            z-index: 1;
        }
        .search-select.open { z-index: 30; }
        .search-select.disabled { opacity: 0.58; pointer-events: none; }
        .search-select-toggle {
            width: 100%;
            min-height: 46px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 0 44px 0 17px;
            border: 1px solid rgba(245, 245, 245, 0.09);
            border-radius: 4px;
            background: #1d2127;
            color: #f7f8fb;
            text-align: left;
            font: inherit;
            cursor: pointer;
        }
        .search-select-toggle::after {
            content: "";
            width: 0;
            height: 0;
            border-left: 6px solid transparent;
            border-right: 6px solid transparent;
            border-top: 6px solid #aeb6c2;
            position: absolute;
            right: 17px;
            top: 20px;
        }
        .search-select-panel {
            display: none;
            position: absolute;
            top: calc(100% + 4px);
            left: 0;
            right: 0;
            max-height: 300px;
            overflow: hidden;
            border: 1px solid rgba(245, 245, 245, 0.18);
            border-radius: 4px;
            background: #f4f4f4;
            color: #111318;
            box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
        }
        .search-select.open .search-select-panel { display: block; }
        .search-select-input {
            width: 100%;
            min-height: 42px;
            border: 0;
            border-bottom: 1px solid #d0d0d0;
            border-radius: 0;
            background: #1d2127;
            color: #fff;
            padding: 0 14px;
        }
        .search-select-list {
            max-height: 250px;
            overflow-y: auto;
            padding: 0;
        }
        .search-select-option,
        .search-select-empty {
            width: 100%;
            display: block;
            min-height: 34px;
            border: 0;
            background: transparent;
            color: #111318;
            padding: 8px 14px;
            text-align: left;
            font: inherit;
        }
        .search-select-option:hover,
        .search-select-option.active {
            background: #bdbdbd;
            color: #fff;
        }
        .car-badge,
        .legend-badge {
            display: inline-flex;
            align-items: center;
            min-height: 24px;
            padding: 3px 8px;
            border-radius: 4px;
            color: #fff;
            font-size: 12px;
            font-style: normal;
            font-weight: 800;
            line-height: 1;
        }
        .car-badge {
            position: absolute;
            top: 12px;
            right: 12px;
            z-index: 3;
        }
        .car-badge.good,
        .legend-badge.good { background: #2f963d; }
        .car-badge.warn,
        .legend-badge.warn { background: #e9782b; }
        .inventory-photo > span {
            z-index: 2;
        }
        .legend-modal {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 1000;
            padding: 44px 18px;
            overflow-y: auto;
            background: rgba(0, 0, 0, 0.62);
            backdrop-filter: blur(2px);
        }
        .legend-modal.open { display: block; }
        .legend-dialog {
            width: min(100%, 1120px);
            margin: 0 auto;
            position: relative;
            padding: 40px;
            border-radius: 8px;
            background: #fff;
            color: #222;
            box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
        }
        .legend-dialog h2 { margin-bottom: 24px; font-size: 34px; }
        .legend-dialog p { margin-bottom: 18px; color: #6b6b6b; font-size: 18px; line-height: 1.45; }
        .legend-close {
            position: absolute;
            top: 18px;
            right: 18px;
            width: 28px;
            height: 28px;
            border: 0;
            background: #222;
            color: #fff;
            cursor: pointer;
        }
        .legend-note {
            margin-top: 28px;
            padding: 22px 26px;
            border-radius: 6px;
            background: #f2f2f2;
        }
        .car-location {
            min-height: 24px;
            margin-bottom: 10px;
            color: #cbd5e1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .car-specs {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px 14px;
            margin: 10px 0 14px;
            min-height: 48px;
        }
        .car-specs span {
            display: inline-flex;
            align-items: center;
            min-width: 0;
            min-height: 20px;
            color: #d6dce6;
            font-size: 14px;
            line-height: 1.25;
        }
        .car-specs span {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .car-specs span::before {
            content: "";
            width: 17px;
            height: 17px;
            flex: 0 0 17px;
            margin-right: 7px;
            background: #aeb6c2;
            border-radius: 50%;
        }
        .catalog-card {
            display: flex;
            flex-direction: column;
        }
        .car-body {
            flex: 1;
            display: grid;
            grid-template-rows: 58px 28px 58px 38px;
            align-content: start;
        }
        .car-body h3 {
            min-height: 58px;
            margin-bottom: 0;
            display: -webkit-box;
            overflow: hidden;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
        .price-row {
            align-self: start;
            min-height: 38px;
        }
        .pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin: 46px 0 70px;
        }
        .pagination a,
        .pagination span {
            min-width: 38px;
            min-height: 38px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 1px solid rgba(255, 255, 255, 0.22);
            border-radius: 4px;
            background: #fff;
            color: #111318;
            padding: 0 10px;
            font-weight: 800;
        }
        .pagination a:hover,
        .pagination .active {
            background: #111318;
            border-color: #111318;
            color: #fff;
        }
        .pagination .disabled {
            opacity: 0.45;
            pointer-events: none;
        }
        @media (max-width: 1199.98px) {
            .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
            .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        }
        @media (max-width: 991.98px) {
            .catalog-sort {
                justify-content: stretch;
                align-items: stretch;
                flex-wrap: wrap;
                gap: 10px;
            }
            .sort-help,
            .sort-menu,
            .sort-toggle {
                width: 100%;
            }
            .sort-options {
                left: 0;
                right: auto;
                width: min(100%, 320px);
            }
            .filter-grid,
            .catalog-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .car-body {
                grid-template-rows: auto;
                gap: 8px;
            }
        }
        @media (max-width: 767.98px) {
            .legend-modal {
                padding: 24px 12px;
            }
            .legend-dialog {
                padding: 32px 18px 24px;
            }
            .legend-dialog h2 {
                font-size: clamp(24px, 8vw, 32px);
            }
            .legend-dialog p {
                font-size: 16px;
            }
            .filter-actions {
                display: grid;
                grid-template-columns: 1fr;
                gap: 12px;
            }
            .switch-field,
            .filter-reset,
            .filter-actions .btn {
                width: 100%;
                min-width: 0;
            }
        }
        @media (max-width: 575.98px) {
            .filter-grid,
            .catalog-grid {
                grid-template-columns: 1fr;
            }
            .filter-grid label.wide {
                grid-column: auto;
            }
            .catalog-sort {
                margin-top: 0;
            }
            .car-body h3 {
                min-height: 0;
            }
            .car-location {
                white-space: normal;
                min-height: 0;
            }
            .car-specs {
                grid-template-columns: 1fr;
                min-height: 0;
            }
            .price-row {
                min-height: 0;
                align-items: flex-start;
                flex-direction: column;
            }
            .pagination {
                flex-wrap: wrap;
                margin: 32px 0 48px;
            }
        }

