/* Custom Post Grid Styles */

.cpg-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

.cpg-header-wrapper {
    margin-bottom: 30px;
}

.cpg-widget-heading-wrapper {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.cpg-widget-heading-line {
    flex: 1;
    height: 1px;
    background-color: #e0e0e0;
    margin: 0 20px;
}

.cpg-widget-heading {
    margin: 0;
    padding: 0 20px;
    font-size: 2.5em;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Category Filters */
.cpg-filters {
    text-align: center;
    margin-bottom: 30px;
}

.cpg-filter-btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.cpg-filter-btn:hover,
.cpg-filter-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Grid Layout */
.cpg-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.cpg-grid-item {
    padding: 15px;
    margin-bottom: 30px;
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

/* Column Classes */
.cpg-grid-item.cpg-col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.cpg-grid-item.cpg-col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.cpg-grid-item.cpg-col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.cpg-grid-item.cpg-col-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.cpg-grid-item.cpg-col-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

/* Post Holder */
.cpg-post-holder {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.cpg-post-holder:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

/* Grid Hover Content - Hidden by default */
.cpg-hover-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    color: white;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease-in-out;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Show hover content on hover */
.cpg-post-holder:hover .cpg-hover-content {
    opacity: 1;
    visibility: visible;
}

/* Overlay backgrounds with pseudo elements */
.cpg-hover-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: -1;
    transition: 0.4s ease-in-out;
    opacity: 0;
    visibility: hidden;
}

.cpg-hover-content::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    transition: 0.4s ease-in-out;
    opacity: 0;
    visibility: hidden;
}

/* Show overlay backgrounds on hover */
.cpg-post-holder:hover .cpg-hover-content::before,
.cpg-post-holder:hover .cpg-hover-content::after {
    opacity: 1;
    visibility: visible;
}

/* Hide normal content on hover - but keep it in layout */
.cpg-post-holder:hover .cpg-content {
    opacity: 0;
    visibility: hidden;
}

/* Image Holder */
.cpg-img-holder {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    height: 300px; /* Fixed height for consistency */
}

.cpg-img-holder img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease-in-out;
    display: block;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
}

.cpg-img-holder a {
    display: block;
    width: 100%;
    height: 100%;
    text-align: center;
}

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

.cpg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.cpg-post-holder:hover .cpg-overlay {
    opacity: 0; /* Hide this on hover as the hover-content takes over */
}

/* Content */
.cpg-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: all 0.4s ease-in-out;
    position: relative;
    z-index: 1;
}

/* Hover Content Styles */
.cpg-hover-content .cpg-entry-title {
    margin: 0 0 20px 0;
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.cpg-hover-content .cpg-entry-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpg-hover-content .cpg-entry-title a:hover {
    color: #f0f0f0;
}

.cpg-hover-content .cpg-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    justify-content: center;
    text-align: center;
}

.cpg-hover-content .cpg-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.cpg-hover-content .cpg-meta-item a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpg-hover-content .cpg-meta-item a:hover {
    color: white;
}

.cpg-hover-content .cpg-excerpt {
    flex: 1;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    text-align: center;
    font-size: 0.95em;
}

.cpg-hover-content .cpg-read-more {
    text-align: center;
}

.cpg-hover-content .cpg-read-more a {
    display: inline-block;
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.cpg-hover-content .cpg-read-more a:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.cpg-entry-title {
    margin: 0 0 15px 0;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.4;
}

.cpg-entry-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpg-entry-title a:hover {
    color: #007cba;
}

/* Post Meta */
.cpg-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
}

.cpg-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cpg-meta-item i {
    font-size: 0.9em;
}

.cpg-meta-item a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpg-meta-item a:hover {
    color: #007cba;
}

.cpg-separator {
    margin: 0 5px;
    color: #ccc;
}

/* Excerpt */
.cpg-excerpt {
    flex: 1;
    margin-bottom: 20px;
    color: #666;
    line-height: 1.6;
}

/* Read More */
.cpg-read-more {
    margin-top: auto;
}

.cpg-read-more a {
    display: inline-block;
    padding: 8px 16px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.cpg-read-more a:hover {
    background: #005a87;
}

/* Pagination */
.cpg-pagination-wrap {
    text-align: center;
    margin-top: 40px;
}

.cpg-pagination {
    display: inline-block;
}

.cpg-pagination-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 5px;
}

.cpg-pagination-list li {
    display: inline-block;
}

.cpg-pagination-list a,
.cpg-pagination-list span {
    display: block;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.cpg-pagination-list a:hover,
.cpg-pagination-list .active span {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Loading */
.cpg-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.cpg-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: cpg-spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .cpg-grid-item.cpg-col-4,
    .cpg-grid-item.cpg-col-3,
    .cpg-grid-item.cpg-col-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .cpg-img-holder {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .cpg-grid-item.cpg-col-4,
    .cpg-grid-item.cpg-col-6,
    .cpg-grid-item.cpg-col-3,
    .cpg-grid-item.cpg-col-2 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .cpg-widget-heading {
        font-size: 2em;
    }
    
    .cpg-widget-heading-line {
        display: none;
    }
    
    .cpg-post-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .cpg-filter-btn {
        display: block;
        margin: 5px 0;
    }
    
    .cpg-img-holder {
        height: 200px;
    }
    
    /* Disable hover effects on mobile */
    .cpg-hover-content {
        display: none;
    }
    
    .cpg-post-holder:hover .cpg-content {
        opacity: 1;
        visibility: visible;
    }
    
    .cpg-post-holder:hover {
        transform: none;
    }
}

@media (max-width: 576px) {
    .cpg-container {
        padding: 10px 0;
    }
    
    .cpg-grid {
        margin: 0 -10px;
    }
    
    .cpg-grid-item {
        padding: 10px;
    }
    
    .cpg-content {
        padding: 15px;
    }
    
    .cpg-img-holder {
        height: 180px;
    }
}
