/* ==========================================
   CATALIS AI CHATBOT STYLES
   ========================================== */

/* Chatbot Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d946ef 0%, #facc15 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(217, 70, 239, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 9998;
  animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(217, 70, 239, 0.55);
}

.chatbot-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 4px 20px rgba(217, 70, 239, 0.35);
  }
  50% {
    box-shadow: 0 4px 30px rgba(217, 70, 239, 0.6);
  }
}

/* Chatbot Window */
.chatbot-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 9999;
  overflow: hidden;
}

.chatbot-window.active {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Chatbot Header */
.chatbot-header {
  background: linear-gradient(135deg, #d946ef 0%, #facc15 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 16px 16px 0 0;
}

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

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chatbot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

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

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: blink 2s infinite;
}
.status-offline { background:#ef4444; animation:none; }

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.chatbot-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chatbot-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Messages Container */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Message Bubbles */
.chatbot-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: slideIn 0.3s ease;
}

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

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

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

.message-content {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.bot-message .message-content {
  background: white;
  color: #1f2937;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
  background: linear-gradient(135deg, #d946ef 0%, #facc15 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-timestamp {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
  padding: 0 4px;
}

.user-message .message-timestamp {
  text-align: right;
}

/* Typing Indicator */
.typing-indicator .message-content {
  padding: 12px 20px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #d946ef;
  border-radius: 50%;
  animation: 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 typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Quick Actions (Optional) */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.quick-action-btn {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: #d946ef;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.quick-action-btn:hover {
  background: #f3f4f6;
  border-color: #d946ef;
  transform: translateX(4px);
}

/* Input Area */
.chatbot-input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  padding: 12px 16px;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.chatbot-input:focus {
  border-color: #d946ef;
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.12);
}

.chatbot-send-btn {
  background: linear-gradient(135deg, #d946ef 0%, #facc15 100%);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.4);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .chatbot-header {
    border-radius: 0;
  }

  .chatbot-toggle {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
  .chatbot-window {
    background: #1f2937;
  }

  .chatbot-messages {
    background: #111827;
  }

  .bot-message .message-content {
    background: #374151;
    color: #f9fafb;
  }

  .chatbot-input-area {
    background: #1f2937;
    border-top-color: #374151;
  }

  .chatbot-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }

  .quick-action-btn {
    background: #374151;
    border-color: #4b5563;
    color: #a5b4fc;
  }

  .quick-action-btn:hover {
    background: #4b5563;
  }
}

/* Accessibility */
.chatbot-toggle:focus,
.chatbot-close-btn:focus,
.chatbot-send-btn:focus,
.chatbot-input:focus {
  outline: 2px solid #d946ef;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .chatbot-toggle,
  .chatbot-window {
    display: none !important;
  }
}
.send-bounce { animation: sendBounce .6s ease; }
@keyframes sendBounce {
  0% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
