/* Ease Pet Vet chatbot widget styles. Self-contained; all classes are namespaced
   epv-chatbot-* and the widget avoids global/body/html resets so it will not break
   the host website. This is the only chatbot stylesheet. */

.epv-chatbot-root {
  --epv-accent: #1f7a8c;
  --epv-accent-dark: #145e6e;
  --epv-bg: #ffffff;
  --epv-panel-bg: #f7fafb;
  --epv-text: #1c2b2f;
  --epv-muted: #5d7176;
  --epv-bot-bubble: #eef4f5;
  --epv-user-bubble: #1f7a8c;
  --epv-border: #e2ebec;
  --epv-shadow: 0 12px 40px rgba(20, 60, 70, 0.18);
  position: fixed;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--epv-text);
}

.epv-chatbot-root.epv-pos-bottom-right { right: 20px; bottom: 20px; }
.epv-chatbot-root.epv-pos-bottom-left { left: 20px; bottom: 20px; }

/* Launcher bubble */
.epv-chatbot-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--epv-accent);
  color: #fff;
  box-shadow: var(--epv-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease;
}
.epv-chatbot-launcher:hover { background: var(--epv-accent-dark); transform: translateY(-2px); }
.epv-chatbot-launcher:focus-visible { outline: 3px solid rgba(31, 122, 140, 0.4); outline-offset: 2px; }
.epv-chatbot-launcher svg { width: 28px; height: 28px; }

/* Panel */
.epv-chatbot-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--epv-bg);
  border-radius: 16px;
  box-shadow: var(--epv-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.epv-pos-bottom-left .epv-chatbot-panel { right: auto; left: 0; }
.epv-chatbot-root.epv-open .epv-chatbot-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.epv-chatbot-root.epv-open .epv-chatbot-launcher { transform: scale(0.92); }

/* Header */
.epv-chatbot-header {
  background: var(--epv-accent);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.epv-chatbot-header-text { flex: 1 1 auto; min-width: 0; }
.epv-chatbot-title { font-weight: 600; font-size: 15px; }
.epv-chatbot-subtitle { font-size: 11.5px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epv-chatbot-header-actions { display: flex; gap: 4px; }
.epv-chatbot-icon-btn {
  background: transparent; border: none; color: #fff; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.epv-chatbot-icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.epv-chatbot-icon-btn svg { width: 18px; height: 18px; }

/* Messages */
.epv-chatbot-messages {
  flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--epv-panel-bg);
}
.epv-chatbot-msg { width: fit-content; max-width: 86%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }

/* Links rendered inside bot answers (clickable URLs, media, emails). */
.epv-chatbot-link { color: var(--epv-accent-dark); text-decoration: none; word-break: break-all; max-width: 100%; }
.epv-chatbot-link:hover { text-decoration: underline; }
.epv-chatbot-msg-user .epv-chatbot-link { color: #eaf6f8; text-decoration: underline; }
.epv-chatbot-msg-bot { align-self: flex-start; margin-right: auto; background: var(--epv-bot-bubble); color: var(--epv-text); border-bottom-left-radius: 4px; }
.epv-chatbot-msg-user { align-self: flex-end; margin-left: auto; background: var(--epv-user-bubble); color: #fff; border-bottom-right-radius: 4px; }
.epv-chatbot-msg-error { background: #fdecec; color: #a12626; }

/* Typing indicator */
.epv-chatbot-typing { display: flex; gap: 4px; align-items: center; }
.epv-chatbot-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--epv-muted); opacity: 0.5;
  animation: epv-bounce 1.2s infinite ease-in-out;
}
.epv-chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.epv-chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes epv-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Composer */
.epv-chatbot-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--epv-border); background: #fff; }
.epv-chatbot-input {
  flex: 1 1 auto; resize: none; border: 1px solid var(--epv-border); border-radius: 12px; padding: 9px 12px;
  font-family: inherit; font-size: 14px; line-height: 1.4; max-height: 120px; min-height: 40px; color: var(--epv-text); background: #fff;
}
.epv-chatbot-input:focus { outline: none; border-color: var(--epv-accent); }
.epv-chatbot-input:disabled { background: #f1f5f6; color: var(--epv-muted); cursor: not-allowed; }
.epv-chatbot-send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--epv-accent); color: #fff; display: flex; align-items: center; justify-content: center; transition: background 0.15s ease;
}
.epv-chatbot-send:hover { background: var(--epv-accent-dark); }
.epv-chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; }
.epv-chatbot-send svg { width: 18px; height: 18px; }

.epv-chatbot-footer { text-align: center; font-size: 10.5px; color: var(--epv-muted); padding: 0 0 8px; background: #fff; }
.epv-chatbot-footer-warning { color: #a12626; font-weight: 500; }

@media (max-width: 480px) {
  .epv-chatbot-root.epv-pos-bottom-right, .epv-chatbot-root.epv-pos-bottom-left { right: 12px; left: 12px; bottom: 12px; }
  .epv-chatbot-panel {
    width: auto; left: 0; right: 0; height: 70vh; max-height: calc(100vh - 90px); bottom: 74px;
  }
}
