/**
 * Datei: search.css
 * Modul: Search
 * Zweck:
 *  - Autocomplete für Standortsuche
 *  - Sortierbox
 *  - Suchfilter-Formular
 *  - Ergebnisse (Cards) inkl. List/Grid
 *  - Mobile Optimierungen
 */

/* ============================================================
   1) Autocomplete
============================================================ */

.mp-search-location-wrapper {
	position: relative;
	width: 100%;
}

/* FIX: Autocomplete beeinflusst Flexbox NICHT mehr */
.mp-search-autocomplete {
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--color-6);
	border-radius: 6px;
	box-shadow: 0 4px 14px rgba(0,0,0,0.08);
	max-height: 260px;
	overflow-y: auto;
	z-index: 99999;
	display: none;
	pointer-events: auto;
}

.mp-ac-item {
	padding: 10px 12px;
	font-size: 15px;
	color: var(--color-4);
	cursor: pointer;
	border-bottom: 1px solid #eee;
	transition: background 0.15s ease;
}

.mp-ac-item:last-child {
	border-bottom: none;
}

.mp-ac-item:hover {
	background: #f7f7f7;
}

/* Aktives Autocomplete-Item (Pfeiltasten-Auswahl) */
.mp-search-autocomplete .mp-ac-item.mp-ac-active {
    background: #eee;
}

/* Markierung des eingegebenen Textes im Vorschlag */
.mp-search-autocomplete .mp-ac-item .mp-ac-highlight {
    font-weight: 700;
    color: var(--color-1);
}

/* ============================================================
   2) Sortierungsbox
============================================================ */

.mp-search-sorting-form .mp-field { margin-bottom: 0; }
.mp-search-sorting-form select { width: 200px; }

/* ============================================================
   3) Treffertabelle (alt – Kompatibilität)
============================================================ */

.mp-search-results { list-style: none; padding: 0; margin: 0; }

.mp-search-result-item {
	padding: 10px 0;
	border-bottom: 1px solid #eee;
}

.mp-search-result-item a {
	color: var(--color-text);
	text-decoration: none;
}

.mp-search-result-item a:hover { color: var(--color1); }

/* ============================================================
   4) Inputs einheitlich
============================================================ */

.mp-search-input,
.mp-search-location {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 0;
	border: none;
	border-bottom: 2px solid #ccc;
	background: transparent;
	font-size: 15px;
	outline: none;
	transition: border-color 0.2s ease;
}

.mp-search-input:focus,
.mp-search-location:focus {
	border-bottom-color: #006699;
}

/* ============================================================
   5) Ergebnis-Container: List vs. Grid
============================================================ */

/* Liste: vertikale Liste, Cards horizontal */
.mp-search-results-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 10px;
}

/* Grid: 2-Spalten-Layout, Cards mit Bild oben */
.mp-search-results-grid {
    display: grid;
    grid-gap: 20px;
    margin-top: 10px;
}

/* Desktop: 2 Spalten, responsive */
@media (min-width: 1201px) {
    .mp-search-results-grid.mp-search-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet: ebenfalls max. 2 Spalten */
@media (max-width: 1200px) and (min-width: 700px) {
    .mp-search-results-grid.mp-search-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile: 1 Spalte */
@media (max-width: 699px) {
    .mp-search-results-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   6) Cards – gemeinsame Basis
============================================================ */

.mp-search-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: box-shadow 0.15s ease;
}

.mp-search-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.mp-card-image img {
    display: block;
    object-fit: cover;
}

/* Content-Bereich */
.mp-card-content {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

/* ============================================================
   7) LISTEN-LAYOUT (Row)
============================================================ */

.mp-search-card-list {
    display: flex;
    gap: 20px;
    padding: 10px 12px;
}

.mp-search-card-list .mp-card-image img {
    width: 200px;
    height: 150px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ============================================================
   8) GRID-LAYOUT (Bild oben)
============================================================ */

.mp-search-card-grid {
    display: flex;
    flex-direction: column;
}

.mp-search-card-grid .mp-card-image img {
    width: 100%;
    height: 180px;
    border-radius: 4px 4px 0 0;
}

/* Mobile: auch Liste untereinander */
@media (max-width: 700px) {
    .mp-search-card-list {
        flex-direction: column;
    }

    .mp-search-card-list .mp-card-image img {
        width: 100%;
        height: 200px;
    }
}

/* ============================================================
   9) Inhalt: Meta / Titel / Untertitel / Beschreibung
============================================================ */

/* 1. Zeile: Kategorie + Standort */
.listing-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: #666;
}

.listing-meta-left,
.listing-meta-right {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

/* Standort-Icon wie BB */
.listing-loc i {
    color: var(--color-3);
    margin-right: 4px;
}

/* 2. Zeile: Titel (max. 2 Zeilen, dann …) */
.mp-search-card .listing-title {
    margin: 2px 0 0 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.mp-search-card .listing-title a {
    color: var(--color-1);
    text-decoration: none;
}

.mp-search-card .listing-title a:hover {
    text-decoration: underline;
}

/* 3. Zeile: Untertitel */
.mp-search-card .listing-subtitle {
    margin-top: 4px;
    font-size: 0.9rem;
    color: #666;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

/* 4. Zeile: Beschreibung (Text kommt bereits gekürzt aus PHP) */
.mp-search-card .listing-desc {
    margin-top: 4px;
    font-size: 0.9rem;
    color: #444;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1; /* eine Zeile reicht, da max. 5 Wörter */
}

/* ============================================================
   10) Footer – links Fav/Admin, rechts Preis
============================================================ */

.listing-footer {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
}

.listing-price {
    font-weight: 600;
    color: #222;
    font-size: 1rem;
    line-height: 1.2;
}

/* Herz/Fav-Icon (kommt aus Filter) */
.fav-icon {
    cursor: pointer;
    color: #999;
    font-size: 1.3rem;
    transition: color 0.2s ease;
}
.fav-icon:hover { color: #e33; }

/* ============================================================
   11) Trefferzähler
============================================================ */

.mp-search-result-count {
	font-size: 15px;
	font-weight: 600;
	color: var(--color-4);
	margin-bottom: 18px;
	padding: 6px 0;
	border-bottom: 1px solid var(--color-6);
}

/* ============================================================
   12) Entfernung (km) pro Suchergebnis
============================================================ */

.mp-card-distance {
	font-size: 13px;
	color: #444;
	display: flex;
	align-items: center;
}

.mp-card-distance i {
	color: var(--color-3);
	margin-right: 4px;
}
















/* ============================================================
   ACCORDION – Kategorien
============================================================ */

.mp-acc-cat {
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.mp-acc-item {
    border-bottom: 1px solid #eee;
}

.mp-acc-item:last-child {
    border-bottom: none;
}

.mp-acc-head {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: #f7f7f7;
    border: none;
    cursor: pointer;
    font-size: 15px;
}

.mp-acc-body {
    display: none;
    padding: 8px 12px;
    background: #fff;
}

.mp-acc-body a {
    display: block;
    padding: 4px 0;
    color: var(--color-1);
    text-decoration: none;
}
.mp-acc-body a:hover {
    text-decoration: underline;
}
/* ============================================================
   ACCORDION ICONS
   Modernes Chevron wie mobile.de
============================================================ */

.mp-acc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
}

.mp-acc-icon {
    transition: transform 0.25s ease;
    font-size: 13px;
    color: #666;
}

/* Drehen bei offenem Panel */
.mp-acc-item.open .mp-acc-icon {
    transform: rotate(90deg);
    color: #000;
}

/* Hover für moderne UX */
.mp-acc-head:hover {
    background: #eee;
}


/* ============================================================
   13) Search-Layout: Sidebar links, Content rechts
   ============================================================ */

/* Desktop: 2-Spalten-Layout */
.mp-search-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Sidebar */
.mp-search-sidebar {
    width: 280px;
    flex-shrink: 0;
}

/* Content */
.mp-search-content {
    flex: 1 1 auto;
    min-width: 0;
}

/* Sidebar-Whiteblock wieder kompakt */
.mp-search-sidebar .mp-white-block {
    margin-bottom: 20px;
}

/* ------------------------------------------------------------
   Mobile Darstellung
   Sidebar soll oben stehen, volle Breite
------------------------------------------------------------ */
@media (max-width: 900px) {
    .mp-search-layout {
        flex-direction: column;
        gap: 20px;
    }

    .mp-search-sidebar,
    .mp-search-content {
        width: 100%;
    }
}

/* ------------------------------------------------------------
   Optional: Sticky Sidebar (wie mobile.de)
   Wird NUR am Desktop aktiv
   Sehr angenehmes UX für Filter
------------------------------------------------------------ */
@media (min-width: 901px) {
    .mp-search-sidebar {
        position: sticky;
        top: 20px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        padding-right: 4px; /* Scrollbar-Puffer */
    }
}
/* ============================================================
   ACCORDION – mobile.de Version mit Ebenen 1–3
   ============================================================ */

/* Grundstruktur des Accordions */
.mp-acc-cat {
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

/* Hauptebene */
.mp-acc-item {
    border-bottom: 1px solid #eee;
}
.mp-acc-item:last-child {
    border-bottom: none;
}

/* Button der Hauptebene */
.mp-acc-head {
    width: 100%;
    padding: 12px 14px;
    background: #f7f7f7;
    border: none;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

/* Hover */
.mp-acc-head:hover {
    background: #eee;
}

/* Chevron-Icon */
.mp-acc-icon {
    font-size: 13px;
    color: #666;
    transition: transform 0.25s ease, color 0.25s ease;
}

/* Drehen bei offen */
.mp-acc-item.open > .mp-acc-head .mp-acc-icon {
    transform: rotate(90deg);
    color: #000;
}

/* Body (Ebenen 2+3) */
.mp-acc-body {
    display: none;
    padding: 8px 0 10px;
    background: #fff;
}

/* Level 2: Unterkategorien */
.mp-acc-sub {
    padding-left: 10px;
    border-left: 2px solid #f0f0f0;
    margin: 2px 0;
}

/* Button für Level 2 */
.mp-acc-sub-head {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: #fafafa;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

/* Hover Level 2 */
.mp-acc-sub-head:hover {
    background: #f0f0f0;
}

/* Level-2 Chevron */
.mp-acc-sub-head .mp-acc-icon {
    font-size: 12px;
    opacity: 0.7;
}
.mp-acc-sub.open .mp-acc-icon {
    transform: rotate(90deg);
    opacity: 1;
}

/* Level 3: Einträge */
.mp-acc-sub-body {
    display: none;
    padding: 6px 20px;
    background: #fff;
}

/* Links in Level 3 */
.mp-acc-sub-body a {
    display: block;
    padding: 4px 0;
    font-size: 14px;
    color: var(--color-1);
    text-decoration: none;
}
.mp-acc-sub-body a:hover {
    text-decoration: underline;
}

/* Animation für Ein-/Ausfahren */
.mp-acc-body,
.mp-acc-sub-body {
    transition: all 0.25s ease;
}

/* Einrückungen (nach mobile.de Prinzip) */
.mp-acc-item[data-level="1"] {}
.mp-acc-sub[data-level="2"] { padding-left: 12px; }
.mp-acc-sub-body[data-level="3"] { padding-left: 24px; }
