/* Category Posts Widget Styles */

.category-posts-widget {
    padding: 4rem 0;
    background-color: #ffffff;
}

/* Widget Header */
.cpw-header {
    text-align: center;
    margin-bottom: 3rem;
}

.cpw-headline {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text, #2c3e50);
    margin-bottom: 2rem;
}

/* Tabs */
.cpw-tabs {
    display: flex;
    justify-content: center;
    gap: 0.1rem; /* Very close together */
    flex-wrap: wrap;
    margin-bottom: 3rem;
    text-align: center;
}

.cpw-tab {
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    font-size: 0.375rem; /* Small text */
    padding: 0.025rem 0.1rem; /* Half of previous padding */
    /* All button styling inherited from theme settings */
}

.cpw-tab:hover {
    /* Hover styling inherited from theme settings */
}

.cpw-tab.active {
    /* Active state uses theme button hover colors */
    background: var(--button-hover-bg) !important;
    border-color: var(--button-hover-border) !important;
    color: var(--button-hover-text) !important;
}

/* Posts Grid */
.cpw-posts-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2rem;
    margin-bottom: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Force post cards to respect grid layout */
.cpw-post-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 992px) {
    .cpw-posts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 576px) {
    .category-posts-widget {
        padding-top: 2rem; /* 50% of 4rem */
    }
    
    .cpw-posts-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Post Card */
.cpw-post-card {
    background: #ffffff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.cpw-post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Post Image */
.cpw-post-image {
    display: block;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

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

.cpw-post-card:hover .cpw-post-image img {
    transform: scale(1.05);
}

/* Post Content */
.cpw-post-content {
    padding: 1.5rem;
    padding-left: 5px;
    padding-right: 5px;
    padding-bottom: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cpw-post-title {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.cpw-post-title a {
    color: var(--color-text, #2c3e50);
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpw-post-title a:hover {
    color: #ef4444;
}

.cpw-post-excerpt {
    font-family: var(--font-excerpt, 'Open Sans', sans-serif) !important;
    color: var(--color-body, #4b5563) !important;
    font-size: var(--size-excerpt, 1rem) !important;
    font-weight: var(--weight-excerpt, 400) !important;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cpw-post-excerpt b,
.cpw-post-excerpt strong {
    font-weight: 700;
    color: inherit;
}

.cpw-post-excerpt em,
.cpw-post-excerpt i {
    font-style: italic;
    color: inherit;
}

.cpw-post-excerpt a {
    color: var(--color-link, #ef4444);
    text-decoration: underline;
}

.cpw-read-more {
    text-decoration: none;
    display: block;
    width: calc(100% + 3rem);
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin-top: auto;
    border-radius: 0;
    /* All button styling inherited from theme settings */
}

.cpw-read-more:hover {
    text-decoration: none;
    /* Hover styling inherited from theme settings */
}

/* Load More Button */
.cpw-load-more-container {
    text-align: center;
    margin-top: 2rem;
}

.cpw-load-more-btn {
    cursor: pointer;
    transition: all 0.3s ease;
    /* All button styling inherited from theme settings */
}

.cpw-load-more-btn:hover {
    /* Hover styling inherited from theme settings */
}

.cpw-load-more-btn:hover:not(:disabled) {
    /* Additional hover effects */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cpw-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading State */
.cpw-loading {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.cpw-posts-grid p.text-muted {
    font-size: 1.1rem;
    color: #9ca3af;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .cpw-headline {
        font-size: 2rem;
    }
    
    .cpw-tabs {
        gap: 0.1rem; /* Match desktop gap */
    }
    
    .cpw-tab {
        /* Keep desktop padding and font-size */
    }
}

@media (max-width: 576px) {
    .cpw-headline {
        font-size: 1.75rem;
    }
    
    .cpw-tabs {
        gap: 0.1rem; /* Match desktop gap */
    }
    
    .cpw-tab {
        /* Keep desktop padding and font-size */
    }
    
    .cpw-load-more-btn {
        padding: 0.875rem 2rem;
        font-size: 0.95rem;
    }

    .cpw-read-more {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}
