/**
 * Recipes Grid Pro Styles
 * Version: 2.1.0
 * Optimized for performance and accessibility
 */

/* Container Styles */
.recipes-grid-container,
.rgp-container {
    margin: 30px 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

/* Header Styles */
.recipes-section-header,
.rgp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.recipes-section-header h2,
.rgp-title {
    font-size: 18px;
    margin: 0;
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    flex: 1;
    min-width: 200px;
}

/* Loading Indicator */
.recipes-loading-indicator,
.rgp-loading {
    display: none;
    margin-left: 10px;
}

.recipes-loading-indicator.active,
.rgp-loading.active {
    display: block;
}

.recipes-loader,
.rgp-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: recipesLoaderSpin 0.8s linear infinite;
    will-change: transform;
}

@keyframes recipesLoaderSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Grid Layout - Optimized */
.recipes-posts-grid,
.rgp-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Responsive Grid */
@media (min-width: 1200px) {
    .recipes-posts-grid,
    .rgp-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .recipes-posts-grid,
    .rgp-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .recipes-posts-grid,
    .rgp-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 599px) {
    .recipes-posts-grid,
    .rgp-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Post Item Styles */
.recipes-post-item,
.rgp-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 240px;
    position: relative;
    will-change: transform;
}

.recipes-post-item:hover,
.rgp-item:hover {
    transform: translateY(-3px);
    border-color: #3498db;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15);
}

.recipes-post-item a,
.rgp-item-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Image Container */
.recipes-post-image,
.rgp-image {
    height: 140px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.recipes-post-image img,
.rgp-post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recipes-post-item:hover .recipes-post-image img,
.rgp-item:hover .rgp-post-img {
    transform: scale(1.08);
}

.recipes-no-image,
.rgp-no-img {
    font-size: 24px;
    color: #bdc3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Content Area */
.recipes-post-content,
.rgp-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
}

.recipes-post-title,
.rgp-post-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #2c3e50;
    height: 35px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.rgp-post-excerpt {
    display: none; /* Hide by default, can be shown in future versions */
    font-size: 12px;
    color: #7f8c8d;
    margin: 8px 0 0;
    line-height: 1.4;
}

.recipes-post-date,
.rgp-post-date {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
    margin-top: 8px;
    flex-shrink: 0;
}

/* Load More Button Container */
.recipes-load-more-container,
.rgp-load-more-wrapper {
    text-align: center;
    margin: 20px 0 0;
}

/* Load More Button - Enhanced */
.recipes-load-more-btn,
.rgp-load-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

.rgp-btn-icon {
    display: inline-block;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.recipes-load-more-btn:hover:not(:disabled) .rgp-btn-icon,
.rgp-load-btn:hover:not(:disabled) .rgp-btn-icon {
    transform: translateY(3px);
}

.recipes-load-more-btn:hover:not(:disabled),
.rgp-load-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.recipes-load-more-btn:disabled,
.rgp-load-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* No More Posts Message */
.recipes-no-more-posts,
.rgp-no-more {
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    padding: 20px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.rgp-no-posts {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* Animation Effects - GPU Accelerated */
.recipes-post-item.fade-in,
.rgp-item.fade-in {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.recipes-post-item.fade-out,
.rgp-item.fade-out {
    animation: fadeOutDown 0.3s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutDown {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 599px) {
    .recipes-section-header,
    .rgp-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .recipes-loading-indicator,
    .rgp-loading {
        margin-left: 0;
        justify-content: center;
        align-self: center;
    }

    .recipes-section-header h2,
    .rgp-title {
        text-align: center;
    }

    .recipes-post-item,
    .rgp-item {
        height: 220px;
    }

    .recipes-post-image,
    .rgp-image {
        height: 120px;
    }

    .recipes-post-content,
    .rgp-content {
        padding: 10px;
    }

    .recipes-post-title,
    .rgp-post-title {
        font-size: 13px;
        height: 32px;
    }

    .recipes-post-date,
    .rgp-post-date {
        font-size: 11px;
    }

    .recipes-load-more-btn,
    .rgp-load-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Accessibility Improvements */
.recipes-post-item:focus-within,
.rgp-item:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.recipes-load-more-btn:focus,
.rgp-load-btn:focus {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .recipes-grid-container,
    .rgp-container {
        color: #f5f5f5;
    }

    .recipes-post-item,
    .rgp-item {
        background: #2c3e50;
        border-color: #34495e;
    }

    .recipes-section-header h2,
    .rgp-title {
        color: #ecf0f1;
    }

    .recipes-post-title,
    .rgp-post-title {
        color: #ecf0f1;
    }

    .recipes-no-more-posts,
    .rgp-no-more {
        background: #2c3e50;
        border-color: #34495e;
        color: #95a5a6;
    }
}

/* Print Styles */
@media print {
    .recipes-load-more-container,
    .rgp-load-more-wrapper,
    .recipes-loading-indicator,
    .rgp-loading {
        display: none !important;
    }
}
