/* ClaudeAI Chat — Widget Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

#caic-root * { box-sizing: border-box; font-family: 'DM Sans', sans-serif; }

/* LAUNCHER BUTTON */
#caic-launcher {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  transition: transform .2s ease, box-shadow .2s ease;
  background: var(--caic-primary, #6c63ff);
  overflow: hidden;
}

#caic-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,.3);
}

#caic-launcher svg { width: 26px; height: 26px; fill: white; transition: opacity .2s; }
#caic-launcher .caic-icon-close { display: none; }
#caic-launcher.open .caic-icon-chat  { display: none; }
#caic-launcher.open .caic-icon-close { display: block; }

#caic-launcher .caic-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* UNREAD BADGE */
#caic-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}

/* CHAT WINDOW */
#caic-window {
  position: fixed;
  z-index: 99999;
  width: 370px;
  max-height: 560px;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
  background: #fff;
  opacity: 0;
  transform: translateY(20px) scale(.97);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}

#caic-window.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* HEADER */
#caic-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.caic-agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 18px;
}

.caic-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.caic-agent-info { flex: 1; }
.caic-agent-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.caic-agent-status { font-size: 11px; opacity: .85; display: flex; align-items: center; gap: 4px; }
.caic-status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
  animation: caic-pulse 2s infinite;
}

@keyframes caic-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .5; }
}

#caic-close-btn {
  background: rgba(255,255,255,.2);
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
#caic-close-btn:hover { background: rgba(255,255,255,.35); }
#caic-close-btn svg { width: 14px; height: 14px; fill: white; }

/* MESSAGES */
#caic-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafc;
  scroll-behavior: smooth;
}

#caic-messages::-webkit-scrollbar { width: 4px; }
#caic-messages::-webkit-scrollbar-track { background: transparent; }
#caic-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.caic-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: caic-msg-in .25s ease;
}

@keyframes caic-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.caic-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.caic-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.caic-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
}

.caic-msg.bot .caic-msg-bubble {
  background: white;
  color: #1a1d2e;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

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

.caic-msg.user .caic-msg-bubble {
  background: var(--caic-primary, #6c63ff);
  color: white;
  border-bottom-right-radius: 4px;
}

/* TYPING INDICATOR */
.caic-typing .caic-msg-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.caic-typing-dot {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: caic-bounce .9s infinite;
}
.caic-typing-dot:nth-child(2) { animation-delay: .15s; }
.caic-typing-dot:nth-child(3) { animation-delay: .3s; }

@keyframes caic-bounce {
  0%,80%,100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* INPUT */
#caic-input-row {
  padding: 12px 14px;
  background: white;
  border-top: 1px solid #eef0f5;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

#caic-input {
  flex: 1;
  border: 1px solid #e2e5ef;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
  font-family: 'DM Sans', sans-serif;
  background: #f7f8fc;
  transition: border-color .15s;
}

#caic-input:focus {
  outline: none;
  border-color: var(--caic-primary, #6c63ff);
  background: white;
}

#caic-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: var(--caic-primary, #6c63ff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .15s;
}
#caic-send-btn:hover { transform: scale(1.05); }
#caic-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#caic-send-btn svg { width: 16px; height: 16px; fill: white; }



@media (max-width: 400px) {
  #caic-window { width: calc(100vw - 20px); }
}
