@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
    --cfaq-blue: #2970FF;
}

.cfaq-container {
    font-family: 'Poppins', sans-serif;
    margin: 40px auto;
    padding: 20px;
}

/* Filter Title with Animated Border - Inside Filters Row */
.cfaq-filter-title {
    color: #002855 !important;
    font-weight: 800 !important;
    position: relative;
    line-height: 1.2;
    margin: 0;
    margin-right: 20px;
    font-size: 28px;
    align-self: center;
    flex-shrink: 0;
}

.cfaq-filter-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    margin-top: 12px;
    border-radius: 2px;

    /* Modern Gradient Background for the Shine Effect */
    background: linear-gradient(90deg, #C5BA90 0%, #E8DDB5 50%, #C5BA90 100%);
    background-size: 200% 100%;

    /* Initial State for Load Animation */
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;

    /* Combine Animations: Grow on load + Infinite Shine */
    animation:
        borderGrowIn 1.2s cubic-bezier(0.19, 1, 0.22, 1) forwards,
        borderShine 3s linear infinite;
    animation-delay: 0.5s, 1.7s;
}

.cfaq-filter-title:hover::after {
    width: 120px;
    transition: width 0.4s ease-in-out;
}

/* Keyframes for the animated border */
@keyframes borderGrowIn {
    0% {
        transform: scaleX(0);
        opacity: 0;
    }

    100% {
        transform: scaleX(1);
        opacity: 1;
    }
}

@keyframes borderShine {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Filters */
.cfaq-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 30px;
    border-top: 1px solid #B6BFCC;
}

.cfaq-filter-btn {
    background-color: transparent;
    border: 1px solid #C5BA90;
    color: #303A54;
    border-radius: 50px;
    padding: 10px 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cfaq-filter-btn:hover {
    color: #303A54 !important
}


.cfaq-filter-btn:hover,
.cfaq-filter-btn.active {
    background-color: #F9F7F2 !important;
    border-color: #C5BA90 !important;
}

.cfaq-arrow-down {
    border: solid #303A54;
    border-width: 0 1.5px 1.5px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    transition: transform 0.3s;
}

.cfaq-filter-dropdown {
    position: relative;
    display: inline-block;
}

.cfaq-dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
    z-index: 10;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 5px 0;
    margin-top: 5px;
}

.cfaq-filter-dropdown.open .cfaq-dropdown-content {
    display: block;
}

.cfaq-filter-dropdown.open .cfaq-arrow-down {
    transform: rotate(225deg);
}

.cfaq-dropdown-content a {
    color: #303A54;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
}

.cfaq-dropdown-content a:hover {
    background-color: #F9F7F2;
}

/* Apply Filters Button */
#cfaq-apply-filters-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: var(--cfaq-blue);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(41, 112, 255, 0.3);
    transition: transform 0.2s;
    margin-left: -5px;
}

#cfaq-apply-filters-btn:hover {
    transform: scale(1.1);
}

/* FAQ List */
.cfaq-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    min-height: 200px;
}

/* Updated Loading State with Spinner Icon */
.cfaq-list-wrapper.loading {
    pointer-events: none;
    position: relative;
    min-height: 300px;
}

/* Hide existing items during loading */
.cfaq-list-wrapper.loading .cfaq-item {
    opacity: 0;
    visibility: hidden;
}

.cfaq-list-wrapper.loading .cfaq-pagination {
    opacity: 0;
    visibility: hidden;
}

/* Spinner Icon Container */
.cfaq-list-wrapper.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin-top: -25px;
    margin-left: -25px;
    z-index: 10;
    border: 4px solid rgba(197, 186, 144, 0.2);
    border-top: 4px solid #C5BA90;
    border-radius: 50%;
    animation: spinnerRotate 0.8s linear infinite;
}

/* Optional: Add a subtle circular background behind the spinner */
.cfaq-list-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    margin-top: -35px;
    margin-left: -35px;
    z-index: 9;
    border: 2px solid rgba(197, 186, 144, 0.1);
    border-radius: 50%;
    animation: spinnerPulse 1.5s ease-in-out infinite;
}

/* Spinner Rotation Animation */
@keyframes spinnerRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Circle Pulse Animation */
@keyframes spinnerPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.5;
    }
}

.cfaq-item {
    background-color: rgba(225, 225, 225, 0.38);
    border-radius: 20px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.cfaq-item.active {
    background-color: #fff;
    border-color: #e9ecef;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.cfaq-question {
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.cfaq-item .active .cfaq-question {
    background: rgba(225, 225, 225, 0.38);
}

.cfaq-question h3 {
    margin: 0;
    color: #000;
    font-family: 'Montserrat', sans-serif;
    font-size: 19px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
}

/* Accordion Icon */
.cfaq-icon {
    width: 32px;
    height: 32px;
    border: 1.5px solid #ced4da;
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cfaq-icon::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid #495057;
    border-right: 2px solid #495057;
    transform: translateY(-2px) rotate(45deg);
    transition: all 0.3s ease;
}

.cfaq-item.active .cfaq-icon {
    background: #C5BA90;
    border-color: #C5BA90;
}

.cfaq-item.active .cfaq-icon::before {
    border-color: #fff;
    transform: translateY(2px) rotate(225deg);
}

.cfaq-answer {
    border-radius: 37px;
    border: 1px solid #FDEBEB;
    background: rgba(255, 255, 255, 0.38);
    color: #2C4569;
    font-size: 15px;
    line-height: 1.7;
    display: none;
    padding: 0 25px 25px 25px;
}

.cfaq-answer p:last-child {
    margin-bottom: 0;
    padding: 20px;
    color: #2C4569;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
}

.cfaq-answer ul {
    padding-left: 20px;
}

/* Pagination Dots */
.cfaq-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
}

.cfaq-pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0;
}

.cfaq-pagination .page-numbers:not(.current):not(.prev):not(.next) {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
    background-color: #dee2e6;
    border: none;
}

.cfaq-pagination .page-numbers:not(.current):not(.prev):not(.next):hover {
    background-color: #C5BA90;
    transform: scale(1.2);
}

.cfaq-pagination .page-numbers.current {
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 50%;
    background-color: #C5BA90;
    border: none;
    cursor: default;
}

.cfaq-pagination .prev,
.cfaq-pagination .next {
    width: 36px;
    height: 36px;
    background-color: #F9F7F2;
    border: 1px solid #C5BA90;
    border-radius: 50%;
    position: relative;
}

.cfaq-pagination .prev:hover,
.cfaq-pagination .next:hover {
    background-color: #C5BA90 !important;
    border-color: #C5BA90 !important;
}

.cfaq-pagination .prev:hover::before,
.cfaq-pagination .next:hover::before {
    border-color: #fff;
}

.cfaq-pagination .prev::before,
.cfaq-pagination .next::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid #303A54;
    border-right: 2px solid #303A54;
    transition: border-color 0.3s ease;
}

.cfaq-pagination .prev::before {
    transform: translate(-35%, -50%) rotate(135deg);
}

.cfaq-pagination .next::before {
    transform: translate(-65%, -50%) rotate(-45deg);
}

/* General Button Hovers (excluding pagination) */
[type=button]:focus, [type=button]:hover, [type=submit]:focus, [type=submit]:hover, button:focus, button:hover {
    background-color: #F9F7F2 !important;
    border-color: #C5BA90 !important;
    color: #303A54 !important;
}

/* Override for the blue apply button */
#cfaq-apply-filters-btn,
#cfaq-apply-filters-btn:hover {
    background-color: var(--cfaq-blue) !important;
    border-color: var(--cfaq-blue) !important;
    color: #fff !important;
}

/* No Results Styling */
.cfaq-no-results {
    text-align: center;
    padding: 60px 20px;
    background-color: #f8f9fa;
    border: 2px dashed #e9ecef;
    border-radius: 20px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cfaq-no-results svg {
    color: #adb5bd;
    margin-bottom: 20px;
}

.cfaq-no-results h5 {
    font-size: 20px;
    font-weight: 600;
    color: #343a40;
    margin: 0 0 10px 0;
}

.cfaq-no-results p {
    font-size: 16px;
    color: #6c757d;
    margin: 0;
    max-width: 400px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .cfaq-container {
        margin: 20px 0;
        padding: 15px;
    }

    .cfaq-filter-title {
        font-size: 24px;
        margin-right: 0;
        margin-bottom: 10px;
        align-self: flex-start;
    }

    .cfaq-filter-title::after {
        width: 60px;
        height: 3px;
        margin-top: 10px;
    }

    .cfaq-filter-title:hover::after {
        width: 80px;
    }

    .cfaq-filters {
        flex-direction: column;
        align-items: stretch;
        /* Makes children full width */
        gap: 15px;
        padding-top: 20px;
        overflow-x: visible;
    }

    .cfaq-filters::-webkit-scrollbar {
        display: none;
    }

    #cfaq-apply-filters-btn {
        margin-left: 0;
    }

    .cfaq-question {
        padding: 15px;
    }

    .cfaq-question h3 {
        font-size: 16px;
    }

    .cfaq-answer {
        padding: 0 15px 15px 15px;
        font-size: 14px;
    }

    .cfaq-list-wrapper.loading::before {
        width: 40px;
        height: 40px;
        margin-top: -20px;
        margin-left: -20px;
        border-width: 3px;
    }

    .cfaq-list-wrapper.loading::after {
        width: 60px;
        height: 60px;
        margin-top: -30px;
        margin-left: -30px;
    }

    .cfaq-filter-btn,
    .cfaq-filter-dropdown,
    #cfaq-all-questions-btn {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
    }

    .cfaq-filter-dropdown .cfaq-filter-btn {
        width: 100%;
    }

    .cfaq-dropdown-content {
        width: 100%;
        position: absolute;
        /* Keeps it floating over content */
        left: 0;
        box-sizing: border-box;
    }

    #cfaq-apply-filters-btn {
        width: 100%;
        height: 50px;
        border-radius: 50px;
        /* Match the style of other buttons */
        margin-left: 0;
        margin-top: 5px;
    }

    /* FAQ Item Adjustments */
    .cfaq-question {
        padding: 15px;
    }

    .cfaq-question h3 {
        font-size: 14px;
    }

    .cfaq-answer {
        padding: 0 15px 15px 15px;
        font-size: 14px;
    }

    /* Loading Spinner Adjustments */
    .cfaq-list-wrapper.loading::before {
        width: 40px;
        height: 40px;
        margin-top: -20px;
        margin-left: -20px;
        border-width: 3px;
    }

}

/* ... (Gardez votre CSS existant) ... */

/* RTL Support for Arabic */
.cfaq-rtl {
    direction: rtl;
    text-align: right;
}

.cfaq-rtl .cfaq-filter-title {
    margin-right: 0;
    margin-left: 20px;
}

.cfaq-rtl .cfaq-filter-title::after {
    transform-origin: right;
}

.cfaq-rtl .cfaq-arrow-down {
    margin-right: 8px;
    margin-left: 0;
}

.cfaq-rtl #cfaq-apply-filters-btn {
    margin-left: 0;
    margin-right: -5px;
}

.cfaq-rtl .cfaq-icon::before {
    /* Inversion de l'icône si nécessaire */
}

.cfaq-rtl .cfaq-dropdown-content {
    left: auto;
    right: 0;
}

@media (max-width: 768px) {
    .cfaq-rtl .cfaq-filter-title {
        align-self: flex-start;
    }
}