/* WP AI Chatbot widget — all classes prefixed waic- to avoid theme conflicts.
 * The primary color comes from the settings page via the --waic-primary
 * CSS variable (set inline by widget.js); #2271b1 is the fallback. */

.waic-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--waic-primary, #2271b1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 99999;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.waic-toggle:hover { filter: brightness(0.85); transform: scale(1.05); }

.waic-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.waic-panel.waic-open { display: flex; }

/* Bottom-left placement (settings → Position) */
.waic-toggle.waic-left,
.waic-panel.waic-left { right: auto; left: 24px; }

.waic-header {
  padding: 12px 16px;
  background: var(--waic-primary, #2271b1);
  color: #fff;
}
.waic-title { font-weight: 600; font-size: 15px; }
.waic-sub { font-size: 11px; opacity: 0.85; margin-top: 2px; font-weight: 400; }

.waic-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}

.waic-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: waic-fadein 0.18s ease-out;
}
@keyframes waic-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.waic-msg-user {
  align-self: flex-end;
  background: var(--waic-primary, #2271b1);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.waic-msg-bot {
  align-self: flex-start;
  background: #f0f0f1;
  color: #1d2327;
  border-bottom-left-radius: 4px;
}
.waic-msg-bot a {
  color: var(--waic-primary, #2271b1);
  text-decoration: underline;
  word-break: break-all;
}
.waic-msg-bot strong { font-weight: 600; }

/* Typing indicator — three pulsing dots */
.waic-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.waic-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7aaad;
  animation: waic-pulse 1.2s infinite ease-in-out;
}
.waic-typing span:nth-child(2) { animation-delay: 0.2s; }
.waic-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes waic-pulse {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30%           { opacity: 1; transform: translateY(-3px); }
}

.waic-inputrow {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #e0e0e0;
  padding: 8px;
}
.waic-input {
  flex: 1;
  border: none;
  padding: 10px 8px;
  font-size: 14px;
  outline: none;
  background: transparent;
}
.waic-counter {
  font-size: 12px;
  color: #a7aaad;
}
.waic-send {
  border: none;
  background: var(--waic-primary, #2271b1);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.waic-send:hover { filter: brightness(0.85); }
.waic-send:disabled { background: #dcdcde; color: #a7aaad; cursor: default; filter: none; }
