/* ═══════════════════════════════════════════════════════════════
   RHIINO MAX — Widget chat
   ═══════════════════════════════════════════════════════════════ */

/* ── Bouton flottant ─────────────────────────────────────────── */
.rchat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #31362e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28), 0 1px 6px rgba(0,0,0,0.14);
  z-index: 9990;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.2s ease;
}
.rchat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(0,0,0,0.32);
}
.rchat-btn:focus-visible {
  outline: 3px solid #C5F135;
  outline-offset: 3px;
}
.rchat-btn svg {
  width: 26px;
  height: 26px;
  stroke: #C5F135;
  fill: none;
  flex-shrink: 0;
}

/* Badge notification */
.rchat-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  background: #C5F135;
  border-radius: 50%;
  border: 2.5px solid #fff;
  display: none;
  animation: rchatPulse 1.8s ease infinite;
}
.rchat-btn.has-notif .rchat-badge { display: block; }

@keyframes rchatPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

/* ── Panel ───────────────────────────────────────────────────── */
.rchat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-height: 530px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 4px 20px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  z-index: 9991;
  overflow: hidden;
  transform-origin: bottom right;
}
.rchat-panel[hidden] { display: none !important; }
.rchat-panel.rchat-in {
  animation: rchatOpen 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes rchatOpen {
  from { opacity: 0; transform: scale(0.82) translateY(14px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* ── En-tête ─────────────────────────────────────────────────── */
.rchat-header {
  background: #31362e;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.rchat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rchat-avatar {
  width: 38px;
  height: 38px;
  background: rgba(197,241,53,0.18);
  border: 1.5px solid rgba(197,241,53,0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.rchat-avatar img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.rchat-header-name {
  color: #f2f2f2;
  font-weight: 700;
  font-size: 14px;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.rchat-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(242,242,242,0.6);
  font-size: 11px;
  margin-top: 2px;
}
.rchat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C5F135;
  flex-shrink: 0;
  animation: rchatDotBlink 2.5s ease infinite;
}
@keyframes rchatDotBlink {
  0%, 80%, 100% { opacity: 1; }
  40%            { opacity: 0.4; }
}
.rchat-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #f2f2f2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.rchat-close:hover { background: rgba(255,255,255,0.2); }
.rchat-close svg { width: 12px; height: 12px; stroke: #f2f2f2; }

/* ── Messages ────────────────────────────────────────────────── */
.rchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.rchat-messages::-webkit-scrollbar { width: 4px; }
.rchat-messages::-webkit-scrollbar-track { background: transparent; }
.rchat-messages::-webkit-scrollbar-thumb { background: #e4e4e4; border-radius: 2px; }

.rchat-bubble {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  animation: rchatBubble 0.2s ease both;
}
@keyframes rchatBubble {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.rchat-bubble.bot {
  background: #f2f2f2;
  color: #31362e;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.rchat-bubble.user {
  background: #31362e;
  color: #f2f2f2;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.rchat-bubble strong { font-weight: 700; }
.rchat-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.rchat-bubble a:hover { opacity: 1; }

/* Typing indicator */
.rchat-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 14px;
  background: #f2f2f2;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  align-self: flex-start;
}
.rchat-typing span {
  width: 7px;
  height: 7px;
  background: #b0b5aa;
  border-radius: 50%;
  animation: rchatDot 1.1s infinite;
}
.rchat-typing span:nth-child(2) { animation-delay: 0.18s; }
.rchat-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes rchatDot {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.45; }
  30%            { transform: translateY(-5px); opacity: 1;    }
}

/* ── Chips ───────────────────────────────────────────────────── */
.rchat-chips {
  padding: 8px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
  max-height: 130px;
  overflow-y: auto;
}
.rchat-chips::-webkit-scrollbar { display: none; }
.rchat-chip {
  background: #fff;
  border: 1.5px solid #e4e4e4;
  color: #31362e;
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.3;
}
.rchat-chip:hover {
  background: #31362e;
  border-color: #31362e;
  color: #C5F135;
}

/* ── Barre de saisie ─────────────────────────────────────────── */
.rchat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid #f2f2f2;
  flex-shrink: 0;
}
.rchat-input-bar[hidden] { display: none !important; }

#rchat-input {
  flex: 1;
  border: 1.5px solid #e4e4e4;
  border-radius: 24px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: #31362e;
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s;
}
#rchat-input:focus { border-color: #31362e; background: #fff; }
#rchat-input::placeholder { color: #b0b5aa; }

#rchat-send {
  width: 36px;
  height: 36px;
  background: #31362e;
  border: none;
  border-radius: 50%;
  color: #C5F135;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
#rchat-send:hover   { background: #252a20; }
#rchat-send:active  { transform: scale(0.94); }
#rchat-send svg { width: 15px; height: 15px; stroke: #C5F135; fill: none; }

/* Confirmation lead capté */
.rchat-lead-confirm {
  font-size: 12px;
  color: #4a7c3f;
  background: #f0fce8;
  border: 1px solid #c5f135;
  border-radius: 10px;
  padding: 7px 12px;
  text-align: center;
  animation: rchatBubble 0.2s ease both;
}

/* ── Responsive mobile ───────────────────────────────────────── */
@media (max-width: 480px) {
  .rchat-panel {
    width: calc(100vw - 28px);
    right: 14px;
    bottom: 84px;
    max-height: 58vh;
    border-radius: 16px;
  }
  .rchat-btn {
    right: 14px;
    bottom: 14px;
    width: 52px;
    height: 52px;
  }
  .rchat-btn svg { width: 22px; height: 22px; }
}
