/* ===== CBT Claude Assistant Widget ===== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Lora:ital@0;1&display=swap');

:root {
  --cbt-primary:    #2d6a4f;
  --cbt-primary-lt: #52b788;
  --cbt-accent:     #b7e4c7;
  --cbt-bg:         #f8fdf9;
  --cbt-white:      #ffffff;
  --cbt-text:       #1b3a2d;
  --cbt-muted:      #6b9e82;
  --cbt-shadow:     0 8px 40px rgba(45,106,79,0.18);
  --cbt-radius:     18px;
}

/* Toggle Button */
#cbt-toggle-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cbt-primary), var(--cbt-primary-lt));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(45,106,79,0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#cbt-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(45,106,79,0.45);
}
.cbt-icon-close { display: none; }

/* Panel */
#cbt-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 99998;
  width: 360px;
  max-height: 540px;
  background: var(--cbt-white);
  border-radius: var(--cbt-radius);
  box-shadow: var(--cbt-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Open state */
#cbt-chat-widget.cbt-widget-open #cbt-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
#cbt-chat-widget.cbt-widget-open .cbt-icon-open { display: none; }
#cbt-chat-widget.cbt-widget-open .cbt-icon-close { display: flex; }

/* Header */
.cbt-header {
  background: linear-gradient(135deg, var(--cbt-primary) 0%, #1b4332 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.cbt-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cbt-header-info h3 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cbt-status {
  font-size: 12px;
  color: var(--cbt-accent);
  display: flex;
  align-items: center;
  gap: 5px;
}
.cbt-dot {
  width: 7px;
  height: 7px;
  background: #52b788;
  border-radius: 50%;
  display: inline-block;
  animation: cbt-pulse 2s infinite;
}
@keyframes cbt-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Messages */
#cbt-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--cbt-bg);
  scroll-behavior: smooth;
}
#cbt-messages::-webkit-scrollbar { width: 4px; }
#cbt-messages::-webkit-scrollbar-track { background: transparent; }
#cbt-messages::-webkit-scrollbar-thumb { background: var(--cbt-accent); border-radius: 4px; }

.cbt-message {
  display: flex;
  animation: cbt-fadein 0.3s ease;
}
@keyframes cbt-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cbt-message.cbt-user { justify-content: flex-end; }
.cbt-message.cbt-bot  { justify-content: flex-start; }

.cbt-bubble {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  font-family: 'DM Sans', sans-serif;
}
.cbt-bot .cbt-bubble {
  background: var(--cbt-white);
  color: var(--cbt-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(45,106,79,0.08);
}
.cbt-user .cbt-bubble {
  background: linear-gradient(135deg, var(--cbt-primary), var(--cbt-primary-lt));
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.cbt-typing .cbt-bubble {
  padding: 14px 18px;
}
.cbt-typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.cbt-typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--cbt-primary-lt);
  border-radius: 50%;
  animation: cbt-bounce 1.2s infinite;
}
.cbt-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.cbt-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cbt-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Input area */
.cbt-input-area {
  padding: 12px 14px;
  background: var(--cbt-white);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border-top: 1px solid #e8f5ec;
}
#cbt-input {
  flex: 1;
  border: 1.5px solid #d4edda;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--cbt-text);
  background: var(--cbt-bg);
  resize: none;
  outline: none;
  max-height: 100px;
  transition: border-color 0.2s;
  line-height: 1.5;
}
#cbt-input:focus { border-color: var(--cbt-primary-lt); }
#cbt-input::placeholder { color: #a8c9b4; }

#cbt-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cbt-primary), var(--cbt-primary-lt));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}
#cbt-send-btn:hover { transform: scale(1.05); }
#cbt-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.cbt-disclaimer {
  text-align: center;
  font-size: 10.5px;
  color: var(--cbt-muted);
  margin: 0 0 10px;
  font-family: 'DM Sans', sans-serif;
}

/* Mobile */
@media (max-width: 420px) {
  #cbt-chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 90px; }
  #cbt-toggle-btn { right: 16px; bottom: 20px; }
}
