/**
 * Lolo Elem Blog Posts Widget Styles
 * 
 * Comprehensive styling for the blog posts widget with ElementsKit compatibility
 * and responsive design. Includes support for all layout styles and search functionality.
 */

/* ==========================================================================
   Base Container Styles
   ========================================================================== */

.lolo-blog-posts-container {
    width: 100%;
    position: relative;
}

.lolo-blog-posts-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.lolo-blog-post-item {
    padding: 0 10px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Layout Styles - Block Layout
   ========================================================================== */

.lolo-blog-posts-container.elementskit-blog-block-post .lolo-blog-post-item {
    width: 100%;
}

.lolo-blog-posts-container.elementskit-blog-block-post .post-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.lolo-blog-posts-container.elementskit-blog-block-post .post-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.lolo-blog-posts-container.elementskit-blog-block-post .post-image {
    flex: 0 0 300px;
    min-height: 200px;
}

.lolo-blog-posts-container.elementskit-blog-block-post .post-content-wrap {
    flex: 1;
}

/* ==========================================================================
   Layout Styles - Grid Layouts
   ========================================================================== */

.lolo-blog-posts-container.elementskit-post-image-card .post-item,
.lolo-blog-posts-container.elementskit-post-card .post-item {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.lolo-blog-posts-container.elementskit-post-image-card .post-item:hover,
.lolo-blog-posts-container.elementskit-post-card .post-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.lolo-blog-posts-container.elementskit-post-image-card .post-content-wrap,
.lolo-blog-posts-container.elementskit-post-card .post-content-wrap {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Column Classes (ElementsKit Style)
   ========================================================================== */

.ekit-lg-12 { width: 100%; }
.ekit-lg-6 { width: 50%; }
.ekit-lg-4 { width: 33.333333%; }
.ekit-lg-3 { width: 25%; }
.ekit-lg-2 { width: 16.666667%; }

/* Medium devices */
@media (max-width: 992px) {
    .ekit-md-12 { width: 100%; }
    .ekit-md-6 { width: 50%; }
    .ekit-lg-4.ekit-md-6 { width: 50%; }
    .ekit-lg-3.ekit-md-6 { width: 50%; }
    .ekit-lg-2.ekit-md-6 { width: 50%; }
}

/* Small devices */
@media (max-width: 768px) {
    .ekit-lg-6,
    .ekit-lg-4,
    .ekit-lg-3,
    .ekit-lg-2,
    .ekit-md-6 {
        width: 100%;
    }
    
    /* Adjust block layout for mobile */
    .lolo-blog-posts-container.elementskit-blog-block-post .post-item {
        flex-direction: column;
        text-align: center;
    }
    
    .lolo-blog-posts-container.elementskit-blog-block-post .post-image {
        flex: none;
        width: 100%;
        margin-bottom: 15px;
    }
    
    /* Mobile pagination adjustments */
    .lolo-blog-posts-pagination .page-numbers {
        padding: 6px 10px;
        margin: 0 2px;
        font-size: 12px;
    }
    
    .lolo-blog-post-pagination-style-loadmore .page-numbers.next {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Post Image Styles
   ========================================================================== */

.post-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.post-image a {
    display: block;
    line-height: 0;
}

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

.post-image:hover img {
    transform: scale(1.05);
}

/* Grid layout image heights */
.lolo-blog-posts-container.elementskit-post-image-card .post-image {
    height: 200px;
}

.lolo-blog-posts-container.elementskit-post-card .post-image {
    display: none; /* Hidden in card layout */
}

/* ==========================================================================
   Typography Styles
   ========================================================================== */

.lolo-blog-post-title {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: #333333;
}

.lolo-blog-post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.lolo-blog-post-title a:hover {
    color: #007cba;
}

.lolo-blog-post-content {
    margin: 0 0 15px 0;
    color: #666666;
    line-height: 1.6;
    font-size: 14px;
}

.lolo-blog-post-meta {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #999999;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.lolo-blog-post-meta a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.lolo-blog-post-meta a:hover {
    color: #007cba;
}

.post-author::before {
    content: "👤 ";
    margin-right: 3px;
}

.post-date::before {
    content: "📅 ";
    margin-right: 3px;
}

.post-category::before {
    content: "📂 ";
    margin-right: 3px;
}

/* ==========================================================================
   Read More Button Styles
   ========================================================================== */

.post-read-more {
    margin-top: auto; /* Push to bottom in flex container */
    padding-top: 15px;
}

.lolo-blog-read-more {
    display: inline-block;
    padding: 8px 16px;
    background-color: #007cba;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #007cba;
}

.lolo-blog-read-more:hover {
    background-color: #005a87;
    border-color: #005a87;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Alternative button styles */
.lolo-blog-read-more.style-outline {
    background-color: transparent;
    color: #007cba;
}

.lolo-blog-read-more.style-outline:hover {
    background-color: #007cba;
    color: #ffffff;
}

/* ==========================================================================
   No Results Styles
   ========================================================================== */

.no-results {
    text-align: center;
    padding: 60px 20px;
    margin: 40px auto;
    max-width: 500px;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    font-size: 16px;
    line-height: 1.5;
}

.no-results::before {
    content: "🔍";
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* ==========================================================================
   Pagination Styles
   ========================================================================== */

.lolo-blog-posts-pagination {
    margin-top: 40px;
    text-align: center;
}

.lolo-blog-posts-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    background-color: #f8f9fa;
    color: #6c757d;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.lolo-blog-posts-pagination .page-numbers:hover,
.lolo-blog-posts-pagination .page-numbers.current {
    background-color: #007cba;
    color: #ffffff;
}

.lolo-blog-posts-pagination .page-numbers.dots {
    background: none;
    color: #6c757d;
    cursor: default;
}

.lolo-blog-posts-pagination .page-numbers.dots:hover {
    background: none;
    color: #6c757d;
}

/* ==========================================================================
   Pagination Style Variations (ElementsKit Compatible)
   ========================================================================== */

/* Simple Pagination Style */
.lolo-blog-post-pagination-style-simple .page-numbers {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 5px;
    background-color: #f8f9fa;
    color: #6c757d;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.lolo-blog-post-pagination-style-simple .page-numbers:hover,
.lolo-blog-post-pagination-style-simple .page-numbers.current {
    background-color: #007cba;
    border-color: #007cba;
    color: #ffffff;
}

/* Hide page numbers in simple style, show only prev/next */
.lolo-blog-post-pagination-style-simple .page-numbers:not(.prev):not(.next) {
    display: none;
}

/* Numbered Pagination Style */
.lolo-blog-post-pagination-style-numbered .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 3px;
    background-color: #f8f9fa;
    color: #6c757d;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    min-width: 40px;
    text-align: center;
}

.lolo-blog-post-pagination-style-numbered .page-numbers:hover,
.lolo-blog-post-pagination-style-numbered .page-numbers.current {
    background-color: #007cba;
    border-color: #007cba;
    color: #ffffff;
}

.lolo-blog-post-pagination-style-numbered .page-numbers.dots {
    background: none;
    border: none;
    color: #6c757d;
    cursor: default;
}

.lolo-blog-post-pagination-style-numbered .page-numbers.dots:hover {
    background: none;
    color: #6c757d;
}

/* Load More Pagination Style */
.lolo-blog-post-pagination-style-loadmore {
    text-align: center;
    margin-top: 40px;
}

/* Hide ALL pagination elements except the load more button */
.lolo-blog-post-pagination-style-loadmore .page-numbers {
    display: none !important;
}

/* Show ONLY the Load More button */
.lolo-blog-post-pagination-style-loadmore .page-numbers.lolo-load-more-btn {
    display: inline-block !important;
    padding: 15px 30px;
    margin: 0;
    background-color: #28a745;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid #28a745;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.lolo-blog-post-pagination-style-loadmore .page-numbers.lolo-load-more-btn:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
}

/* Loading state for Load More button */
.lolo-blog-post-pagination-style-loadmore .page-numbers.lolo-load-more-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.lolo-blog-post-pagination-style-loadmore .page-numbers.lolo-load-more-btn.loading::after {
    content: " ...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: " ."; }
    40% { content: " .."; }
    60%, 100% { content: " ..."; }
}

/* ==========================================================================
   Loading States & Animations
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lolo-blog-post-item {
    animation: fadeInUp 0.5s ease forwards;
}

.lolo-blog-post-item:nth-child(1) { animation-delay: 0.1s; }
.lolo-blog-post-item:nth-child(2) { animation-delay: 0.2s; }
.lolo-blog-post-item:nth-child(3) { animation-delay: 0.3s; }
.lolo-blog-post-item:nth-child(4) { animation-delay: 0.4s; }
.lolo-blog-post-item:nth-child(5) { animation-delay: 0.5s; }
.lolo-blog-post-item:nth-child(6) { animation-delay: 0.6s; }

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .lolo-blog-posts-container {
        background: none !important;
        box-shadow: none !important;
    }
    
    .post-item {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    .lolo-blog-read-more,
    .lolo-blog-posts-pagination {
        display: none !important;
    }
}

/* ==========================================================================
   Accessibility Styles
   ========================================================================== */

.lolo-blog-post-title a:focus,
.lolo-blog-read-more:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.no-results {
    role: status;
    aria-live: polite;
}

/* Screen reader only content */
.sr-only {
    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;
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

.rtl .lolo-blog-posts-grid {
    direction: rtl;
}

.rtl .lolo-blog-post-meta {
    direction: rtl;
}

.rtl .lolo-blog-posts-container.elementskit-blog-block-post .post-item {
    direction: rtl;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .post-item {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .lolo-blog-post-title {
        color: #f7fafc;
    }
    
    .lolo-blog-post-content {
        color: #cbd5e0;
    }
    
    .lolo-blog-post-meta {
        color: #a0aec0;
    }
    
    .no-results {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .post-item {
        border: 2px solid;
    }
    
    .lolo-blog-read-more {
        border: 2px solid;
    }
    
    .no-results {
        border: 2px solid;
    }
}