/* ============================================================
   CARE DENTAL HOSPITAL — CHATBOT v2 (Complete AI Dental Assistant)
   Ultra-responsive, mobile-optimized, glassmorphism UI
   ============================================================ */

/* ── Floating Actions Stacking with Chatbot ── */
.floating-actions {
  position: fixed !important;
  right: 24px !important;
  bottom: 92px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  align-items: flex-end !important;
  z-index: 99999 !important;
  pointer-events: none !important;
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.floating-actions .fab-btn {
  pointer-events: auto !important;
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.2rem !important;
  cursor: pointer !important;
  border: none !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  position: relative !important;
  text-decoration: none !important;
  color: #ffffff !important;
}

.floating-actions .fab-btn.whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e) !important;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45) !important;
}

.floating-actions .fab-btn.call {
  background: linear-gradient(135deg, #005bff, #00c7ff) !important;
  box-shadow: 0 6px 20px rgba(0, 91, 255, 0.45) !important;
}

.floating-actions .fab-btn:hover {
  transform: scale(1.1) !important;
  filter: brightness(1.1) !important;
}

/* ── Chatbot Wrapper (Fixed at Bottom-Right) ── */
.chatbot-wrapper {
  position: fixed !important;
  right: 24px !important;
  bottom: 24px !important;
  width: 56px !important;
  height: 56px !important;
  z-index: 100000 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
}

/* ── Chatbot Bubble Toggle Button ── */
.chatbot-bubble {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #00cfff, #005bff) !important;
  border: 2px solid rgba(255, 255, 255, 0.25) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.4rem !important;
  color: #ffffff !important;
  box-shadow: 0 8px 30px rgba(0, 207, 255, 0.55), 0 0 0 0 rgba(0, 207, 255, 0.4) !important;
  animation: chatbot-pulse 2.8s ease-out infinite !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease !important;
  position: relative !important;
  overflow: hidden !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.chatbot-bubble:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 12px 38px rgba(0, 207, 255, 0.75) !important;
}

.chatbot-bubble:active {
  transform: scale(0.95) !important;
}

.chatbot-bubble .bubble-icon,
.chatbot-bubble .close-icon {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  position: absolute !important;
}

.chatbot-bubble .close-icon {
  display: none;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.chatbot-bubble.chat-open .bubble-icon,
.chatbot-bubble.active .bubble-icon {
  display: none !important;
  opacity: 0 !important;
  transform: rotate(90deg) scale(0) !important;
}

.chatbot-bubble.chat-open .close-icon,
.chatbot-bubble.active .close-icon {
  display: block !important;
  opacity: 1 !important;
  transform: rotate(0deg) scale(1) !important;
}

@keyframes chatbot-pulse {
  0% { box-shadow: 0 8px 25px rgba(0, 207, 255, 0.5), 0 0 0 0 rgba(0, 207, 255, 0.4); }
  70% { box-shadow: 0 8px 25px rgba(0, 207, 255, 0.5), 0 0 0 14px rgba(0, 207, 255, 0); }
  100% { box-shadow: 0 8px 25px rgba(0, 207, 255, 0.5), 0 0 0 0 rgba(0, 207, 255, 0); }
}

/* ── Notification Badge ── */
.bot-badge {
  position: absolute !important;
  top: 2px !important;
  right: 2px !important;
  width: 12px !important;
  height: 12px !important;
  background: #ef4444 !important;
  border-radius: 50% !important;
  border: 2px solid #050c1a !important;
  animation: badge-pulse 1.5s infinite alternate !important;
}

@keyframes badge-pulse {
  0% { transform: scale(0.9); }
  100% { transform: scale(1.2); }
}

/* ── Chat Window (Desktop) ── */
.chat-window {
  position: fixed !important;
  bottom: 90px !important;
  right: 24px !important;
  left: auto !important;
  top: auto !important;
  width: 380px !important;
  max-width: calc(100vw - 48px) !important;
  max-height: calc(100vh - 120px) !important;
  height: 530px !important;
  border-radius: 20px !important;
  background: rgba(10, 22, 44, 0.98) !important;
  border: 1px solid rgba(0, 207, 255, 0.28) !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 207, 255, 0.15) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(18px) scale(0.95) !important;
  transform-origin: bottom right !important;
  transition: opacity 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              transform 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              visibility 0.3s ease !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  z-index: 100001 !important;
  box-sizing: border-box !important;
}

.chat-window.open,
.chat-window.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

/* ── Chat Header ── */
.chat-header {
  padding: 14px 16px !important;
  background: linear-gradient(135deg, rgba(0, 207, 255, 0.14), rgba(0, 91, 255, 0.1)) !important;
  border-bottom: 1px solid rgba(0, 207, 255, 0.18) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-shrink: 0 !important;
}

.chat-header-info {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.chat-avatar {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  position: relative !important;
  background: rgba(0, 207, 255, 0.12) !important;
  border: 2px solid rgba(0, 207, 255, 0.35) !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.chat-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.active-dot {
  position: absolute !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 10px !important;
  height: 10px !important;
  background: #22c55e !important;
  border-radius: 50% !important;
  border: 2px solid #081022 !important;
  animation: dot-pulse 1.8s infinite !important;
}

@keyframes dot-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.chat-header-info h4 {
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.chat-header-info span {
  font-size: 0.72rem !important;
  color: #22c55e !important;
  display: block !important;
  margin-top: 2px !important;
}

.chat-close {
  width: 32px !important;
  height: 32px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  color: rgba(255, 255, 255, 0.75) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.88rem !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.chat-close:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #ef4444 !important;
}

/* ── Chat Body ── */
.chat-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  scroll-behavior: smooth !important;
}

.chat-body::-webkit-scrollbar {
  width: 5px !important;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent !important;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 207, 255, 0.25) !important;
  border-radius: 3px !important;
}

/* ── Messages ── */
.chat-msg {
  display: flex !important;
  gap: 8px !important;
  align-items: flex-start !important;
  animation: msg-appear 0.28s ease !important;
}

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
  flex-direction: row-reverse !important;
}

.msg-avatar {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: rgba(0, 207, 255, 0.12) !important;
  border: 1px solid rgba(0, 207, 255, 0.25) !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.72rem !important;
  color: #00cfff !important;
}

.msg-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.msg-content {
  max-width: 86% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}

.msg-content p {
  margin: 0 0 6px 0 !important;
  font-size: 0.84rem !important;
  line-height: 1.5 !important;
}

.msg-content p:last-child {
  margin-bottom: 0 !important;
}

.chat-msg.bot .msg-content > div,
.chat-msg.bot .msg-content > p {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
  padding: 10px 13px !important;
  border-radius: 16px 16px 16px 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.chat-msg.user .msg-content > div,
.chat-msg.user .msg-content > p {
  background: linear-gradient(135deg, #00cfff, #0066ff) !important;
  color: #ffffff !important;
  padding: 10px 13px !important;
  border-radius: 16px 16px 4px 16px !important;
  font-weight: 500 !important;
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.35) !important;
}

/* ── Rich Card in Bot Msg ── */
.msg-card {
  background: rgba(0, 207, 255, 0.08) !important;
  border: 1px solid rgba(0, 207, 255, 0.2) !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin-top: 6px !important;
  font-size: 0.81rem !important;
  color: #cbd5e1 !important;
  line-height: 1.55 !important;
}

.msg-card strong {
  color: #00cfff !important;
  display: block !important;
  margin-bottom: 4px !important;
  font-size: 0.84rem !important;
}

.msg-card-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-bottom: 3px !important;
}

.msg-card-row i {
  color: #00cfff !important;
  width: 14px !important;
  font-size: 0.78rem !important;
}

/* ── Action Buttons inside Messages ── */
.msg-cta-row,
.chat-wa-cta-row {
  display: flex !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  margin-top: 8px !important;
}

.msg-cta-btn,
.chat-wa-cta {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  border: none !important;
  cursor: pointer !important;
  color: #ffffff !important;
}

.msg-cta-btn.wa,
.chat-wa-cta {
  background: linear-gradient(135deg, #25d366, #128c7e) !important;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3) !important;
}

.msg-cta-btn.call {
  background: linear-gradient(135deg, #005bff, #00c7ff) !important;
  box-shadow: 0 3px 10px rgba(0, 91, 255, 0.3) !important;
}

.msg-cta-btn.primary {
  background: linear-gradient(135deg, #00cfff, #005bff) !important;
}

.msg-cta-btn.ghost {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.msg-cta-btn:hover,
.chat-wa-cta:hover {
  transform: translateY(-1px) !important;
  filter: brightness(1.12) !important;
}

/* ── Typing Indicator ── */
.typing-indicator {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.typing-dots {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 10px 14px !important;
  border-radius: 16px 16px 16px 4px !important;
}

.typing-dot {
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: #00cfff !important;
}

.typing-dot:nth-child(1) { animation: typing-wave 1.2s infinite 0s !important; }
.typing-dot:nth-child(2) { animation: typing-wave 1.2s infinite 0.2s !important; }
.typing-dot:nth-child(3) { animation: typing-wave 1.2s infinite 0.4s !important; }

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

/* ── Suggestion Pills ── */
.chat-suggestions {
  padding: 8px 12px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(5, 12, 26, 0.6) !important;
  flex-shrink: 0 !important;
  max-height: 110px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.chat-sug-btn {
  padding: 5px 10px !important;
  background: rgba(0, 207, 255, 0.1) !important;
  border: 1px solid rgba(0, 207, 255, 0.25) !important;
  border-radius: 16px !important;
  color: #00cfff !important;
  font-size: 0.74rem !important;
  font-family: inherit !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  line-height: 1.3 !important;
}

.chat-sug-btn:hover,
.chat-sug-btn:active {
  background: rgba(0, 207, 255, 0.25) !important;
  border-color: rgba(0, 207, 255, 0.5) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.chat-sug-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* ── Chat Input Area ── */
.chat-input-area {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(0, 0, 0, 0.3) !important;
  flex-shrink: 0 !important;
}

.chat-input {
  flex: 1 1 auto !important;
  padding: 9px 12px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-family: inherit !important;
  outline: none !important;
  transition: border-color 0.2s, background 0.2s !important;
  resize: none !important;
  max-height: 70px !important;
  min-height: 38px !important;
  line-height: 1.35 !important;
  box-sizing: border-box !important;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4) !important;
  font-size: 0.8rem !important;
}

.chat-input:focus {
  border-color: rgba(0, 207, 255, 0.5) !important;
  background: rgba(0, 207, 255, 0.06) !important;
}

.chat-send-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  background: linear-gradient(135deg, #00cfff, #005bff) !important;
  border: none !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.88rem !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.chat-send-btn:hover {
  transform: scale(1.06) !important;
  box-shadow: 0 4px 14px rgba(0, 207, 255, 0.5) !important;
}

.chat-send-btn:active {
  transform: scale(0.94) !important;
}

/* ── Chat Footer ── */
.chat-footer {
  padding: 5px 12px 8px !important;
  flex-shrink: 0 !important;
  background: rgba(0, 0, 0, 0.25) !important;
}

.chat-footer-note {
  font-size: 0.68rem !important;
  color: rgba(255, 255, 255, 0.35) !important;
  text-align: center !important;
  margin: 0 !important;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE MEDIA QUERIES (MOBILE FIXES)
   ════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .floating-actions #waBtnFloat,
  .floating-actions #callBtnFloat {
    display: none !important;
  }

  .floating-actions {
    right: 12px !important;
    bottom: calc(130px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .chatbot-wrapper {
    position: fixed !important;
    right: 12px !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    width: 48px !important;
    height: 48px !important;
    z-index: 100000 !important;
  }

  .chatbot-bubble {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.15rem !important;
  }

  .chat-window {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    max-height: min(560px, calc(86vh - 75px)) !important;
    height: auto !important;
    margin: 0 auto !important;
    z-index: 100001 !important;
    border-radius: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 207, 255, 0.25) !important;
  }

  .chat-body {
    max-height: min(340px, calc(60vh - 110px)) !important;
    min-height: 180px !important;
    padding: 14px 12px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
  }

  .chat-suggestions {
    display: flex !important;
    flex-wrap: wrap !important;
    max-height: 110px !important;
    overflow-y: auto !important;
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  .chat-sug-btn {
    font-size: 0.74rem !important;
    padding: 6px 11px !important;
    border-radius: 20px !important;
    white-space: nowrap !important;
  }

  .chat-input-area {
    padding: 10px 12px !important;
  }
}

@media (max-width: 480px) {
  .floating-actions {
    right: 10px !important;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .chatbot-wrapper {
    right: 10px !important;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
    width: 46px !important;
    height: 46px !important;
  }

  .chatbot-bubble {
    width: 46px !important;
    height: 46px !important;
    font-size: 1.1rem !important;
  }

  .chat-window {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: min(540px, calc(88vh - 70px)) !important;
    border-radius: 18px !important;
  }

  .chat-header {
    padding: 12px 14px !important;
  }

  .chat-avatar {
    width: 34px !important;
    height: 34px !important;
  }

  .chat-header-info h4 {
    font-size: 0.9rem !important;
  }

  .chat-header-info span {
    font-size: 0.7rem !important;
  }

  .chat-body {
    max-height: min(320px, calc(58vh - 100px)) !important;
    min-height: 160px !important;
    padding: 12px 10px !important;
    gap: 10px !important;
  }

  .msg-content {
    max-width: 90% !important;
  }

  .chat-suggestions {
    max-height: 95px !important;
    padding: 6px 8px !important;
    gap: 5px !important;
  }

  .chat-sug-btn {
    font-size: 0.72rem !important;
    padding: 5px 9px !important;
  }

  .chat-input {
    font-size: 14px !important;
    padding: 8px 12px !important;
    min-height: 38px !important;
  }

  .chat-send-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }
}
