/* ==========================================
   NOVIABOT · NOVY CHATBOT — Premium UI
   ========================================== */

:root {
  --cb-purple: #8b5cf6;
  --cb-cyan:   #06b6d4;
  --cb-bg:     rgba(255, 255, 255, 0.06);
  --cb-surface:rgba(255, 255, 255, 0.07);
  --cb-border: rgba(255, 255, 255, 0.14);
  --cb-text:   #f0f0fa;
  --cb-muted:  #a0a0c0;
}

/* ==========================================
   FAB — ENVELOPPE
   ========================================== */
.chatbot-fab {
  position: fixed !important;
  bottom: 28px;
  right: 28px;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  z-index: 99999 !important;
  pointer-events: auto !important;
  padding: 0;
}

.cb-fab-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-fab:hover  .cb-fab-wrap { transform: scale(1.12) translateY(-3px); }
.chatbot-fab:active .cb-fab-wrap { transform: scale(0.93); transition-duration: 0.1s; }

.cb-fab-svg {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 4px 16px rgba(139, 92, 246, 0.55));
}

.notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid #0b0718;
  animation: cb-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cb-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ==========================================
   FENÊTRE
   ========================================== */
.chatbot-window {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 460px;
  height: 600px;
  max-height: calc(100vh - 120px);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(40px) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) brightness(1.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 0 0 1px rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  z-index: 10005;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34,1.2,0.64,1);
  transform-origin: bottom right;
}

.chatbot-window.hidden {
  opacity: 0;
  transform: scale(0.85) translateY(20px);
  pointer-events: none;
}

/* ==========================================
   HEADER
   ========================================== */
.chatbot-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

/* Avatar circulaire avec NOVY */
.cb-header-avatar {
  position: relative;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.cb-avatar-img {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  background: #000;
  display: block;
}

.cb-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0b0718;
  box-shadow: 0 0 8px rgba(16,185,129,0.8);
  animation: cb-online 2.4s ease-in-out infinite;
}

@keyframes cb-online {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}

.cb-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cb-header-name {
  font-size: 22px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.02em;
  line-height: 1;
}

.cb-header-status {
  font-size: 14px;
  color: var(--cb-muted);
  letter-spacing: 0.01em;
}

#chatbot-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#chatbot-close:hover {
  background: rgba(255,255,255,0.12);
  color: white;
  transform: rotate(90deg);
}

/* ==========================================
   MESSAGES
   ========================================== */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chatbot-messages::-webkit-scrollbar { width: 3px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.25);
  border-radius: 2px;
}

.chatbot-message {
  display: flex;
  gap: 10px;
  animation: cb-slide 0.26s ease-out;
}

@keyframes cb-slide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Avatar utilisateur — cercle dégradé à droite */
.user-avatar {
  background: linear-gradient(135deg, rgba(139,92,246,0.5), rgba(6,182,212,0.4)) !important;
  color: white;
  flex-shrink: 0;
}

.user-avatar-icon {
  width: 22px;
  height: 22px;
  color: white;
}

/* Avatar messages bot */
.message-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #000;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-avatar-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  object-position: center 12%;
  border-radius: 50%;
  display: block;
}

.message-content { flex: 1; min-width: 0; }

.bot-message .message-content p {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 14px 18px;
  border-radius: 4px 18px 18px 18px;
  color: var(--cb-text);
  margin: 0;
  line-height: 1.7;
  font-size: 16px;
  word-break: break-word;
}

.user-message { justify-content: flex-end; align-items: flex-end; }

.user-message .message-content p {
  background: linear-gradient(135deg, rgba(139,92,246,0.6), rgba(6,182,212,0.5));
  border: 1px solid rgba(139,92,246,0.35);
  padding: 14px 18px;
  border-radius: 18px 4px 18px 18px;
  color: white;
  margin: 0 0 0 auto;
  max-width: 82%;
  line-height: 1.7;
  font-size: 16px;
  word-break: break-word;
}

/* ==========================================
   QUICK REPLIES
   ========================================== */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.quick-reply {
  background: rgba(139,92,246,0.07);
  border: 1px solid rgba(139,92,246,0.25);
  color: rgba(238,238,245,0.85);
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.quick-reply:hover {
  background: rgba(139,92,246,0.18);
  border-color: rgba(139,92,246,0.5);
  color: white;
  transform: translateY(-1px);
}

/* ==========================================
   TYPING
   ========================================== */
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 12px 14px;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--cb-muted);
  border-radius: 50%;
  animation: cb-typing 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cb-typing {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-8px); opacity: 1; }
}

/* ==========================================
   INPUT
   ========================================== */
.chatbot-input-container {
  padding: 12px 14px 14px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.09);
  background: transparent;
}

#chatbot-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--cb-text);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

#chatbot-input:focus {
  outline: none;
  border-color: rgba(139,92,246,0.55);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}

#chatbot-input::placeholder { color: var(--cb-muted); }

#chatbot-send {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cb-purple), var(--cb-cyan));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

#chatbot-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(139,92,246,0.5);
}

/* ==========================================
   ESCALATION
   ========================================== */
.escalation-buttons { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }

.escalation-btn {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-align: left;
  font-family: inherit;
}

.escalation-btn.primary  { background: linear-gradient(135deg, var(--cb-purple), var(--cb-cyan)); color: white; }
.escalation-btn.primary:hover  { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,92,246,0.4); }
.escalation-btn.secondary { background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.25); color: var(--cb-text); }
.escalation-btn.secondary:hover { background: rgba(139,92,246,0.15); }
.escalation-btn.tertiary  { background: transparent; color: var(--cb-muted); }
.escalation-btn.tertiary:hover { background: rgba(255,255,255,0.04); }

.escalation-message { animation: cb-bounce 0.5s cubic-bezier(0.68,-0.55,0.265,1.55); }

@keyframes cb-bounce {
  0%   { opacity:0; transform: translateY(16px) scale(0.9); }
  60%  { transform: translateY(-3px) scale(1.01); }
  100% { opacity:1; transform: translateY(0) scale(1); }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 90px;
    height: calc(100vh - 120px);
  }
}

@media (max-height: 660px) {
  .chatbot-window { height: calc(100vh - 120px); }
}
