/* Codevia Chat Widget Styles
   Brand: dark navy (#0a1628) + teal (#00d4aa) accents
   Embeddable on any page via <link> or inlined by the JS widget */

:root {
  --cv-primary: #0a1628;
  --cv-primary-light: #132240;
  --cv-accent: #00d4aa;
  --cv-accent-hover: #00b894;
  --cv-text: #e8e8e8;
  --cv-text-muted: #8899aa;
  --cv-bg: #0d1b2e;
  --cv-bg-msg-user: #132240;
  --cv-bg-msg-bot: #0a1628;
  --cv-border: #1a2d4a;
  --cv-shadow: rgba(0, 0, 0, 0.4);
  --cv-radius: 12px;
  --cv-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Bubble trigger */
#cv-chat-bubble {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cv-accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--cv-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  transition: transform 0.2s, background 0.2s;
}
#cv-chat-bubble:hover {
  transform: scale(1.08);
  background: var(--cv-accent-hover);
}
#cv-chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: var(--cv-primary);
}

/* Chat panel */
#cv-chat-panel {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 48px);
  border-radius: var(--cv-radius);
  background: var(--cv-bg);
  border: 1px solid var(--cv-border);
  box-shadow: 0 8px 32px var(--cv-shadow);
  display: none;
  flex-direction: column;
  z-index: 99999 !important;
  font-family: var(--cv-font);
  overflow: hidden;
}
#cv-chat-panel.cv-open {
  display: flex;
}

/* Header */
#cv-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--cv-primary);
  border-bottom: 1px solid var(--cv-border);
}
#cv-chat-header-title {
  color: var(--cv-text);
  font-size: 15px;
  font-weight: 600;
}
#cv-chat-header-subtitle {
  color: var(--cv-text-muted);
  font-size: 12px;
  margin-top: 2px;
}
#cv-chat-close {
  background: none;
  border: none;
  color: var(--cv-text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
}
#cv-chat-close:hover {
  color: var(--cv-text);
}

/* Messages area */
#cv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#cv-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#cv-chat-messages::-webkit-scrollbar-thumb {
  background: var(--cv-border);
  border-radius: 2px;
}

/* Message bubbles */
.cv-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cv-text);
  word-wrap: break-word;
}
.cv-msg-user {
  align-self: flex-end;
  background: var(--cv-bg-msg-user);
  border: 1px solid var(--cv-border);
}
.cv-msg-bot {
  align-self: flex-start;
  background: var(--cv-bg-msg-bot);
  border: 1px solid var(--cv-border);
}
.cv-msg-bot strong, .cv-msg-bot b {
  color: var(--cv-accent);
}

/* Typing indicator */
.cv-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.cv-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cv-text-muted);
  animation: cv-bounce 1.4s infinite ease-in-out;
}
.cv-typing-dot:nth-child(1) { animation-delay: 0s; }
.cv-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cv-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cv-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input area */
#cv-chat-input-area {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--cv-border);
  background: var(--cv-primary);
  gap: 8px;
}
#cv-chat-input {
  flex: 1;
  background: var(--cv-bg);
  border: 1px solid var(--cv-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--cv-text);
  font-size: 14px;
  font-family: var(--cv-font);
  outline: none;
  resize: none;
  max-height: 80px;
}
#cv-chat-input::placeholder {
  color: var(--cv-text-muted);
}
#cv-chat-input:focus {
  border-color: var(--cv-accent);
}
#cv-chat-send {
  background: var(--cv-accent);
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#cv-chat-send:hover {
  background: var(--cv-accent-hover);
}
#cv-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#cv-chat-send svg {
  width: 18px;
  height: 18px;
  fill: var(--cv-primary);
}

/* Powered by */
#cv-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--cv-text-muted);
}
#cv-chat-footer a {
  color: var(--cv-accent);
  text-decoration: none;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #cv-chat-panel {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  #cv-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}

/* Honeypot fields — invisible to humans */
.cv-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  tabindex: -1;
}
