/**
 * Filtered Content Module Styles
 */

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

.filtered-content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* ============================================
   LEFT SIDEBAR - FILTERS
   ============================================ */

.filter-sidebar {
    flex: 0 0 330px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 18px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 25px;
}

.filter-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.filter-search-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.search-button {
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    background: #2196F3;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    background: #1976D2;
}

.search-button svg {
    width: 18px;
    height: 18px;
}

/* Filter Categories */
.filter-categories h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #2196F3;
    padding-bottom: 10px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    position: relative;
}

.category-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.category-item label:hover {
    background: #f5f5f5;
    border-color: #2196F3;
}

.category-item.active label {
    background: #E3F2FD;
    border-color: #2196F3;
    color: #1976D2;
}

.category-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2196F3;
}

.category-name {
    flex: 1;
    font-weight: 500;
}

.category-count {
    color: #666;
    font-size: 13px;
    font-weight: normal;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
}

.category-item.active .category-count {
    background: #BBDEFB;
    color: #1565C0;
}

/* Parent Categories */
.parent-category {
    margin-bottom: 5px;
}

.parent-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
}

.parent-category-header:hover {
    background: #f5f5f5;
    border-color: #2196F3;
}

.parent-category-header:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.parent-category-toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    color: #666;
}

.parent-category.collapsed .parent-category-toggle {
    transform: rotate(-90deg);
}

.parent-category.collapsed .child-categories {
    display:none;
}

/* Child Categories */
.child-categories {
    padding-left: 25px;
    margin-top: 5px;
    margin-bottom: 5px;
    border-left: 2px solid #E3F2FD;
    padding-top: 5px;
    padding-bottom: 5px;
    overflow: hidden;
}

.child-category label {
    font-weight: 400;
    font-size: 13px;
    padding: 8px 10px;
}

/* ============================================
   RIGHT CONTENT AREA
   ============================================ */

.content-area {
    flex: 1;
    position: relative;
    min-height: 400px;
}

.content-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.content-results {
    transition: opacity 0.3s ease;
}

/* Posts Wrapper */
.posts-wrapper {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
}

.posts-wrapper.layout-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.posts-wrapper.layout-list {
    grid-template-columns: 1fr;
}

/* Post Item */
.post-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.layout-list .post-item {
    flex-direction: row;
}

.post-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.post-thumbnail {
    overflow: hidden;
    background: #f5f5f5;
}

.layout-grid .post-thumbnail {
    height: 200px;
}

.layout-list .post-thumbnail {
    flex: 0 0 250px;
    height: auto;
}

.post-thumbnail a {
    display: block;
    height: 100%;
}

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

.post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content-at {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-title-at {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
}

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

.post-title-at a:hover {
    color: #2196F3;
}

.post-meta-at {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

    .post-meta-at span {
        display: flex;
        align-items: center;
        gap: 5px;
    }

.post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.primary-category-label {
    font-weight: 500;
}

.primary-category-label--advocacy {
    color: #2196F3;
}

.primary-category-label--red-tape {
    color: #d32f2f;
}

.primary-category-label--resolved {
    color: #2e7d32;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid #bdbdbd;
    background: #9e9e9e;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.category-badge--red-tape {
    background: #d32f2f;
    border-color: rgba(211, 47, 47, 0.75);
}

.category-badge--resolved {
    background: #2e7d32;
    border-color: rgba(46, 125, 50, 0.75);
}

.category-badge:hover {
    background: #757575;
    border-color: #616161;
}

.category-badge--red-tape:hover {
    background: #c62828;
    border-color: rgba(198, 40, 40, 0.9);
}

.category-badge--resolved:hover {
    background: #1b5e20;
    border-color: rgba(27, 94, 32, 0.9);
}

.post-excerpt {
    margin-bottom: 15px;
    color: #555;
    line-height: 1.6;
    flex: 1;
    font-style: normal;
}

.post-excerpt:empty::after {
    content: 'Click "Read More" to view the full content.';
    color: #999;
    font-style: italic;
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: #2196F3;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.read-more:hover {
    color: #1976D2;
    gap: 8px;
}

.read-more--red-tape {
    color: #d32f2f;
}

.read-more--red-tape:hover {
    color: #c62828;
}

.read-more--resolved {
    color: #2e7d32;
}

.read-more--resolved:hover {
    color: #1b5e20;
}

/* Pagination Wrapper */
.pagination-wrapper {
    border-top: 1px solid #e5e5e5;
    margin-top: 30px;
    padding-top: 20px;
}

/* Pagination Info */
.pagination-info {
    text-align: center;
    padding: 10px 20px;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-btn {
    padding: 10px 16px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: #f5f5f5;
    border-color: #2196F3;
    color: #2196F3;
}

.pagination-btn.active {
    background: #2196F3;
    border-color: #2196F3;
    color: white;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9f9f9;
}

.pagination-num {
    min-width: 40px;
    text-align: center;
    padding: 10px 12px;
}

.pagination-prev,
.pagination-next {
    font-weight: 500;
}

.pagination-ellipsis {
    color: #999;
    padding: 0 5px;
    font-size: 14px;
}

/* No Results */
.no-results-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
    margin: 20px 0;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .filter-sidebar {
        flex: 0 0 250px;
    }

    .posts-wrapper.layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

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

    .filter-sidebar {
        flex: 0 0 auto;
        width: 100%;
        position: static;
        max-height: none;
        margin-bottom: 30px;
    }

    .posts-wrapper.layout-grid {
        grid-template-columns: 1fr;
    }

    .layout-list .post-item {
        flex-direction: column;
    }

    .layout-list .post-thumbnail {
        flex: 0 0 auto;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .et_pb_filtered_content {
        padding: 10px 0;
    }

    .filtered-content-wrapper {
        gap: 20px;
    }

    .filter-sidebar {
        padding: 20px;
    }

    .post-content-at {
        padding: 15px;
    }

    .post-title-at {
        font-size: 18px;
    }

    .post-meta-at {
        flex-direction: column;
        gap: 5px;
    }
}

/* ============================================
   DIVI BUILDER SPECIFIC
   ============================================ */

.et-db #et-boc .et_pb_filtered_content {
    margin: 0;
}

/* Visual Builder Mode */
.et-fb .et_pb_filtered_content {
    pointer-events: none;
}

.et-fb .et_pb_filtered_content * {
    pointer-events: auto;
}
