/* =============================================================
 * Kaliwave — Feuille de style publique des tunnels (Builder v2)
 * -------------------------------------------------------------
 * SOURCE UNIQUE du rendu des tunnels. Consommée par :
 *   - saas/public/funnel.php        (page publique)
 *   - saas/vendor/funnels/preview.php (aperçu brouillon)
 *   - saas/vendor/funnels/builder.php (canvas d'édition)
 *
 * Avant la v2 ce CSS était dupliqué à l'identique dans ces trois
 * fichiers. Ne jamais réintroduire une copie locale : un écart
 * entre l'éditeur et la page publique se paie en confiance.
 *
 * Les variables --fb-* sont redéfinies par renderStyleTag()
 * (saas/includes/funnel_style.php) juste après ce fichier dans le
 * <head>. Les valeurs ci-dessous sont donc des REPLIS, utilisés
 * quand le tunnel n'a pas encore de thème.
 * ============================================================= */

:root {
    --fb-primary: #1A56DB;
    --fb-bg: #F4F6FB;
    --fb-text: #0F1729;
    --fb-btn: #1A56DB;
    --fb-btn-text: #FFFFFF;
    --fb-muted: #5B6785;
    --fb-line: #E4E9F2;
    --fb-radius: 10px;
    --fb-w: 720px;
    --fb-font: 'Segoe UI', Arial, sans-serif;
    --fb-font-title: 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--fb-font);
    background: var(--fb-bg);
    color: var(--fb-text);
    line-height: 1.6;
}

img { max-width: 100%; }

/* ---- Bandeau vendeur ---- */
.fb-top {
    background: #fff;
    border-bottom: 1px solid var(--fb-line);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.fb-top img { height: 34px; border-radius: 6px; }
.fb-top span { font-weight: 700; }

/* =============================================================
 * Sections
 * -------------------------------------------------------------
 * .fb-wrap ne borne plus la largeur : ce sont les sections qui
 * bornent leur contenu via --fb-w. C'est ce qui rend possible une
 * section pleine largeur au milieu d'une page étroite, la variable
 * étant surchargée par section (.s-42 { --fb-w: 100% }).
 * ============================================================= */

.fb-wrap { padding: 0; }

.fb-section { padding: 40px 20px; position: relative; }
.fb-section__inner { max-width: var(--fb-w); margin: 0 auto; }

/* Variante « libre » : les sections créées par le backfill de la
   migration. Reproduit exactement l'ancien couple .fb-wrap/.fb-card
   pour que les tunnels déjà publiés ne bougent pas d'un pixel. */
.fb-section--libre { padding: 32px 20px 60px; }
.fb-section--libre .fb-section__inner {
    background: #fff;
    border: 1px solid var(--fb-line);
    border-radius: 16px;
    padding: 28px;
}

/* ---- Colonnes ---- */
.fb-cols { display: grid; gap: 24px; align-items: start; }
.fb-cols--1 { grid-template-columns: 1fr; }
.fb-cols--2 { grid-template-columns: repeat(2, 1fr); }
.fb-cols--3 { grid-template-columns: repeat(3, 1fr); }
.fb-cols--4 { grid-template-columns: repeat(4, 1fr); }

/* =============================================================
 * Blocs
 * ============================================================= */

.fb-titre {
    font-family: var(--fb-font-title);
    font-size: 26px;
    line-height: 1.25;
    margin: 18px 0 10px;
}
.fb-sous-titre {
    font-family: var(--fb-font-title);
    font-size: 19px;
    line-height: 1.35;
    color: var(--fb-muted);
    margin: 6px 0 12px;
}
.fb-texte { color: #33405c; margin: 10px 0; }

.fb-image img,
.fb-video video {
    width: 100%;
    border-radius: 12px;
    margin: 14px 0;
    display: block;
}
/* La couverture d'un livre (books.couverture_image) : à la taille d'un
   livre, avec son ombre, plutôt qu'étirée sur toute la colonne. */
.fb-image img[src*="/produits/images/couv-"] {
    max-width: 280px;
    margin: 18px auto;
    border-radius: 4px;
    box-shadow: 0 16px 36px rgba(15, 23, 41, .30);
}
.fb-video iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 12px;
    margin: 14px 0;
    display: block;
}

.fb-cta { margin: 22px 0; text-align: center; }
.fb-btn {
    display: inline-block;
    background: var(--fb-btn);
    color: var(--fb-btn-text);
    text-decoration: none;
    padding: 15px 34px;
    border-radius: var(--fb-radius);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    cursor: pointer;
}
.fb-btn--ghost {
    background: #fff;
    color: var(--fb-primary);
    border: 1px solid var(--fb-primary);
}

.fb-temoignage {
    border-left: 3px solid var(--fb-primary);
    background: var(--fb-bg);
    padding: 14px 18px;
    border-radius: 8px;
    margin: 16px 0;
    font-style: italic;
    color: #33405c;
}
.fb-temoignage cite {
    display: block;
    margin-top: 8px;
    font-style: normal;
    font-weight: 600;
    color: var(--fb-text);
}

.fb-liste { margin: 14px 0; padding-left: 0; list-style: none; }
.fb-liste li {
    padding: 8px 0 8px 28px;
    position: relative;
    border-bottom: 1px solid var(--fb-line);
}
.fb-liste li::before {
    content: "\2713";
    position: absolute;
    left: 4px;
    /* La couleur des boutons du thème, plutôt qu'un vert hors de toute charte. */
    color: var(--fb-btn, #0A7C42);
    font-weight: 700;
}

.fb-faq__item { padding: 12px 0; border-bottom: 1px solid var(--fb-line); }
.fb-faq__q { font-weight: 600; }
.fb-faq__r { color: var(--fb-muted); }

/* Repli des réponses : uniquement si le JS a pris la main, sinon toutes
   les réponses restent lisibles. */
.js .fb-faq__item.is-collapsible .fb-faq__q { cursor: pointer; padding-right: 22px; position: relative; }
.js .fb-faq__item.is-collapsible .fb-faq__q::after {
    content: "+"; position: absolute; right: 2px; top: 0;
    color: var(--fb-primary); font-weight: 700;
}
.js .fb-faq__item.is-collapsible.is-open .fb-faq__q::after { content: "−"; }
.js .fb-faq__item.is-collapsible .fb-faq__r { display: none; margin-top: 6px; }
.js .fb-faq__item.is-collapsible.is-open .fb-faq__r { display: block; }

/* ---- Compte à rebours ---- */
.fb-countdown__t { font-variant-numeric: tabular-nums; font-size: 17px; }

/* ---- Popups ---- */
.fb-popup {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(15, 23, 41, .58);
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
    overflow-y: auto;
}
.fb-popup[hidden] { display: none !important; }
.fb-popup__box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    position: relative;
    overflow: hidden;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 18px 50px rgba(15, 23, 41, .34);
}
.fb-popup__x {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    background: rgba(255, 255, 255, .9); border: 1px solid var(--fb-line);
    width: 30px; height: 30px; border-radius: 50%;
    cursor: pointer; font-size: 14px; color: var(--fb-muted); line-height: 1;
}
.fb-popup__x:hover { color: var(--fb-text); }
/* Une section dans un popup ne rejoue pas la carte de la page. */
.fb-popup .fb-section--libre { padding: 26px 22px; }
.fb-popup .fb-section--libre .fb-section__inner {
    background: none; border: 0; border-radius: 0; padding: 0;
}
.fb-popup .fb-section { padding: 26px 22px; }

.fb-prix { text-align: center; margin: 20px 0; }
.fb-prix__montant {
    font-size: 32px;
    font-weight: 800;
    color: var(--fb-primary);
    display: block;
}
.fb-prix__note { color: var(--fb-muted); font-size: 14px; }

.fb-form { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.fb-form input {
    padding: 13px 14px;
    border: 1px solid var(--fb-line);
    border-radius: var(--fb-radius);
    font-size: 15px;
    font-family: inherit;
}
.fb-form label { font-size: 13px; color: var(--fb-muted); display: flex; gap: 8px; align-items: flex-start; }

.fb-countdown {
    text-align: center;
    background: #FFF7E6;
    color: #B7791F;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--fb-radius);
    margin: 16px 0;
}

/* ---- Séparateurs et espaces ---- */
.fb-sep { margin: 22px 0; }
.fb-sep--ligne { border-top: 1px solid var(--fb-line); }
.fb-sep--points { border-top: 2px dotted var(--fb-line); }
.fb-sep--vide { border: 0; }
.fb-espaceur { width: 100%; }

/* ---- Icône + texte (grille de bénéfices) ---- */
.fb-icone-texte { padding: 6px 0 10px; }
.fb-icone-texte__i { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.fb-icone-texte__t {
    font-family: var(--fb-font-title);
    font-size: 17px; font-weight: 700; margin-bottom: 5px;
}
.fb-icone-texte__d { color: #33405c; font-size: 15px; }

/* ---- Garantie ---- */
.fb-garantie {
    display: flex; gap: 14px; align-items: flex-start;
    background: #F3F8FF; border: 1px solid #D6E4FB;
    border-radius: var(--fb-radius); padding: 16px 18px; margin: 16px 0;
}
.fb-garantie__i { font-size: 26px; line-height: 1.2; }
.fb-garantie__t { font-weight: 700; margin-bottom: 4px; }
.fb-garantie__d { color: #33405c; font-size: 14px; }

/* ---- Avis client ---- */
.fb-avis {
    background: #fff; border: 1px solid var(--fb-line);
    border-radius: var(--fb-radius); padding: 16px 18px; margin: 12px 0;
}
.fb-avis__note { color: #E8A33D; letter-spacing: 2px; font-size: 15px; margin-bottom: 8px; }
.fb-avis__txt { color: #33405c; font-size: 15px; margin-bottom: 12px; }
.fb-avis__who { display: flex; align-items: center; gap: 10px; }
.fb-avis__ph { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }
.fb-avis__n { display: block; font-weight: 600; font-size: 14px; }
.fb-avis__r { display: block; color: var(--fb-muted); font-size: 12px; }

/* ---- Tableau comparatif ---- */
.fb-compare {
    border: 1px solid var(--fb-line); border-radius: var(--fb-radius);
    overflow: hidden; margin: 16px 0;
}
.fb-compare__h, .fb-compare__r { display: grid; grid-template-columns: 1fr 1fr; }
.fb-compare__h { background: #F7F9FD; font-weight: 700; font-size: 14px; }
.fb-compare__h span, .fb-compare__r span {
    padding: 11px 14px; border-bottom: 1px solid var(--fb-line); font-size: 14px;
}
.fb-compare__h span:first-child, .fb-compare__r span:first-child { border-right: 1px solid var(--fb-line); }
.fb-compare__r:last-child span { border-bottom: 0; }
.fb-compare .is-ok { color: #0A7C42; }
.fb-compare .is-ko { color: #97A2B8; }

/* ---- Bouton WhatsApp ---- */
.fb-btn--wa { background: #25D366; color: #fff; }
.fb-wa-i { font-size: 17px; }

/* ---- Bouton WhatsApp flottant ---- */
.fb-wa-float {
    position: fixed; right: 18px; bottom: 18px; z-index: 70;
    width: 54px; height: 54px; border-radius: 50%;
    background: #25D366; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; text-decoration: none;
    box-shadow: 0 4px 16px rgba(15, 23, 41, .28);
}
.fb-wa-float:hover { filter: brightness(1.06); }
@media (max-width: 768px) {
    /* Plus petit sur mobile : il ne doit pas masquer un bouton d'achat. */
    .fb-wa-float { width: 48px; height: 48px; font-size: 22px; right: 14px; bottom: 14px; }
}

/* ---- Barre d'achat collante (téléphone) ----
   Option du thème, sur les pages de vente. Cachée sur ordinateur, où la
   page tient dans moins d'écrans et où le bouton reste proche. Elle glisse
   depuis le bas : funnel-public.js pose .is-visible hors des boutons. */
.fb-barre-achat { display: none; }
@media (max-width: 768px) {
    .fb-barre-achat {
        display: flex; align-items: center; gap: 12px;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: #fff; border-top: 1px solid var(--fb-line);
        box-shadow: 0 -6px 20px rgba(15, 23, 41, .12);
        transform: translateY(110%); transition: transform .25s ease;
    }
    .fb-barre-achat[hidden] { display: none; }
    .fb-barre-achat.is-visible { transform: translateY(0); }
    .fb-barre-achat__txt { flex: 1; min-width: 0; line-height: 1.25; }
    .fb-barre-achat__txt strong {
        display: block; font-size: 13px; color: var(--fb-text);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .fb-barre-achat__txt span { font-size: 15px; font-weight: 700; color: var(--fb-primary); }
    /* Les boutons du tunnel passent en pleine largeur sur téléphone : celui
       de la barre garde sa taille, à côté du produit et de son prix. */
    .fb-barre-achat .fb-barre-achat__btn {
        flex: none; display: inline-block; width: auto; max-width: 58%;
        padding: 12px 18px; font-size: 15px; margin: 0; white-space: nowrap;
    }
    /* La bulle WhatsApp remonte au-dessus de la barre plutôt que de la couvrir. */
    .fb-barre-achat.is-visible ~ .fb-wa-float, body:has(.fb-barre-achat.is-visible) .fb-wa-float { bottom: 84px; }
}

/* ---- Livraison (page de remerciement) ---- */
.fb-livraison {
    background: #E7F7EF; border: 1px solid #BFE8D3; color: #0A7C42;
    border-radius: var(--fb-radius); padding: 16px 18px; margin: 16px 0;
    text-align: center; font-size: 15px;
}

/* ---- Offre complémentaire après le paiement ----
   Volontairement contrastée, comme l'order bump du paiement : elle
   arrive sous le lien de téléchargement, sur une page que le client
   parcourt vite. Un encart discret ne serait jamais vu. */
.fb-section--offre { padding: 4px 20px 44px; }
.fb-offre {
    background: #FFF8E6; border: 1px solid #F5DFA8;
    border-radius: 14px; padding: 24px 22px; text-align: center;
}
.fb-offre__sur {
    display: inline-block; background: #B7791F; color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; border-radius: 20px; padding: 4px 12px;
    margin-bottom: 14px;
}
.fb-offre__img { max-width: 160px; margin: 0 auto 14px; }
.fb-offre__img img { width: 100%; height: auto; display: block; border-radius: 8px; }
.fb-offre__t {
    display: block; font-family: var(--fb-font-title);
    font-size: 20px; line-height: 1.35;
}
.fb-offre__x { color: #6B5320; font-size: 15px; line-height: 1.65; margin: 10px 0 0; }
.fb-offre__p { font-size: 26px; font-weight: 700; color: #B7791F; margin-top: 14px; }
/* Remise : l'ancien prix barré en rouge, le nouveau en vert. La couleur
   fait le travail que le chiffre seul ne fait pas. */
.fb-offre__p--remise { color: #0A7C42; }
.fb-offre__barre {
    color: #C0392B; text-decoration: line-through; font-weight: 600;
    font-size: 19px; margin-right: 10px;
}
/* Le bouton est un vrai formulaire : il crée la commande en POST. */
.fb-offre__f { margin: 0; }
.fb-offre .fb-cta { margin: 16px 0 10px; }
.fb-offre__n { color: var(--fb-muted); font-size: 12px; margin: 0; }

.fb-footer { color: var(--fb-muted); font-size: 13px; text-align: center; margin-top: 22px; }

/* Chrome de page : hors section, donc bornés et espacés à la main. */
.fb-steps,
.fb-poweredby {
    text-align: center;
    color: var(--fb-muted);
    font-size: 12px;
    padding: 0 20px;
}
.fb-steps { margin-top: 4px; }
.fb-poweredby { margin: 18px 0 40px; }
.fb-poweredby a { color: var(--fb-muted); }

/* =============================================================
 * Animations d'apparition
 * -------------------------------------------------------------
 * L'état initial (invisible) n'est appliqué que sous .js, sinon une
 * page chargée sans JavaScript afficherait des sections vides.
 * L'état de départ précis est émis par _cssExtras() selon la section.
 * ============================================================= */

@media (prefers-reduced-motion: reduce) {
    .js .fb-anim { opacity: 1 !important; transform: none !important; transition: none !important; }
    .fb-btn, .fb-section { transition: none !important; }
}

/* =============================================================
 * Responsive
 * ============================================================= */

@media (max-width: 768px) {
    .fb-cols--2,
    .fb-cols--3,
    .fb-cols--4 { grid-template-columns: 1fr; }

    .fb-section { padding: 28px 16px; }
    .fb-section--libre { padding: 20px 14px 40px; }
    .fb-section--libre .fb-section__inner { padding: 20px; border-radius: 12px; }

    .fb-titre { font-size: 22px; }
    .fb-sous-titre { font-size: 17px; }
    .fb-prix__montant { font-size: 27px; }
    .fb-btn { display: block; width: 100%; padding: 15px 20px; }

    .fb-offre { padding: 20px 16px; }
    .fb-offre__t { font-size: 18px; }
    .fb-offre__p { font-size: 23px; }
}
