/* =========================================================
   Guide d'utilisation APME — bouton « ? », panneau d'aide et visite guidée
   Autonome : utilisé sur le site, l'espace PME et l'administration.
   ========================================================= */
:root {
    --apg-navy: #1c3a6b;
    --apg-navy-dark: #142c54;
    --apg-green: #2e7d32;
    --apg-text: #1b2333;
    --apg-muted: #5d6677;
    --apg-line: #e2e7ef;
    --apg-font: 'Figtree', 'Public Sans', system-ui, sans-serif;
}

/* ---------- Bouton « ? » ---------- */
.apg-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1.5px solid var(--apg-navy);
    border-radius: 50%;
    background: #fff;
    color: var(--apg-navy);
    font: 800 18px/1 var(--apg-font);
    cursor: pointer;
    transition: background-color .15s, color .15s, box-shadow .15s;
}
.apg-help-btn:hover,
.apg-help-btn[aria-expanded="true"] { background: var(--apg-navy); color: #fff; }
.apg-help-btn:focus-visible { outline: 3px solid rgba(28, 58, 107, .35); outline-offset: 2px; }

/* Pastille : un guide de la page n'a pas encore été vu */
.apg-help-btn { position: relative; }
.apg-help-btn.has-new::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--apg-green);
}

/* ---------- Panneau d'aide ---------- */
.apg-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2147482000;
    display: flex;
    flex-direction: column;
    width: min(380px, 100vw);
    background: #fff;
    color: var(--apg-text);
    font-family: var(--apg-font);
    box-shadow: -12px 0 40px rgba(15, 25, 45, .18);
    transform: translateX(100%);
    transition: transform .2s ease;
}
.apg-panel.is-open { transform: translateX(0); }
.apg-panel[hidden] { display: none; }

.apg-panel-head {
    padding: 20px 20px 16px;
    background: linear-gradient(135deg, var(--apg-navy), var(--apg-navy-dark));
    color: #fff;
}
.apg-panel-head h2 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 4px; font-size: 19px; font-weight: 800; color: #fff; }
.apg-panel-head p { margin: 0 0 14px; font-size: 13px; color: rgba(255, 255, 255, .8); }
.apg-panel-head .apg-x { color: #fff; }
.apg-search {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    font: 14px var(--apg-font);
    color: var(--apg-text);
    outline: 0;
}
.apg-search:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }

.apg-panel-list { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.apg-panel-list h4 { margin: 14px 4px 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--apg-muted); }
.apg-panel-list ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

.apg-guide {
    display: flex;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--apg-line);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    font-family: var(--apg-font);
    color: var(--apg-text);
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.apg-guide:hover, .apg-guide:focus-visible { border-color: var(--apg-navy); background: #f5f8fc; outline: 0; }
.apg-guide-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9eef6;
    color: var(--apg-navy);
    font-size: 12px;
}
.apg-guide-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.apg-guide-text strong { font-size: 14.5px; line-height: 1.3; }
.apg-guide-text small { font-size: 13px; line-height: 1.4; color: var(--apg-muted); }
.apg-guide-text em { margin-top: 2px; font-size: 12px; font-style: normal; font-weight: 700; color: var(--apg-green); }
.apg-empty { padding: 24px 8px; text-align: center; color: var(--apg-muted); font-size: 14px; }

.apg-panel-foot { padding: 10px 20px; border-top: 1px solid var(--apg-line); font-size: 12px; color: var(--apg-muted); }
.apg-panel-foot code { padding: 1px 6px; border-radius: 4px; background: #f1f4f9; color: var(--apg-navy); font-size: 12px; user-select: all; }

/* ---------- Visite guidée ---------- */
.apg-layer { position: fixed; inset: 0; z-index: 2147483000; display: none; font-family: var(--apg-font); }
.apg-layer.is-open { display: block; }
.apg-backdrop { position: absolute; inset: 0; }
.apg-layer.is-centered .apg-backdrop { background: rgba(10, 20, 40, .55); }

.apg-spot {
    position: fixed;
    border-radius: 10px;
    box-shadow: 0 0 0 4px rgba(46, 125, 50, .9), 0 0 0 9999px rgba(10, 20, 40, .55);
    pointer-events: none;
    transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.apg-layer.is-centered .apg-spot { display: none; }

.apg-pop {
    position: fixed;
    width: min(340px, calc(100vw - 24px));
    padding: 16px 18px 14px;
    border-radius: 14px;
    background: #fff;
    color: var(--apg-text);
    box-shadow: 0 18px 50px rgba(10, 20, 40, .3);
    outline: 0;
}
.apg-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.apg-count { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--apg-green); }
.apg-pop h3 { margin: 0 0 6px; font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--apg-navy); }
.apg-pop p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--apg-text); }

.apg-x {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--apg-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.apg-x:hover { background: rgba(0, 0, 0, .06); }

.apg-dots { display: flex; gap: 5px; margin: 14px 0 12px; }
.apg-dots i { width: 6px; height: 6px; border-radius: 3px; background: #d5dde9; transition: width .2s; }
.apg-dots i.is-on { width: 18px; background: var(--apg-navy); }

.apg-actions { display: flex; justify-content: space-between; gap: 8px; }
.apg-btn {
    min-height: 38px;
    padding: 0 16px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font: 700 14px var(--apg-font);
    cursor: pointer;
}
.apg-btn-primary { margin-left: auto; background: var(--apg-navy); color: #fff; }
.apg-btn-primary:hover { background: var(--apg-navy-dark); }
.apg-btn-ghost { border-color: var(--apg-line); background: #fff; color: var(--apg-navy); }
.apg-btn-ghost:hover { border-color: var(--apg-navy); }
.apg-btn:focus-visible, .apg-x:focus-visible { outline: 3px solid rgba(28, 58, 107, .35); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .apg-panel, .apg-spot, .apg-dots i { transition: none; }
}
