/* Widget de chat RAG - styles isolés autant que possible du thème WordPress */
:root {
  --wprag-accent: #1f6f63;
  --wprag-accent-dark: #17554b;
  --wprag-bg: #ffffff;
  --wprag-text: #1c1c1c;
  --wprag-muted: #6b7280;
  --wprag-border: #e6e6e6;
  --wprag-bot-bubble: #f2f6f5;
  --wprag-user-bubble: #1f6f63;
}

#wprag-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wprag-accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  border: none;
  cursor: pointer;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
#wprag-launcher:hover {
  background: var(--wprag-accent-dark);
  transform: scale(1.05);
}
#wprag-launcher svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

#wprag-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: var(--wprag-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  border: 1px solid var(--wprag-border);
}
#wprag-panel.wprag-open {
  display: flex;
}

#wprag-header {
  background: var(--wprag-accent);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#wprag-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
#wprag-close:hover { opacity: 1; }

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

.wprag-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--wprag-text);
  white-space: pre-wrap;
}
.wprag-msg.bot {
  background: var(--wprag-bot-bubble);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.wprag-msg.user {
  background: var(--wprag-user-bubble);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.wprag-sources {
  font-size: 12px;
  margin-top: 6px;
  color: var(--wprag-muted);
}
.wprag-sources a {
  color: var(--wprag-accent);
  text-decoration: none;
}
.wprag-sources a:hover { text-decoration: underline; }

.wprag-typing {
  align-self: flex-start;
  color: var(--wprag-muted);
  font-size: 13px;
  padding: 4px 13px;
}

#wprag-form {
  display: flex;
  border-top: 1px solid var(--wprag-border);
  padding: 10px;
  gap: 8px;
}
#wprag-input {
  flex: 1;
  border: 1px solid var(--wprag-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
}
#wprag-input:focus {
  border-color: var(--wprag-accent);
}
#wprag-send {
  background: var(--wprag-accent);
  border: none;
  color: #fff;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#wprag-send:hover { background: var(--wprag-accent-dark); }
#wprag-send:disabled { opacity: 0.5; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  #wprag-launcher { transition: none; }
}
