/* Grid Container Styles */
.cepg-main-wrapper,
.cepg-wrapper {
    width: 100%;
    position: relative;
}

.cepg-grid-container {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
}

/* Desktop Columns */
.columns-desktop-1 {
    grid-template-columns: repeat(1, 1fr);
}

.columns-desktop-2 {
    grid-template-columns: repeat(2, 1fr);
}

.columns-desktop-3 {
    grid-template-columns: repeat(3, 1fr);
}

.columns-desktop-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Tablet Columns */
@media (max-width: 1024px) {
    .columns-tablet-1 {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .columns-tablet-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .columns-tablet-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile Columns */
@media (max-width: 767px) {
    .columns-mobile-1 {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .columns-mobile-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grid Item Styles */
.cepg-grid-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cepg-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.cepg-post-image {
    width: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

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

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

.cepg-post-content {
    padding: 20px;
}

.cepg-post-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

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

.cepg-post-title a:hover {
    color: #0073aa;
}

.cepg-post-date {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.cepg-post-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

.cepg-read-more {
    margin-top: 10px;
}

.cepg-read-more a {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cepg-read-more a:hover {
    color: #005a87;
}

/* Enhanced Pagination Styles */
.cepg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.cepg-page-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cepg-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: all 0.25s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Previous and Next buttons with text */
.cepg-prev-btn,
.cepg-next-btn {
    min-width: auto;
    padding: 0 16px;
    font-weight: 500;
}

.cepg-nav-text {
    font-size: 14px;
}

.cepg-nav-arrow {
    font-size: 16px;
    font-weight: normal;
}

/* Button hover effects */
.cepg-page-btn:hover:not(.disabled):not(.active) {
    background: #f8f9fa;
    border-color: #c0c0c0;
    color: #333;
    transform: translateY(-1px);
}

/* Active page button */
.cepg-page-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    cursor: default;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

/* Disabled buttons (Previous on first page, Next on last page) */
.cepg-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.cepg-page-btn.disabled:hover {
    transform: none;
    background: #f5f5f5;
    border-color: #e0e0e0;
}

/* Dots for pagination */
.cepg-dots {
    padding: 0 4px;
    color: #999;
    font-size: 14px;
    user-select: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cepg-pagination {
        gap: 6px;
    }
    
    .cepg-page-numbers {
        gap: 4px;
    }
    
    .cepg-page-btn {
        min-width: 35px;
        height: 35px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .cepg-prev-btn,
    .cepg-next-btn {
        padding: 0 12px;
    }
    
    /* Hide text on mobile, show only arrows */
    .cepg-nav-text {
        display: none;
    }
    
    .cepg-prev-btn,
    .cepg-next-btn {
        min-width: 35px;
        padding: 0;
    }
    
    .cepg-nav-arrow {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .cepg-page-numbers {
        gap: 3px;
    }
    
    .cepg-page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* Loading State */
.cepg-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
    min-height: 200px;
}

.cepg-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: cepg-spin 1s linear infinite;
    z-index: 10;
}

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

.cepg-grid-container {
    transition: opacity 0.3s ease;
}

.cepg-loading .cepg-grid-container {
    opacity: 0.5;
}

.cepg-no-posts {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

/* Elementor Editor Specific Styles */
.elementor-edit-mode .cepg-editor-notice {
    background: #f0f6fc;
    border-left: 4px solid #0073aa;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.elementor-edit-mode .cepg-editor-notice p {
    margin: 0;
    font-size: 13px;
    color: #1e1e1e;
}

.elementor-edit-mode .cepg-pagination {
    position: relative;
}

.elementor-edit-mode .cepg-pagination .cepg-page-btn {
    pointer-events: none;
}

.elementor-edit-mode .cepg-editor-pagination {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    position: relative;
}

.elementor-edit-mode .cepg-editor-pagination > div:last-child {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #999;
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
    .elementor-edit-mode .cepg-editor-pagination > div:last-child {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-top: 10px;
        text-align: center;
    }
}

/* Ensure grid items look good in editor */
.elementor-edit-mode .cepg-grid-item {
    cursor: default;
}

.elementor-edit-mode .cepg-read-more a {
    pointer-events: none;
}

/* Make editor preview look professional */
.cepg-main-wrapper.elementor-edit-mode,
.cepg-wrapper.elementor-edit-mode {
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
}

/* Widget wrapper styling in editor */
.elementor-widget-custom_post_grid {
    margin-bottom: 20px;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}