/* MAMOUSSO V85 — Assistant MAMOUSSO (panneau de discussion de l'éditeur) */
.visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.chatOpenBtn {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 18px; padding: 12px 14px;
  border: 1px solid var(--ui-accent, #c2410c); border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--ui-accent-soft, #fff1e8); color: var(--ui-text, #0c0a09); font: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.chatOpenBtn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -14px rgba(194, 65, 12, .6); }
.chatOpenBtn:focus-visible { outline: 3px solid var(--ui-accent, #c2410c); outline-offset: 2px; }
.chatOpenBtn b { display: block; font-weight: 600; font-size: 14px; }
.chatOpenBtn small { display: block; color: var(--ui-muted, #57534e); font-size: 12px; margin-top: 2px; }
.chatOpenIcon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--ui-accent, #c2410c); color: #fff; }
.chatOpenIcon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.chatPanel {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(440px, 100vw); height: 100dvh; max-height: 100dvh;
  padding: 0; border: 0; border-left: 1px solid var(--ui-line, #e7e5e4); z-index: 1200;
  background: var(--ui-surface, #fff); color: var(--ui-text, #0c0a09);
  box-shadow: -24px 0 60px -30px rgba(0, 0, 0, .35); font-family: var(--ui-sans, system-ui, sans-serif);
}
.chatPanel[open] { display: flex; flex-direction: column; animation: chatSlide .28s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes chatSlide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chatPanel[open] { animation: none; } }

.chatHead { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--ui-line, #e7e5e4); }
.chatHeadText { flex: 1; min-width: 0; }
.chatHeadText small { color: var(--ui-accent, #c2410c); font-weight: 600; font-size: 12px; letter-spacing: .02em; }
.chatHeadText h3 { margin: 2px 0 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatGhostBtn { border: 1px solid var(--ui-line, #e7e5e4); background: transparent; color: var(--ui-text-2, #292524);
  border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chatIconBtn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--ui-surface-3, #f5f5f4); color: var(--ui-text-2, #292524); }
.chatIconBtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.chatLog { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chatWelcome p { margin: 0 0 12px; color: var(--ui-muted, #57534e); font-size: 14px; line-height: 1.5; }
.chatChips { display: flex; flex-wrap: wrap; gap: 8px; }
.chatChip { border: 1px solid var(--ui-line-strong, #d6d3d1); background: var(--ui-surface-2, #fafaf9); color: var(--ui-text, #0c0a09);
  border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chatChip:hover { border-color: var(--ui-accent, #c2410c); }

.chatMsg { max-width: 92%; border-radius: 16px; padding: 10px 13px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.chatUser { align-self: flex-end; background: var(--ui-ink, #0c0a09); color: var(--ui-on-ink, #fff); border-bottom-right-radius: 6px; }
.chatBot { align-self: flex-start; background: var(--ui-surface-3, #f5f5f4); border-bottom-left-radius: 6px; }
.chatRefused { background: var(--ui-accent-soft, #fff1e8); }
.chatWaiting .chatText { animation: chatPulse 1s ease-in-out infinite alternate; }
@keyframes chatPulse { from { opacity: .35; } to { opacity: 1; } }
.chatText p { margin: 0 0 6px; }
.chatText p:last-child { margin-bottom: 0; }
.chatText h4 { margin: 8px 0 4px; font-size: 14px; }
.chatText ul, .chatText ol { margin: 2px 0 8px; padding-left: 20px; }
.chatWarn { margin: 8px 0 0; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; background: #fef3c7; color: #78350f; }
.chatRefs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chatRefsLabel { font-size: 12px; color: var(--ui-muted, #57534e); }
.chatRef { border: 1px solid var(--ui-line-strong, #d6d3d1); background: var(--ui-surface, #fff); color: var(--ui-text, #0c0a09);
  border-radius: 8px; padding: 3px 8px; font: inherit; font-size: 12px; font-family: var(--ui-mono, monospace); cursor: pointer; }
.chatRef:hover { border-color: var(--ui-accent, #c2410c); color: var(--ui-accent, #c2410c); }
.chatCredits { display: inline-block; margin-top: 8px; padding: 7px 12px; border-radius: 10px; background: var(--ui-accent, #c2410c);
  color: #fff; text-decoration: none; font-weight: 600; font-size: 13px; }

.chatForm { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px 6px; border-top: 1px solid var(--ui-line, #e7e5e4); }
.chatForm textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--ui-line-strong, #d6d3d1); background: var(--ui-surface-2, #fafaf9); color: var(--ui-text, #0c0a09);
  font: inherit; font-size: 14px; line-height: 1.4; }
.chatForm textarea:focus { outline: none; border-color: var(--ui-accent, #c2410c); box-shadow: 0 0 0 3px var(--ui-accent-soft, #fff1e8); }
.chatSendBtn { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--ui-accent, #c2410c); color: #fff; }
.chatSendBtn:disabled { opacity: .5; cursor: wait; }
.chatSendBtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chatPrice { margin: 0; padding: 0 16px 12px; font-size: 12px; color: var(--ui-muted, #57534e); min-height: 1em; }

.inlineSegment.chatFlash { background: var(--ui-highlight, #fde3cf); border-radius: 4px; transition: background .3s; }

@media (max-width: 640px) {
  .chatPanel { width: 100vw; border-left: 0; }
  .chatHead { padding: 12px 16px; }
  .chatGhostBtn { padding: 6px 8px; font-size: 12px; }
}
/* Ordinateur : le lecteur audio du bas reste utilisable (les passages cités se lancent depuis le panneau). */
@media (min-width: 821px) {
  .chatPanel { height: calc(100dvh - 76px); max-height: calc(100dvh - 76px); inset: 0 0 auto auto; }
}
