/**
 * Widget chat flottant — couleurs INFINITY AFRICA CAPITAL (#005486, #0a1019)
 */
#iac-floating-chat-root {
  --iac-chat-primary: #005486;
  --iac-chat-primary-hover: #003d66;
  --iac-chat-primary-soft: rgba(0, 84, 134, 0.12);
  --iac-chat-primary-border: rgba(0, 84, 134, 0.25);
  --iac-chat-dark: #0a1019;
  --iac-chat-accent: #1a9ad6;
  --iac-chat-send-end: #003d66;
  --iac-chat-close-btn: rgba(255, 255, 255, 0.2);
  position: fixed;
  bottom: 1.25rem;
  right: 1rem;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Neutralise body blanc + règle globale `p { color: var(--paragraph-color); }` */
  color: #0f172a;
}

#iac-floating-chat-root *,
#iac-floating-chat-root *::before,
#iac-floating-chat-root *::after {
  box-sizing: border-box;
}

/* Priorité au-dessus de `p { color: var(--paragraph-color); }` (site Webflow) */
#iac-floating-chat-root p {
  margin-top: 0;
  margin-bottom: 0;
  color: inherit;
  font-family: inherit;
}

#iac-floating-chat-root .iac-chat-bubble-text {
  color: inherit;
  font-weight: 500;
}

#iac-floating-chat-root .iac-chat-bubble--user {
  color: #042f47;
}

#iac-floating-chat-root .iac-chat-bubble--assistant {
  color: #020617;
}

@media (min-width: 640px) {
  #iac-floating-chat-root {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

.iac-chat-panel {
  display: none;
  width: min(100vw - 2rem, 400px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(0, 84, 134, 0.15);
  background: #fff;
  box-shadow: 0 25px 50px -12px rgba(10, 16, 25, 0.35);
}

#iac-floating-chat-root[data-open="true"] .iac-chat-panel {
  display: flex;
  animation: iac-chat-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes iac-chat-panel-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.iac-chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, var(--iac-chat-primary), var(--iac-chat-dark));
}

#iac-floating-chat-root .iac-chat-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.35;
}

#iac-floating-chat-root .iac-chat-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.4;
}

.iac-chat-header-text {
  min-width: 0;
}

.iac-chat-btn-close-panel {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 999px;
  background: var(--iac-chat-close-btn);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.iac-chat-btn-close-panel:hover {
  background: rgba(255, 255, 255, 0.32);
}

.iac-chat-messages {
  max-height: min(52vh, 360px);
  min-height: 200px;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.iac-chat-row {
  display: flex;
}

.iac-chat-row--user {
  justify-content: flex-end;
}

.iac-chat-row--assistant {
  justify-content: flex-start;
}

.iac-chat-bubble {
  max-width: 85%;
  border-radius: 1rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

.iac-chat-bubble--user {
  border-radius: 1rem 1rem 0.375rem 1rem;
  border: 1px solid rgba(0, 84, 134, 0.35);
  background: rgba(0, 84, 134, 0.14);
}

.iac-chat-bubble--assistant {
  border-radius: 1rem 1rem 1rem 0.375rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.iac-chat-bubble-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.iac-chat-whatsapp-btn {
  display: inline-flex;
  width: 100%;
  margin-top: 0.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  background: #25d366;
  color: #fff;
  transition: background 0.2s ease;
}

.iac-chat-whatsapp-btn:hover {
  background: #20bd5a;
  color: #fff;
}

#iac-floating-chat-root .iac-chat-loading {
  display: flex;
  align-items: center;
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 1rem 1rem 1rem 0.375rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  animation: iac-chat-loading-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes iac-chat-loading-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#iac-floating-chat-root .iac-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

#iac-floating-chat-root .iac-chat-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 84, 134, 0.55);
  animation: iac-chat-dot-pulse 0.9s ease-in-out infinite;
  will-change: opacity, transform;
}

#iac-floating-chat-root .iac-chat-dot:nth-child(1) {
  animation-delay: 0s;
}

#iac-floating-chat-root .iac-chat-dot:nth-child(2) {
  animation-delay: 0.18s;
}

#iac-floating-chat-root .iac-chat-dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes iac-chat-dot-pulse {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.iac-chat-inbox-wrap {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  padding: 0.75rem;
}

.iac-chat-inbox-inner {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.25rem 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.iac-chat-inbox-inner:focus-within {
  border-color: var(--iac-chat-primary);
  box-shadow: 0 0 0 3px rgba(0, 84, 134, 0.12);
}

#iac-floating-chat-root textarea.iac-chat-textarea {
  flex: 1;
  min-height: 44px;
  max-height: 7rem;
  padding: 0.6rem 0.5rem;
  border: none;
  resize: none;
  font: inherit;
  font-size: 0.875rem;
  color: #0f172a;
  background: transparent;
  -webkit-text-fill-color: currentColor;
}

#iac-floating-chat-root textarea.iac-chat-textarea::placeholder {
  color: #64748b;
  opacity: 1;
}

#iac-floating-chat-root textarea.iac-chat-textarea:disabled {
  color: #475569;
  -webkit-text-fill-color: currentColor;
}

.iac-chat-textarea:focus {
  outline: none;
}

.iac-chat-btn-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.2rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--iac-chat-primary), var(--iac-chat-accent));
  box-shadow: 0 1px 2px rgba(0, 84, 134, 0.25);
  transition: opacity 0.2s ease, transform 0.15s ease, filter 0.2s ease;
}

.iac-chat-btn-send:not(:disabled):hover {
  filter: brightness(1.06);
}

.iac-chat-btn-send:not(:disabled):active {
  transform: scale(0.96);
}

.iac-chat-btn-send:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.iac-chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, var(--iac-chat-accent), var(--iac-chat-primary));
  box-shadow: 0 10px 28px rgba(0, 84, 134, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.iac-chat-toggle:hover {
  transform: scale(1.06);
}

.iac-chat-toggle:active {
  transform: scale(0.94);
}

#iac-floating-chat-root:not([data-open="true"]) .iac-chat-toggle {
  animation: iac-chat-float 1.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  animation-delay: 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  #iac-floating-chat-root:not([data-open="true"]) .iac-chat-toggle {
    animation: none;
  }

  #iac-floating-chat-root[data-open="true"] .iac-chat-panel {
    animation: none;
  }

  #iac-floating-chat-root .iac-chat-loading {
    animation: none;
  }

  #iac-floating-chat-root .iac-chat-dot {
    animation: none;
    opacity: 0.65;
  }
}

@keyframes iac-chat-float {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-6px);
  }
}

.iac-chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.iac-chat-icon-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

#iac-floating-chat-root[data-open="true"] .iac-chat-icon-msg {
  display: none;
}

#iac-floating-chat-root:not([data-open="true"]) .iac-chat-icon-close-fab {
  display: none;
}
