/* ============================================================================
   Lane Cove Acupuncture — Chatbot widget
   Self-contained, scoped under .lca-chatbot to avoid clashing with site CSS.
   Warm sienna / bronze palette with sage accent.
   ============================================================================ */

.lca-chatbot,
.lca-chatbot * { box-sizing: border-box; }

.lca-chatbot {
  --lca-primary:    #8E5B2F;
  --lca-primary-2:  #B07B45;
  --lca-accent:     #2E6B4F;
  --lca-bg:         #ffffff;
  --lca-bg-alt:     #FBF6EE;
  --lca-bubble-u:   #8E5B2F;
  --lca-bubble-a:   #FBF1E5;
  --lca-text:       #2A1F14;
  --lca-muted:      #7A6655;
  --lca-border:     #E0D2BE;
  --lca-shadow:     0 10px 40px rgba(0,0,0,0.18);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--lca-text);
  line-height: 1.45;

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483000;
}

.lca-chatbot__launcher {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lca-primary), var(--lca-primary-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: var(--lca-shadow);
  transition: transform 0.18s ease;
  position: relative;
}
.lca-chatbot__launcher:hover { transform: translateY(-2px); }
.lca-chatbot__launcher svg { width: 28px; height: 28px; }
.lca-chatbot__launcher .lca-chatbot__logo-img { width: 32px; height: 32px; object-fit: contain; }
.lca-chatbot__avatar  .lca-chatbot__logo-img { width: 26px; height: 26px; object-fit: contain; }
.lca-chatbot__launcher .lca-chatbot__badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--lca-accent);
  color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  display: none;
}
.lca-chatbot__launcher.has-unread .lca-chatbot__badge { display: block; }

.lca-chatbot__window {
  position: absolute;
  bottom: 78px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: var(--lca-bg);
  border-radius: 16px;
  box-shadow: var(--lca-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.lca-chatbot.open .lca-chatbot__window {
  display: flex; opacity: 1; transform: translateY(0);
}

.lca-chatbot__header {
  background: linear-gradient(135deg, var(--lca-primary), var(--lca-primary-2));
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
.lca-chatbot__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lca-chatbot__avatar svg { width: 22px; height: 22px; }
.lca-chatbot__title { font-weight: 600; font-size: 15px; line-height: 1.1; }
.lca-chatbot__subtitle { font-size: 12px; opacity: 0.85; }
.lca-chatbot__close {
  margin-left: auto;
  background: transparent; border: none; color: #fff;
  font-size: 22px; line-height: 1;
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.lca-chatbot__close:hover { background: rgba(255,255,255,0.15); }

.lca-chatbot__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--lca-bg-alt);
}
.lca-chatbot__msg { display: flex; margin-bottom: 10px; }
.lca-chatbot__msg-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.lca-chatbot__msg.user { justify-content: flex-end; }
.lca-chatbot__msg.user .lca-chatbot__msg-bubble {
  background: var(--lca-bubble-u);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.lca-chatbot__msg.assistant .lca-chatbot__msg-bubble {
  background: var(--lca-bubble-a);
  color: var(--lca-text);
  border-bottom-left-radius: 4px;
}
.lca-chatbot__msg.system .lca-chatbot__msg-bubble {
  background: #FFF3CD;
  color: #664D03;
  font-size: 12px;
  width: 100%; max-width: 100%;
  text-align: center;
  border-radius: 8px;
}
.lca-chatbot__msg-bubble a { color: inherit; text-decoration: underline; }

.lca-chatbot__sources {
  font-size: 11px;
  color: var(--lca-muted);
  margin: -4px 0 8px 4px;
}
.lca-chatbot__sources a { color: var(--lca-primary); text-decoration: none; }
.lca-chatbot__sources a:hover { text-decoration: underline; }

.lca-chatbot__typing {
  display: inline-flex; gap: 4px;
  padding: 8px 0;
}
.lca-chatbot__typing span {
  width: 7px; height: 7px;
  background: var(--lca-muted);
  border-radius: 50%;
  animation: lca-blink 1.2s infinite ease-in-out both;
}
.lca-chatbot__typing span:nth-child(2) { animation-delay: 0.2s; }
.lca-chatbot__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lca-blink { 0%,80%,100% { opacity: 0.2; } 40% { opacity: 1; } }

.lca-chatbot__lead {
  background: #fff;
  border: 1px solid var(--lca-border);
  border-radius: 12px;
  padding: 12px;
  margin: 4px 0 10px;
}
.lca-chatbot__lead h4 {
  margin: 0 0 6px; font-size: 13px; color: var(--lca-primary);
  font-weight: 600;
}
.lca-chatbot__lead p { margin: 0 0 8px; font-size: 12px; color: var(--lca-muted); }
.lca-chatbot__lead input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--lca-border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
  font-family: inherit;
  color: var(--lca-text);
  background: #fff;
}
.lca-chatbot__lead input:focus {
  outline: none;
  border-color: var(--lca-primary-2);
  box-shadow: 0 0 0 3px rgba(176,123,69,0.18);
}
.lca-chatbot__lead-actions { display: flex; gap: 6px; margin-top: 4px; }
.lca-chatbot__btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.lca-chatbot__btn--primary { background: var(--lca-primary); color: #fff; }
.lca-chatbot__btn--primary:hover { background: var(--lca-primary-2); }
.lca-chatbot__btn--ghost   { background: transparent; color: var(--lca-muted); }
.lca-chatbot__btn--ghost:hover { color: var(--lca-primary); }

.lca-chatbot__footer {
  border-top: 1px solid var(--lca-border);
  padding: 10px 12px;
  background: #fff;
}
.lca-chatbot__inputwrap {
  display: flex; gap: 6px;
  background: var(--lca-bg-alt);
  border: 1px solid var(--lca-border);
  border-radius: 22px;
  padding: 4px 4px 4px 14px;
  align-items: flex-end;
}
.lca-chatbot__inputwrap textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font: inherit;
  color: var(--lca-text);
  padding: 8px 0;
  max-height: 120px;
  outline: none;
  font-family: inherit;
}
.lca-chatbot__send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--lca-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lca-chatbot__send:hover { background: var(--lca-primary-2); }
.lca-chatbot__send:disabled { background: var(--lca-muted); cursor: not-allowed; }
.lca-chatbot__send svg { width: 16px; height: 16px; }
.lca-chatbot__disclaimer {
  text-align: center;
  margin-top: 6px;
  font-size: 10px;
  color: var(--lca-muted);
}

@media (max-width: 480px) {
  .lca-chatbot { bottom: 12px; right: 12px; left: 12px; }
  .lca-chatbot__window {
    width: auto; right: 0; left: 0;
    height: 75vh;
  }
  .lca-chatbot__launcher { margin-left: auto; }
}
