/* ==========================================================================
   1. KRABYTE FAHRZEUGLISTE (CSS)
   ========================================================================== */

.kr-vehicle-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Hauptkarte: Flexbox (Für Desktop) */
.kr-vehicle-card {
    display: flex;
    flex-direction: row;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.kr-vehicle-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

/* Bild links (Desktop 300px fix) */
.kr-vehicle-image {
    display: flex;
    flex-direction: column; 
    flex: 0 0 300px;
    max-width: 300px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

.kr-main-image-link {
    flex: 1 1 auto; 
    display: block;
    min-height: 150px;
}

.kr-main-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.kr-vehicle-card:hover .kr-main-image-link img {
    transform: scale(1.05);
}

.kr-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 0.9rem;
}

/* Rechter Bereich */
.kr-vehicle-content {
    flex: 1 1 auto;
    min-width: 0; 
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
}

/* 1. Beschreibung */
.kr-vehicle-title {
    margin: 0 0 10px 0;
    padding: 0 0 10px 0;
    font-size: 1.25rem;
    font-weight: bold;
    /* border-bottom: 1px dashed #e1e5e9; */
}

.kr-vehicle-title a {
    text-decoration: none;
    color: #2c3e50;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kr-vehicle-title a:hover { color: #046f41; }

/* Preise */
.kr-vehicle-prices { margin-bottom: 20px; }
.kr-price-gross { display: block; color: #046f41; font-size: 1.5rem; font-weight: bold; line-height: 1.2; }
.kr-price-gross small { font-size: 0.7em; font-weight: normal; color: #555; margin-left: 5px; }
.kr-price-net { display: block; color: #2c3e50; font-size: 1.1rem; font-weight: 500; margin-top: 8px; }
.kr-price-net small { font-size: 0.8em; color: #6c757d; margin-left: 5px; }

/* Pills */
.kr-vehicle-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.kr-pill {
    display: inline-flex; align-items: center; background-color: #f4f6f8;
    border: 1px solid #e1e5e9; border-radius: 4px; padding: 6px 12px;
    font-size: 0.85rem; color: #2c3e50; font-weight: 500;
}
.kr-pill svg { margin-right: 6px; flex-shrink: 0; }
.kr-pill-success { background-color: #e6f4ea; border-color: #b6d4c2; color: #046f41; }

/* Button */
.kr-vehicle-actions { margin-top: auto; }
.kr-btn {
    display: inline-block; background-color: #046f41; color: #ffffff !important;
    padding: 5px 15px; border-radius: 4px; text-decoration: none; font-weight: bold;
    text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.9rem; transition: background-color 0.2s ease;
}
.kr-btn:hover { background-color: #035533; }

/* Mobile Anpassungen Listenansicht */
@media (max-width: 767px) {
    .kr-vehicle-card { display: block; overflow: hidden; }
    .kr-vehicle-image {
        float: left; flex: none; width: 120px; max-width: 120px; height: auto;
        margin: 10px 12px 5px 10px; border-radius: 4px;
    }
    .kr-main-image-link { min-height: 0 !important; }
    .kr-main-image-link img { min-height: 0 !important; height: auto !important; }
    .kr-vehicle-content { display: block !important; padding: 10px 10px 15px 10px; }
    .kr-vehicle-title { font-size: 1rem; margin: 0 0 8px 0; padding: 0 0 8px 0; border-bottom: 1px solid #f0f0f0; }
    .kr-vehicle-title a {
        white-space: normal !important; overflow: hidden !important; text-overflow: ellipsis !important;
        display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    }
    .kr-price-gross { font-size: 1.2rem; }
    .kr-price-net { font-size: 0.95rem; margin-top: 4px; }
    .kr-vehicle-pills { clear: both; gap: 4px; margin-top: 10px; margin-bottom: 12px; }
    .kr-pill { padding: 4px 8px; font-size: 0.75rem; }
    .kr-btn { padding: 10px 15px; font-size: 0.85rem; width: 100%; text-align: center; }
    .kr-top-thumbnails { height: 40px; }
}

/* ==========================================================================
   TOP FAHRZEUGE (Diagonales Banner & Vorschau)
   ========================================================================== */
.kr-top-vehicle { background-color: #f0fdf4 !important; border-color: #b6d4c2 !important; }
.kr-top-vehicle:hover { background-color: #e6f4ea !important; }

.kr-top-thumbnails {
    display: flex; flex: 0 0 auto; height: 50px; border-top: 1px solid #e1e5e9; margin-top: 2px;
}
.kr-thumb-item { flex: 1 1 0; margin-right: 2px; overflow: hidden; }
.kr-thumb-item:last-child { margin-right: 0; }
.kr-thumb-item img { width: 100%; height: 100%; object-fit: cover; }

.kr-top-banner {
    position: absolute; top: 0; left: 0; z-index: 20; width: 80px; height: 80px;
    overflow: hidden; pointer-events: none;
}
.kr-top-banner::before {
    content: "TOP"; position: absolute; top: 15px; left: -25px; width: 110px; text-align: center;
    background-color: #046f41; color: #ffffff !important; font-size: 0.85rem; font-weight: bold;
    padding: 5px 0; text-transform: uppercase; box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transform: rotate(-45deg); display: block;
}
@media (max-width: 767px) {
    .kr-top-banner { width: 60px; height: 60px; }
    .kr-top-banner::before { top: 10px; left: -20px; width: 85px; font-size: 0.75rem; padding: 3px 0; }
}

/* ==========================================================================
   3. FAHRZEUGFILTER (Sticky Desktop & Mobile Bottom Sheet)
   ========================================================================== */
.kr-filter-wrapper { position: relative; }
.kr-filter-box {
    background: #fff; border: 1px solid #e9ecef; border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06); padding: 20px;
}
.kr-filter-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #e9ecef;
}
.kr-filter-title { font-size: 1.2rem; font-weight: 600; color: #2c3e50; margin: 0; }
.kr-filter-count { font-size: 0.9rem; color: #6c757d; margin-left: auto; margin-right: 15px; }
.kr-filter-close { display: none; background: none; border: none; font-size: 1.5rem; color: #6c757d; }
.kr-filter-group { margin-bottom: 12px; }
.kr-filter-group label { display: block; font-size: 0.9rem; font-weight: 500; color: #6c757d; margin-bottom: 8px; }
.kr-filter-input { width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid #ced4da; font-size: 0.95rem; }
.kr-range { padding: 0; height: 6px; -webkit-appearance: none; appearance: none; background: #e9ecef; border-radius: 4px; }
.kr-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #046f41; cursor: pointer; border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.kr-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #046f41; cursor: pointer; border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

/* Desktop: Sticky Fix für Filter (Nutzt die Twig Variable) */
@media (min-width: 992px) {
    .kr-filter-wrapper.is-sticky {
        position: -webkit-sticky;
        position: sticky;
        top: var(--kr-sticky-top, 120px); 
        align-self: flex-start !important; 
        height: fit-content;
        z-index: 1000;
    }
}

/* Mobile: Bottom Sheet */
.kr-filter-fab {
    display: none; position: fixed; bottom: 20px; right: 20px; width: 56px; height: 56px;
    background: #046f41; color: #fff; border: none; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000000; cursor: pointer; align-items: center; justify-content: center;
}
@media (max-width: 991px) {
    .kr-filter-fab { display: flex; }
    .kr-filter-box {
        display: block; position: fixed; bottom: 0; left: 0; width: 100%; max-height: 85vh; background: #fff;
        z-index: 1000000; transform: translateY(100%); transition: transform 0.3s ease-in-out;
        border-radius: 16px 16px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.15); overflow-y: auto; padding: 20px;
    }
    .kr-filter-box.is-open { transform: translateY(0); }
    .kr-filter-close { display: block; background: #f8f9fa; border-radius: 50%; width: 40px; height: 40px; line-height: 40px; text-align: center; font-size: 1.5rem; }
}

/* 4. FILTER ERWEITERUNGEN (Mobile Grid & Button Position) */
@media (max-width: 991px) {
    .kr-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
    .kr-filter-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; margin-top: 5px; }
    .kr-filter-grid .kr-filter-group, .kr-filter-sliders .kr-filter-group { margin-bottom: 15px; }
}
.kr-filter-fab-left { right: auto !important; left: 20px !important; }

/* ==========================================================================
   5. ALTERNATIVES LAYOUT: GRID (Karten nebeneinander)
   ========================================================================== */

/* Das Grid Wrapper */
.kr-grid-layout .kr-vehicle-list-wrapper {
    display: grid;
    gap: 20px;
}

/* Desktop: 2-3 Spalten nebeneinander */
@media (min-width: 768px) {
    .kr-grid-layout .kr-vehicle-list-wrapper {
        grid-template-columns: 1fr 1fr; /* 2 Spalten auf Tablet */
    }
}
@media (min-width: 1200px) {
    .kr-grid-layout .kr-vehicle-list-wrapper {
        grid-template-columns: 1fr 1fr 1fr; /* 3 Spalten auf großem Desktop */
    }
}

/* Die Karte selbst um 90 Grad drehen (Bild oben, Text unten) */
.kr-grid-layout .kr-vehicle-card {
    flex-direction: column !important; /* Statt row jetzt column */
}

/* Bild: Volle Breite, feste Höhe */
.kr-grid-layout .kr-vehicle-image {
    flex: none !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 200px; /* Feste Höhe für einheitliches Kartenbild */
}
.kr-grid-layout .kr-main-image-link {
    min-height: 200px !important;
}

/* Inhalt darunter */
.kr-grid-layout .kr-vehicle-content {
    padding: 15px !important;
}

/* Auf Mobile (unter 768px) wieder das Standard-Listen-Layout erzwingen, 
   damit die horizontalen Karten nicht zu klein werden */
@media (max-width: 767px) {
    .kr-grid-layout .kr-vehicle-list-wrapper {
        display: flex; /* Zurück auf Flexbox (untereinander) */
    }
    .kr-grid-layout .kr-vehicle-card {
        display: flex !important;
        flex-direction: row !important; /* Wieder horizontal */
    }
    .kr-grid-layout .kr-vehicle-image {
        height: auto;
        flex: 0 0 120px !important;
        max-width: 120px !important;
        width: 120px !important;
    }
    .kr-grid-layout .kr-main-image-link {
        min-height: 0 !important;
    }
}

/* Highlights (Badges) in der Fahrzeugliste */
.kr-highlights-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.kr-highlight-badge {
    background-color: #28a745; /* mobile.de Grün */
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.4;
    display: inline-block;
}

/* Auf Mobile etwas kompakter */
@media (max-width: 768px) {
    .kr-highlight-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
}