/**
 * Custom Post Filter - CSS (UPDATED with Clear Filters Button)
 * Place this file in: /css/custom-post-filter.css
 */

/* ============================================================================
   WRAPPER & CONTAINER
   ========================================================================= */

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

/* ============================================================================
   svg icon
   ========================================================================= */
span.custom_toggle_icon svg{
        fill: #000;
    height: 20px;
    margin-right: 0px;
    width: auto;
}

/* ============================================================================
   TOP SECTION
   ========================================================================= */

.custom_top_section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.custom_top_left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.custom_top_right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Toggle Filters Button */
.custom_toggle_filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0px;
    background: none !important;
    color: black !important;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    transition: all 0.3s ease;
    line-height:1.77em;
}

.custom_toggle_filters:hover {
    background: #34495e;
    transform: translateY(-2px);
}

.custom_toggle_icon {
    font-size: 25px;
}

/* Clear Filters Button */
.custom_clear_filters {
    display: none; /* Hidden by default, shown via JavaScript when filters are active */
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.custom_clear_filters:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.custom_clear_filters:active {
    transform: translateY(0);
}

.custom_clear_filters.clearing {
    animation: custom_pulse 0.3s ease;
}

@keyframes custom_pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.95); }
}

.custom_clear_icon {
    font-size: 16px;
    font-weight: bold;
}

.custom_clear_text {
    font-size: 14px;
}

/* Results Count */
.custom_results_count {
    color: #000;
    font-size: 18px;
	line-height: 1em;
}

.custom_count_number {
    color: #000;
    font-size: 18px;
	line-height: 1em;
}

/* Sort Select */
.custom_sort_select {
    background-color: transparent;
    border-color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding-bottom: 0;
    padding-top: 0;
	padding-left:0;
	padding-right:80px;
}

.custom_sort_select:focus {
    outline: none;
    border-color: #3498db;
}

/* ============================================================================
   MAIN SECTION
   ========================================================================= */

.custom_main_section {
    display: flex;
    gap: 30px;
    position: relative;
}
/* ============================================================================
  filter right new
   ========================================================================= */
.custom_main_count_sort {
    display:flex
}

.custom_main_count_sort2 {
    display:flex
}
.custom_results_count {
    color: #000;
    font-size: 18px;
    line-height: 1em;
    vertical-align: middle;
    padding-right:10px;
    margin-right:10px;
    border-right:1px solid;
	   display: flex;
    align-items: center;
    gap: 6px;
}
.custom_main_count_sort2 {
    display: flex;
    align-items: center;
    gap: 8px;
}
.custom_main_count_sort2 label {
    white-space: nowrap;
    margin: 0;
    color: rgb(0, 0, 0);
    font-size: 18px;
    line-height: 1em;
    vertical-align: middle;   
}

.custom_post_link {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.custom_post_content {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.custom_post_badges {
    margin-top: auto;
}


/* ============================================================================
   SIDEBAR (LEFT FILTERS)
   ========================================================================= */

.custom_sidebar {
      width: 230px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: sticky;
    top: 20px;
    height: fit-content;
    overflow-y: hidden;
}

.custom_sidebar[data-state="hidden"] {
    width: 0;
    overflow: hidden;
    opacity: 0;
}

.custom_sidebar_inner {
    background: #f8f9fa;
    padding: 0px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.custom_close_filters {
    display: none;
    width: 100%;
    padding: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    margin-bottom: 15px;
    cursor: pointer;
    font-weight: 600;
}

/* Search Bar */
.custom_search_wrapper {
    position: relative;
    margin-bottom: 25px;
}

.custom_search_input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.custom_search_input:focus {
    outline: none;
    border-color: #3498db;
}

.custom_search_loader {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom_search_loader.active {
    opacity: 1;
    animation: custom_spin 0.8s linear infinite;
}

/* Filter Groups */
.custom_filter_group {
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}


.custom_filter_header {
     display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 15px;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    /* border-bottom: 1px solid #eee; */
}

.custom_filter_header:hover {
    background: #f8f9fa;
}

.custom_filter_header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    font-family: Open Sans, sans-serif;
	line-height:1.777em
}

.custom_filter_header .custom_toggle_icon {
    font-size: 30px;
    font-weight: bold;
    color: #000;
   
}

.custom_filter_content {
    padding-left: 8px;
    position: relative;
    padding-bottom: 20px;
}

.custom_filter_loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    opacity: 0;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.custom_filter_loader.active {
    opacity: 1;
    animation: custom_spin 0.8s linear infinite;
}


/* Filter Options */
.custom_filter_option {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 4px;
    padding-left: 5px;
}

.custom_filter_option:hover {
    background: #f8f9fa;
}

.custom_filter_option input[type="checkbox"],
.custom_filter_option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.custom_filter_option span {
    color: #000;
    font-family: Open Sans,sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.7777777777777777em;
    text-decoration: none;
    text-transform: none;
}

/* ============================================================================
   CONTENT AREA (RIGHT POSTS)
   ========================================================================= */

.custom_content {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
	padding-top:30px;
}

.custom_content.full-width {
    width: 100%;
}

/* Posts Loader */
.custom_posts_loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.custom_posts_loader.active {
    opacity: 1;
}

.custom_spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: custom_spin 1s linear infinite;
}

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

/* Posts Grid */
.custom_posts_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    min-height: 400px;
}

.custom_posts_grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.custom_posts_grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Post Item */
.custom_post_item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

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



.custom_post_thumbnail {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f0f0f0;
}

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

.custom_post_item:hover .custom_post_thumbnail img {
    transform: scale(1.05);
}

.custom_post_no_image {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.custom_post_content {
    padding: 25px;
}

.custom_post_title {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 500;
    color: #000;
    line-height: 1.33;
}

.custom_post_excerpt {
    margin-bottom: 15px;
    color: #000;
    font-size: 18px;
    line-height: 1.77;
	font-weight:400;
	letter-spacing:0;
}

/* Post Badges */
.custom_post_badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.custom_badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.custom_badge_video {
    background: #e74c3c;
    color: white;
}

.custom_badge_article {
    background: #3498db;
    color: white;
}

/* No Results */
.custom_no_results {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #7f8c8d;
}

.custom_error {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #e74c3c;
}

/* ============================================================================
   PAGINATION
   ========================================================================= */

.custom_pagination_wrapper {
    margin-bottom: 30px;
}

.custom_pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom_page_btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #ddd;
    background: white;
    color: #2c3e50;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.custom_page_btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.custom_page_btn.custom_active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.custom_prev_btn,
.custom_next_btn {
    min-width: auto;
    padding: 0 15px;
}

.custom_dots {
    padding: 0 5px;
    color: #7f8c8d;
}

/* ============================================================================
   RESULTS SUMMARY
   ========================================================================= */

.custom_results_summary {
 color: #000;
    font-family: Open Sans,sans-serif;
    font-size: 18px;
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.7777777777777777em;
    text-decoration: none;
    text-transform: none;
    text-align:center;
    padding-bottom:50px;
}

/* ============================================================================
   MOBILE FILTER BUTTON
   ========================================================================= */

.custom_mobile_filter_btn {
    display: none;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

/* ============================================================================
   search icon /s/
   ========================================================================= */
input#custom_search_input {
    background-color: #fff;
    border: 1px solid #d1d3d4;
    border-radius: 6px;
    box-shadow: none;
    box-sizing: border-box;
    color: #000;
    display: block;
    font-family: Open Sans, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    width: 100%;
    outline: none;

    /* space for icon */
    padding: 20px 15px 18px 48px;

    /* search icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232b6cb0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 20px;
}




/* ============================================================================
   RESPONSIVE STYLES
   ========================================================================= */

@media (max-width: 1024px) {
    .custom_posts_grid,
    .custom_posts_grid[data-columns="3"],
    .custom_posts_grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Hide desktop toggle button */
    .custom_toggle_filters {
        display: none;
    }
    
    /* Show mobile filter button */
    .custom_mobile_filter_btn {
        display: block;
    }
    
    /* Sidebar becomes mobile menu */
    .custom_sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        z-index: 9999;
        transition: left 0.3s ease;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .custom_sidebar.mobile-open {
        left: 0;
    }
    
    .custom_sidebar[data-state="hidden"] {
        width: 300px;
        opacity: 1;
    }
    
    .custom_close_filters {
        display: block;
    }
    
    /* Overlay when mobile filters open */
    body.custom-filters-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }
    
    /* Main section full width on mobile */
    .custom_main_section {
        flex-direction: column;
    }
    
    .custom_content {
        width: 100%;
    }
    
    /* Posts grid single column */
    .custom_posts_grid,
    .custom_posts_grid[data-columns="2"],
    .custom_posts_grid[data-columns="3"],
    .custom_posts_grid[data-columns="4"] {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Top section stack */
    .custom_top_section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .custom_top_left,
    .custom_top_right {
        width: 100%;
    }
    
    .custom_top_right {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .custom_clear_filters,
    .custom_sort_select {
        width: 100%;
    }
    
    /* Pagination adjustments */
    .custom_pagination {
        gap: 5px;
    }
    
    .custom_page_btn {
        min-width: 35px;
        height: 35px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .custom_filter_wrapper {
        padding: 15px;
    }
    
    .custom_sidebar {
        width: 280px;
    }
    
    .custom_post_thumbnail {
        height: 180px;
    }
    
    .custom_page_numbers .custom_page_btn:not(.custom_active) {
        display: none;
    }
    
    .custom_page_numbers .custom_page_btn.custom_active {
        display: inline-block;
    }
    
    .custom_dots {
        display: inline;
    }
    
    .custom_clear_filters {
        font-size: 13px;
        padding: 8px 15px;
    }
    
    .custom_clear_icon {
        font-size: 14px;
    }
}