/* ===== CHAT WIDGET ===== */

#chat-bubble-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  background: transparent;
  border: 1.5px solid rgba(130, 204, 221, 0.45);
  border-radius: 50px;
  padding: 13px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #82ccdd;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
  transition: border-color 0.25s, background 0.25s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#chat-bubble-btn:hover {
  background: rgba(130, 204, 221, 0.08);
  border-color: #82ccdd;
  transform: translateY(-2px);
}

#chat-bubble-btn .chat-btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #82ccdd;
  animation: chatDotPulse 2s infinite;
  flex-shrink: 0;
}

@keyframes chatDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Fenêtre de chat */
#chat-window {
  position: fixed;
  bottom: 90px;
  right: 28px;
  z-index: 9999;
  width: 340px;
  max-height: 480px;
  background: linear-gradient(160deg, #0c2461 0%, #0a3d62 100%);
  border: 1px solid rgba(130, 204, 221, 0.25);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  font-family: 'Montserrat', sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(130, 204, 221, 0.15);
  background: rgba(30, 55, 153, 0.4);
}

#chat-header .chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#chat-header .chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3799, #0a3d62);
  border: 1.5px solid rgba(130, 204, 221, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

#chat-header .chat-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

#chat-header .chat-subtitle {
  font-size: 10px;
  color: rgba(130, 204, 221, 0.6);
  margin-top: 1px;
}

#chat-close-btn {
  background: none;
  border: none;
  color: rgba(130, 204, 221, 0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s;
}

#chat-close-btn:hover {
  color: #82ccdd;
}

/* Messages */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 204, 221, 0.2) transparent;
}

#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(130, 204, 221, 0.2); border-radius: 2px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: msgAppear 0.2s ease-out;
}

@keyframes msgAppear {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot  { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

.chat-msg .bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.chat-msg.bot .bubble {
  background: rgba(30, 55, 153, 0.55);
  border: 1px solid rgba(130, 204, 221, 0.18);
  color: rgba(130, 204, 221, 0.95);
  border-bottom-left-radius: 4px;
}

.chat-msg.user .bubble {
  background: rgba(130, 204, 221, 0.15);
  border: 1px solid rgba(130, 204, 221, 0.3);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-msg.bot.typing .bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #82ccdd;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Suggestions rapides */
#chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.chat-suggestion {
  background: transparent;
  border: 1px solid rgba(130, 204, 221, 0.3);
  border-radius: 20px;
  color: rgba(130, 204, 221, 0.8);
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.chat-suggestion:hover {
  background: rgba(130, 204, 221, 0.1);
  border-color: #82ccdd;
  color: #82ccdd;
}

/* Input */
#chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(130, 204, 221, 0.15);
  background: rgba(10, 61, 98, 0.6);
}

#chat-input {
  flex: 1;
  background: rgba(30, 55, 153, 0.3);
  border: 1px solid rgba(130, 204, 221, 0.25);
  border-radius: 10px;
  color: #ffffff;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  padding: 9px 13px;
  outline: none;
  transition: border-color 0.2s;
}

#chat-input::placeholder {
  color: rgba(130, 204, 221, 0.35);
}

#chat-input:focus {
  border-color: rgba(130, 204, 221, 0.6);
}

#chat-send-btn {
  background: rgba(130, 204, 221, 0.15);
  border: 1px solid rgba(130, 204, 221, 0.35);
  border-radius: 10px;
  color: #82ccdd;
  font-size: 16px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

#chat-send-btn:hover {
  background: rgba(130, 204, 221, 0.25);
  border-color: #82ccdd;
}

/* Mobile */
@media (max-width: 768px) {
  #chat-window {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 80px;
  }

  #chat-bubble-btn {
    right: 16px;
    bottom: 20px;
  }
}
