/* WooCommerce AI Chatbot Widget */
:root {
  --wac-accent: #6c47ff;
  --wac-accent-dark: #5535d4;
  --wac-radius: 16px;
  --wac-shadow: 0 8px 40px rgba(0,0,0,0.18);
  --wac-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#wac-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--wac-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--wac-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 26px;
  line-height: 1;
}

#wac-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
}

#wac-launcher .wac-icon-open,
#wac-launcher .wac-icon-close { transition: opacity 0.2s, transform 0.2s; position: absolute; }
#wac-launcher .wac-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
#wac-launcher.wac-open .wac-icon-open  { opacity: 0; transform: rotate(90deg) scale(0.6); }
#wac-launcher.wac-open .wac-icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

/* Unread badge */
#wac-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #ff4646;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#wac-badge.visible { display: block; }

/* Chat window */
#wac-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  border-radius: var(--wac-radius);
  box-shadow: var(--wac-shadow);
  background: #fff;
  display: flex;
  flex-direction: column;
  z-index: 999997;
  overflow: hidden;
  font-family: var(--wac-font);
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

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

/* Header */
#wac-header {
  background: var(--wac-accent);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.wac-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.wac-header-info { flex: 1; }
.wac-header-info strong { display: block; font-size: 15px; font-weight: 600; }
.wac-header-info span  { font-size: 12px; opacity: 0.85; }

.wac-online-dot {
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
  animation: wac-pulse 2s infinite;
}

@keyframes wac-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Messages */
#wac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fc;
  scroll-behavior: smooth;
}

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

.wac-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 90%;
  animation: wac-fadein 0.2s ease;
}

@keyframes wac-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wac-msg.bot  { align-self: flex-start; }
.wac-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.wac-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--wac-accent);
  color: #fff;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.wac-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 100%;
  word-break: break-word;
}

.wac-msg.bot  .wac-bubble { background: #fff; border: 1px solid #e8e8f0; border-bottom-left-radius: 4px; color: #1a1a2e; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.wac-msg.user .wac-bubble { background: var(--wac-accent); color: #fff; border-bottom-right-radius: 4px; }

/* Markdown-like formatting in bubble */
.wac-bubble strong { font-weight: 600; }
.wac-bubble ul { margin: 6px 0 2px 16px; padding: 0; }
.wac-bubble li { margin: 3px 0; }

/* Typing indicator */
.wac-typing .wac-bubble {
  padding: 11px 14px;
  display: flex; gap: 4px; align-items: center;
}
.wac-dot {
  width: 7px; height: 7px;
  background: #b0b0c8;
  border-radius: 50%;
  animation: wac-bounce 1.2s infinite;
}
.wac-dot:nth-child(2) { animation-delay: 0.2s; }
.wac-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Quick replies */
#wac-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 4px;
  background: #f7f8fc;
}

.wac-quick-btn {
  background: #fff;
  border: 1.5px solid var(--wac-accent);
  color: var(--wac-accent);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: var(--wac-font);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.wac-quick-btn:hover {
  background: var(--wac-accent);
  color: #fff;
}

/* Input area */
#wac-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}

#wac-input {
  flex: 1;
  border: 1.5px solid #e0e0ee;
  border-radius: 24px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: var(--wac-font);
  outline: none;
  resize: none;
  transition: border-color 0.2s;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.4;
}

#wac-input:focus { border-color: var(--wac-accent); }
#wac-input::placeholder { color: #aaa; }

#wac-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--wac-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
  font-size: 16px;
}

#wac-send:hover  { background: var(--wac-accent-dark); transform: scale(1.08); }
#wac-send:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* Powered by */
#wac-footer {
  text-align: center;
  font-size: 11px;
  color: #bbb;
  padding: 5px 0 7px;
  background: #fff;
  flex-shrink: 0;
  font-family: var(--wac-font);
}

/* Mobile tweaks */
@media (max-width: 480px) {
  #wac-window { bottom: 80px; right: 12px; width: calc(100vw - 24px); }
  #wac-launcher { bottom: 16px; right: 16px; }
}
