/**
 * Blog Grid Widget - Grid Layout Styles Only
 * Individual post styling is handled by Elementor section templates
 */

/* Main Container */
.blog-grid-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

/* Top Controls Section */
.blog-grid-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Main Content Area */
.blog-grid-main {
    flex: 1;
    min-width: 0;
}

/* Grid Container */
.elementor-loop-container {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(320px, 1fr));
    /* Grid properties are controlled by widget settings */
}

/* Ensure each grid item takes full available space */
.elementor-loop-container > * {
    width: 100%;
    max-width: 357px;
    height: 100%;
}

/* Fix image stretching issues */
.elementor-loop-container img {
    width: 100%;
    height: auto;
    object-fit: cover;
    /* aspect-ratio: 16/9; */
    border-radius: 8px;
}

/* Error states */
.elementor-loop-error,
.elementor-loop-no-posts {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #6c757d;
}

/* Search Form Styles */
.blog-search-container {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.blog-search-container h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.blog-search-form {
    position: relative;
}

.blog-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.blog-search-input {
    flex: 1;
    padding-left: 55px !important;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: #333;
    border-radius: 25px !important;
}

.blog-search-input::placeholder {
    color: #9ca3af;
    font-size: 14px;
}

.blog-search-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
}

.blog-search-button {
    position: absolute;
    /* left: 16px; */
    top: 50%;
    transform: translateY(-50%);
    padding: 15px 20px;
    background: none;
    border: none !important;
    cursor: pointer;
    color: #9ca3af;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 2;
}

.blog-search-button:hover {
    color: #3b82f6;
}

.blog-search-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
}

.blog-search-clear:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Category Filter Styles */
.blog-grid-category-filter {
    flex: 0 0 200px;
    margin-bottom: 0;
}

.blog-grid-category-filter h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.category-filter {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.category-filter:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.category-filter:hover {
    border-color: #d1d5db;
}

/* Tag Filter Styles */
.blog-grid-tag-filter {
    flex: 0 0 200px;
    margin-bottom: 0;
}

.blog-grid-tag-filter h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.tag-filter {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tag-filter:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tag-filter:hover {
    border-color: #d1d5db;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive behavior */
@media (max-width: 768px) {
    .blog-grid-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .blog-search-container,
    .blog-grid-category-filter,
    .blog-grid-tag-filter {
        flex: none;
        width: 100%;
    }
    
    .elementor-loop-container > * {
        max-width: 100% !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .elementor-loop-container {
        grid-template-columns: 1fr !important;
    }
    
    .blog-grid-controls {
        padding: 12px;
        gap: 12px;
    }
}

/* Pagination Styles */
.blog-pagination {
    margin-top: 40px;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Numbered Pagination */
.blog-pagination-number,
.blog-pagination-prev,
.blog-pagination-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.blog-pagination-number:hover,
.blog-pagination-prev:hover,
.blog-pagination-next:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
    text-decoration: none;
}

.blog-pagination-number.current {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    cursor: default;
}

.blog-pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    color: #6b7280;
    font-weight: 500;
}

/* Previous/Next Pagination */
.blog-pagination-prev-next {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.blog-pagination-info {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}



/* Responsive Pagination */
@media (max-width: 768px) {
    .blog-pagination {
        margin-top: 30px;
        gap: 6px;
    }
    
    .blog-pagination-number,
    .blog-pagination-prev,
    .blog-pagination-next {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .blog-pagination-prev-next {
        gap: 15px;
    }
    

}

@media (max-width: 480px) {
    .blog-pagination {
        margin-top: 25px;
        gap: 4px;
    }
    
    .blog-pagination-number,
    .blog-pagination-prev,
    .blog-pagination-next {
        min-width: 32px;
        height: 32px;
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .blog-pagination-prev-next {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    

}