/**
 * CHATBOT FLEXITRAVAIL - Design Moderne & Professionnel
 * Aesthetic: Clean, Professional, Trustworthy
 */

/* === BOUTON DÉCLENCHEUR === */
.chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  min-width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  border: none;
  border-radius: 32px;
  box-shadow: 0 8px 24px rgba(30, 64, 175, 0.35),
              0 4px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  color: white;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
  overflow: hidden;
}

.chat-trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.chat-trigger:hover {
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 16px 40px rgba(30, 64, 175, 0.45),
              0 8px 16px rgba(0, 0, 0, 0.15);
}

.chat-trigger:hover::before {
  opacity: 1;
}

.chat-trigger svg {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.chat-badge {
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chat-notification {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #DC2626;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/* === FENÊTRE CHAT === */
.chat-window {
  position: fixed;
  bottom: 104px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 48px);
  height: 640px;
  max-height: calc(100vh - 150px);
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2),
              0 8px 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

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

/* === HEADER === */
.chat-header {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  color: white;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.chat-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-info h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status {
  margin: 4px 0 0 0;
  font-size: 13px;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  }
}

.chat-close {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* === MESSAGES === */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(180deg, #F9FAFB 0%, #FFFFFF 100%);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: messageSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message.bot {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.message-content {
  padding: 14px 18px;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
  line-height: 1.6;
}

.message.bot .message-content {
  background: white;
  border: 1px solid #E5E7EB;
  border-bottom-left-radius: 6px;
}

.message.user .message-content {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.message-content p {
  margin: 0;
  font-size: 15px;
}

.message-content p + p {
  margin-top: 10px;
}

.message-time {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 6px;
  padding: 0 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* === RÉPONSES RAPIDES === */
.quick-replies {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.quick-reply {
  background: white;
  border: 1.5px solid #E5E7EB;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
  color: #374151;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.quick-reply:hover {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1E40AF;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* === BOUTON WHATSAPP === */
.transfer-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #20BA5A 100%);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.transfer-whatsapp:hover {
  background: linear-gradient(135deg, #20BA5A 0%, #1CA34D 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
}

/* === INPUT === */
.chat-input-container {
  padding: 20px 24px;
  background: white;
  border-top: 1px solid #E5E7EB;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input {
  flex: 1;
  border: 1.5px solid #E5E7EB;
  padding: 14px 18px;
  border-radius: 24px;
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
  background: #F9FAFB;
}

.chat-input:focus {
  border-color: #3B82F6;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-send {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.chat-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.35);
}

.chat-send:disabled {
  background: linear-gradient(135deg, #D1D5DB 0%, #9CA3AF 100%);
  cursor: not-allowed;
  opacity: 0.5;
}

/* === TYPING INDICATOR === */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
}

.typing-indicator span {
  width: 10px;
  height: 10px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .chat-trigger {
    bottom: 20px;
    right: 20px;
  }
  
  .quick-replies {
    grid-template-columns: 1fr;
  }
}

/* === DARK MODE === */
body.dark .chat-window {
  background: #1F2937;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark .chat-messages {
  background: linear-gradient(180deg, #111827 0%, #1F2937 100%);
}

body.dark .message.bot .message-content {
  background: #1F2937;
  border-color: #374151;
  color: #F9FAFB;
}

body.dark .chat-input-container {
  background: #1F2937;
  border-color: #374151;
}

body.dark .chat-input {
  background: #111827;
  color: #F9FAFB;
  border-color: #374151;
}

body.dark .chat-input:focus {
  background: #1F2937;
  border-color: #3B82F6;
}

body.dark .quick-reply {
  background: #1F2937;
  border-color: #374151;
  color: #F9FAFB;
}

body.dark .quick-reply:hover {
  background: #374151;
  border-color: #3B82F6;
}
