/* ===================================================================
   VibroAqua AI / Customer Support Chatbot Widget Styles
   =================================================================== */

/* Floating Launcher */
.chatbot-launcher-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.chatbot-greeting-bubble {
  background: #ffffff;
  color: var(--secondary);
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  animation: floatBubble 3s ease-in-out infinite;
  max-width: 260px;
  transition: var(--transition);
}

.chatbot-greeting-bubble:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.chatbot-greeting-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}

@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.chatbot-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.chatbot-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.55);
}

.chatbot-toggle-btn .bot-icon-open,
.chatbot-toggle-btn .bot-icon-close {
  position: absolute;
  transition: all 0.3s ease;
}

.chatbot-toggle-btn .bot-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.chatbot-launcher-container.active .chatbot-toggle-btn .bot-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.chatbot-launcher-container.active .chatbot-toggle-btn .bot-icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.chatbot-unread-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

/* Chatbot Window */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 380px;
  max-width: calc(100vw - 30px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 40px -10px rgba(8, 47, 73, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Chat Header */
.chatbot-header {
  background: linear-gradient(135deg, #075985 0%, #0284c7 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  border: 2px solid #bae6fd;
}

.chatbot-avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.chatbot-title h4 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.chatbot-status {
  font-size: 0.75rem;
  color: #bae6fd;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chatbot-status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition);
}

.chatbot-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages Body */
.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.chatbot-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msgFadeIn 0.25s ease-out;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  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-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.chatbot-msg-avatar img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.chatbot-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.chatbot-message.bot .chatbot-msg-bubble {
  background: #ffffff;
  color: var(--secondary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.chatbot-message.user .chatbot-msg-bubble {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.chatbot-msg-time {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

.chatbot-message.user .chatbot-msg-time {
  color: rgba(255, 255, 255, 0.8);
  text-align: right;
}

/* Typing Indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.chatbot-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Inline Product Card in Chat */
.chatbot-product-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-top: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatbot-product-img {
  width: 65px;
  height: 65px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}

.chatbot-product-info {
  flex: 1;
}

.chatbot-product-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.25;
  margin-bottom: 2px;
}

.chatbot-product-price {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0369a1;
  margin-bottom: 6px;
}

.chatbot-product-actions {
  display: flex;
  gap: 6px;
}

.chatbot-product-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Suggestion / Quick Reply Chips */
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chatbot-chip {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chatbot-chip:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
}

/* Chat Input Bar */
.chatbot-footer {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.chatbot-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.chatbot-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.chatbot-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

/* Direct WhatsApp Link Bar inside Footer */
.chatbot-wa-bar {
  margin-top: 8px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chatbot-wa-bar a {
  color: #16a34a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chatbot-wa-bar a:hover {
  text-decoration: underline;
}

/* Adjust floating WhatsApp button when chatbot is present */
.floating-whatsapp {
  bottom: 95px !important;
  width: 52px !important;
  height: 52px !important;
}

.floating-whatsapp svg {
  width: 28px !important;
  height: 28px !important;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    right: 15px;
    left: 15px;
    width: auto;
    bottom: 90px;
    height: calc(100vh - 110px);
  }
  .chatbot-launcher-container {
    bottom: 20px;
    right: 20px;
  }
  .floating-whatsapp {
    bottom: 85px !important;
    right: 20px !important;
  }
}
