/* Comms Unlimited AI Chat Widget */

#cu-chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #d42b2b;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(212, 43, 43, 0.45), 0 2px 8px rgba(0,0,0,0.4);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  outline: none;
}

#cu-chat-fab:hover {
  background: #b01f1f;
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(212, 43, 43, 0.55), 0 2px 10px rgba(0,0,0,0.5);
}

#cu-chat-fab:active {
  transform: scale(0.97);
}

#cu-chat-fab svg {
  width: 24px;
  height: 24px;
  color: #fff;
  transition: opacity 0.15s ease;
}

#cu-chat-fab .cu-fab-icon-chat { display: flex; }
#cu-chat-fab .cu-fab-icon-close { display: none; }
#cu-chat-fab.open .cu-fab-icon-chat { display: none; }
#cu-chat-fab.open .cu-fab-icon-close { display: flex; }

#cu-chat-bubble {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 8999;
  width: 380px;
  max-width: calc(100vw - 56px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #111111;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#cu-chat-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.cu-chat-header {
  background: #0a0a0a;
  border-bottom: 1px solid #2a2a2a;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cu-chat-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d42b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cu-chat-header-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.cu-chat-header-info {
  flex: 1;
  min-width: 0;
}

.cu-chat-header-name {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

.cu-chat-header-status {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #666666;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.cu-chat-header-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.cu-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.cu-chat-messages::-webkit-scrollbar { width: 4px; }
.cu-chat-messages::-webkit-scrollbar-track { background: transparent; }
.cu-chat-messages::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }

.cu-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 100%;
}

.cu-msg.cu-msg-user { flex-direction: row-reverse; }

.cu-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}

.cu-msg-ai .cu-msg-avatar { background: #d42b2b; color: #fff; }
.cu-msg-user .cu-msg-avatar { background: #2a2a2a; color: #bbbbbb; }

.cu-msg-body {
  max-width: calc(100% - 40px);
  padding: 10px 13px;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.cu-msg-ai .cu-msg-body {
  background: #1a1a1a;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
  border: 1px solid #2a2a2a;
}

.cu-msg-user .cu-msg-body {
  background: #d42b2b;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.cu-msg-body p { margin: 0 0 6px; }
.cu-msg-body p:last-child { margin-bottom: 0; }
.cu-msg-body strong { font-weight: 600; }
.cu-msg-body code {
  background: #0a0a0a;
  color: #d42b2b;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12.5px;
}
.cu-msg-body ul, .cu-msg-body ol { margin: 4px 0 4px 16px; padding: 0; }
.cu-msg-body li { margin-bottom: 3px; }

.cu-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 13px;
}

.cu-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
  animation: cu-bounce 1.2s ease-in-out infinite;
}
.cu-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.cu-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cu-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.cu-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.cu-suggestion-btn {
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #888888;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.cu-suggestion-btn:hover {
  border-color: #d42b2b;
  color: #d42b2b;
  background: rgba(212, 43, 43, 0.06);
}

.cu-chat-input-area {
  border-top: 1px solid #2a2a2a;
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #0a0a0a;
  flex-shrink: 0;
}

#cu-chat-input {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  color: #e0e0e0;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  padding: 9px 12px;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 100px;
  line-height: 1.5;
  transition: border-color 0.15s;
}

#cu-chat-input::placeholder { color: #444444; }
#cu-chat-input:focus { border-color: #d42b2b; }

#cu-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #d42b2b;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
  outline: none;
}

#cu-chat-send:hover { background: #b01f1f; }
#cu-chat-send:active { transform: scale(0.93); }
#cu-chat-send:disabled { background: #2a2a2a; cursor: not-allowed; }

#cu-chat-send svg { width: 16px; height: 16px; color: #fff; }

.cu-chat-error {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #f87171;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  #cu-chat-bubble {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 84px;
  }
  #cu-chat-fab {
    right: 16px;
    bottom: 16px;
  }
}
