/* ============================================================
   MH DENTAL WORLD — Chatbot Widget
   Premium Floating Assistant
   ============================================================ */

/* Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 105px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #DC3558 0%, #e8627c 100%);
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(220, 53, 88, 0.45);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: float-chatbot 3s ease-in-out infinite;
}

@keyframes float-chatbot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.chatbot-toggle:hover {
  animation: none;
  transform: scale(1.1) !important;
  box-shadow: 0 10px 30px rgba(220, 53, 88, 0.55);
}

.chatbot-toggle.active {
  transform: rotate(90deg) scale(1);
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.chatbot-toggle svg {
  width: 34px;
  height: 34px;
  fill: white;
  transition: transform 0.3s ease;
}

.chatbot-toggle .cb-icon-close { display: none; }
.chatbot-toggle.active .cb-icon-chat { display: none; }
.chatbot-toggle.active .cb-icon-close { display: block; }

/* Notification Pulse */
.chatbot-toggle::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #10b981;
  border-radius: 50%;
  border: 3px solid white;
  animation: cbPulse 2s ease-in-out infinite;
}

.chatbot-toggle.active::after { display: none; }

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

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 172px;
  right: 28px;
  width: 380px;
  max-height: 540px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 8px 24px rgba(0,0,0,0.1);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Header */
.cb-header {
  background: linear-gradient(135deg, #DC3558 0%, #c62a4a 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.cb-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.4);
}

.cb-header-info h4 {
  color: white;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.02em;
}

.cb-header-info span {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cb-header-info span::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
}

.cb-header-close {
  margin-left: auto;
  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;
  font-size: 16px;
  transition: background 0.2s;
}

.cb-header-close:hover {
  background: rgba(255,255,255,0.3);
}

/* Messages Area */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 300px;
  background: #f8f9fb;
}

.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Message Bubble */
.cb-msg {
  max-width: 85%;
  animation: cbSlideIn 0.3s ease-out;
}

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

.cb-msg-bot {
  align-self: flex-start;
}

.cb-msg-user {
  align-self: flex-end;
}

.cb-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #1f2937;
}

.cb-msg-bot .cb-msg-bubble {
  background: white;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cb-msg-user .cb-msg-bubble {
  background: linear-gradient(135deg, #DC3558, #e8627c);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Quick Action Buttons */
.cb-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.cb-quick-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #374151;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.cb-quick-btn:hover {
  border-color: #DC3558;
  color: #DC3558;
  background: #fef2f4;
  transform: translateY(-1px);
}

.cb-quick-btn.cb-nav-btn {
  border-color: #3b82f6;
  color: #3b82f6;
}

.cb-quick-btn.cb-nav-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.cb-quick-btn.cb-contact-btn {
  border-color: #10b981;
  color: #10b981;
}

.cb-quick-btn.cb-contact-btn:hover {
  background: #ecfdf5;
  border-color: #059669;
  color: #059669;
}

/* Contact Card */
.cb-contact-card {
  background: white;
  border-radius: 14px;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cb-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  text-decoration: none;
  color: #374151;
  font-size: 13px;
  transition: color 0.2s;
}

.cb-contact-item:last-child { border-bottom: none; }
.cb-contact-item:hover { color: #DC3558; }

.cb-contact-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.cb-contact-icon.phone { background: #fef2f4; }
.cb-contact-icon.whatsapp { background: #ecfdf5; }
.cb-contact-icon.email { background: #eff6ff; }
.cb-contact-icon.location { background: #fef9ee; }

/* Map embed */
.cb-map-frame {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  border: none;
  margin-top: 8px;
}

/* Input Area */
.cb-input-area {
  padding: 14px 16px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 10px;
  align-items: center;
  background: white;
  flex-shrink: 0;
}

.cb-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.cb-input:focus {
  border-color: #DC3558;
}

.cb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #DC3558, #e8627c);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.cb-send-btn:hover {
  transform: scale(1.08);
}

.cb-send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* Typing Indicator */
.cb-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.cb-typing span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: cbTyping 1.4s infinite;
}

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

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

/* Back Button */
.cb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 16px;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
}

.cb-back-btn:hover {
  border-color: #DC3558;
  color: #DC3558;
}

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