/**
 * Post Grid Widget Styles
 */

/* Grid Container */
.post-grid-wrapper {
    width: 100%;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 0;
}

/* Grid Item */
.post-grid-item {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.post-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Featured Image */
.post-thumbnail {
    position: relative;
    overflow: hidden;
    height: 250px;
    margin-bottom: 15px;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-grid-item:hover .post-thumbnail img {
    transform: scale(1.1);
}

.post-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-grid-item:hover .post-thumbnail::after {
    opacity: 1;
}

/* Post Content */
.post-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 0;
}

/* Post Meta */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #999999;
    margin-bottom: 15px;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
}

.post-meta span:not(:last-child)::after {
    content: '•';
    margin-left: 10px;
    color: #dddddd;
}

.post-meta a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-meta a:hover {
    color: #AD8330;
}

.post-category a {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    color: #AD8330;
}

/* Post Title */
.post-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 15px 0;
}

.post-title a {
    color: #333333;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-title a:hover {
    color: #AD8330;
}

/* Post Excerpt */
.post-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #666666;
    margin-bottom: 15px;
    flex-grow: 1;
}

/* Read More Button */
.post-read-more {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #AD8330;
    background-color: transparent;
    border: 2px solid #AD8330;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    align-self: flex-start;
    margin-top: auto;
}

.post-read-more:hover {
    color: #ffffff;
    background-color: #AD8330;
    transform: translateX(5px);
}

.post-read-more::after {
    content: '→';
    margin-left: 8px;
    transition: margin-left 0.3s ease;
}

.post-read-more:hover::after {
    margin-left: 12px;
}

/* No Results Message */
.post-grid-no-results {
    text-align: center;
    padding: 60px 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.post-grid-no-results p {
    font-size: 18px;
    color: #666666;
    margin: 0;
}

/* Pagination */
.post-grid-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.post-grid-pagination a,
.post-grid-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 0 15px;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.post-grid-pagination a:hover,
.post-grid-pagination .page-numbers.current {
    color: #ffffff;
    background-color: #AD8330;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(173, 131, 48, 0.3);
}

.post-grid-pagination .page-numbers.dots {
    background-color: transparent;
    pointer-events: none;
}

.post-grid-pagination .page-numbers.prev,
.post-grid-pagination .page-numbers.next {
    padding: 0 20px;
}

/* Load More Button */
.post-grid-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #C89F4E 0%, #AD8330 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(173, 131, 48, 0.3);
}

.post-grid-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(173, 131, 48, 0.4);
}

.post-grid-load-more:active {
    transform: translateY(0);
}

.post-grid-load-more.loading {
    opacity: 0.7;
    pointer-events: none;
}

.post-grid-load-more.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading State for Grid Items */
.post-grid-item.loading {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .post-grid {
        gap: 20px;
    }

    .post-thumbnail {
        height: 200px;
    }

    .post-title {
        font-size: 20px;
    }

    .post-excerpt {
        font-size: 14px;
    }

    .post-meta {
        font-size: 12px;
        gap: 8px;
    }

    .post-grid-pagination a,
    .post-grid-pagination .page-numbers {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .post-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .post-thumbnail {
        height: 180px;
    }

    .post-title {
        font-size: 18px;
    }

    .post-excerpt {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .post-read-more {
        padding: 8px 16px;
        font-size: 13px;
    }

    .post-meta {
        font-size: 11px;
        gap: 6px;
    }

    .post-meta span:not(:last-child)::after {
        margin-left: 6px;
    }

    .post-grid-pagination {
        gap: 5px;
        margin-top: 30px;
    }

    .post-grid-pagination a,
    .post-grid-pagination .page-numbers {
        min-width: 35px;
        height: 35px;
        padding: 0 10px;
        font-size: 13px;
    }

    .post-grid-load-more {
        padding: 12px 30px;
        font-size: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .post-grid-item {
        background-color: #2d3436;
    }

    .post-title a {
        color: #ffffff;
    }

    .post-excerpt {
        color: #b2bec3;
    }

    .post-meta {
        color: #636e72;
    }

    .post-grid-no-results {
        background-color: #2d3436;
    }

    .post-grid-no-results p {
        color: #b2bec3;
    }

    .post-grid-pagination a,
    .post-grid-pagination .page-numbers {
        color: #ffffff;
        background-color: #2d3436;
    }
}

/* Print Styles */
@media print {
    .post-grid-pagination,
    .post-read-more {
        display: none;
    }

    .post-grid {
        display: block;
    }

    .post-grid-item {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* Accessibility */
.post-grid-item:focus-within {
    outline: 2px solid #AD8330;
    outline-offset: 2px;
}

.post-read-more:focus,
.post-grid-pagination a:focus {
    outline: 2px solid #AD8330;
    outline-offset: 2px;
}

/* Animation for new items (AJAX load) */
.post-grid-item.newly-loaded {
    animation: fadeInUp 0.6s ease;
}

/* Skeleton Loading State */
.post-grid-item.skeleton {
    pointer-events: none;
}

.post-grid-item.skeleton .post-thumbnail,
.post-grid-item.skeleton .post-title,
.post-grid-item.skeleton .post-excerpt,
.post-grid-item.skeleton .post-meta span {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: transparent;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
