/* 
   Modern Ad List Styles (Grid & Row Support)
   Container ID: #ad-container
*/

.ad-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- Common Card Styles --- */
.ad-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ad-card-premium {
    border: 2px solid var(--mz-one);
}

.ad-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #ccc;
}

.ad-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.ad-image-wrapper {
    position: relative;
    background-color: #f8f9fa;
    overflow: hidden;
    aspect-ratio: 4 / 3; /* Globaler CLS-Schutz: Immer Platz reservieren */
}

.ad-image-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ad-card:hover .ad-image-wrapper img {
    transform: scale(1.05);
}

.ad-image-wrapper .ad-price {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--mz-one);
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ad-image-wrapper .ad-badge-search {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--mz-two); /* Blau */
    color: #fff;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 2;
}

.adcard-premium-label {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--mz-one);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    z-index: 3;
    border-bottom-left-radius: 8px;
}

.ad-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ad-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.3;
    height: 2.6em; /* Fixiert auf exakt 2 Zeilen (1.3 * 2) */
    /* Clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ad-desc {
    /*font-size: 0.9rem;*/
    color: #4a4a4a; /* Dunkler für besseren Kontrast (vorher #666) */
    line-height: 1.5; /* Explizit setzen für Berechnung */
    margin: 0 0 15px 0;
    flex-grow: 1;
    height: 4.5em; /* Fixiert auf exakt 3 Zeilen (1.5 * 3) */
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ad-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #444; /* Noch dunkler für optimalen Kontrast */
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
    margin-top: auto;
}

/* --- VIEW: LIST (Row) --- */
.view-list .ad-link {
    flex-direction: row;
}
.view-list .ad-image-wrapper {
    width: 220px;
    flex-shrink: 0;
    align-self: start; /* Verhindert vertikales Strecken, erzwingt 4:3 */
}
/* Mobile List View: Stack vertically on very small screens */
@media (max-width: 500px) {
    /* Grid bleibt stacked, aber List bleibt Row (Bild links, Text rechts) */
    .view-list .ad-image-wrapper {
        width: 130px;
    }

    .view-list .ad-content {
        padding: 10px; /* Kompakteres Padding */
    }

    .view-list .ad-title {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .view-list .ad-meta {
        padding-top: 5px;
        font-size: 0.75rem;
    }
}

/* --- VIEW: GRID --- */
.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.view-grid .ad-link {
    flex-direction: column;
}
.view-grid .ad-image-wrapper {
    width: 100%;
    height: auto;
}

.ad-count-info {
    font-size: 0.85rem;
    color: #999;
    margin-top: 15px;
    margin-bottom: 0;
}

/* Admin List View Placeholder */
.lv-thumb-placeholder {
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

/* Watchlist Styles */
.ad-card-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative; /* Für Overlay */
}

.ad-card-wrapper .ad-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    flex-grow: 1;
}

.watchlist-actions {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-top: 1px solid #eee;
    border-radius: 0 0 8px 8px;
    padding: 10px 15px;
    display: flex;
    justify-content: flex-end;
}

.watchlist-info {
    line-height: 1.2;
}

.text-green { color: #28a745; }
.text-red { color: #dc3545; }
.f-s { font-size: 0.85rem; }
.f-xs { font-size: 0.75rem; }

/* Overlay für inaktive Anzeigen */
.watchlist-status-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 50px; /* Actions freilassen */
    background: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none; /* Klicks gehen durch (zum Link) */
}

/* Watchlist Filter */
.watchlist-filter-form { gap: 10px; }
.watchlist-cat-select { min-width: 200px; }
.search-group { gap: 5px; }

/* --- Similar Ads (Compact Row) --- */
/* Überschreibt die Standard view-list Styles nur wenn view-list-similar gesetzt ist */

.view-list-similar .ad-image-wrapper {
    width: 160px; /* Schmaler als Standard 220px */
}

.view-list-similar .ad-desc {
    -webkit-line-clamp: 2; /* Nur 2 Zeilen Text */
    height: 3em; /* Höhe anpassen (1.5 * 2) */
    margin-bottom: 5px;
}

.view-list-similar .ad-content {
    padding: 10px 15px; /* Etwas kompakteres Padding */
}

.view-list-similar .ad-title {
    font-size: 1rem; /* Etwas kleinerer Titel */
}

@media (max-width: 500px) {
    .view-list-similar .ad-image-wrapper {
        width: 110px; /* Noch kleiner auf Mobile */
    }
}