/* ============================================
   CHATBOT - MAS DES FUGUEYROLLES
   Assistant Intelligent 24/7
   ============================================ */

/* === CHATBOT TOGGLE BUTTON === */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--text-light);
  box-shadow: 0 6px 24px rgba(139, 115, 85, 0.45), 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(139, 115, 85, 0.55), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chatbot-toggle:active {
  transform: scale(0.95);
}

.chatbot-toggle .chatbot-icon-chat,
.chatbot-toggle .chatbot-icon-close {
  position: absolute;
  transition: all 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.chatbot-toggle .chatbot-icon-chat {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.chatbot-toggle .chatbot-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.chatbot-toggle.active .chatbot-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

.chatbot-toggle.active .chatbot-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Pulse animation when idle */
.chatbot-toggle:not(.active)::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  z-index: -1;
  animation: chatbotPulse 2.5s ease-in-out infinite;
}

@keyframes chatbotPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.2);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Notification badge */
.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e74c3c;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: badgeBounce 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes badgeBounce {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
  }
}

/* === CHATBOT WINDOW === */
.chatbot-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  z-index: 9999;
  width: 400px;
  max-height: 600px;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Glassmorphism */
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.15),
    0 8px 16px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Animation */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* === CHATBOT HEADER === */
.chatbot-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

/* Subtle pattern overlay */
.chatbot-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.4;
}

.chatbot-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.chatbot-avatar svg {
  width: 100%;
  height: 100%;
}

.chatbot-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2ecc71;
  border: 2px solid var(--color-primary);
}

.chatbot-header-info {
  position: relative;
  flex: 1;
}

.chatbot-header-info h4 {
  color: white;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.chatbot-header-info span {
  font-size: 0.75rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header-info .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecc71;
  display: inline-block;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.chatbot-header-close {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.chatbot-header-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* === CHATBOT MESSAGES === */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 300px;
  max-height: 380px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 115, 85, 0.2);
  border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 115, 85, 0.4);
}

/* Message bubbles */
.chatbot-message {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: messageSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-message.bot {
  align-self: flex-start;
}

.chatbot-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chatbot-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.chatbot-message.bot .chatbot-message-avatar {
  background: none;
  overflow: hidden;
}

.chatbot-message.bot .chatbot-message-avatar svg {
  width: 100%;
  height: 100%;
}

.chatbot-message.user .chatbot-message-avatar {
  background: linear-gradient(135deg, var(--color-secondary-light), var(--color-secondary));
  color: white;
}

.chatbot-message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
}

.chatbot-message.bot .chatbot-message-bubble {
  background: var(--color-beige);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

.chatbot-message.user .chatbot-message-bubble {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  border-bottom-right-radius: 6px;
}

.chatbot-message-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.chatbot-message.user .chatbot-message-time {
  text-align: right;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  gap: 10px;
  align-self: flex-start;
  max-width: 85%;
  animation: messageSlideIn 0.3s ease;
}

.chatbot-typing-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.chatbot-typing-avatar svg {
  width: 100%;
  height: 100%;
}

.chatbot-typing-dots {
  background: var(--color-beige);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.chatbot-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary-light);
  animation: typingDot 1.4s infinite;
}

.chatbot-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* === QUICK REPLIES === */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
  animation: messageSlideIn 0.4s ease 0.1s both;
}

.chatbot-quick-reply {
  background: white;
  border: 1.5px solid var(--color-primary-light);
  color: var(--color-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-body);
  white-space: nowrap;
}

.chatbot-quick-reply:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

.chatbot-quick-reply:active {
  transform: translateY(0);
}

/* === CHATBOT INPUT === */
.chatbot-input-area {
  padding: 16px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.7);
}

.chatbot-input-wrapper {
  flex: 1;
  position: relative;
}

.chatbot-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--color-gray-light);
  border-radius: 24px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: white;
  resize: none;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  max-height: 100px;
  line-height: 1.4;
}

.chatbot-input::placeholder {
  color: var(--text-muted);
}

.chatbot-input:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.chatbot-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(139, 115, 85, 0.35);
}

.chatbot-send:active {
  transform: scale(0.95);
}

.chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chatbot-send svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.chatbot-send:not(:disabled):hover svg {
  transform: translateX(2px);
}

/* === FOOTER INFO === */
.chatbot-footer-info {
  text-align: center;
  padding: 0 20px 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.chatbot-footer-info svg {
  width: 12px;
  height: 12px;
  opacity: 0.5;
}

/* === WELCOME TOOLTIP === */
.chatbot-welcome-tooltip {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9997;
  background: white;
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 0.88rem;
  line-height: 1.4;
  max-width: 280px;

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-welcome-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chatbot-welcome-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 28px;
  width: 16px;
  height: 16px;
  background: white;
  transform: rotate(45deg);
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.05);
}

.chatbot-welcome-tooltip .tooltip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
  line-height: 1;
}

.chatbot-welcome-tooltip .tooltip-close:hover {
  color: var(--text-primary);
}

/* === ESCALATION NOTICE === */
.chatbot-escalation {
  background: linear-gradient(135deg, #FFF8F0, #FFF3E6);
  border: 1px solid rgba(211, 167, 106, 0.3);
  border-radius: 14px;
  padding: 12px 16px;
  margin: 4px 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.chatbot-escalation svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-primary);
  margin-top: 1px;
}

/* === LINK IN MESSAGE === */
.chatbot-message-bubble a {
  color: var(--color-primary-dark);
  text-decoration: underline;
  font-weight: 500;
}

.chatbot-message.user .chatbot-message-bubble a {
  color: rgba(255, 255, 255, 0.9);
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
  }

  .chatbot-messages {
    max-height: calc(100dvh - 220px);
    min-height: 50vh;
  }

  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .chatbot-welcome-tooltip {
    right: 16px;
    bottom: 82px;
    max-width: 240px;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .chatbot-window {
    width: 360px;
    right: 16px;
    bottom: 96px;
  }

  .chatbot-toggle {
    bottom: 20px;
    right: 20px;
  }
}
/* Reserve button in chatbot messages */
.chatbot-reserve-btn {
  display: inline-block;
  background: #2563eb;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  text-decoration: none !important;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
}
.chatbot-reserve-btn:hover {
  background: #1d4ed8;
}
