/* Widget chatbot — s'appuie sur les variables du thème actif (--c-*, --font-*). */
.fv-chat { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 1250; font-family: var(--font-body); }
.fv-chat-panel, .fv-chat-teaser { max-width: calc(100vw - 2rem); } /* neutralise « * { max-width: 100% } » du thème */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.fv-chat-launcher {
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer; position: relative;
  background: linear-gradient(135deg, var(--c-secondary), var(--c-primary-deep)); color: #fff;
  box-shadow: 0 12px 30px -6px rgba(var(--rgb-primary), 0.55); display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.fv-chat-launcher:hover { transform: translateY(-2px) scale(1.03); }
.fv-chat-launcher .icon-close, .fv-chat.is-open .fv-chat-launcher .icon-open { display: none; }
.fv-chat.is-open .fv-chat-launcher .icon-close { display: block; }
.fv-chat-dot { position: absolute; top: 4px; right: 4px; width: 13px; height: 13px; border-radius: 50%; background: #22C55E; border: 2px solid #fff; }
.fv-chat.is-open .fv-chat-dot { display: none; }

.fv-chat-teaser {
  position: absolute; right: 0; bottom: 76px; width: 250px; background: var(--c-surface); color: var(--c-text-body);
  border: 1px solid var(--c-border); border-radius: 14px 14px 4px 14px; padding: 0.85rem 2rem 0.85rem 1rem;
  font-size: 0.875rem; line-height: 1.45; box-shadow: var(--shadow-hover); cursor: pointer; animation: fv-pop 0.35s ease;
}
.fv-chat-teaser strong { display: block; color: var(--c-primary-deep); }
.fv-chat-teaser-close { position: absolute; top: 4px; right: 8px; border: none; background: none; font-size: 1.1rem; cursor: pointer; color: var(--c-text-muted); }

.fv-chat-panel {
  position: absolute; right: 0; bottom: 78px; width: 390px; height: min(640px, calc(100vh - 120px));
  background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 30px 70px -15px rgba(var(--rgb-text-dark), 0.35);
  animation: fv-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.fv-chat-panel[hidden], .fv-chat-sheet[hidden], .fv-chat-teaser[hidden], .fv-chat-quick[hidden],
.fv-chat-actions[hidden], .fv-chat-composer[hidden], #fv-chat-form label[hidden] { display: none; }
@keyframes fv-pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

.fv-chat-header {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--c-primary-deep), var(--c-primary)); color: #fff;
}
.fv-chat-avatar { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.14); display: flex; align-items: center; justify-content: center; }
.fv-chat-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fv-chat-id strong { font-family: var(--font-heading); font-size: 1.15rem; line-height: 1.1; }
.fv-chat-id span { font-size: 0.72rem; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; margin-right: 6px; vertical-align: middle; }
.fv-chat-icon-btn { border: none; background: rgba(255, 255, 255, 0.1); color: #fff; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fv-chat-icon-btn:hover { background: rgba(255, 255, 255, 0.2); }

.fv-chat-body { flex: 1; overflow-y: auto; padding: 1rem; scroll-behavior: smooth; }
.fv-chat-messages { display: flex; flex-direction: column; gap: 0.6rem; }
.fv-msg { max-width: 86%; padding: 0.7rem 0.95rem; border-radius: 16px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.fv-msg + .fv-msg { margin-top: 0; }
.fv-msg.assistant { align-self: flex-start; background: var(--c-surface); color: var(--c-text-body); border: 1px solid var(--c-border-light); border-bottom-left-radius: 5px; }
.fv-msg.user { align-self: flex-end; background: var(--c-primary); color: #fff; border-bottom-right-radius: 5px; }
.fv-msg.success { align-self: stretch; max-width: 100%; background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.fv-msg.error { align-self: stretch; max-width: 100%; background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.fv-typing { display: inline-flex; gap: 4px; padding: 0.85rem 1rem; }
.fv-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-secondary-light); animation: fv-blink 1.2s infinite; }
.fv-typing i:nth-child(2) { animation-delay: 0.15s; } .fv-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes fv-blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.fv-chat-quick { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.85rem; }
.fv-chip { border: 1px solid var(--c-secondary-soft); background: var(--c-surface); color: var(--c-primary); border-radius: 999px; padding: 0.4rem 0.8rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: left; }
.fv-chip:hover { background: var(--c-surface-tint); }

.fv-chat-actions { display: flex; gap: 0.5rem; padding: 0.55rem 0.9rem 0; border-top: 1px solid var(--c-border-light); background: var(--c-bg); }
.fv-action { flex: 1; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-primary-deep); border-radius: 10px; padding: 0.5rem; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.fv-action:hover { border-color: var(--c-secondary); background: var(--c-surface-tint); }
.fv-action.is-highlight { background: var(--c-accent); border-color: var(--c-accent); color: #fff; animation: fv-pulse 1.8s ease 2; }
@keyframes fv-pulse { 50% { box-shadow: 0 0 0 6px rgba(184, 142, 62, 0.25); } }

.fv-chat-composer { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.65rem 0.9rem; background: var(--c-bg); }
.fv-chat-composer textarea {
  flex: 1; resize: none; max-height: 120px; border: 1px solid var(--c-border); border-radius: 14px; padding: 0.65rem 0.85rem;
  font: inherit; font-size: 0.9rem; background: var(--c-surface); color: var(--c-text-dark); line-height: 1.4;
}
.fv-chat-composer textarea:focus { outline: none; border-color: var(--c-secondary); box-shadow: 0 0 0 3px rgba(var(--rgb-secondary), 0.15); }
.fv-send { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; border: none; background: var(--c-primary); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fv-send:disabled { opacity: 0.5; cursor: not-allowed; }
.fv-chat-privacy { font-size: 0.68rem; color: var(--c-text-muted); text-align: center; padding: 0 1rem 0.65rem; background: var(--c-bg); line-height: 1.35; }

/* Feuilles (créneaux / coordonnées) */
.fv-chat-sheet { position: absolute; inset: 64px 0 0 0; background: var(--c-bg); padding: 1rem; overflow-y: auto; z-index: 2; display: flex; flex-direction: column; gap: 0.7rem; animation: fv-pop 0.25s ease; }
.fv-sheet-head { display: flex; justify-content: space-between; align-items: center; color: var(--c-primary-deep); }
.fv-link { background: none; border: none; color: var(--c-secondary); font-weight: 700; cursor: pointer; font-size: 0.82rem; padding: 0.25rem; }
.fv-center { align-self: center; margin-top: 0.25rem; }
.fv-muted { color: var(--c-text-muted); font-size: 0.85rem; }
.fv-channel { display: flex; gap: 0.5rem; }
.fv-channel label { flex: 1; border: 1px solid var(--c-border); border-radius: 10px; padding: 0.5rem; font-size: 0.82rem; font-weight: 600; text-align: center; cursor: pointer; background: var(--c-surface); }
.fv-channel input { accent-color: var(--c-primary); margin-right: 4px; }
.fv-slot-day { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-muted); font-weight: 700; margin: 0.4rem 0 0.35rem; }
.fv-slot-times { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.fv-slot { border: 1px solid var(--c-secondary-soft); background: var(--c-surface); color: var(--c-primary); border-radius: 9px; padding: 0.45rem 0.75rem; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.fv-slot:hover, .fv-slot:focus-visible { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.fv-slot-recap { background: var(--c-surface-tint); border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.85rem; color: var(--c-primary-deep); font-weight: 600; }
#fv-chat-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--c-text-dark); }
#fv-chat-form input:not([type="checkbox"]) { border: 1px solid var(--c-border); border-radius: 9px; padding: 0.6rem 0.75rem; font: inherit; font-size: 16px; background: var(--c-surface); color: var(--c-text-dark); }
#fv-chat-form input:focus { outline: none; border-color: var(--c-secondary); }
#fv-chat-form .fv-consent { flex-direction: row; align-items: flex-start; gap: 0.5rem; font-weight: 500; color: var(--c-text-muted); }
.fv-consent input { margin-top: 2px; accent-color: var(--c-primary); }
.fv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.fv-form-error { color: #B91C1C; font-size: 0.82rem; }
.fv-chat-primary { border: none; border-radius: 999px; background: var(--c-primary); color: #fff; padding: 0.8rem; font-weight: 700; cursor: pointer; font-size: 0.92rem; }
.fv-chat-primary:disabled { opacity: 0.6; }

@media (max-width: 520px) {
  .fv-chat { right: 1rem; bottom: 1rem; }
  .fv-chat-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; bottom: 0; }
  .fv-chat.is-open .fv-chat-launcher { display: none; }
  .fv-row { grid-template-columns: 1fr; }
  .cookie-banner:not([hidden]) ~ .fv-chat { bottom: 9rem; }
}
