/* AI Website Chat Widget — v1.0 stylesheet */

:root {
  --cw-primary: #2563eb;
  --cw-primary-dark: #1d4ed8;
  --cw-bg: #ffffff;
  --cw-text: #111827;
  --cw-muted: #6b7280;
  --cw-border: #e5e7eb;
  --cw-user-bubble: #2563eb;
  --cw-user-text: #ffffff;
  --cw-bot-bubble: #f3f4f6;
  --cw-bot-text: #111827;
  --cw-radius: 16px;
  --cw-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --cw-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.cw-root {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 999999;
  font-family: var(--cw-font);
}

.cw-hidden {
  display: none !important;
}

/* Floating launcher button */
.cw-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--cw-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--cw-shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.cw-launcher:hover {
  background: var(--cw-primary-dark);
  transform: scale(1.05);
}

/* Chat panel */
.cw-panel {
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 100px);
  background: var(--cw-bg);
  border-radius: var(--cw-radius);
  box-shadow: var(--cw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 0;
}

.cw-header {
  background: var(--cw-primary);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}

.cw-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.cw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cw-bg);
}

.cw-msg {
  display: flex;
  max-width: 80%;
}

.cw-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.cw-msg-user {
  align-self: flex-end;
}

.cw-msg-user .cw-msg-bubble {
  background: var(--cw-user-bubble);
  color: var(--cw-user-text);
  border-bottom-right-radius: 4px;
}

.cw-msg-bot {
  align-self: flex-start;
}

.cw-msg-bot .cw-msg-bubble {
  background: var(--cw-bot-bubble);
  color: var(--cw-bot-text);
  border-bottom-left-radius: 4px;
}

.cw-msg-typing .cw-msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}

.cw-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cw-muted);
  animation: cw-blink 1.2s infinite ease-in-out;
}

.cw-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.cw-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes cw-blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.cw-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--cw-border);
  background: var(--cw-bg);
}

.cw-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--cw-font);
  font-size: 14px;
  color: var(--cw-text);
  max-height: 120px;
  outline: none;
}

.cw-input:focus {
  border-color: var(--cw-primary);
}

.cw-send {
  background: var(--cw-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cw-send:hover {
  background: var(--cw-primary-dark);
}

.cw-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .cw-root {
    bottom: 12px;
    right: 12px;
  }
  .cw-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 90px);
  }
}
