/**
 * Advanced Blog Posts with AJAX Filtering Styling
 * Author: Robust Tech House / Facilitybot Developer
 */

.fcb-advanced-posts-wrap {
    width: 100%;
    margin: 40px 0;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --fcb-accent-color: #8a0303;
}

/* Filtering Header Bar */
.fcb-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eef1f6;
    padding-bottom: 25px;
    margin-bottom: 35px;
    flex-wrap: wrap;
    gap: 20px;
}

.fcb-filter-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.fcb-filter-label-text {
    font-size: 14px;
    font-weight: 500;
    color: #8c96a8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
}

.fcb-filter-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.fcb-filter-item {
    display: flex;
    align-items: center;
    position: relative;
}

.fcb-filter-item:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 16px;
    background-color: #d2d9e5;
    margin: 0 15px;
}

.fcb-filter-item select {
    appearance: none;
    -webkit-appearance: none;
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d1e3d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right center;
    background-size: 11px;
    padding: 5px 20px 5px 0;
    border: none;
    font-size: 16px;
    font-weight: 700;
    color: #ff6337;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: color 0.3s ease;
}

.fcb-filter-item select:hover {
    color: var(--fcb-accent-color, #8a0303);
}

/* Custom Dropdown Multiselect */
.fcb-dropdown-multiselect {
    position: relative;
    display: inline-block;
}

.fcb-dropdown-trigger {
    background: #ffffff;
    border: 1.5px solid #d2d9e5;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 700;
    color: #0d1e3d;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
    margin: 0;
    transition: all 0.3s ease;
    height: 38px;
    box-sizing: border-box;
    font-family: inherit;
}

.fcb-dropdown-trigger:hover {
    border-color: var(--fcb-accent-color, #8a0303);
}

.fcb-dropdown-multiselect.is-open .fcb-dropdown-trigger {
    border-color: #bce0fd;
    box-shadow: 0 0 0 3px rgba(188, 224, 253, 0.4);
}

.fcb-dropdown-multiselect.has-selected .fcb-dropdown-trigger {
    background-color: #f0f6ff;
    border-color: var(--fcb-accent-color, #8a0303);
}

.fcb-dropdown-trigger .fcb-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.3s ease;
}

.fcb-dropdown-multiselect.is-open .fcb-arrow {
    transform: rotate(180deg);
}

.fcb-dropdown-menu {
    position: absolute;
    top: 110%;
    left: 0;
    z-index: 100;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 280px;
    display: none;
    border: 1px solid #eef1f6;
    animation: fcb-fade-in 0.2s ease;
}

.fcb-dropdown-multiselect.is-open .fcb-dropdown-menu {
    display: block;
}

@keyframes fcb-fade-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.fcb-dropdown-menu-inner {
    max-height: 220px;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom Scrollbar for Checkbox dropdown */
.fcb-dropdown-menu-inner::-webkit-scrollbar {
    width: 6px;
}

.fcb-dropdown-menu-inner::-webkit-scrollbar-track {
    background: transparent;
}

.fcb-dropdown-menu-inner::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* Checkbox Labels */
.fcb-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #0d1e3d;
    user-select: none;
    transition: color 0.2s ease;
    line-height: 1.3;
}

.fcb-checkbox-label:hover {
    color: var(--fcb-accent-color, #8a0303);
}

.fcb-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.fcb-checkbox-custom {
    position: relative;
    height: 18px;
    width: 18px;
    background-color: #ffffff;
    border: 1.5px solid #d2d9e5;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fcb-checkbox-label:hover input ~ .fcb-checkbox-custom {
    border-color: var(--fcb-accent-color, #8a0303);
}

.fcb-checkbox-label input:checked ~ .fcb-checkbox-custom {
    background-color: #0d5ff2;
    border-color: #0d5ff2;
}

.fcb-checkbox-custom:after {
    content: "";
    position: absolute;
    display: none;
}

.fcb-checkbox-label input:checked ~ .fcb-checkbox-custom:after {
    display: block;
}

.fcb-checkbox-custom:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Right Side: Stats & Search */
.fcb-filter-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.fcb-filter-counter {
    font-size: 14px;
    color: #555e70;
}

.fcb-filter-counter strong {
    color: #0d1e3d;
    font-weight: 700;
}

.fcb-search-wrap {
    display: flex;
    align-items: center;
    position: relative;
    border: 1.5px solid #d2d9e5;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    transition: border-color 0.3s ease;
}

.fcb-search-wrap:focus-within {
    border-color: var(--fcb-accent-color, #8a0303);
}

.fcb-search-wrap .fcb-search-input {
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    margin: 0;
    width: 200px;
    outline: none;
    font-family: inherit;
    color: #0d1e3d;
    background: transparent;
    box-shadow: none;
}

.fcb-search-wrap .fcb-search-btn {
    background: var(--fcb-search-btn-bg, #0d5ff2);
    border: none;
    color: #ffffff;
    padding: 0 16px;
    height: 38px;
    cursor: pointer;
    display: flex;
    margin: 0;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.fcb-search-btn:hover {
    opacity: 0.9;
}

.fcb-search-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Post Container & AJAX Loader */
.fcb-posts-container {
    position: relative;
    width: 100%;
}

.fcb-posts-loader {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: none;
}

.fcb-posts-container.is-loading .fcb-posts-grid {
    opacity: 0.35;
    pointer-events: none;
}

.fcb-posts-container.is-loading .fcb-posts-loader {
    display: block;
}

.fcb-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #f0f2f5;
    border-top: 4px solid var(--fcb-accent-color, #8a0303);
    border-radius: 50%;
    animation: fcb-spin 0.8s linear infinite;
}

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

/* Posts Grid */
.fcb-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    transition: opacity 0.3s ease;
}

.fcb-posts-grid.no-posts {
    display: block;
    text-align: center;
    padding: 60px 0;
    color: #8c96a8;
    font-size: 16px;
}

/* Individual Post Card */
.fcb-post-card {
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
}

.fcb-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    background-color: #f0f2f5;
}

.fcb-post-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

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

.fcb-card-top-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(16, 2, 2, 0.7);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.fcb-card-brand-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 32%;
    height: 24px;
    z-index: 2;
    display: flex;
    align-items: center;
    padding-left: 10px;
    background: var(--fcb-accent-color, #8a0303);
    clip-path: polygon(0 0, 85% 0, 100% 100%, 0 100%);
}

.fcb-card-brand-logo {
    height: 12px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.fcb-post-card-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    color: #0d1e3d;
    margin: 0 0 10px 0;
    transition: color 0.3s ease;
}

.fcb-post-card:hover .fcb-post-card-title {
    color: var(--fcb-accent-color, #8a0303);
}

.fcb-post-card-excerpt {
    font-size: 15px;
    line-height: 1.55;
    color: #555e70;
    margin: 0 0 20px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fcb-post-card-link {
    font-size: 15px;
    font-weight: 700;
    color: #0d1e3d;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    transition: color 0.3s ease;
}

.fcb-post-card:hover .fcb-post-card-link {
    color: var(--fcb-accent-color, #8a0303);
}

/* Pagination styling */
.fcb-pagination-wrap {
    width: 100%;
    margin-top: 60px;
    border-top: 1px solid #eef1f6;
    padding-top: 25px;
}

.fcb-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

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

.fcb-pagination-link, .fcb-pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    color: #0d1e3d;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    background: transparent;
    line-height: 1;
    min-width: 32px;
    height: 32px;
    box-sizing: border-box;
}

.fcb-pagination-link:hover, .fcb-pagination-page:hover {
    color: var(--fcb-accent-color, #8a0303);
}

.fcb-pagination-page.active {
    background-color: var(--primary-color);
    border-radius: 8px;
    color: #ffffff;
    cursor: default;
    pointer-events: none;
}

.fcb-pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #8c96a8;
    min-width: 32px;
    height: 32px;
}

.fcb-pagination .fcb-prev, .fcb-pagination .fcb-next {
    font-size: 15px;
    font-weight: 700;
    color: #0d1e3d;
    display: inline-flex;
    align-items: center;
    text-transform: none;
    background: transparent;
    border: none;
    padding: 0;
}

.fcb-pagination-link.disabled, .fcb-pagination-page.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsiveness */
@media (max-width: 991px) {
    .fcb-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    .fcb-post-card-title {
        font-size: 18px;
    }
}

@media (max-width: 767px) {
    .fcb-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .fcb-filter-right {
        margin-left: 0;
        justify-content: space-between;
        width: 100%;
    }
    .fcb-search-wrap {
        flex-grow: 1;
    }
    .fcb-search-input {
        width: 100%;
    }
}

@media (max-width: 575px) {
    .fcb-posts-grid {
        grid-template-columns: 1fr;
    }
    .fcb-filter-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .fcb-filter-group {
        width: 100%;
        justify-content: space-between;
    }
    .fcb-filter-item {
        flex-grow: 1;
        justify-content: center;
    }
    .fcb-filter-item select {
        width: 100%;
        text-align-last: center;
    }
    .fcb-filter-right {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .fcb-filter-counter {
        text-align: center;
    }
}
