/* === POSTS ARCHIVE GRID WRAPPER === */
.lb-posts-archive-wrapper {
    contain: layout style;
}

.lb-posts-filter {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0 20px;
}

.lb-posts-filter form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-posts-filter select {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* === GRID LAYOUT SYSTEM 4-4-2+Banner-2+Banner-4-4 === */
.lb-posts-archive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--lb-grid-gap, 20px);
    margin-bottom: 40px;
    position: relative;
    /* Auto rows - KEINE Mindesthöhe mehr, damit das Grid flexibel bleibt */
    grid-auto-rows: auto;
    /* FIX: grid-auto-flow: dense sorgt dafür, dass Lücken im Grid gefüllt werden */
    grid-auto-flow: row dense;
    /* PERFORMANCE: content-visibility für bessere Performance bei vielen Items */
    content-visibility: auto;
}

/* === ORIGINAL ARTICLE CARD STYLES === */
/* EXAKTE KOPIE von articles-carousel.php CSS */

.lb-article-card {
    background: #ffffff;
    border-radius: var(--lb-card-border-radius, 12px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e8e8e8;
    /* Feste Höhe für konsistentes Grid-Layout */
    height: 400px;
    min-height: 400px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    /* PERFORMANCE: Optimize rendering - KEIN contain:layout, da das Grid dynamisch erweitert wird */
    will-change: transform;
}

/* === POSTS POSITIONIERUNG UM BANNER HERUM === */
/* Wird durch JavaScript dynamisch gesetzt, um leere Zeilen zu vermeiden */

.lb-article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.lb-article-image {
    position: relative;
    height: 180px;
    overflow: hidden;
    border-radius: var(--lb-card-border-radius, 12px) var(--lb-card-border-radius, 12px) 0 0;
    margin: 0;
    padding: 0;
}

/* Favoriten-Button Positionierung */
.lb-favorite-button-container {
    position: absolute;
    bottom: 5px;
    right: 5px;
    z-index: 10;
}

/* Favoriten-Button Styling - Stern Icon */
.lb-favorite-button-container .lb-favorite-btn {
    background: rgba(255, 215, 0, 0.95) !important;
    color: #191970 !important;
    /* border: 2px solid #ffffff !important; */
    border-radius: 50% !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.3s ease !important;
}

.lb-favorite-button-container .lb-favorite-btn:hover {
    background: rgba(255, 215, 0, 1) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

.lb-favorite-button-container .lb-favorite-btn i {
    font-size: 18px !important;
    color: #191970 !important;
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    line-height: 18px !important;
    font-family: 'eicons' !important;
    text-align: center !important;
}

.lb-favorite-button-container .lb-favorite-btn.lb-favorited {
    background: rgba(25, 25, 112, 0.95) !important;
    color: #FFD700 !important;
}

.lb-favorite-button-container .lb-favorite-btn.lb-favorited i {
    color: #FFD700 !important;
}

.lb-article-image img, .lb-article-image svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    margin: 0;
    padding: 0;
}

.lb-article-card:hover .lb-article-image img,
.lb-article-card:hover .lb-article-image svg {
    transform: scale(1.02);
}

/* Category Badge oben links - EINHEITLICHES FARBSYSTEM */
.lb-article-category {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    color: #333 !important;
    padding: 5px 10px !important;
    border-radius: 16px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    backdrop-filter: blur(4px);
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

.lb-article-category:hover {
    transform: scale(1.05) !important;
    color: #333 !important;
    text-decoration: none !important;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}


.lb-article-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.lb-article-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lb-article-title a {
    color: inherit;
    text-decoration: none;
}

.lb-article-title a:hover {
    color: #4B0082; /* Dunkelviolett wie articles-carousel */
}

.lb-article-excerpt {
    font-size: 13px;
    color: #777;
    line-height: 1.4;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.lb-article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
}

.lb-article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lb-article-reading-time {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}

.lb-article-read-more {
    color: #4B0082; /* Dunkelviolett wie articles-carousel */
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.lb-article-read-more:hover {
    color: #191970; /* Dunkelblau beim Hover wie articles-carousel */
    text-decoration: none;
}

/* === BANNER POSITIONING IN GRID - 2x1 Layout mit Left/Right Support === */
.lb-banner-container.lb-banner-2x2 {
    /* WICHTIG: KEINE explizite grid-row Positionierung im CSS! */
    /* Banner bleiben im normalen Grid-Flow basierend auf ihrer DOM-Position */
    grid-column: 3 / span 2; /* Default: rechts */
    grid-row: span 1; /* Nimmt nur 1 Zeile ein */
    border-radius: var(--lb-card-border-radius, 12px);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    height: 400px; /* Gleiche Höhe wie Article-Cards */
}

/* Banner-Position: Links */
.lb-banner-container.lb-banner-position-left {
    grid-column: 1 / span 2; /* Startet bei Spalte 1, spannt 2 Spalten (links) */
    grid-row: span 1; /* Nimmt nur 1 Zeile ein */
}

/* Banner-Position: Rechts */
.lb-banner-container.lb-banner-position-right {
    grid-column: 3 / span 2; /* Startet bei Spalte 3, spannt 2 Spalten (rechts) */
    grid-row: span 1; /* Nimmt nur 1 Zeile ein */
}

.lb-banner-container.lb-banner-2x2:hover {
    transform: translateY(-2px);
    /* box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); */
}

/* Banner Items für Rotation */
.lb-banner-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.lb-banner-item.lb-banner-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.lb-banner-item.lb-banner-hidden {
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.lb-banner-single {
    position: relative;
    width: 100%;
    height: 100%;
}

.lb-banner-single img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    loading: lazy;
}

.lb-banner-overlay {
    display: none !important;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.3), transparent);
    color: white;
    padding: 20px;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
}

.lb-banner-container:hover .lb-banner-overlay {
    transform: translateY(0);
    opacity: 1;
}

.lb-banner-overlay h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.lb-banner-container a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

/* Banner Pagination Dots */
.lb-banner-pagination {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.lb-banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.lb-banner-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.lb-banner-dot.active {
    background: #ffffff;
    border-color: #ffffff;
    transform: scale(1.3);
}

/* === BANNER STYLING === */
.lb-banner-slider,
.lb-banner-single {
    height: 100%;
    position: relative;
}

.lb-banner-slide,
.lb-banner-single {
    height: 100%;
}

.lb-banner-slide img,
.lb-banner-single img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    loading: lazy;
}

/* === PAGINATION === */
.lb-posts-pagination {
    text-align: center;
    margin: 40px 0;
}

.lb-posts-pagination .page-numbers {
    display: inline-flex;
    margin: 0 5px;
    padding: 8px 12px;
    background: transparent;
    color: #191970;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.lb-posts-pagination a.page-numbers:hover,
.lb-posts-pagination span.page-numbers.current {
    background: #191970;
    color: white;
}

/* === LAZY LOADING === */
.lb-posts-lazy-loading {
    text-align: center;
    padding: 40px 20px;
}

.lb-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #191970;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === LOAD MORE BUTTON & INFO === */
.lb-load-more-wrapper {
    text-align: center;
    margin: 40px 0 20px;
}

.lb-load-more-button {
    background: linear-gradient(135deg, #191970 0%, #4B0082 100%);
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(25, 25, 112, 0.3);
}

.lb-load-more-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #4B0082 0%, #191970 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 25, 112, 0.4);
}

.lb-load-more-button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.lb-load-more-info {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.lb-load-more-info .lb-loaded-count,
.lb-load-more-info .lb-total-count {
    font-weight: 600;
    color: #191970;
}

/* === RESPONSIVE === */

/* Laptop: 3 Spalten */
@media (max-width: 1366px) {
    .lb-posts-archive-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-flow: row dense;
    }

    .lb-banner-container.lb-banner-2x2 {
        grid-column: 2 / span 2; /* Default: rechts */
        grid-row: span 1; /* Nimmt nur 1 Zeile ein */
        height: 380px; /* Gleiche Höhe wie Article-Cards */
    }

    /* Banner-Position auf Laptop: Links */
    .lb-banner-container.lb-banner-position-left {
        grid-column: 1 / span 2;
        grid-row: span 1; /* Nimmt nur 1 Zeile ein */
    }

    /* Banner-Position auf Laptop: Rechts */
    .lb-banner-container.lb-banner-position-right {
        grid-column: 2 / span 2;
        grid-row: span 1; /* Nimmt nur 1 Zeile ein */
    }

    .lb-article-card {
        height: 380px;
        min-height: 380px;
        max-height: 380px;
    }
}

/* Tablet: 2 Spalten */
@media (max-width: 1024px) {
    .lb-posts-archive-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-flow: row dense;
    }

    .lb-banner-container.lb-banner-2x2,
    .lb-banner-container.lb-banner-position-left,
    .lb-banner-container.lb-banner-position-right {
        grid-column: 1 / span 2; /* Spannt beide Spalten auf Tablet */
        grid-row: auto; /* Automatische Zeile */
        height: 360px;
    }

    .lb-article-card {
        height: 360px;
        min-height: 360px;
        max-height: 360px;
        /* Reset grid-column für Tablet - wird automatisch positioniert */
        grid-column: auto;
    }

    .lb-article-image {
        height: 160px;
    }

    .lb-article-content {
        padding: 16px;
    }
}

/* Mobile: 1 Spalte */
@media (max-width: 768px) {
    .lb-posts-archive-grid {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
    }

    .lb-banner-container.lb-banner-2x2,
    .lb-banner-container.lb-banner-position-left,
    .lb-banner-container.lb-banner-position-right {
        grid-column: auto; /* Automatische Spalte */
        grid-row: auto; /* Automatische Zeile */
        height: 340px;
    }

    .lb-article-card {
        height: 340px;
        min-height: 340px;
        max-height: 340px;
        /* Reset grid-column für Mobile */
        grid-column: auto;
    }

    .lb-article-image {
        height: 160px;
    }

    .lb-article-content {
        padding: 14px;
    }

    .lb-article-title {
        font-size: 14px;
    }

    .lb-article-excerpt {
        font-size: 13px;
    }

    .lb-load-more-button {
        padding: 12px 24px;
        font-size: 14px;
    }
}

