/**
 * WS Booster - Widget FAQ Avancee
 */

.ws-faq {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* v4.9.83 : .ws-faq__list est le conteneur interne des items.
   Quand groupes actives : un .ws-faq__list par .ws-faq__group.
   Sinon : directement enfant de .ws-faq.
   Le grid-template-columns est pose par le controle "Colonnes" responsive. */
.ws-faq__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* v4.9.x : Sens de remplissage "Inverse" (manque a gauche).
   prefix_class fill_direction = 'rtl' sur le wrapper widget.
   Le grid recoit direction:rtl -> les items s'alignent de droite a gauche
   (la 1ere card est en haut-droite, la derniere fillera la colonne gauche).
   On reset direction:ltr sur chaque item pour que le contenu interne
   (titre, texte, bouton, icone) reste lisible normalement. */
.ws-faq-fill-rtl .ws-faq__list {
    direction: rtl;
}
.ws-faq-fill-rtl .ws-faq__list > .ws-faq__item {
    direction: ltr;
}

/* ========== v4.9.83 : RECHERCHE LIVE ========== */
.ws-faq__search {
    position: relative;
    margin-bottom: 24px;
}
.ws-faq__search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 1;
}
.ws-faq__search-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px 12px 44px;
    background: #ffffff;
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
}
.ws-faq__search-input:focus {
    border-color: var(--ws-faq-item-color, #ef3340);
    box-shadow: 0 0 0 3px rgba(239, 51, 64, 0.1);
}
.ws-faq__no-results {
    margin-top: 12px;
    padding: 16px;
    text-align: center;
    color: rgba(0, 0, 0, 0.5);
    font-style: italic;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

/* ========== v4.9.83 : GROUPES ========== */
.ws-faq__group + .ws-faq__group {
    margin-top: 32px;
}
.ws-faq__group-title {
    margin: 0 0 16px 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #1a1a2e;
    position: relative;
    padding-bottom: 8px;
}
/* Trait colore sous le titre (utilise --ws-faq-cat-color pose par PHP) */
.ws-faq-grp-line-yes .ws-faq__group-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 48px;
    height: 3px;
    background: var(--ws-faq-cat-color, #ef3340);
    border-radius: 2px;
}
.ws-faq-grp-line- .ws-faq__group-title::after { display: none; }

/* ========== v4.9.83 : COULEUR D'ACCENT PAR ITEM ========== */
/* Quand --ws-faq-item-color est pose (par item ou par categorie), le numero
   et le chevron utilisent cette couleur. Override le style global. */
.ws-faq__item[style*="--ws-faq-item-color"] .ws-faq__number {
    color: var(--ws-faq-item-color);
}
.ws-faq__item[style*="--ws-faq-item-color"] .ws-faq__chevron {
    color: var(--ws-faq-item-color);
}
/* Une legere bordure latérale colorée à gauche pour identifier visuellement le groupe */
.ws-faq__item[style*="--ws-faq-item-color"] {
    border-left: 3px solid var(--ws-faq-item-color);
}

/* ========== v4.9.83 : QUESTION STICKY ========== */
/* Active uniquement quand .ws-faq-sticky-yes sur le wrapper widget */
.ws-faq-sticky-yes .ws-faq__item.is-open .ws-faq__question {
    position: sticky;
    top: 0;
    z-index: 5;
    background: inherit;
}

/* ========== v4.9.83 : HAUTEUR FIXE + SCROLL INTERNE ========== */
/* La hauteur max est posee inline par le controle Slider via selectors. */
.ws-faq-fixed-yes .ws-faq__item.is-open .ws-faq__answer-inner {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}
.ws-faq-fixed-yes .ws-faq__item.is-open .ws-faq__answer-inner::-webkit-scrollbar {
    width: 6px;
}
.ws-faq-fixed-yes .ws-faq__item.is-open .ws-faq__answer-inner::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
}
.ws-faq-fixed-yes .ws-faq__item.is-open .ws-faq__answer-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.45);
}

/* ========== v4.9.83 : WRAPPER QUESTION-TEXT pour heading SEO ========== */
/* La balise wrap est maintenant un hX (par defaut h3). Reset les marges
   par defaut du browser pour eviter qu'elles cassent le layout flex de
   .ws-faq__question. */
.ws-faq__question-text,
h1.ws-faq__question-text,
h2.ws-faq__question-text,
h3.ws-faq__question-text,
h4.ws-faq__question-text,
h5.ws-faq__question-text,
h6.ws-faq__question-text {
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    flex: 1 1 auto;
    text-align: left;
}

/* ========== v4.9.83 : HIDDEN par recherche ========== */
.ws-faq__item[data-hidden-search="1"] {
    display: none;
}
.ws-faq__group[data-hidden-search="1"] {
    display: none;
}

.ws-faq__item {
    --ws-faq-item-transition: 0.25s;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition:
        background-color var(--ws-faq-item-transition) ease,
        background-image var(--ws-faq-item-transition) ease,
        border-color var(--ws-faq-item-transition) ease,
        box-shadow var(--ws-faq-item-transition) ease;
}

.ws-faq__item.is-open {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.ws-faq__question {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.ws-faq__question:focus {
    outline: 2px solid rgba(239, 51, 64, 0.4);
    outline-offset: -2px;
}

.ws-faq__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ws-faq__icon i,
.ws-faq__icon svg {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.ws-faq__question-text {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
}

.ws-faq__chevron {
    flex: 0 0 auto;
    display: inline-flex;
    transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1);
    color: #ef3340;
}

.ws-faq__item.is-open .ws-faq__chevron {
    transform: rotate(180deg);
}

.ws-faq__chevron svg {
    display: block;
    width: 20px;
    height: 20px;
}

.ws-faq__answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.ws-faq__item.is-open .ws-faq__answer {
    max-height: 2000px;
}

.ws-faq__answer-inner {
    padding: 0 18px 18px;
    color: #4b5563;
    line-height: 1.6;
}

.ws-faq__answer-inner > *:first-child {
    margin-top: 0;
}

.ws-faq__answer-inner > *:last-child {
    margin-bottom: 0;
}

.ws-faq__answer-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin-bottom: 12px;
    border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .ws-faq__chevron,
    .ws-faq__answer {
        transition: none;
    }
}

/* Numeros */
.ws-faq--numbered .ws-faq__number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 4px 8px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* Layout offset : le contenu commence apres une colonne filler
 * (aligne avec le titre de la question pour un look etape de process) */
.ws-faq--offset .ws-faq__answer-inner {
    display: grid;
    grid-template-columns: 68px 1fr;
    align-items: start;
}

.ws-faq--offset .ws-faq__answer-inner::before {
    content: "";
    display: block;
    grid-column: 1;
    grid-row: 1 / span 99;
}

.ws-faq--offset .ws-faq__answer-inner > * {
    grid-column: 2;
}

.ws-faq--numbered.ws-faq--offset .ws-faq__answer-inner {
    grid-template-columns: 60px 1fr;
}

/* Video locale (injection lazy via IntersectionObserver) */
.ws-faq__video-local {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
}

.ws-faq__video-local video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video embed lazy */
.ws-faq__video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
}

.ws-faq__video-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Comparateur avant/apres */
.ws-faq__ba {
    position: relative;
    width: 100%;
    margin-bottom: 14px;
    user-select: none;
    overflow: hidden;
    border-radius: 10px;
}

.ws-faq__ba-img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.ws-faq__ba-after-wrap {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    overflow: hidden;
}

.ws-faq__ba-after-wrap img {
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.ws-faq__ba-range {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    cursor: ew-resize;
    background: transparent;
    opacity: 0;
    -webkit-appearance: none;
    appearance: none;
}

.ws-faq__ba-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 100%;
    height: 100%;
    cursor: ew-resize;
}

.ws-faq__ba-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 40px;
    height: 100%;
    transform: translateX(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.ws-faq__ba-handle::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #fff;
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.ws-faq__ba-handle svg {
    position: relative;
    z-index: 1;
    background: #fff;
    color: #1a1a2e;
    border-radius: 50%;
    padding: 6px;
    box-sizing: content-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   ANIMATION D'APPARITION (cascade staggered)
   - .ws-faq-appear-ready : etat cache, pose par le JS AVANT l'entree dans
     l'ecran (fail-safe : sans JS, les items restent visibles).
   - .ws-faq-appear-in : pose par le JS quand le bloc entre dans le viewport
     (et .ws-faq-appear-ready est retiree). L'animation joue, decalee par item
     via --ws-faq-i. fill-mode "backwards" => apres l'anim, l'item revient a
     son CSS normal (le survol / hover FX n'est pas casse par un fill forwards).
   ========================================================================== */
.ws-faq-appear-ready .ws-faq__item {
    opacity: 0;
}

.ws-faq-appear-in .ws-faq__item {
    /* Easing doux (easeOutCubic) : deceleration progressive, pas de demarrage
       brusque -> rendu plus lent et plus fluide qu'un expo.out. */
    animation: var(--ws-faq-appear-dur, 0.9s) cubic-bezier(0.33, 1, 0.68, 1) backwards;
    animation-delay: calc(var(--ws-faq-i, 0) * var(--ws-faq-appear-stag, 0.18s));
}

.ws-faq--appear-cascade.ws-faq-appear-in    .ws-faq__item { animation-name: wsFaqAppearCascade; }
.ws-faq--appear-cascade-up.ws-faq-appear-in .ws-faq__item { animation-name: wsFaqAppearCascadeUp; }
.ws-faq--appear-fade-up.ws-faq-appear-in    .ws-faq__item { animation-name: wsFaqAppearUp; }
.ws-faq--appear-fade.ws-faq-appear-in       .ws-faq__item { animation-name: wsFaqAppearFade; }
.ws-faq--appear-slide-side.ws-faq-appear-in .ws-faq__item { animation-name: wsFaqAppearSide; }
.ws-faq--appear-zoom.ws-faq-appear-in       .ws-faq__item { animation-name: wsFaqAppearZoom; }

/* Cascade : chaque item tombe doucement depuis le haut (waterfall). */
@keyframes wsFaqAppearCascade {
    from { opacity: 0; transform: translateY(-34px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Cascade inversee : chaque item monte doucement depuis le bas. */
@keyframes wsFaqAppearCascadeUp {
    from { opacity: 0; transform: translateY(34px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes wsFaqAppearUp {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes wsFaqAppearFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes wsFaqAppearSide {
    from { opacity: 0; transform: translateX(-34px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes wsFaqAppearZoom {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .ws-faq-appear-ready .ws-faq__item { opacity: 1; }
    .ws-faq-appear-in .ws-faq__item { animation: none !important; }
}

/* ============================================================
   Bouton optionnel dans la reponse d'un item FAQ
   Defaults raisonnables (override via Style > Bouton).
   ============================================================ */
.ws-faq__btn-wrap {
    display: flex;
    flex-wrap: wrap;
    margin-top: 16px;
}

.ws-faq__btn {
    --ws-faq-btn-hover-speed: 0.25s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 8px;
    background-color: #1a1a2e;
    color: #ffffff;
    text-decoration: none;
    line-height: 1;
    font-weight: 600;
    cursor: pointer;
    border: 0;
    transition:
        color var(--ws-faq-btn-hover-speed) ease,
        background-color var(--ws-faq-btn-hover-speed) ease,
        background-image var(--ws-faq-btn-hover-speed) ease,
        border-color var(--ws-faq-btn-hover-speed) ease,
        box-shadow var(--ws-faq-btn-hover-speed) ease,
        transform var(--ws-faq-btn-hover-speed) ease;
    will-change: transform;
}

.ws-faq__btn:hover,
.ws-faq__btn:focus-visible {
    text-decoration: none;
    outline: none;
}

.ws-faq__btn-text {
    display: inline-block;
}

.ws-faq__btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.ws-faq__btn-icon svg {
    width: 1em;
    height: 1em;
    display: block;
}

/* Compense le baseline du glyph quand l'icone est a droite/gauche
   (regle MANIFEST 4.0.4 - line-height: 1 sur bouton). */
.ws-faq__btn-icon i,
.ws-faq__btn-icon svg {
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .ws-faq__btn { transition: none !important; }
}

/* ============================================================
   Icone / image en petit dans la question
   ============================================================ */
.ws-faq__icon--image {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.ws-faq__icon--image img {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: cover;
    max-width: none !important;   /* override theme img { max-width: 100% } */
    max-height: none !important;
}
