/* ══════════════════════════════════════════════
   LEADERNET CHATBOT — Styles
══════════════════════════════════════════════ */

/* ── Bouton flottant ── */
#ln-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #a01519);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(204,28,35,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
  overflow: hidden;
}
#ln-chat-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 10px 36px rgba(204,28,35,0.55);
}
#ln-chat-btn:active { transform: scale(0.95); }
#ln-chat-btn .icon-chat,
#ln-chat-btn .icon-close {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.3s ease;
}
#ln-chat-btn .icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.7);
}
#ln-chat-btn.open .icon-chat {
  opacity: 0;
  transform: translateY(-8px) scale(0.7);
}
#ln-chat-btn.open .icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ── Robot animations ── */
@keyframes robotFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-3px); }
}
@keyframes robotWave {
  0%, 100% { transform: rotate(0deg); transform-origin: right center; }
  25%       { transform: rotate(-18deg); transform-origin: right center; }
  75%       { transform: rotate(12deg); transform-origin: right center; }
}
@keyframes eyeBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95%            { transform: scaleY(0.1); }
}
@keyframes pupilMove {
  0%, 40%, 100% { transform: translateX(0); }
  50%            { transform: translateX(1.5px); }
  70%            { transform: translateX(-1px); }
}
@keyframes antennaPulse {
  0%, 100% { fill: white; r: 2.5; }
  50%       { fill: #4ade80; filter: drop-shadow(0 0 4px #4ade80); }
}
@keyframes mouthSmile {
  0%, 100% { d: path("M16 25 Q22 28.5 28 25"); }
  50%       { d: path("M16 24 Q22 29.5 28 24"); }
}

#ln-robot {
  animation: robotFloat 2.2s ease-in-out infinite;
}
#ln-robot .robot-eye-l {
  animation: eyeBlink 3.5s ease-in-out infinite;
  transform-origin: 16px 19px;
}
#ln-robot .robot-eye-r {
  animation: eyeBlink 3.5s ease-in-out infinite 0.15s;
  transform-origin: 28px 19px;
}
#ln-robot .robot-pupil-l {
  animation: pupilMove 4s ease-in-out infinite;
}
#ln-robot .robot-pupil-r {
  animation: pupilMove 4s ease-in-out infinite 0.2s;
}
#ln-robot .robot-antenna-dot {
  animation: antennaPulse 1.8s ease-in-out infinite;
}
/* Bras gauche qui fait signe */
#ln-robot rect:nth-child(10) {
  animation: robotWave 2.5s ease-in-out infinite 1s;
  transform-origin: 12px 31.5px;
}

/* Pastille notification */
#ln-chat-notif {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--cyan);
  border: 2px solid white;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: notifPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes notifPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Fenêtre chat ── */
#ln-chat-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  z-index: 9997;
  width: 360px;
  max-height: 560px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(26,50,114,0.18), 0 4px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
#ln-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#ln-chat-header {
  background: linear-gradient(135deg, var(--navy) 0%, #1472B8 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ln-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.25);
}
.ln-header-info { flex: 1; }
.ln-header-name {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.ln-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}
.ln-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.6; transform:scale(0.8); }
}

/* ── Zone messages ── */
#ln-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#ln-chat-messages::-webkit-scrollbar { width: 4px; }
#ln-chat-messages::-webkit-scrollbar-track { background: transparent; }
#ln-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Messages */
.ln-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: msgIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes msgIn {
  from { opacity:0; transform:translateY(10px) scale(0.95); }
  to   { opacity:1; transform:none; }
}
.ln-msg.bot { flex-direction: row; }
.ln-msg.user { flex-direction: row-reverse; }

.ln-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ln-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
}
.ln-msg.bot .ln-bubble {
  background: #f0f4ff;
  color: var(--navy);
  border-bottom-left-radius: 4px;
}
.ln-msg.user .ln-bubble {
  background: linear-gradient(135deg, var(--navy), #1472B8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.ln-typing {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ln-typing .ln-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.ln-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingDot 1.2s ease infinite;
}
.ln-dot:nth-child(2) { animation-delay: 0.2s; }
.ln-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%,60%,100% { transform: translateY(0); opacity:0.4; }
  30%          { transform: translateY(-6px); opacity:1; }
}

/* Suggestions rapides */
#ln-suggestions {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.ln-sug-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border-hi);
  background: #fff;
  color: var(--navy);
  font-size: 0.78rem;
  font-family: var(--font-display);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.ln-sug-btn:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

/* ── Zone saisie ── */
#ln-chat-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: #fff;
}
#ln-chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--navy);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-2);
  resize: none;
  height: 42px;
  line-height: 1.4;
}
#ln-chat-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(20,114,184,0.1);
  background: #fff;
}
#ln-chat-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #a01519);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(204,28,35,0.3);
}
#ln-chat-send:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(204,28,35,0.4);
}
#ln-chat-send:active { transform: scale(0.9); }

/* Lien dans bulle */
.ln-bubble a {
  color: var(--cyan);
  text-decoration: underline;
  font-weight: 600;
}
.ln-msg.user .ln-bubble a { color: rgba(255,255,255,0.85); }

/* ── Responsive mobile ── */
@media (max-width: 480px) {
  #ln-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 96px;
    max-height: 70vh;
  }
  #ln-chat-btn { right: 16px; bottom: 16px; }
}
