.cb-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: system-ui, Segoe UI, Roboto, Arial
}

.cb-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
  cursor: pointer
}

.cb-btn .cb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1e40af;
  display: flex;
  align-items: center;
  justify-content: center
}

.cb-btn .cb-teaser {
  font-size: 14px
}

.cb-win {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 320px;
  max-height: 70vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 9998;
  display: flex;
  /* Flexbox */
  flex-direction: column;
  /* Vertical stack */
}

.cb-win.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1)
}

.cb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f2937;
  color: #fff;
  padding: 10px 12px;
  flex-shrink: 0;
  /* Don't shrink */
}

.cb-title {
  font-weight: 600;
  font-size: 14px
}

.cb-close {
  margin-left: auto;
  cursor: pointer;
  opacity: 1;
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
  line-height: 1
}

.cb-body {
  padding: 12px;
  flex: 1;
  /* Fill remaining space */
  min-height: 150px;
  /* Minimum useful height */
  overflow-y: auto;
  /* Scroll if content is too big */
  background: #f8fafc
}

.cb-msg {
  margin: 8px 0;
  display: flex
}

.cb-msg .cb-bubble {
  max-width: 80%;
  padding: 8px 10px;
  border-radius: 10px;
  background: #e5e7eb;
  font-size: 14px;
  line-height: 1.35
}

.cb-msg.you {
  justify-content: flex-end
}

.cb-msg.you .cb-bubble {
  background: #2563eb;
  color: #fff
}

/* Footer: input + button perfectly aligned */
.cb-foot {
  display: flex;
  align-items: center;
  /* vertical centering */
  gap: 8px;
  padding: 10px;
  background: #f1f5f9;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  /* Don't shrink */
}

/* same height for both controls */
.cb-input {
  flex: 1;
  height: 42px;
  /* ← set the height */
  padding: 0 12px;
  /* vertical padding 0 to avoid extra height */
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.cb-send {
  height: 42px;
  /* ← match input height */
  padding: 0 18px;
  /* vertical padding 0 so it stays 42px tall */
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  /* center label in the button */
  align-items: center;
  justify-content: center;
  line-height: 1;
  /* avoid extra vertical space from fonts */
}


/* Avatars généraux */
.cb-avatar img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

/* Header présence : deux états (expanded/compact) */
.cb-presence {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  transition: all .25s ease;
  cursor: pointer;
}

/* === Expanded (au démarrage) === */
/* --- Presence header facelift --- */

/* Expanded: neat 3-column grid, nicer ring & labels */
.cb-presence.expanded {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.cb-presence.expanded .cb-coaches {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 16px;
}

.cb-presence.expanded .cb-coach {
  width: 64px;
  text-align: center;
}

.cb-presence.expanded .cb-coach-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .18);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .22), inset 0 0 0 2px rgba(255, 255, 255, .06);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.cb-presence.expanded .cb-coach-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cb-presence.expanded .cb-coach:hover .cb-coach-img {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .35);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .26), inset 0 0 0 2px rgba(255, 255, 255, .10);
}

.cb-presence.expanded .cb-coach-name {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.1;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Compact (après 5 s) === */
.cb-presence.compact {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-presence.compact .cb-coaches {
  display: flex;
  gap: 10px;
}

.cb-presence.compact .cb-coach {
  width: auto;
  display: block;
}

.cb-presence.compact .cb-coach-img {
  width: 28px;
  /* un peu plus grand que 22px */
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .25);
}

.cb-presence.compact .cb-coach-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cb-presence.compact .cb-coach-name {
  display: none;
  /* pas de noms en mode compact */
}


/* Status on one line + subtle pulse */
.cb-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #a7f3d0;
  white-space: nowrap;
  /* keeps “en ligne” on one line */
  padding-left: 8px;
}

.cb-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
  animation: cbDotPulse 1.8s ease-out infinite;
}

@keyframes cbDotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .25);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ——— Messages avec avatar bot ——— */
.cb-msg {
  position: relative;
}

.cb-msg.bot {
  display: flex;
  align-items: flex-start;
}

.cb-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 8px;
  flex: 0 0 28px;
  border: 1px solid rgba(0, 0, 0, .08);
}

.cb-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cb-msg.bot .cb-bubble {
  background: #e5e7eb;
  color: #111827;
}

/* ——— Indicateur “3 points” animé ——— */
.cb-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.cb-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  animation: cb-bounce 1s infinite ease-in-out;
}

.cb-dots i:nth-child(2) {
  animation-delay: .15s;
}

.cb-dots i:nth-child(3) {
  animation-delay: .30s;
}

@keyframes cb-bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: .55;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}