/* =====================================================================
   DriveOnly : « Questions fréquentes », bulle d'aide (03/12/2026)
   Gabarit : templates/_partials/do/faq-bot.tpl ; script : assets/js/do-faq.js.
   Habillage Signature Atelier (driveonly-signature.css) : carbone, anneau du
   logo (or > orange | vert lime > vert), filet Spectre, surfaces minérales,
   boutons plats. Toutes les règles passent par #do-faq : le CSS du thème et
   des modules (boutons, titres, liens) ne déteint pas sur la bulle.
   Bas d'écran à droite : la bulle ; « haut de page » remonte au-dessus ;
   sur la fiche produit (≤ 991 px), les deux passent au-dessus de la barre d'achat.
   Calques : bulle 90 (au-dessus de la barre d'achat 80, sous le voile des
   tiroirs 95 et le header 100) ; fenêtre 99 ; panneau mobile 1030 (+ voile 1029).
   ===================================================================== */

#do-faq {
    --faq-carbon: linear-gradient(155deg, #1a1d26 0%, #0e1015 100%);
    --faq-ring: conic-gradient(from -90deg, #ffd600 0deg 85deg, #ff8c00 85deg 172deg, transparent 172deg 188deg, #a6dc1c 188deg 275deg, #3ca342 275deg 352deg, transparent 352deg 360deg);
    --faq-spectrum: linear-gradient(90deg, #ffd600 0%, #ff8c00 48.5%, transparent 48.5%, transparent 51.5%, #a6dc1c 51.5%, #3ca342 100%);
    --faq-right: 18px;
    --faq-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    --faq-fab: 52px;
    --faq-ink: var(--do-ink, #111318);
    --faq-muted: var(--do-muted, #5d636e);
    --faq-line: var(--do-line, rgba(17, 19, 24, .09));
    --faq-accent: var(--do-accent, #ff8c00);
    --faq-ease: var(--do-ease, cubic-bezier(.2, .8, .2, 1));
    font-family: var(--do-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
    -webkit-font-smoothing: antialiased;
}

#do-faq [hidden] {
    display: none !important;
}

#do-faq button {
    margin: 0;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
    -webkit-tap-highlight-color: transparent;
}

#do-faq svg {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#do-faq button:focus-visible,
#do-faq a:focus-visible {
    outline: 2px solid var(--faq-accent);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Bulle (bouton flottant)
   --------------------------------------------------------------------- */
#do-faq .do-faq__fab {
    position: fixed;
    right: var(--faq-right);
    bottom: var(--faq-bottom);
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    height: var(--faq-fab);
    padding: 0 18px 0 6px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 14px;
    background: var(--faq-carbon);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 16px 36px -16px rgba(10, 12, 18, .6);
    cursor: pointer;
    transition: bottom .35s var(--faq-ease), border-color .16s ease, transform .16s ease;
}

#do-faq .do-faq__fab:hover {
    border-color: rgba(255, 255, 255, .34);
}

#do-faq .do-faq__fab:active {
    transform: scale(.97);
}

/* Anneau coupé du logo autour d'un noyau carbone (même dessin que le badge de la page Support) */
#do-faq .do-faq__ring {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #262b39 0%, #101218 75%);
    color: #fff;
}

#do-faq .do-faq__ring::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 2.5px;
    border-radius: 50%;
    background: var(--faq-ring);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

#do-faq .do-faq__ring svg {
    position: relative;
    width: 19px;
    height: 19px;
}

#do-faq .do-faq__ico-close,
#do-faq.is-open .do-faq__ico-chat {
    display: none;
}

#do-faq.is-open .do-faq__ico-close {
    display: block;
}

/* « Haut de page » (thème) : au-dessus de la bulle, même bord droit */
body:has(#do-faq) .btn-to-top {
    right: calc(var(--faq-right, 18px) + 4px) !important;
    bottom: calc(18px + 52px + 12px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ---------------------------------------------------------------------
   Fenêtre
   --------------------------------------------------------------------- */
#do-faq .do-faq__panel {
    position: fixed;
    right: var(--faq-right);
    bottom: calc(var(--faq-bottom) + var(--faq-fab) + 12px);
    z-index: 99;
    display: flex;
    flex-direction: column;
    width: min(392px, calc(100vw - 36px));
    max-height: min(620px, calc(100vh - 230px));
    max-height: min(620px, calc(100dvh - 230px));
    border: 1px solid rgba(17, 19, 24, .1);
    border-radius: 16px;
    background: var(--do-bg, #f3f2ee);
    box-shadow: 0 34px 80px -34px rgba(10, 12, 18, .55), 0 2px 6px rgba(10, 12, 18, .06);
    overflow: hidden;
    transform-origin: 100% 100%;
    animation: do-faq-pop .26s var(--faq-ease);
}

@keyframes do-faq-pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* En-tête carbone + filet Spectre */
#do-faq .do-faq__head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    flex: none;
    padding: 17px 12px 14px 14px;
    background:
        radial-gradient(260px 150px at 100% 0%, rgba(255, 140, 0, .24), transparent 70%),
        radial-gradient(220px 140px at 0% 100%, rgba(148, 209, 29, .12), transparent 70%),
        var(--faq-carbon);
    color: #fff;
}

#do-faq .do-faq__head::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--faq-spectrum);
}

#do-faq .do-faq__ring--sm {
    width: 36px;
    height: 36px;
}

#do-faq .do-faq__ring--sm svg {
    width: 17px;
    height: 17px;
}

#do-faq .do-faq__titles {
    flex: 1;
    min-width: 0;
}

#do-faq .do-faq__title {
    margin: 0;
    padding: 0;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.01em;
    text-transform: none;
}

#do-faq .do-faq__sub {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 4px 0 0;
    color: rgba(255, 255, 255, .68);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
}

#do-faq .do-faq__sub::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: 50%;
    background: #94d11d;
    box-shadow: 0 0 0 3px rgba(148, 209, 29, .2);
}

#do-faq .do-faq__iconbtn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 9px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease;
}

#do-faq .do-faq__iconbtn:hover {
    border-color: rgba(255, 255, 255, .3);
    background: rgba(255, 255, 255, .14);
}

/* Corps : messages puis choix, dans un seul défilement. Avant (retour de l'utilisateur, 03/12/2026) :
   messages et liste défilaient chacun de leur côté, la liste écrasait ses questions (texte hors du cadre)
   et Windows y affichait sa barre de défilement. */
#do-faq .do-faq__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Barre de défilement : réglette fine sans flèches (Chrome, Edge, Safari). Les propriétés standard
   scrollbar-width / scrollbar-color ne servent qu'à Firefox : Chrome les préférerait aux règles
   ::-webkit-scrollbar et garderait ses flèches sous Windows. */
@supports not selector(::-webkit-scrollbar) {
    #do-faq .do-faq__body {
        scrollbar-width: thin;
        scrollbar-color: rgba(17, 19, 24, .24) transparent;
    }
}

#do-faq .do-faq__body::-webkit-scrollbar {
    width: 8px;
}

#do-faq .do-faq__body::-webkit-scrollbar-track {
    background: transparent;
}

#do-faq .do-faq__body::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 8px;
    background: rgba(17, 19, 24, .24) padding-box;
}

#do-faq .do-faq__body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(17, 19, 24, .4);
}

/* Fil de discussion */
#do-faq .do-faq__log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 14px 6px;
}

#do-faq .do-faq__msg {
    max-width: 88%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    animation: do-faq-msg .24s var(--faq-ease) both;
}

@keyframes do-faq-msg {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

#do-faq .do-faq__msg--bot {
    align-self: flex-start;
    border: 1px solid var(--faq-line);
    border-bottom-left-radius: 4px;
    background: #fff;
    color: var(--faq-ink);
}

#do-faq .do-faq__msg--user {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    background: var(--do-dark-2, #171a22);
    color: #fff;
    font-weight: 600;
}

#do-faq .do-faq__msg strong,
#do-faq .do-faq__msg b {
    font-weight: 750;
}

#do-faq .do-faq__msg a {
    color: var(--faq-ink);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--faq-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

#do-faq .do-faq__msg a:hover {
    color: var(--faq-accent);
}

#do-faq .do-faq__steps {
    margin: 8px 0 8px;
    padding: 0 0 0 20px;
}

#do-faq .do-faq__steps li {
    margin: 0 0 4px;
    padding-left: 2px;
}

#do-faq .do-faq__steps li::marker {
    color: var(--faq-accent);
    font-weight: 800;
}

#do-faq .do-faq__rows {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

#do-faq .do-faq__rows li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-top: 1px solid var(--faq-line);
}

#do-faq .do-faq__rows span {
    color: var(--do-ink-2, #2a2e37);
}

#do-faq .do-faq__rows strong {
    flex: none;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* « … » pendant que le robot « écrit » */
#do-faq .do-faq__typing {
    display: inline-flex;
    gap: 4px;
    padding: 13px 14px;
}

#do-faq .do-faq__typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9aa0aa;
    animation: do-faq-dot 1s infinite ease-in-out;
}

#do-faq .do-faq__typing i:nth-child(2) {
    animation-delay: .15s;
}

#do-faq .do-faq__typing i:nth-child(3) {
    animation-delay: .3s;
}

@keyframes do-faq-dot {
    0%,
    60%,
    100% {
        opacity: .35;
        transform: none;
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* Choix (thèmes puis questions), à la suite des messages */
#do-faq .do-faq__choices {
    padding: 12px 14px 16px;
}

#do-faq .do-faq__label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: var(--faq-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .1em;
    text-transform: uppercase;
}

#do-faq .do-faq__label::before {
    content: "";
    width: 18px;
    height: 3px;
    flex: none;
    border-radius: 2px;
    background: var(--faq-spectrum);
}

#do-faq .do-faq__options--themes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#do-faq .do-faq__options--list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#do-faq .do-faq__theme,
#do-faq .do-faq__q {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid var(--faq-line);
    border-radius: 10px;
    background: #fff;
    color: var(--faq-ink);
    font-size: 13.5px;
    font-weight: 650;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

#do-faq .do-faq__theme {
    gap: 10px;
    min-height: 50px;
    padding: 8px 10px;
}

#do-faq .do-faq__ticon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 8px;
    background: var(--do-bg, #f3f2ee);
    color: var(--faq-ink);
    transition: background-color .16s ease, color .16s ease;
}

#do-faq .do-faq__ticon svg {
    width: 18px;
    height: 18px;
}

#do-faq .do-faq__q {
    flex: none;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 11px 10px 11px 13px;
    font-weight: 560;
    line-height: 1.38;
}

#do-faq .do-faq__q svg {
    width: 16px;
    height: 16px;
    color: var(--faq-muted);
}

#do-faq .do-faq__q.is-read {
    color: var(--faq-muted);
    font-weight: 500;
}

#do-faq .do-faq__theme:hover,
#do-faq .do-faq__q:hover {
    border-color: var(--faq-accent);
    background: #fffaf3;
}

#do-faq .do-faq__theme:hover .do-faq__ticon {
    background: var(--do-accent-soft, rgba(255, 140, 0, .12));
    color: var(--faq-accent);
}

#do-faq .do-faq__q:hover svg {
    color: var(--faq-accent);
}

#do-faq .do-faq__options.is-busy {
    opacity: .55;
    pointer-events: none;
}

/* Pied : vers la page Support / SAV */
#do-faq .do-faq__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 8px;
    flex: none;
    margin: 0;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--faq-line);
    background: var(--do-surface, #fff);
    color: var(--faq-muted);
    font-size: 12.5px;
    line-height: 1.3;
}

#do-faq .do-faq__foot a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--faq-ink);
    font-weight: 700;
    text-decoration: none;
}

#do-faq .do-faq__foot a:hover {
    color: var(--faq-accent);
}

#do-faq .do-faq__foot svg {
    width: 15px;
    height: 15px;
}

/* ---------------------------------------------------------------------
   Fiche produit, mobile et tablette : la barre d'achat (driveonly.css,
   .do-buybar, 12 px du bas, 68 px de haut) apparaît quand le bouton
   « Ajouter au panier » sort de l'écran : bulle et « haut de page » montent.
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    body:has(.do-buybar.is-visible) #do-faq .do-faq__fab {
        bottom: calc(12px + 68px + 10px + env(safe-area-inset-bottom, 0px));
    }

    body:has(.do-buybar.is-visible) #do-faq .do-faq__panel {
        bottom: calc(12px + 68px + 10px + 52px + 12px + env(safe-area-inset-bottom, 0px));
    }

    body:has(#do-faq):has(.do-buybar.is-visible) .btn-to-top {
        bottom: calc(12px + 68px + 10px + 52px + 12px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* Libellé masqué sous 768 px : la bulle devient un carré */
@media (max-width: 767.98px) {
    #do-faq .do-faq__fab {
        justify-content: center;
        width: var(--faq-fab);
        padding: 0;
    }

    #do-faq .do-faq__fab-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

/* ---------------------------------------------------------------------
   Téléphone, ou écran trop bas pour la fenêtre (téléphone à l'horizontale,
   petite fenêtre) : panneau qui monte du bas de l'écran, voile derrière.
   Même requête dans do-faq.js (SHEET).
   --------------------------------------------------------------------- */
@media (max-width: 575.98px), (max-height: 640px) {
    #do-faq .do-faq__scrim {
        position: fixed;
        inset: 0;
        z-index: 1029;
        background: rgba(14, 16, 21, .5);
        animation: do-faq-fade .25s ease both;
    }

    #do-faq .do-faq__panel,
    body:has(.do-buybar.is-visible) #do-faq .do-faq__panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        width: auto;
        max-width: 600px;
        max-height: 88vh;
        max-height: min(88dvh, 720px);
        margin: 0 auto;
        border: 0;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--do-bg, #f3f2ee);
        transform-origin: 50% 100%;
        animation: do-faq-up .32s var(--faq-ease);
    }

    #do-faq .do-faq__head {
        padding-top: 22px;
    }

    /* poignée */
    #do-faq .do-faq__head::after {
        content: "";
        position: absolute;
        top: 9px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 2px;
        background: rgba(255, 255, 255, .26);
    }

    /* cibles tactiles confortables */
    #do-faq .do-faq__theme,
    #do-faq .do-faq__q {
        font-size: 14px;
    }

    #do-faq .do-faq__q {
        min-height: 48px;
    }

    html.do-faq-lock,
    html.do-faq-lock body {
        overflow: hidden;
    }
}

/* Écran très bas (téléphone à l'horizontale) : en-tête et listes plus compacts */
@media (max-height: 480px) {
    #do-faq .do-faq__head {
        padding-top: 18px;
        padding-bottom: 10px;
    }

    #do-faq .do-faq__sub {
        display: none;
    }

    #do-faq .do-faq__log {
        padding-top: 10px;
    }

    #do-faq .do-faq__theme {
        min-height: 44px;
    }
}

@keyframes do-faq-up {
    from {
        transform: translateY(100%);
    }

    to {
        transform: none;
    }
}

@keyframes do-faq-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    #do-faq *,
    #do-faq *::before,
    #do-faq *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    #do-faq {
        display: none !important;
    }
}
