/* ===========================================================================
   L'assistant en bulle (16/10/2026, version 0.2.5)
   ---------------------------------------------------------------------------
   « On le voit à peine » : les encarts d'assistant quittent la page et
   deviennent une bulle en bas à droite, avec l'ampoule et le nombre de
   conseils. Un clic ouvre le volet. Voir public/js/assistant-bulle.js.
   =========================================================================== */

/* Les encarts assistant ne s'affichent plus dans la page : la bulle les lit. */
.assistant-panel[data-encart="assistant"] { display: none !important; }

#assistant-bulle {
  position: fixed; right: 24px; bottom: 24px; z-index: 85;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  display: none; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), #1b5fa8);
  color: #FFF; cursor: pointer;
  box-shadow: 0 10px 26px rgba(11,65,122,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
body.assistant-bulle-visible #assistant-bulle { display: inline-flex; }
#assistant-bulle:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(11,65,122,.42); }
#assistant-bulle[aria-expanded="true"] { background: linear-gradient(135deg, var(--coral), var(--brand-red)); }
#assistant-bulle .ico { width: 26px; height: 26px; }
.assistant-bulle-compte {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--coral); color: #FFF;
  font-size: var(--txt-xs); font-weight: 700;
  border: 2px solid var(--bg);
}
#assistant-bulle.pulse { animation: assistant-pulse 1.2s ease-out 2; }
@keyframes assistant-pulse {
  0%   { box-shadow: 0 10px 26px rgba(11,65,122,.35), 0 0 0 0 rgba(245,96,88,.55); }
  100% { box-shadow: 0 10px 26px rgba(11,65,122,.35), 0 0 0 18px rgba(245,96,88,0); }
}

#assistant-popover {
  position: fixed; right: 24px; bottom: 92px; z-index: 86;
  width: 400px; max-width: calc(100vw - 32px); max-height: min(70vh, 560px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(11,65,122,.22);
}
#assistant-popover[hidden] { display: none; }
.assistant-popover-entete {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(11,65,122,.08), rgba(245,96,88,.1));
  border-bottom: 1px solid var(--border);
  color: var(--navy); font-weight: 700; font-size: var(--txt-md);
}
.assistant-popover-titre { flex: 1; min-width: 0; }
.assistant-popover-fermer {
  border: 0; background: transparent; color: var(--text-soft); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px; font-family: inherit;
}
.assistant-popover-fermer:hover { color: var(--text); }
.assistant-popover-corps { padding: 6px 16px 12px; overflow: auto; }
.assistant-popover-corps .assistant-item {
  font-size: var(--txt-md); padding: 10px 0; line-height: 1.45;
  border-bottom: 1px solid var(--border);
}
.assistant-popover-corps .assistant-item:last-child { border-bottom: 0; }
.assistant-popover-corps .assistant-item .ico { vertical-align: -3px; margin-right: 4px; color: var(--navy); }

/* Le bandeau du bas monte au-dessus de la bulle quand elle est là. */
body.assistant-bulle-visible #toast { bottom: 96px; }

/* --- Thème sombre ------------------------------------------------------- */
[data-theme="dark"] .assistant-popover-entete { color: #8FB3DE; }
[data-theme="dark"] .assistant-popover-corps .assistant-item .ico { color: #8FB3DE; }
[data-theme="dark"] .assistant-bulle-compte { border-color: var(--card); }

/* --- Mouvement réduit --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #assistant-bulle { transition: none; animation: none !important; }
}

/* --- Petit écran -------------------------------------------------------- */
@media (max-width: 640px) {
  #assistant-bulle { right: 16px; bottom: 16px; width: 50px; height: 50px; }
  #assistant-popover { right: 12px; left: 12px; width: auto; bottom: 76px; max-height: 70vh; }
  body.assistant-bulle-visible #toast { bottom: 84px; }
}
