/* ChenBridge AI Chatbot Widget - Sleek Glassmorphic AI Capsule */

#cb-teaser {
  display: none !important;
}

#cb-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#cb-chat-btn {
  width: auto;
  height: 44px;
  padding: 0 18px 0 14px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0F3D2E 0%, #164D3B 100%);
  border: 1.5px solid rgba(196, 165, 116, 0.45);
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 6px 20px rgba(15, 61, 46, 0.35), 0 0 14px rgba(196, 165, 116, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  white-space: nowrap;
}

#cb-chat-btn::before,
#cb-chat-btn::after {
  display: none !important;
}

#cb-chat-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #144E3B 0%, #1C5D47 100%);
  border-color: #C4A574;
  box-shadow: 0 10px 26px rgba(15, 61, 46, 0.45), 0 0 20px rgba(196, 165, 116, 0.35);
}

.cb-pill-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #C4A574;
}

.cb-pill-label {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: opacity 0.25s, max-width 0.3s;
  max-width: 200px;
}

.cb-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
  display: inline-block;
}

/* Semi-hidden / Collapsed mode on scroll */
#cb-chat-btn.collapsed {
  padding: 0;
  width: 44px;
  height: 44px;
  justify-content: center;
  border-radius: 50%;
  opacity: 0.85;
}

#cb-chat-btn.collapsed .cb-pill-label {
  max-width: 0;
  opacity: 0;
  margin: 0;
  overflow: hidden;
}

#cb-chat-btn.collapsed:hover {
  width: auto;
  padding: 0 18px 0 14px;
  border-radius: 9999px;
  opacity: 1;
}

#cb-chat-btn.collapsed:hover .cb-pill-label {
  max-width: 200px;
  opacity: 1;
}

/* Chat Window */
#cb-chat-window {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  height: 520px;
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15, 61, 46, 0.25), 0 0 0 1px rgba(196, 165, 116, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: cb-chat-fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cb-chat-fade-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#cb-chat-header {
  background: linear-gradient(135deg, #091C15 0%, #0F3D2E 100%);
  color: #FFFFFF;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(196, 165, 116, 0.3);
}

#cb-chat-header .cb-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cb-avatar-brand {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(196, 165, 116, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-avatar-brand img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

#cb-chat-header .cb-title {
  font-weight: 700;
  color: #FFFFFF;
  font-size: 14px;
}

#cb-chat-header .cb-sub {
  font-size: 11.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

#cb-chat-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  font-size: 20px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

#cb-chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

#cb-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8F9F9;
}

.cb-msg {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cb-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0F3D2E, #164D3B);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.cb-msg.bot {
  align-self: flex-start;
  background: #FFFFFF;
  color: #1A2E26;
  border: 1px solid #E8ECEB;
  border-bottom-left-radius: 4px;
}

.cb-msg.bot strong {
  font-weight: 700;
  color: #0F3D2E;
}

.cb-msg.bot ul,
.cb-msg.bot ol {
  margin: 8px 0;
  padding-left: 18px;
}

.cb-msg.bot li {
  margin-bottom: 5px;
  line-height: 1.5;
}

#cb-chat-input-area {
  display: flex;
  padding: 14px 16px;
  border-top: 1px solid #EAEFEA;
  gap: 10px;
  background: #FFFFFF;
  align-items: center;
}

#cb-chat-input {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid #DFE5E2;
  border-radius: 24px;
  outline: none;
  font-size: 13.5px;
  transition: all 0.2s;
  background: #F8FAF9;
  color: #1A2E26;
}

#cb-chat-input:focus {
  border-color: #0F3D2E;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(15, 61, 46, 0.1);
}

#cb-chat-send {
  background: linear-gradient(135deg, #F28C28 0%, #E07B1A 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 24px;
  padding: 11px 22px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(242, 140, 40, 0.3);
}

#cb-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(242, 140, 40, 0.45);
}

#cb-chat-send:disabled {
  opacity: 0.5;
  transform: none;
  cursor: not-allowed;
}

.cb-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 18px !important;
}

.cb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C4A574;
  opacity: 0.4;
  animation: cb-typing 1s infinite;
}

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

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

@media (max-width: 480px) {
  #cb-chat-widget {
    bottom: 16px;
    right: 16px;
  }
  #cb-chat-btn {
    height: 40px;
    padding: 0 13px 0 10px;
    gap: 7px;
  }
  #cb-chat-input {
    font-size: 16px;
  }
  .cb-pill-label {
    font-size: 12.5px;
  }
  #cb-chat-window {
    position: fixed;
    bottom: 16px;
    right: 12px;
    left: 12px;
    width: auto;
    height: min(76vh, 540px);
    border-radius: 18px;
  }
}