/*
 * Fahrzeugbestand – eigenes Stylesheet
 * Wird ausschließlich vom Fahrzeugbestand-Template geladen.
 * Die Versionierung erfolgt im PHP-Template über filemtime().
 */

/* ==========================================================
   Fahrzeugbestand: responsive Filter und dynamische Facetten
   ========================================================== */

.vehicle-inventory-page {
    width: 100%;
    background: whitesmoke;
    box-sizing: border-box;
}

.vehicle-inventory-page *,
.vehicle-inventory-page *::before,
.vehicle-inventory-page *::after {
    box-sizing: border-box;
}

.vehicle-inventory-page .single-title,
.vehicle-inventory-page .motorrad-filter-section,
.vehicle-inventory-page .vehicle-inventory-layout {
    width: min(1380px, calc(100% - 40px));
    margin-left: auto;
    margin-right: auto;
}

.vehicle-inventory-layout {
    display: grid;
    grid-template-columns: minmax(0, 768px) minmax(250px, 310px);
    grid-template-areas: "inventory filters";
    justify-content: center;
    gap: 28px;
    align-items: start;
    margin-top: 24px;
    margin-bottom: 50px;
}

.vehicle-inventory-layout .list-section {
    grid-area: inventory;
    width: 100%;
    max-width: 768px;
    min-width: 0;
    margin: 0;
}

.vehicle-inventory-layout .filter-section {
    grid-area: filters;
    min-width: 0;
    margin: 0;
}

.mobile-filter-toggle {
    display: none;
}

.filter-sidebar-inner {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
    padding: 22px;
    background: #fff;
    border: 1px solid rgba(15, 15, 15, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(15, 15, 15, 0.08);
}

.filter-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.filter-sidebar-header h2 {
    margin: 2px 0 0;
    font-size: 1.35rem;
    line-height: 1.2;
}

.filter-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(15, 15, 15, 0.58);
}

.filter-reset-button {
    appearance: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111;
    font: inherit;
    font-size: 0.78rem;
    text-decoration: underline;
    cursor: pointer;
}

.filter-reset-button:hover,
.filter-reset-button:focus-visible {
    text-decoration-thickness: 2px;
}

.active-filter-summary {
    padding: 12px;
    margin-bottom: 12px;
    background: #f4f4f4;
    border-radius: 10px;
    font-size: 0.8rem;
}

.active-filter-summary p {
    margin: 0;
}

.active-filter-title {
    margin-bottom: 8px !important;
    font-weight: 700;
}

.active-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.active-filter-chip {
    appearance: none;
    max-width: 100%;
    padding: 5px 8px;
    overflow: hidden;
    border: 1px solid rgba(15, 15, 15, 0.15);
    border-radius: 999px;
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.active-filter-chip:hover,
.active-filter-chip:focus-visible {
    border-color: #111;
}

.filter-item {
    border-top: 1px solid rgba(15, 15, 15, 0.1);
}

.filter-item:last-of-type {
    border-bottom: 1px solid rgba(15, 15, 15, 0.1);
}

.filter-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 0;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}

.filter-item summary::-webkit-details-marker {
    display: none;
}

.filter-item summary::after {
    content: "+";
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 400;
}

.filter-item[open] summary::after {
    content: "−";
}

.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    margin-left: auto;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 0.7rem;
    line-height: 1;
}

.filter-count-badge:empty {
    display: none;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 0 14px;
}

.filter-options-scroll {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.filter-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 5px 7px;
    border-radius: 8px;
    cursor: pointer;
}

.filter-option:hover {
    background: #f5f5f5;
}

.filter-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: #111;
}

.filter-option-label {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.88rem;
    text-align:left;
}

.filter-option-count {
    color: rgba(15, 15, 15, 0.56);
    font-size: 0.76rem;
}

.filter-option.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.filter-options-empty {
    margin: 0;
    color: rgba(15, 15, 15, 0.58);
    font-size: 0.82rem;
}

.range-filter {
    padding: 0 0 18px;
}

.range-filter-values {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: rgba(15, 15, 15, 0.7);
    font-size: 0.78rem;
}

.range-filter-values output {
    color: #111;
    font-weight: 650;
}

.dual-range {
    --range-left: 0%;
    --range-right: 0%;
    position: relative;
    width: 100%;
    height: 32px;
    touch-action: none;
}

/* Eine einzige sichtbare Schiene für beide Reglerpunkte */
.dual-range-rail {
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 10px;
    left: 10px;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 15, 15, 0.16);
    transform: translateY(-50%);
    pointer-events: none;
}

.dual-range-selection {
    position: absolute;
    top: 0;
    right: var(--range-right);
    bottom: 0;
    left: var(--range-left);
    border-radius: inherit;
    background: #111;
}

/* Beide nativen Range-Inputs liegen exakt übereinander. Ihre eigenen
   Schienen sind unsichtbar; sichtbar bleiben nur die beiden Griffe. */
.dual-range-input[type="range"] {
    position: absolute !important;
    z-index: 3;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    pointer-events: none;
}

.dual-range-input-min {
    z-index: 4 !important;
}

.dual-range-input-max {
    z-index: 5 !important;
}

.dual-range[data-active-handle="min"] .dual-range-input-min {
    z-index: 6 !important;
}

.dual-range[data-active-handle="max"] .dual-range-input-max {
    z-index: 6 !important;
}

.dual-range-input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
}

.dual-range-input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -10px;
    border: 2px solid #111;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(15, 15, 15, 0.22);
    appearance: none;
    -webkit-appearance: none;
    cursor: grab;
    pointer-events: auto;
}

.dual-range-input[type="range"]:active::-webkit-slider-thumb {
    cursor: grabbing;
}

.dual-range-input[type="range"]::-moz-range-track,
.dual-range-input[type="range"]::-moz-range-progress {
    width: 100%;
    height: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.dual-range-input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 2px solid #111;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(15, 15, 15, 0.22);
    cursor: grab;
    pointer-events: auto;
}

.dual-range-input[type="range"]:active::-moz-range-thumb {
    cursor: grabbing;
}

.dual-range-input[type="range"]:focus-visible::-webkit-slider-thumb {
    outline: 3px solid rgba(15, 15, 15, 0.22);
    outline-offset: 2px;
}

.dual-range-input[type="range"]:focus-visible::-moz-range-thumb {
    outline: 3px solid rgba(15, 15, 15, 0.22);
    outline-offset: 2px;
}

.dual-range-input[type="range"]:disabled {
    opacity: 0.4;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sort-filter-item {
    padding-top: 18px;
}

.sort-filter-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 650;
}

.sort-filter-item select {
    width: 100%;
    min-height: 42px;
    padding: 8px 34px 8px 10px;
    border: 1px solid rgba(15, 15, 15, 0.2);
    border-radius: 9px;
    background-color: #fff;
    color: #111;
    font: inherit;
    font-size: 0.85rem;
}

.inventory-toolbar {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 4px 12px;
}

#results-count {
    margin: 0;
    font-weight: 650;
}

#container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 768px;
    gap: 20px;
}

.vehicle-card-template {
    display: none !important;
}

#bestand-content.vehicle-card {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    width: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 16px;
    box-shadow: 0 7px 24px rgba(15, 15, 15, 0.07);
}

#bestand-content.vehicle-card > div:first-child {
    min-width: 0;
}

#bestand-content.vehicle-card #titelbild-url {
    display: block;
    width: 100%;
    background: #f5f5f5;
}

#bestand-content.vehicle-card .titelbild {
    display: block;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}

#bestand-content.vehicle-card #co2 {
    width: auto !important;
    margin: 12px 18px;
    font-size: 0.72rem;
    line-height: 1.45;
}

#bestand-content.vehicle-card .text-felder {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px;
}

#bestand-content.vehicle-card #headline-url {
    color: #111;
    text-decoration: none;
}

#bestand-content.vehicle-card #headline-ausstattung {
    color: #111;
    text-decoration: none;
    font-weight: 400;
    margin-top:0;
}

#bestand-content.vehicle-card #headline {
    margin: 0 0 6px;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    line-height: 1.2;
}

#bestand-content.vehicle-card .subtitle {
    margin: 0 0 15px;
    color: rgba(15, 15, 15, 0.58);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

#bestand-content.vehicle-card #preis-overview {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

#bestand-content.vehicle-card #preisangabe {
    margin: 0;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    font-weight: 650;
}

#bestand-content.vehicle-card #mwst-ausweisbar,
#bestand-content.vehicle-card #finanzierung-overview p {
    margin: 3px 0 0;
    font-size: 0.75rem;
}

#bestand-content.vehicle-card .details-list {
    margin: 0;
}

#bestand-content.vehicle-card .details-first-row,
#bestand-content.vehicle-card .details-second-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
}

#bestand-content.vehicle-card .details-first-row {
    padding: 12px 0;
    margin-bottom: 10px;
    border-top: 1px solid rgba(15, 15, 15, 0.09);
    border-bottom: 1px solid rgba(15, 15, 15, 0.09);
}

#bestand-content.vehicle-card .details-second-row-details li,
#bestand-content.vehicle-card .details-first-row li {
    margin-bottom: 7px;
    font-size: 0.82rem;
    line-height: 1.4;
}

#bestand-content.vehicle-card .details-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 18px;
}

#bestand-content.vehicle-card #details-url {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border-radius: 9px;
    background: #111;
    color: #fff;
    text-decoration: none;
}

#bestand-content.vehicle-card .ref-number {
    margin: 0;
    color: rgba(15, 15, 15, 0.56);
    font-size: 0.72rem;
}

.inventory-empty-state {
    padding: 45px 25px;
    background: #fff;
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 16px;
    text-align: center;
}

.inventory-empty-state h3,
.inventory-empty-state p {
    margin: 0;
}

.inventory-empty-state p {
    margin-top: 8px;
    color: rgba(15, 15, 15, 0.65);
}

/* Motorradtypen bleiben über dem gesamten Bestand. */
.motorrad-filter-section {
    margin-top: 24px;
}

.motorrad-filter-wrapper {
    padding: 18px;
    background: #fff;
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 16px;
}

.motorrad-filter {
    position: relative;
    max-height: 148px;
    overflow: hidden;
    transition: max-height 0.28s ease;
}

.motorrad-filter.expanded {
    max-height: 420px;
}

.motorrad-filter-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.motorrad-filter-list + .motorrad-filter-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 12px;
}

.motorrad-filter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 125px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f5f5f5;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.motorrad-filter-item:hover,
.motorrad-filter-item:focus-visible {
    border-color: rgba(15, 15, 15, 0.28);
    transform: translateY(-1px);
    outline: none;
}

.motorrad-filter-item.active {
    border-color: #111;
    background: #fff;
    box-shadow: inset 0 0 0 1px #111;
}

.motorrad-filter-item img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.motorrad-filter-item p {
    margin: 7px 0 0;
    font-size: 0.82rem;
    font-weight: 650;
}

.toggle-button {
    display: block;
    margin: 14px auto 0;
    padding: 8px 14px;
    border: 1px solid rgba(15, 15, 15, 0.18);
    border-radius: 9px;
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

@media (min-width: 768px) {
    .vehicle-inventory-layout .filter-section {
        margin-top: 48px;
    }
}

@media (max-width: 1100px) {
    #bestand-content.vehicle-card {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 767px) {
    .vehicle-inventory-page .single-title,
    .vehicle-inventory-page .motorrad-filter-section,
    .vehicle-inventory-page .vehicle-inventory-layout {
        width: min(100% - 24px, 680px);
    }

    .vehicle-inventory-layout {
        display: flex;
        flex-direction: column;
        gap: 18px;
        margin-top: 18px;
    }

    .vehicle-inventory-layout .filter-section,
    .vehicle-inventory-layout .list-section {
        width: 100%;
    }

    .vehicle-inventory-layout .filter-section {
        margin-top: 0;
    }

    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        min-height: 72px;
        padding: 14px 16px;
        border: 1px solid rgba(15, 15, 15, 0.1);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 7px 24px rgba(15, 15, 15, 0.07);
        color: #111;
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

    .mobile-filter-toggle-copy {
        display: flex;
        flex: 1;
        min-width: 0;
        flex-direction: column;
        gap: 3px;
    }

    .mobile-filter-toggle-title {
        font-size: 1rem;
        font-weight: 700;
        line-height: 1.25;
    }

    .mobile-filter-toggle-summary {
        overflow: hidden;
        color: rgba(15, 15, 15, 0.62);
        font-size: 0.82rem;
        line-height: 1.35;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-filter-toggle-action {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 9px;
    }

    .mobile-filter-toggle-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 25px;
        height: 25px;
        padding: 0 7px;
        border-radius: 999px;
        background: #111;
        color: #fff;
        font-size: 0.75rem;
        font-weight: 700;
    }

    .mobile-filter-toggle-count[hidden] {
        display: none;
    }

    .mobile-filter-toggle i {
        transition: transform 180ms ease;
    }

    .filter-section.is-open .mobile-filter-toggle i {
        transform: rotate(180deg);
    }

    .filter-sidebar-inner {
        display: none;
        position: static;
        width: 100%;
        max-height: none;
        margin-top: 10px;
        overflow: visible;
        padding: 17px;
    }

    .filter-section.is-open .filter-sidebar-inner {
        display: block;
    }

    .filter-sidebar-header h2 {
        font-size: 1.2rem;
    }

    .filter-options-scroll {
        max-height: none;
        overflow: visible;
    }

    .motorrad-filter {
        max-height: 136px;
    }

    .motorrad-filter.expanded {
        max-height: 980px;
    }

    .motorrad-filter-list,
    .motorrad-filter-list + .motorrad-filter-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .motorrad-filter-item {
        min-height: 112px;
    }

    .motorrad-filter-item img {
        width: 58px;
        height: 58px;
    }

    #bestand-content.vehicle-card .text-felder {
        padding: 18px;
    }

    #bestand-content.vehicle-card #preis-overview,
    #bestand-content.vehicle-card .details-bottom {
        align-items: flex-start;
        flex-direction: row;
    }

    #bestand-content.vehicle-card .details-first-row,
    #bestand-content.vehicle-card .details-second-row {
        /*grid-template-columns: 1fr;*/
    }

    #bestand-content.vehicle-card #details-url {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .filter-sidebar-header {
        flex-direction: column;
        gap: 7px;
    }

    .motorrad-filter-list,
    .motorrad-filter-list + .motorrad-filter-list {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .motorrad-filter-item p {
        font-size: 0.75rem;
    }
}

/* ==========================================================
   Fahrzeugbestand: einheitliche Marken-/Modelloptionen
   und bessere mobile Breitennutzung
   ========================================================== */

/* Marke und Modell verwenden ausdrücklich exakt dasselbe Layout. */
.vehicle-inventory-page #markenFilter,
.vehicle-inventory-page #modellFilter {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 0 0 14px;
}

.vehicle-inventory-page #markenFilter .filter-option,
.vehicle-inventory-page #modellFilter .filter-option {
    display: grid;
    width: 100%;
    min-height: 34px;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 5px 7px;
    border-radius: 8px;
    font: inherit;
    text-align: center;
    font-weight:bold;
}

.vehicle-inventory-page #markenFilter .filter-option input,
.vehicle-inventory-page #modellFilter .filter-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: #111;
}

.vehicle-inventory-page #markenFilter .filter-option-label,
.vehicle-inventory-page #modellFilter .filter-option-label {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.88rem;
    line-height: 1.35;
    text-align:left;
}

.vehicle-inventory-page #markenFilter .filter-option-count,
.vehicle-inventory-page #modellFilter .filter-option-count {
    justify-self: end;
    color: rgba(15, 15, 15, 0.56);
    font-size: 0.76rem;
    line-height: 1;
}

@media (min-width: 335px) and (max-width: 767px) {
    /* Weniger ungenutzter Rand innerhalb des mobilen Filterfeldes. */
    .vehicle-inventory-page .filter-sidebar-inner {
        padding-right: 10px;
        padding-left: 10px;
    }

    /* Kopf, aktive Filter und Sortierung behalten einen kleinen Innenabstand. */
    .vehicle-inventory-page .filter-sidebar-header,
    .vehicle-inventory-page .active-filter-summary,
    .vehicle-inventory-page .sort-filter-item {
        margin-right: 6px;
        margin-left: 6px;
    }

    /* Die einzelnen Filtergruppen wachsen nahezu bis an den Kartenrand. */
    .vehicle-inventory-page .filter-item {
        width: calc(100% + 8px);
        margin-right: -4px;
        margin-left: -4px;
        padding-right: 4px;
        padding-left: 4px;
    }

    .vehicle-inventory-page .filter-item summary {
        padding-right: 6px;
        padding-left: 6px;
    }

    .vehicle-inventory-page .filter-item > .filter-options,
    .vehicle-inventory-page .filter-item > .range-filter {
        padding-right: 6px;
        padding-left: 6px;
    }

    .vehicle-inventory-page #markenFilter,
    .vehicle-inventory-page #modellFilter {
        width: 100%;
    }
}

/* Größere, responsiv skalierende Titelbilder auf Tablet-/Desktopbreite */
@media (min-width: 1100px) {
    #bestand-content.vehicle-card {
        grid-template-columns: clamp(340px, 39%, 420px) minmax(0, 1fr);
    }

    #bestand-content.vehicle-card > div:first-child,
    #bestand-content.vehicle-card #titelbild-url,
    #bestand-content.vehicle-card .titelbild {
        width: 100%;
        max-width: none;
    }
}
