/* =========================================================
   Post Category Filter — Stylesheet
   ========================================================= */

/* ---- Standalone layout (sidebar + own post grid side by side) ---- */

.pcf-wrapper {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Standalone: sidebar fixed width */
.pcf-wrapper:not(.pcf-mode-divi) .pcf-sidebar {
    flex: 0 0 240px;
    position: sticky;
    top: 24px;
}

.pcf-main {
    flex: 1 1 0;
    min-width: 0;
}

/* ---- Divi mode: sidebar fills its column, no flex children needed ---- */

.pcf-mode-divi {
    display: block;   /* Let Divi handle page layout; we just render the sidebar */
}

.pcf-mode-divi .pcf-sidebar {
    position: static;
}

/* ---- Search box ---- */

.pcf-search-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.pcf-search-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pcf-search-input-wrap {
    position: relative;
}

.pcf-keyword-search {
    width: 100%;
    padding: 9px 32px 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.pcf-keyword-search:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.pcf-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
    padding: 2px;
    line-height: 1;
    display: none;
}

.pcf-search-clear:hover { color: #374151; }

/* ---- Categories box ---- */

.pcf-categories-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.pcf-categories-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 12px 0;
}

.pcf-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pcf-select-all-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0 10px;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 8px;
    cursor: pointer;
}

.pcf-category-item label,
.pcf-select-all-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s;
}

.pcf-category-item label:hover { background: #f9fafb; }

.pcf-category-item input[type="checkbox"],
.pcf-select-all-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    flex-shrink: 0;
    cursor: pointer;
}

.pcf-category-name {
    flex: 1;
    font-size: 14px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pcf-select-all-wrap .pcf-category-name {
    font-weight: 600;
    color: #111827;
}

.pcf-category-count {
    font-size: 12px;
    color: #fff;
    background: #6366f1;
    border-radius: 999px;
    padding: 1px 7px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- Results count ---- */

.pcf-results-header {
    margin-bottom: 16px;
    min-height: 22px;
}

.pcf-results-count {
    font-size: 14px;
    color: #6b7280;
}

.pcf-results-count strong { color: #111827; }

/* In Divi mode the results count sits above the sidebar filters */
.pcf-mode-divi .pcf-results-header {
    margin-bottom: 12px;
}

/* ---- Loading state ----
   Applied to .pcf-posts-grid (standalone) or the Divi container (divi mode) */

.pcf-posts-grid,
.et_pb_posts,
.et_pb_blog_grid {
    transition: opacity .2s;
}

.pcf-posts-grid.pcf-is-loading,
.et_pb_posts.pcf-is-loading,
.et_pb_blog_grid.pcf-is-loading {
    opacity: .4;
    pointer-events: none;
}

/* ---- Standalone post grid ---- */

.pcf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

/* ---- Post card (standalone mode) ---- */

.pcf-post-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.pcf-post-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    transform: translateY(-2px);
}

.pcf-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.pcf-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f3f4f6;
}

.pcf-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.pcf-post-card:hover .pcf-card-thumb img { transform: scale(1.04); }

.pcf-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #818cf8, #6366f1);
}

.pcf-no-thumb span {
    font-size: 48px;
    font-weight: 700;
    color: rgba(255,255,255,.7);
    text-transform: uppercase;
    line-height: 1;
}

.pcf-card-body { padding: 14px 16px 16px; }

.pcf-card-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.pcf-cat-tag {
    font-size: 11px;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    border-radius: 999px;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pcf-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pcf-card-excerpt {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.55;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pcf-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.pcf-card-date    { color: #9ca3af; }
.pcf-card-read-more { color: #6366f1; font-weight: 600; }

/* ---- No results ---- */

.pcf-no-results {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.pcf-no-results-icon { font-size: 40px; margin-bottom: 12px; }
.pcf-no-results p    { font-size: 15px; margin: 0; }

/* ---- Pagination (shared between both modes) ---- */

.pcf-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 28px;
    justify-content: center;
}

.pcf-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.pcf-page-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pcf-page-btn.pcf-page-active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    font-weight: 700;
    pointer-events: none;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .pcf-wrapper { flex-direction: column; }

    .pcf-wrapper:not(.pcf-mode-divi) .pcf-sidebar {
        flex: none;
        width: 100%;
        position: static;
    }

    .pcf-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .pcf-grid { grid-template-columns: 1fr; }
}
