/* ── Reset & base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Variables ───────────────────────────────────────────── */
:root {
    --primary:   #0b5ed7;
    --primary-lt:#dbeafe;
    --sidebar-w: 280px;
    --header-h:  54px;
    --radius:    6px;
    --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

/* ── Top bar ─────────────────────────────────────────────── */
#faq-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: var(--header-h);
    background: var(--primary);
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
#faq-topbar img { height: 32px; }
#faq-topbar .site-name {
    font-size: 16px; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#faq-topbar .spacer { flex: 1; }
#faq-search-wrap {
    position: relative; width: 260px;
}
#faq-search {
    width: 100%; padding: 7px 12px 7px 34px;
    border: none; border-radius: 20px;
    font-size: 13px; background: rgba(255,255,255,.2);
    color: #fff; outline: none; transition: background .2s;
}
#faq-search::placeholder { color: rgba(255,255,255,.65); }
#faq-search:focus { background: rgba(255,255,255,.35); }
#faq-search-wrap i {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: rgba(255,255,255,.7); font-size: 13px; pointer-events: none;
}
#faq-search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    max-height: 320px; overflow-y: auto; display: none; z-index: 300;
}
#faq-search-results.open { display: block; }
.sr-item {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9;
    display: flex; flex-direction: column; gap: 2px;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: #f0f9ff; }
.sr-item .sr-page { font-size: 12px; color: var(--primary); font-weight: 600; }
.sr-item .sr-text { font-size: 12px; color: #64748b; }
mark { background: #fef08a; border-radius: 2px; padding: 0 1px; }

/* ── Layout ──────────────────────────────────────────────── */
#faq-layout {
    display: flex; flex: 1;
    padding-top: var(--header-h);
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#faq-sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    position: fixed; top: var(--header-h); bottom: 0; left: 0;
    background: #fff; border-right: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex; flex-direction: column;
}
#faq-sidebar-header { flex-shrink: 0; }
#faq-sidebar-list {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding-bottom: 20px;
    scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
#faq-sidebar-list::-webkit-scrollbar { width: 5px; }
#faq-sidebar-list::-webkit-scrollbar-track { background: transparent; }
#faq-sidebar-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.nav-group { margin-bottom: 4px; }
.nav-group-title {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 18px 5px;
    font-size: 10px; font-weight: 800; letter-spacing: .07em;
    text-transform: uppercase; color: #94a3b8;
    cursor: pointer; user-select: none;
}
.nav-group-title i.group-icon { font-size: 12px; }
.nav-group-title i.chevron {
    margin-left: auto; font-size: 9px; transition: transform .2s;
}
.nav-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-group-items { display: flex; flex-direction: column; }
.nav-group.collapsed .nav-group-items { display: none; }

.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 18px 7px 28px;
    font-size: 13px; color: #475569; cursor: pointer;
    border-left: 3px solid transparent;
    transition: all .12s; text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-item i { font-size: 12px; flex-shrink: 0; width: 14px; text-align: center; color: #94a3b8; }
.nav-item:hover { background: #f8fafc; color: #1e293b; }
.nav-item.active {
    background: var(--primary-lt);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.nav-item.active i { color: var(--primary); }
.nav-item .item-cnt {
    margin-left: auto; flex-shrink: 0;
    font-size: 10px; padding: 1px 6px; border-radius: 10px;
    background: #e2e8f0; color: #64748b;
}
.nav-item.active .item-cnt { background: var(--primary); color: #fff; }

/* sidebar : onglets Aide / Procédures */
.side-tabs {
    display: flex; gap: 5px; padding: 8px 12px 8px;
    border-bottom: 1px solid #e2e8f0;
}
.side-tab {
    flex: 1; border: 1px solid #e2e8f0; background: #fff; color: #64748b;
    font-size: 12px; font-weight: 600; padding: 7px 6px; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px; transition: all .12s;
}
.side-tab i { font-size: 12px; }
.side-tab:hover { background: #f8fafc; color: #1e293b; }
.side-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.side-empty { padding: 18px 16px; font-size: 12px; color: #94a3b8; font-style: italic; text-align: center; }

/* sidebar home link */
.nav-home {
    display: flex; align-items: center; gap: 9px;
    padding: 10px 18px; margin-bottom: 8px;
    font-size: 13px; font-weight: 600; color: var(--primary);
    cursor: pointer; border-bottom: 1px solid #e2e8f0;
    text-decoration: none;
}
.nav-home i { font-size: 14px; }
.nav-home:hover { background: #f0f9ff; }

/* ── Main content ────────────────────────────────────────── */
#faq-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 32px 40px 60px;
    max-width: 900px;
}

/* ── Home page ───────────────────────────────────────────── */
#faq-home { display: flex; flex-direction: column; gap: 32px; }
.home-hero {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    border-radius: 12px; padding: 36px 40px;
    color: #fff; display: flex; flex-direction: column; gap: 10px;
}
.home-hero h1 { font-size: 26px; font-weight: 800; }
.home-hero p  { font-size: 15px; opacity: .85; max-width: 560px; line-height: 1.6; }
.home-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.home-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius);
    padding: 18px; cursor: pointer; transition: all .15s;
    display: flex; flex-direction: column; gap: 8px;
    text-decoration: none; color: inherit;
}
.home-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(11,94,215,.12); transform: translateY(-1px); }
.home-card i { font-size: 22px; color: var(--primary); }
.home-card .card-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.home-card .card-meta  { font-size: 11px; color: #94a3b8; }

/* ── Page doc ────────────────────────────────────────────── */
#faq-page-view { display: flex; flex-direction: column; gap: 28px; }
.page-header {
    padding-bottom: 20px; border-bottom: 2px solid #e2e8f0;
    display: flex; align-items: flex-start; gap: 16px;
}
.page-header .ph-icon {
    width: 52px; height: 52px; border-radius: 10px;
    background: var(--primary-lt); display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}
.page-header .ph-icon i { font-size: 22px; color: var(--primary); }
.page-header h1 { font-size: 22px; font-weight: 800; color: #0f172a; margin-bottom: 4px; }
.page-header .ph-breadcrumb { font-size: 12px; color: #94a3b8; display: flex; align-items: center; gap: 6px; }
.page-header .ph-breadcrumb i { font-size: 9px; }
.page-header .ph-stats { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.ph-stat {
    font-size: 11px; padding: 3px 10px; border-radius: 10px;
    background: #f1f5f9; color: #64748b; display: flex; align-items: center; gap: 4px;
}

/* ── Section card ────────────────────────────────────────── */
.section-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    overflow: hidden; box-shadow: var(--shadow);
}
.section-hd {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 18px; cursor: pointer; user-select: none;
    border-bottom: 1px solid #f1f5f9; background: #f8fafc;
    transition: background .1s;
}
.section-hd:hover { background: #f1f5f9; }
.section-hd i.s-icon { font-size: 14px; color: var(--primary); width: 18px; text-align: center; }
.section-hd .s-title { font-size: 14px; font-weight: 700; color: #0f172a; flex: 1; }
.section-hd .s-count {
    font-size: 11px; padding: 2px 8px; border-radius: 10px;
    background: var(--primary); color: #fff;
}
.section-hd .s-count.empty { background: #e2e8f0; color: #94a3b8; }
.section-hd i.s-chevron { font-size: 11px; color: #94a3b8; transition: transform .2s; }
.section-card.collapsed i.s-chevron { transform: rotate(-90deg); }
.section-body { padding: 0; }
.section-card.collapsed .section-body { display: none; }

/* ── Help items ──────────────────────────────────────────── */
.help-item {
    border-bottom: 1px solid #f1f5f9; overflow: hidden;
}
.help-item:last-child { border-bottom: none; }
.hi-trigger {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; cursor: pointer; transition: background .1s;
    background: #fff;
}
.hi-trigger:hover { background: #f8fafc; }
.hi-trigger i { font-size: 10px; color: #cbd5e1; transition: transform .2s; flex-shrink: 0; }
.hi-trigger .hi-label { font-size: 13px; font-weight: 600; color: #334155; flex: 1; }
.help-item.open .hi-trigger i { transform: rotate(90deg); color: var(--primary); }
.hi-body {
    display: none; padding: 4px 18px 16px 38px;
}
.help-item.open .hi-body { display: block; }
.hi-text {
    font-size: 13px; line-height: 1.7; color: #475569;
}
.hi-text p  { margin-bottom: 10px; }
.hi-text h2 { font-size: 16px; font-weight: 800; color: #0f172a; margin: 10px 0 6px; }
.hi-text h3 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 8px 0 4px; }
.hi-text ul, .hi-text ol { padding-left: 22px; margin-bottom: 10px; }
.hi-text ul { list-style: disc outside; } .hi-text ol { list-style: decimal outside; }
.hi-text li { margin-bottom: 4px; }
/* Défensif (Quill peut émettre <ol data-list="bullet"> selon la version) */
.hi-text ol li[data-list="bullet"] { list-style-type: disc; }
.hi-text ol li[data-list="ordered"] { list-style-type: decimal; }
.hi-text blockquote { margin: 0 0 10px; padding: 6px 14px; border-left: 3px solid var(--primary); background: #f8fafc; color: #475569; font-style: italic; }
.hi-text strong { color: #1e293b; }
.hi-text code {
    background: #f1f5f9; padding: 1px 5px; border-radius: 3px;
    font-size: 12px; font-family: ui-monospace, monospace; color: #be123c;
}
.hi-pic { margin-top: 10px; }
.hi-pic img { max-width: 100%; border-radius: 6px; border: 1px solid #e2e8f0; }

/* ── Empty section placeholder ───────────────────────────── */
.empty-section {
    padding: 20px 18px; text-align: center;
    color: #cbd5e1; font-size: 13px; font-style: italic;
}
.empty-section i { font-size: 24px; display: block; margin-bottom: 6px; opacity: .4; }

/* ── Empty page (no items at all) ────────────────────────── */
.page-empty {
    background: #fff; border: 1px dashed #e2e8f0; border-radius: 8px;
    padding: 48px 32px; text-align: center; color: #94a3b8;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.page-empty i { font-size: 40px; opacity: .3; }
.page-empty p { font-size: 14px; }
.page-empty a { color: var(--primary); font-size: 13px; }

/* ── Procédures (fiches techniques) ──────────────────────── */
.proc-print {
    flex-shrink: 0; align-self: flex-start;
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--primary); color: #fff; text-decoration: none;
    font-size: 12px; font-weight: 600; padding: 8px 14px; border-radius: 20px;
    transition: background .15s;
}
.proc-print:hover { background: #0a4fb5; }
.proc-intro {
    background: var(--primary-lt); border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0; padding: 14px 18px;
    font-size: 14px; line-height: 1.7; color: #334155;
}
.proc-intro :first-child { margin-top: 0; } .proc-intro :last-child { margin-bottom: 0; }
.proc-step { display: flex; gap: 14px; align-items: flex-start; }
.proc-step-num {
    flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800;
}
.proc-step-body {
    flex: 1; min-width: 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 14px 18px; box-shadow: var(--shadow);
}
.proc-step-title { font-size: 15px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    #faq-sidebar { transform: translateX(-100%); transition: transform .25s; z-index: 150; }
    #faq-sidebar.open { transform: none; }
    #faq-main { margin-left: 0; padding: 20px 16px 40px; }
    .home-hero { padding: 24px 20px; }
    #faq-search-wrap { width: 180px; }
    #btn-menu-toggle { display: flex !important; }
}
#btn-menu-toggle {
    display: none; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; background: rgba(255,255,255,.2);
    border-radius: 6px; color: #fff; font-size: 16px; cursor: pointer;
}
