/* ============================================================
   SCIENTIBOT — Chat Flottant IA Expert
   ============================================================ */

/* Bouton flottant */
.sb-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 10000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C8102E 0%, #E25B6A 100%);
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(200,16,46,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.25s, box-shadow 0.25s;
}
.sb-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(200,16,46,0.55);
}
.sb-fab .sb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #28c76f;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: sb-pulse 2s infinite;
}
@keyframes sb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* Panel de chat */
.sb-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 10001;
  width: 400px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: sb-slide-up 0.3s ease;
}
.sb-panel.sb-open {
  display: flex;
}
@keyframes sb-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.sb-header {
  background: linear-gradient(135deg, #C8102E 0%, #E25B6A 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sb-header-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.sb-header-info h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.sb-header-info span {
  font-size: 11px;
  opacity: 0.85;
}
.sb-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.sb-close:hover { opacity: 1; }

/* Messages area */
.sb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-height: 360px;
  background: #f8f7fa;
}
.sb-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}
.sb-msg.sb-user {
  justify-content: flex-end;
}
.sb-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #C8102E, #E25B6A);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.sb-avatar-user {
  background: linear-gradient(135deg, #6366f1, #818cf8);
}
.sb-bubble {
  max-width: 280px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.sb-bubble p { margin: 0 0 6px 0; }
.sb-bubble p:last-child { margin-bottom: 0; }
.sb-bubble strong { color: #C8102E; }
.sb-bubble table { font-size: 11px; width: 100%; border-collapse: collapse; margin: 8px 0; }
.sb-bubble th, .sb-bubble td { border: 1px solid #ddd; padding: 4px 6px; text-align: left; }
.sb-bubble th { background: #f0f0f0; font-weight: 600; }
.sb-bubble-bot {
  background: #fff;
  color: #444050;
  border: 1px solid #e6e6e8;
  border-bottom-left-radius: 4px;
}
.sb-bubble-user {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Input area */
.sb-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e6e6e8;
  display: flex;
  gap: 8px;
  background: #fff;
}
.sb-input-area input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.sb-input-area input:focus {
  border-color: #C8102E;
}
.sb-input-area button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #C8102E, #E25B6A);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.sb-input-area button:hover {
  transform: scale(1.05);
}

/* Quick actions */
.sb-quick {
  padding: 8px 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: #f8f7fa;
  border-top: 1px solid #e6e6e8;
}
.sb-quick-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #6d6b77;
  cursor: pointer;
  transition: all 0.2s;
}
.sb-quick-btn:hover {
  border-color: #C8102E;
  color: #C8102E;
  background: #fef2f2;
}

/* Responsive */
@media (max-width: 480px) {
  .sb-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 80px;
  }
}

/* Typing indicator (IA réfléchit) */
.sb-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.sb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C8102E;
  animation: sb-bounce 1.4s infinite ease-in-out both;
}
.sb-typing span:nth-child(1) { animation-delay: -0.32s; }
.sb-typing span:nth-child(2) { animation-delay: -0.16s; }
.sb-typing span:nth-child(3) { animation-delay: 0s; }
@keyframes sb-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
