:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --bg: #ffffff;
  --bubble-bot: #f1f5f9;
  --bubble-user: #4f46e5;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Inter', -apple-system, sans-serif; }

/* Launcher */
#bot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, background 0.2s;
  z-index: 9999;
  border: none;
}
#bot-launcher:hover { background: var(--primary-dark); transform: scale(1.08); }
#bot-launcher svg { width: 28px; height: 28px; fill: white; }

/* Widget container */
#bot-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 580px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
}
#bot-widget.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}
#bot-widget.fullscreen {
  bottom: 0; right: 0;
  width: 100vw; height: 100vh;
  border-radius: 0;
}

/* Header */
.bot-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.bot-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.bot-info { flex: 1; }
.bot-name { font-weight: 600; font-size: 15px; }
.bot-status { font-size: 12px; opacity: 0.8; }
.header-actions { display: flex; gap: 8px; }
.header-btn {
  background: none; border: none; color: white;
  cursor: pointer; padding: 4px; border-radius: 6px;
  opacity: 0.8; transition: opacity 0.2s;
}
.header-btn:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.header-btn svg { width: 18px; height: 18px; display: block; }

/* Messages area */
.bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.bot-messages::-webkit-scrollbar { width: 4px; }
.bot-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Bubbles */
.msg { display: flex; gap: 8px; max-width: 85%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.bot { align-self: flex-start; }

.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.msg.bot .bubble {
  background: var(--bubble-bot);
  border-bottom-left-radius: 4px;
}
.msg.user .bubble {
  background: var(--bubble-user);
  color: white;
  border-bottom-right-radius: 4px;
}
.msg-time {
  font-size: 11px;
  color: var(--text-light);
  align-self: flex-end;
  margin-bottom: 2px;
  white-space: nowrap;
}

/* Typing indicator */
.typing .bubble { padding: 14px 16px; }
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px;
  background: var(--text-light);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Botões de escolha (Pergunta + Botões) */
.bot-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 10px 0;
  align-self: flex-start;
}
.bot-btn-choice {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.bot-btn-choice:hover {
  background: var(--primary);
  color: white;
}

/* CSAT */
.csat-card {
  background: #f8faff;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 14px;
  align-self: flex-start;
  max-width: 90%;
}
.csat-question { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 10px; }
.csat-stars { display: flex; gap: 6px; margin-bottom: 10px; }
.csat-star {
  font-size: 22px; cursor: pointer;
  transition: transform 0.15s;
  filter: grayscale(1);
}
.csat-star:hover, .csat-star.active { filter: none; transform: scale(1.2); }
.csat-comment {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  margin-bottom: 8px;
}
.csat-comment:focus { border-color: var(--primary); }
.csat-send {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.csat-send:hover { background: var(--primary-dark); }

/* Input area */
.bot-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
#bot-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
#bot-input:focus { border-color: var(--primary); }
#bot-send {
  width: 40px; height: 40px;
  background: var(--primary);
  border: none; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
#bot-send:hover { background: var(--primary-dark); }
#bot-send svg { width: 18px; height: 18px; fill: white; }
#bot-send:disabled { background: var(--border); cursor: not-allowed; }
