/* ===== TSH AI Chatbot Widget ===== */

.chatbot-bubble {
  position: fixed;
  bottom: 28px;
  right: 100px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d5c63, #0e7c86);
  border: none;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(13, 92, 99, 0.35);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: chatbotPulse 2s infinite;
}
.chatbot-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(13, 92, 99, 0.45);
}
.chatbot-bubble svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: transform 0.3s;
}
.cb-logo-img {
  width: 48px;
  height: 48px;
  pointer-events: none;
  border-radius: 50%;
}
.chatbot-bubble .cb-icon-close { display: none; }
.chatbot-bubble.open .cb-icon-chat { display: none; }
.chatbot-bubble.open .cb-icon-close { display: block; }
.chatbot-bubble.open { animation: none; }

@keyframes chatbotPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(13, 92, 99, 0.35); }
  50% { box-shadow: 0 4px 20px rgba(13, 92, 99, 0.55), 0 0 0 8px rgba(13, 92, 99, 0.1); }
}

/* Chat Panel */
.chatbot-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(13, 92, 99, 0.2);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chatbot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.cb-header {
  background: linear-gradient(135deg, #084349, #0d5c63, #0e7c86);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.cb-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.cb-header-info { flex: 1; }
.cb-header-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}
.cb-header-status {
  font-size: 0.75rem;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cb-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00b894;
  display: inline-block;
}
.cb-header-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.cb-header-close:hover { opacity: 1; }
.cb-header-close svg { width: 20px; height: 20px; fill: currentColor; }

/* Messages */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f5fafa;
  scrollbar-width: thin;
  scrollbar-color: #dce8e8 transparent;
}
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: #dce8e8; border-radius: 4px; }

.cb-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.cb-msg-bot {
  background: #fff;
  color: #1a1a2e;
  align-self: flex-start;
  border: 1px solid #dce8e8;
  border-bottom-left-radius: 4px;
}
.cb-msg-user {
  background: linear-gradient(135deg, #0d5c63, #0e7c86);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.cb-msg-bot p { margin: 0 0 8px; }
.cb-msg-bot p:last-child { margin-bottom: 0; }
.cb-msg-bot ul, .cb-msg-bot ol {
  margin: 4px 0 8px;
  padding-left: 18px;
}
.cb-msg-bot li { margin-bottom: 2px; }
.cb-msg-bot strong { font-weight: 700; }
.cb-msg-bot a {
  color: #0e7c86;
  text-decoration: underline;
}

/* Typing indicator */
.cb-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #dce8e8;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 60px;
}
.cb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
  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% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Input */
.cb-input-area {
  padding: 12px 16px;
  border-top: 1px solid #dce8e8;
  display: flex;
  gap: 8px;
  background: #fff;
  flex-shrink: 0;
}
.cb-input {
  flex: 1;
  border: 1px solid #dce8e8;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #f5fafa;
}
.cb-input:focus { border-color: #0e7c86; }
.cb-input::placeholder { color: #666; }
.cb-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d5c63, #0e7c86);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
.cb-send:hover { transform: scale(1.05); }
.cb-send:disabled { opacity: 0.5; cursor: not-allowed; }
.cb-send svg { width: 18px; height: 18px; fill: #fff; }

/* Powered by */
.cb-powered {
  text-align: center;
  padding: 6px;
  font-size: 0.75rem;
  color: #666;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}
.cb-powered a { color: #0e7c86; text-decoration: none; }

/* WhatsApp button shift when chatbot present — no longer needed since buttons are side by side */

/* Quick replies */
.cb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #f5fafa;
}
.cb-quick-btn {
  background: #fff;
  border: 1px solid #0e7c86;
  color: #0d5c63;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-weight: 500;
}
.cb-quick-btn:hover {
  background: #0d5c63;
  color: #fff;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .chatbot-panel {
    width: calc(100vw - 24px);
    height: calc(100dvh - 140px);
    bottom: 90px;
    right: 12px;
    border-radius: 12px;
  }
  .chatbot-bubble {
    width: 54px;
    height: 54px;
    bottom: 20px;
    right: 80px;
  }
}
