/* ============================================================
   FAQ iPharm — DA « Opérations commerciales »
   Vanilla CSS, aucune dépendance.
   Pour changer la teinte d'accent : modifier --faq-accent.
   ============================================================ */

:root {
    --faq-font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

    --faq-ink:        #102c79;  /* encre principale */
    --faq-ink-soft:   #48608e;  /* texte secondaire / réponses */
    --faq-muted:      #8793ad;
    --faq-muted-2:    #6176af;
    --faq-faint:      #a3acc2;

    --faq-line:       #e2e6ef;  /* bordures cartes */
    --faq-line-soft:  #eef0f5;
    --faq-bg:         #ffffff;
    --faq-bg-app:     #fafbfd;  /* sidebar */
    --faq-bg-soft:    #eef2fb;  /* pastilles douces */

    --faq-accent:     #102c79;  /* accent (ouverture, état actif, surlignage) */

    --faq-shadow-card:       0 1px 2px rgba(16,44,121,.04), 0 10px 22px rgba(16,44,121,.06);
    --faq-shadow-card-open:  0 2px 4px rgba(16,44,121,.06), 0 14px 30px rgba(16,44,121,.11);
    --faq-shadow-pill:       0 4px 10px rgba(0,3,103,.08);

    --faq-radius:     14px;
}

/* Scope : tout est préfixé .faq- pour éviter les collisions avec votre CSS existant */
.faq-layout *,
.faq-layout *::before,
.faq-layout *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

.faq-layout {
    display: flex;
    min-height: 100vh;
    font-family: var(--faq-font);
    color: var(--faq-ink);
    background: var(--faq-bg);
    -webkit-font-smoothing: antialiased;
}

.faq-layout ::selection { background: #d8e2fb; }

/* ============= SIDEBAR / SOMMAIRE ============= */
.faq-sidebar {
    width: 288px;
    flex-shrink: 0;
    background: var(--faq-bg-app);
    border-right: 1px solid #e7e9ef;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.faq-sidebar::-webkit-scrollbar { width: 9px; }
.faq-sidebar::-webkit-scrollbar-thumb { background: #d5deeb; border-radius: 9px; border: 2px solid var(--faq-bg-app); }

.faq-brand {
    padding: 0 6px 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e7e9ef;
}
.faq-brand-logo {
    background: #1b2330;
    border-radius: var(--faq-radius);
    padding: 20px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(16,44,121,.10);
}
.faq-brand-logo img {
    display: block;
    width: auto;
    max-width: 100%;
    height: 54px;
}
.faq-brand-sub {
    display: block;
    margin-top: 14px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--faq-muted);
}

.faq-toc-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--faq-faint);
    padding: 0 12px;
    margin: 18px 0 8px;
}
.faq-toc-cat:first-child { margin-top: 0; }

.faq-toc-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--faq-ink-soft);
    padding: 8px 12px;
    border-radius: 9px;
    line-height: 1.3;
    transition: background .16s ease, color .16s ease;
}
.faq-toc-link:hover { background: #f1f4fb; color: var(--faq-ink); }

.faq-toc-link.active {
    background: var(--faq-bg-soft);
    color: var(--faq-accent);
    font-weight: 600;
}

.faq-toc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #cfd7e5;
    transition: background .16s ease;
}
.faq-toc-link.active .faq-toc-dot { background: var(--faq-accent); }

.faq-toc-title { flex: 1; min-width: 0; }

.faq-toc-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--faq-faint);
    flex-shrink: 0;
}
.faq-toc-link.active .faq-toc-count { color: var(--faq-accent); }

/* ============= CONTENU ============= */
.faq-content {
    flex: 1;
    min-width: 0;
    padding: 44px clamp(28px, 4vw, 68px) 96px;
}

.faq-topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.faq-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--faq-muted);
    margin-bottom: 10px;
}

.faq-topbar-titles h1 {
    margin: 0;
    font-size: clamp(34px, 3.4vw, 46px);
    line-height: 1.04;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--faq-ink);
}
.faq-topbar-titles h1 span { display: block; }

/* Recherche = pill */
.faq-search {
    position: relative;
    display: flex;
    align-items: center;
    height: 46px;
    min-width: 280px;
    flex: 0 1 320px;
    border-radius: 23px;
    border: 1px solid #ebebeb;
    background: var(--faq-bg);
    box-shadow: var(--faq-shadow-pill);
    padding: 0 16px;
}
.faq-search-icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    color: #9ca5bb;
}
#faq-search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--faq-ink);
    padding: 0 8px;
}
#faq-search-input::placeholder { color: #8c98b1; }
#faq-search-input::-webkit-search-cancel-button { display: none; }

.faq-search-clear {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: var(--faq-bg-soft);
    color: var(--faq-ink-soft);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.faq-search-clear[hidden] { display: none; }

.faq-controls {
    display: flex;
    align-items: center;
    min-height: 20px;
    margin-bottom: 20px;
}
.faq-result-count {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--faq-muted);
    letter-spacing: .01em;
}

.faq-no-results {
    border: 1px dashed #d5deeb;
    border-radius: var(--faq-radius);
    padding: 48px 24px;
    text-align: center;
    background: var(--faq-bg-app);
    margin: 0 0 8px;
}
.faq-no-results[hidden] { display: none; }
.faq-no-results strong { display: block; font-size: 15px; font-weight: 600; color: var(--faq-ink-soft); }
.faq-no-results span { display: block; margin-top: 8px; font-size: 13px; color: var(--faq-muted); }
.faq-no-results .faq-contact-btn { margin-top: 18px; }

/* Bouton « Contacter l'assistance » */
.faq-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    background: var(--faq-accent);
    border-radius: 999px;
    padding: 11px 22px;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(16,44,121,.22);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.faq-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(16,44,121,.28);
    background: #0c2160;
}

/* Bloc d'aide permanent en bas de page */
.faq-help {
    max-width: 960px;
    margin: 40px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 24px 28px;
    border-radius: var(--faq-radius);
    background: var(--faq-bg-app);
    border: 1px solid var(--faq-line);
}
.faq-help-text strong { display: block; font-size: 15px; font-weight: 700; color: var(--faq-ink); }
.faq-help-text span { display: block; margin-top: 4px; font-size: 13px; color: var(--faq-muted); }

/* ============= SECTIONS ============= */
.faq-main {
    max-width: 960px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.faq-section { scroll-margin-top: 24px; }
.faq-section[hidden] { display: none; }

.faq-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.faq-section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--faq-ink);
    line-height: 1.2;
}
.faq-section-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--faq-ink-soft);
    background: var(--faq-bg-soft);
    border-radius: 999px;
    padding: 4px 11px;
    white-space: nowrap;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============= CARTE / ACCORDÉON ============= */
.faq-item {
    background: var(--faq-bg);
    border: 1px solid var(--faq-line);
    border-radius: var(--faq-radius);
    overflow: hidden;
    box-shadow: var(--faq-shadow-card);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.faq-item[hidden] { display: none; }

.faq-item.open {
    border-color: var(--faq-accent);
    box-shadow: var(--faq-shadow-card-open);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 22px;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--faq-ink);
    text-align: left;
    cursor: pointer;
    line-height: 1.35;
}

.faq-q-text { flex: 1; min-width: 0; }

/* Mot recherché mis en gras dans le titre */
.faq-q-text mark {
    background: none;
    color: var(--faq-accent);
    font-weight: 800;
}

.faq-q-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--faq-bg-soft);
    color: var(--faq-accent);
    transition: background .2s ease, color .2s ease;
}
.faq-q-icon svg {
    width: 17px;
    height: 17px;
    transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.faq-item.open .faq-q-icon {
    background: var(--faq-accent);
    color: #fff;
}
.faq-item.open .faq-q-icon svg { transform: rotate(180deg); }

/* Réponse : dépliage fluide via grid-template-rows */
.faq-answer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s cubic-bezier(.22,1,.36,1);
}
.faq-item.open .faq-answer { grid-template-rows: 1fr; }

.faq-answer-inner {
    overflow: hidden;
    min-height: 0;
    color: var(--faq-ink-soft);
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-line;
    padding: 0 22px;
    border-top: 1px solid transparent;
    transition: padding .3s ease;
}
.faq-item.open .faq-answer-inner {
    padding: 14px 22px 18px;
    border-top-color: var(--faq-line-soft);
}

/* ============= RETOUR EN HAUT ============= */
.faq-back-to-top {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    background: var(--faq-accent);
    border: 0;
    border-radius: var(--faq-radius);
    box-shadow: 0 8px 22px rgba(16,44,121,.28);
    cursor: pointer;
    z-index: 50;
    transition: transform .2s ease;
}
.faq-back-to-top[hidden] { display: none; }
.faq-back-to-top:hover { transform: translateY(-2px); }
.faq-back-to-top svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============= VOLET CONTACT (drawer) ============= */
.faq-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
}
.faq-modal[hidden] { display: none; }

.faq-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 28, 60, .45);
    backdrop-filter: blur(2px);
    animation: faq-fade .2s ease;
}
@keyframes faq-fade { from { opacity: 0; } to { opacity: 1; } }

/* Panneau qui glisse depuis la droite */
.faq-drawer {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(640px, 100%);
    background: var(--faq-bg);
    display: flex;
    flex-direction: column;
    box-shadow: -24px 0 60px rgba(16, 44, 121, .22);
    animation: faq-slide .3s cubic-bezier(.22, 1, .36, 1);
}
@keyframes faq-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* En-tête : titre centré + croix */
.faq-drawer-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px 64px;
    border-bottom: 1px solid var(--faq-line);
    flex-shrink: 0;
}
.faq-modal-title {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
    color: var(--faq-ink);
    text-align: center;
}
.faq-modal-close {
    position: absolute;
    top: 50%;
    right: 22px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--faq-line);
    border-radius: 11px;
    background: var(--faq-bg);
    color: var(--faq-ink-soft);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}
.faq-modal-close:hover { background: var(--faq-bg-soft); border-color: #cdd6e8; }

/* Corps défilant */
.faq-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 26px 32px;
}
.faq-modal-sub {
    margin: 0 0 22px;
    font-size: 14px;
    color: var(--faq-muted);
}

.faq-form { display: flex; flex-direction: column; gap: 18px; }

.faq-field { display: flex; flex-direction: column; gap: 8px; }
.faq-field > span {
    font-size: 14px;
    font-weight: 600;
    color: var(--faq-ink);
}
.faq-field input,
.faq-field textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--faq-ink);
    background: var(--faq-bg);
    border: 1px solid var(--faq-line);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.faq-field textarea { resize: vertical; min-height: 120px; }
.faq-field input:focus,
.faq-field textarea:focus {
    border-color: var(--faq-accent);
    box-shadow: 0 0 0 3px rgba(16, 44, 121, .12);
}
.faq-field input::placeholder,
.faq-field textarea::placeholder { color: #9ca5bb; }

/* Pied : barre d'actions */
.faq-drawer-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    padding: 18px 32px;
    border-top: 1px solid var(--faq-line);
    flex-shrink: 0;
}

.faq-btn-primary {
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--faq-accent);
    border: 0;
    border-radius: 10px;
    padding: 13px 26px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(16, 44, 121, .22);
    transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.faq-btn-primary:hover { background: #0c2160; transform: translateY(-1px); }
.faq-btn-primary:disabled { opacity: .6; cursor: default; transform: none; }

.faq-btn-cancel {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--faq-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px 4px;
    transition: color .16s ease;
}
.faq-btn-cancel:hover { color: var(--faq-ink); }

.faq-form-success {
    text-align: center;
    padding: 40px 8px;
}
.faq-form-success[hidden] { display: none; }
.faq-form-success strong { display: block; font-size: 18px; font-weight: 700; color: var(--faq-ink); }
.faq-form-success span { display: block; margin-top: 8px; font-size: 14px; color: var(--faq-muted); }

/* ============= RESPONSIVE ============= */
@media (max-width: 980px) {
    .faq-layout { flex-direction: column; }
    .faq-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid #e7e9ef;
    }
    .faq-toc { display: flex; flex-wrap: wrap; gap: 6px; }
    .faq-toc-cat { width: 100%; margin: 10px 0 4px; }
    .faq-toc-link { border: 1px solid var(--faq-line); }
    .faq-content { padding: 28px 20px 72px; }
}

@media (max-width: 560px) {
    .faq-topbar { flex-direction: column; align-items: stretch; gap: 18px; }
    .faq-search { flex: 1 1 auto; }
}
