/* Clever Conveyance AI Chat widget styles */

#cc-ai-chat-root {
  position: fixed;
  z-index: 100000;
  bottom: 20px;
  left: 20px; /* left-hand side of the screen, as requested — the site's other sticky "join"
                 button lives at right:100px/bottom:20px, so this deliberately avoids that side */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.cc-ai-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #27187f;
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(39, 24, 127, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.cc-ai-bubble:hover { background: #1a1158; transform: translateY(-2px); }
.cc-ai-bubble svg { width: 28px; height: 28px; }

.cc-ai-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #FF6600;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.cc-ai-panel {
  position: absolute;
  bottom: 74px;
  left: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(41, 51, 102, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e0e5f5;
}
.cc-ai-panel.open { display: flex; }

.cc-ai-header {
  background: #27187f;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cc-ai-header-title { display: flex; flex-direction: column; }
.cc-ai-header-title strong { font-size: 0.95rem; }
.cc-ai-header-title span { font-size: 0.75rem; opacity: 0.8; }
.cc-ai-header-actions { display: flex; align-items: center; gap: 8px; }
.cc-ai-header button {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.9;
  padding: 4px;
  display: flex;
}
.cc-ai-header button:hover { opacity: 1; }
.cc-ai-header svg { width: 18px; height: 18px; }

.cc-ai-tabs {
  display: flex;
  border-bottom: 1px solid #e0e5f5;
  flex-shrink: 0;
}
.cc-ai-tab {
  flex: 1;
  border: none;
  background: #f8f9fe;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
}
.cc-ai-tab.active { background: #fff; color: #27187f; box-shadow: inset 0 -2px 0 #27187f; }

.cc-ai-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.cc-ai-text { display: none; flex-direction: column; flex: 1; min-height: 0; }
.cc-ai-text.active { display: flex; }

/* --- Text mode --- */
.cc-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cc-ai-msg { max-width: 82%; padding: 9px 13px; border-radius: 16px; font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; }
.cc-ai-msg.assistant { align-self: flex-start; background: #f2f4ff; color: #27187f; border-bottom-left-radius: 4px; }
.cc-ai-msg.user { align-self: flex-end; background: #27187f; color: #fff; border-bottom-right-radius: 4px; }
.cc-ai-msg.error { align-self: flex-start; background: #fdecec; color: #9b2c2c; border-bottom-left-radius: 4px; }
.cc-ai-typing { align-self: flex-start; display: flex; gap: 4px; padding: 10px 13px; }
.cc-ai-typing span { width: 6px; height: 6px; border-radius: 50%; background: #b7bce0; animation: cc-ai-bounce 1.2s infinite ease-in-out; }
.cc-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.cc-ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cc-ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.6; } 30% { transform: translateY(-4px); opacity: 1; } }

.cc-ai-inputrow {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e0e5f5;
  flex-shrink: 0;
}
.cc-ai-inputrow input {
  flex: 1;
  border: 1px solid #dcdfe6;
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 0.88rem;
  outline: none;
}
.cc-ai-inputrow input:focus { border-color: #6c63ff; }
.cc-ai-send {
  background: #27187f;
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.cc-ai-send:hover { background: #1a1158; }
.cc-ai-send svg { width: 16px; height: 16px; }

/* --- Voice mode --- */
.cc-ai-voice {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
}
.cc-ai-voice.active { display: flex; }

.cc-ai-voice-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cc-ai-voice-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid #e0e5f5;
  text-align: center;
}

.cc-ai-voice-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6c63ff, #27187f);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.4);
}
.cc-ai-voice-orb svg { width: 24px; height: 24px; }
.cc-ai-voice-orb.listening { animation: cc-ai-pulse 1.4s infinite; }
.cc-ai-voice-orb.speaking { animation: cc-ai-pulse-fast 0.8s infinite; }
@keyframes cc-ai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.35); }
  70% { box-shadow: 0 0 0 18px rgba(108, 99, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0); }
}
@keyframes cc-ai-pulse-fast {
  0% { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.35); }
  70% { box-shadow: 0 0 0 14px rgba(255, 102, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0); }
}

.cc-ai-voice-status { font-size: 0.85rem; color: #555; font-weight: 600; min-height: 1.2em; }

.cc-ai-voice-unmute {
  border: 1px solid #FF6600;
  background: #fff5e1;
  color: #b45309;
  border-radius: 20px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}

.cc-ai-voice-btn {
  border: none;
  border-radius: 24px;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.cc-ai-voice-btn.start { background: #27187f; color: #fff; }
.cc-ai-voice-btn.start:hover { background: #1a1158; }
.cc-ai-voice-btn.end { background: #fdecec; color: #9b2c2c; }
.cc-ai-voice-btn.end:hover { background: #fbd9d9; }

@media (max-width: 420px) {
  #cc-ai-chat-root { left: 12px; bottom: 12px; }
  .cc-ai-panel { width: calc(100vw - 24px); left: -8px; }
}
