.easy-ai-chatbot-widget {
  font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Chat panel */
.easy-ai-chatbot-widget .chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2147483000;
  display: none;
  width: 380px;
  height: 600px;
  background: var(--chat--color-background);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(133, 79, 255, 0.15);
  border: 1px solid rgba(133, 79, 255, 0.2);
  overflow: hidden;
  font-family: inherit;
}
.easy-ai-chatbot-widget .chat-container.position-left { right: auto; left: 20px; }
.easy-ai-chatbot-widget .chat-container.open { display: flex; flex-direction: column; }

.easy-ai-chatbot-widget .widget-header {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid rgba(133, 79, 255, 0.1);
  align-items: center;
}
.easy-ai-chatbot-widget .brand-logo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.easy-ai-chatbot-widget.avatar-circle .brand-logo {
  border-radius: 50%;
  object-fit: cover;
}
.easy-ai-chatbot-widget.avatar-original .brand-logo {
  border-radius: 0;
  object-fit: contain;
}
.easy-ai-chatbot-widget .header-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.easy-ai-chatbot-widget .header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.easy-ai-chatbot-widget .brand-name {
  font-size: 20px;
  font-weight: 500;
  color: var(--chat--color-font);
}
.easy-ai-chatbot-widget .brand-tagline {
  font-size: 12px;
  color: var(--chat--color-font);
  opacity: 0.7;
}
.easy-ai-chatbot-widget .widget-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.easy-ai-chatbot-widget .detach-button,
.easy-ai-chatbot-widget .dock-button,
.easy-ai-chatbot-widget .close-button {
  background: none;
  border: none;
  color: var(--chat--color-font);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  opacity: 0.6;
  width: 28px;
  height: 28px;
  border-radius: 4px;
}
.easy-ai-chatbot-widget .detach-button svg,
.easy-ai-chatbot-widget .dock-button svg,
.easy-ai-chatbot-widget .close-button svg {
  width: 16px;
  height: 16px;
}
.easy-ai-chatbot-widget .detach-button:hover,
.easy-ai-chatbot-widget .dock-button:hover,
.easy-ai-chatbot-widget .close-button:hover {
  opacity: 1;
  background: rgba(133, 79, 255, 0.1);
}

.easy-ai-chatbot-widget .new-conversation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  text-align: center;
  width: 100%;
  max-width: 300px;
}
.easy-ai-chatbot-widget .welcome-text {
  font-size: 24px; font-weight: 600; color: var(--chat--color-font);
  margin-bottom: 24px; line-height: 1.3;
}
.easy-ai-chatbot-widget .new-chat-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px 24px;
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff; border: none; border-radius: 8px; cursor: pointer;
  font-size: 16px; transition: transform 0.3s; font-weight: 500; font-family: inherit; margin-bottom: 12px;
}
.easy-ai-chatbot-widget .new-chat-btn:hover { transform: scale(1.02); }
.easy-ai-chatbot-widget .message-icon { width: 20px; height: 20px; }
.easy-ai-chatbot-widget .response-text { font-size: 14px; color: var(--chat--color-font); opacity: 0.7; margin: 0; }

.easy-ai-chatbot-widget .chat-interface { display: none; flex-direction: column; height: 100%; }
.easy-ai-chatbot-widget .chat-interface.active { display: flex; }

.easy-ai-chatbot-widget .chat-messages {
  flex: 1; overflow-y: auto; padding: 20px; background: var(--chat--color-background);
  display: flex; flex-direction: column;
}
.easy-ai-chatbot-widget .chat-message {
  padding: 12px 16px; margin: 8px 0; border-radius: 12px; max-width: 80%;
  word-wrap: break-word; font-size: 14px; line-height: 1.5;
}
.easy-ai-chatbot-widget .chat-message.user {
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff; align-self: flex-end; box-shadow: 0 4px 12px rgba(133, 79, 255, 0.2); border: none;
}
.easy-ai-chatbot-widget .chat-message.bot {
  background: var(--chat--color-background);
  border: 1px solid rgba(133, 79, 255, 0.2);
  color: var(--chat--color-font);
  align-self: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Links in chat messages */
.easy-ai-chatbot-widget .chat-message a {
  color: var(--chat--color-primary);
  text-decoration: underline;
}
.easy-ai-chatbot-widget .chat-message a:hover {
  color: var(--chat--color-secondary);
}

/* Lists in chat messages */
.easy-ai-chatbot-widget .chat-message ul,
.easy-ai-chatbot-widget .chat-message ol {
  margin: 8px 0;
  padding-left: 20px;
}
.easy-ai-chatbot-widget .chat-message li {
  margin: 4px 0;
}

/* Reply buttons in bot messages */
.easy-ai-chatbot-widget .chat-reply-btn {
  display: inline-block;
  background: var(--chat--color-background);
  border: 1px solid var(--chat--color-primary);
  color: var(--chat--color-primary);
  padding: 6px 12px;
  margin: 4px 4px 4px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}
.easy-ai-chatbot-widget .chat-reply-btn:hover {
  background: var(--chat--color-primary);
  color: white;
  transform: translateY(-1px);
}
.easy-ai-chatbot-widget .chat-reply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.easy-ai-chatbot-widget .chat-reply-btn:disabled:hover {
  background: var(--chat--color-background);
  color: var(--chat--color-primary);
}

/* Welcome message */
.easy-ai-chatbot-widget .welcome-message {
  text-align: center;
  padding: 20px;
  margin: 8px 0;
}
.easy-ai-chatbot-widget .welcome-message > div:first-child {
  font-size: 1.1em;
  margin-bottom: 12px;
  color: var(--chat--color-font);
  line-height: 1.4;
}

/* Question buttons */
.easy-ai-chatbot-widget .question-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.easy-ai-chatbot-widget .question-btn {
  background: var(--chat--color-background);
  border: 2px solid var(--chat--color-primary);
  color: var(--chat--color-primary);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  font-size: 14px;
}
.easy-ai-chatbot-widget .question-btn:hover {
  background: var(--chat--color-primary);
  color: white;
  transform: translateY(-2px);
}

.easy-ai-chatbot-widget .chat-input {
  padding: 16px; background: var(--chat--color-background);
  border-top: 1px solid rgba(133, 79, 255, 0.1); display: flex; gap: 8px;
}
.easy-ai-chatbot-widget .chat-input textarea {
  flex: 1; padding: 12px; border: 1px solid rgba(133, 79, 255, 0.2);
  border-radius: 8px; background: var(--chat--color-background);
  color: var(--chat--color-font); resize: none; font-family: inherit; font-size: 16px; /* 16px avoids iOS focus auto-zoom */
}
.easy-ai-chatbot-widget .chat-input textarea::placeholder { color: var(--chat--color-font); opacity: 0.6; }
.easy-ai-chatbot-widget .chat-input button {
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff; border: none; border-radius: 8px; padding: 0 20px; cursor: pointer;
  transition: transform 0.2s; font-family: inherit; font-weight: 500;
}
.easy-ai-chatbot-widget .chat-input button:hover { transform: scale(1.05); }

/* Launcher */
.easy-ai-chatbot-widget .chat-toggle {
  position: fixed !important; 
  top: auto !important;
  bottom: 20px !important; 
  right: 28px !important;
  width: 100px; height: 100px; border-radius: 50px; touch-action: none;
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 12px rgba(133, 79, 255, 0.3);
  z-index: 2147483000; transition: transform 0.3s;
  display: flex; align-items: center; justify-content: center;
  padding: 0 !important;
}
.easy-ai-chatbot-widget .chat-toggle.position-left { right: auto !important; left: 20px !important; }
.easy-ai-chatbot-widget .chat-toggle img { pointer-events: none; border-radius: 50px; width: 100%; height: 100%; object-fit: cover; display: block; }
.easy-ai-chatbot-widget.avatar-original .chat-toggle { border-radius: 0; background: transparent !important; box-shadow: none; height: auto; }
.easy-ai-chatbot-widget.avatar-original .chat-toggle img { border-radius: 0; width: 100%; height: auto; object-fit: unset; }

.easy-ai-chatbot-widget.widget-open .chat-toggle { display: none !important; }
.easy-ai-chatbot-widget .chat-toggle:hover { transform: scale(1.05); }
.easy-ai-chatbot-widget .chat-toggle svg { width: 24px; height: 24px; fill: currentColor; }

/* Launcher wrapper — created only when visitors can minimize. It carries the fixed
   positioning so the launcher sits inside it statically and the "−" can be anchored
   to it purely in CSS. Nothing here is tracked in JS, so the two cannot drift apart. */
.easy-ai-chatbot-widget .chat-launcher-wrap {
  position: fixed;
  bottom: 20px;
  right: 28px;
  z-index: 2147483000;
  line-height: 0;
}
.easy-ai-chatbot-widget .chat-launcher-wrap.position-left { right: auto; left: 20px; }
/* Inside the wrapper the launcher stops positioning itself — the wrapper does it. */
.easy-ai-chatbot-widget .chat-launcher-wrap .chat-toggle {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
}

/* Per-session minimize control (small "−" on the launcher's top corner) */
.easy-ai-chatbot-widget .chat-dismiss {
  position: absolute;
  top: -4px;
  right: -2px;
  touch-action: manipulation;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #4b4b4b;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 2147483001;
}
.easy-ai-chatbot-widget .chat-dismiss:hover { background: #000; }
.easy-ai-chatbot-widget.widget-open .chat-dismiss { display: none !important; }

/* Minimized state: a slim tab flush against the side edge, deliberately clear of
   the bottom corner where sites put sticky bars, cookie notices, and CTAs. It grows
   slightly inward on hover. Sites that need it higher or lower can override
   --chat-restore-top from the Custom CSS field. */
.easy-ai-chatbot-widget .chat-restore {
  display: none;
  position: fixed;
  top: var(--chat-restore-top, 60%);
  right: env(safe-area-inset-right, 0px);
  width: 22px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.22);
  transition: width 0.15s ease;
  touch-action: manipulation;
  z-index: 2147483000;
}
.easy-ai-chatbot-widget .chat-restore.position-left {
  right: auto;
  left: env(safe-area-inset-left, 0px);
  border-radius: 0 6px 6px 0;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.22);
}
.easy-ai-chatbot-widget .chat-restore:hover { width: 28px; }
.easy-ai-chatbot-widget .chat-restore svg { width: 13px; height: 13px; display: block; }
.easy-ai-chatbot-widget.chat-minimized .chat-toggle,
.easy-ai-chatbot-widget.chat-minimized .chat-tip-bubble,
.easy-ai-chatbot-widget.chat-minimized .chat-dismiss { display: none !important; }
.easy-ai-chatbot-widget.chat-minimized .chat-restore { display: flex; }

/* Footer */
.easy-ai-chatbot-widget .chat-footer {
  padding: 8px; text-align: center; background: var(--chat--color-background);
  border-top: 1px solid rgba(133, 79, 255, 0.1);
}
/* Position footer at bottom on welcome screen */
.easy-ai-chatbot-widget .chat-container > .chat-footer {
  margin-top: auto;
}
.easy-ai-chatbot-widget .chat-footer a {
  color: var(--chat--color-primary); text-decoration: none; font-size: 12px;
  opacity: 0.8; transition: opacity 0.2s; font-family: inherit;
}
.easy-ai-chatbot-widget .chat-footer a:hover { opacity: 1; }

/* Typing */
.easy-ai-chatbot-widget .typing-indicator {
  padding: 12px 16px; margin: 8px 0; border-radius: 12px; max-width: 80%;
  align-self: flex-start; background: var(--chat--color-background);
  border: 1px solid rgba(133, 79, 255, 0.2); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  font-size: 14px; color: var(--chat--color-font); opacity: 0.7;
}

/* Thought bubble above the launcher */
.easy-ai-chatbot-widget .chat-tip-bubble {
  position: fixed;
  bottom: 130px;
  right: 20px;
  max-width: 240px;
  background: var(--chat--color-background);
  color: var(--chat--color-font);
  border: 1px solid rgba(133, 79, 255, 0.2);
  border-radius: 12px;
  padding: 10px 32px 10px 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  z-index: 2147483001;
  font-size: 14px;
  line-height: 1.35;
}
.easy-ai-chatbot-widget .chat-tip-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 28px;
  width: 10px;
  height: 10px;
  background: var(--chat--color-background);
  border-left: 1px solid rgba(133, 79, 255, 0.2);
  border-bottom: 1px solid rgba(133, 79, 255, 0.2);
  transform: rotate(45deg);
}
.easy-ai-chatbot-widget .chat-tip-bubble.position-left { right: auto; left: 20px; }
.easy-ai-chatbot-widget .chat-tip-bubble.position-left::after { right: auto; left: 28px; }
.easy-ai-chatbot-widget .tip-close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--chat--color-font);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 18px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.easy-ai-chatbot-widget .tip-close-button:hover {
  opacity: 1;
}

/* Docked State */
.easy-ai-chatbot-widget.docked .chat-container {
  top: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  left: auto !important;
  width: 380px !important;
  height: 100vh !important;
  height: 100dvh !important;
  border-radius: 0 !important;
  box-shadow: -2px 0 8px rgba(133, 79, 255, 0.15) !important;
  transition: all 0.3s ease;
}
.easy-ai-chatbot-widget.docked.position-left .chat-container {
  right: auto !important;
  left: 0 !important;
  box-shadow: 2px 0 8px rgba(133, 79, 255, 0.15) !important;
}
/* Adjust for WordPress admin bar when logged in */
body.admin-bar .easy-ai-chatbot-widget.docked .chat-container {
  top: 32px !important;
  height: calc(100vh - 32px) !important;
  height: calc(100dvh - 32px) !important;
}
@media screen and (max-width: 782px) {
  body.admin-bar .easy-ai-chatbot-widget.docked .chat-container {
    top: 46px !important;
    height: calc(100vh - 46px) !important;
    height: calc(100dvh - 46px) !important;
  }
}
/* Hide tip bubble when docked */
.easy-ai-chatbot-widget.docked .chat-tip-bubble {
  display: none !important;
}
/* Body margin when docked (added via JS) */
body.chat-widget-docked-right {
  margin-right: 380px;
  transition: margin-right 0.3s ease;
}
body.chat-widget-docked-left {
  margin-left: 380px;
  transition: margin-left 0.3s ease;
}

@media (max-width: 782px) {
  /* Mobile: a floating card with margins all around, page dimmed behind it.
     Top-anchored with a dvh height so it shrinks (input stays above the
     keyboard) and respects iPhone safe areas. Plain fallbacks first. */
  .easy-ai-chatbot-widget .chat-container {
    bottom: auto !important;
    top: 24px !important;
    top: calc(24px + env(safe-area-inset-top)) !important;
    left: 16px !important;
    left: calc(16px + env(safe-area-inset-left)) !important;
    right: 16px !important;
    right: calc(16px + env(safe-area-inset-right)) !important;
    width: auto !important;
    height: calc(100vh - 40px) !important;
    height: calc(100dvh - 40px) !important;
    height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28) !important;
  }

  /* Dimmed backdrop; the page stays visible behind the floating card. */
  .easy-ai-chatbot-widget.widget-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2147482999; /* just below the card */
  }

  /* Smaller launcher on mobile (25% down from 100px). */
  .easy-ai-chatbot-widget .chat-toggle {
    width: 75px !important;
    height: 75px !important;
  }
  .easy-ai-chatbot-widget.avatar-original .chat-toggle {
    width: 75px !important;
    height: auto !important; /* keep original aspect ratio */
  }

  .easy-ai-chatbot-widget .chat-tip-bubble { right: 16px; bottom: 100px; max-width: 70vw; }
  .easy-ai-chatbot-widget .chat-tip-bubble.position-left { left: 16px; }
  .easy-ai-chatbot-widget .chat-tip-bubble::after { right: 22px; }
  .easy-ai-chatbot-widget .chat-tip-bubble.position-left::after { left: 22px; }

  /* Bigger tap target for the minimized edge tab; no hover-grow on touch. */
  .easy-ai-chatbot-widget .chat-restore { width: 26px; height: 52px; }
  .easy-ai-chatbot-widget .chat-restore:hover { width: 26px; }
}

/* Typing dots animation (matches admin widget style) */
@keyframes easy-ai-floating-typing-animation {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-4px); }
}
.easy-ai-chatbot-widget .typing-indicator .easy-ai-chatbot-typing-dots {
  display: inline-flex;
  gap: 4px;
}
.easy-ai-chatbot-widget .typing-indicator .easy-ai-chatbot-typing-dots span {
  animation: easy-ai-floating-typing-animation 1.4s infinite;
  font-size: 20px;
  line-height: 1;
  color: var(--chat--color-primary);
}
.easy-ai-chatbot-widget .typing-indicator .easy-ai-chatbot-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.easy-ai-chatbot-widget .typing-indicator .easy-ai-chatbot-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
.easy-ai-chatbot-widget .typing-indicator .typing-stage-text {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 4px;
  display: none; /* shown by JS after 10s */
}

/* Detached / draggable state */
.easy-ai-chatbot-widget.detached .chat-container {
  bottom: auto !important;
  right: auto !important;
  /* left/top set dynamically by JS */
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}
.easy-ai-chatbot-widget.detached .chat-container .widget-header {
  cursor: grab;
  user-select: none;
}
.easy-ai-chatbot-widget.detached .chat-container .widget-header:active {
  cursor: grabbing;
}
/* Hide tip bubble in detached mode */
.easy-ai-chatbot-widget.detached .chat-tip-bubble {
  display: none !important;
}
/* Hide pop-out / dock buttons on touch devices — those are pointer-driven
   power features that don't make sense on phones/tablets. */
@media (hover: none) and (pointer: coarse) {
  .easy-ai-chatbot-widget .detach-button,
  .easy-ai-chatbot-widget .dock-button {
    display: none !important;
  }
}

/* Session expired banner */
.easy-ai-chatbot-widget .session-expired-banner {
  background: var(--chat--color-background);
  border: 1px solid rgba(133, 79, 255, 0.3);
  align-self: stretch;
  max-width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--chat--color-font);
}
.easy-ai-chatbot-widget .session-expired-banner p {
  margin: 0 0 8px;
  opacity: 0.8;
}
.easy-ai-chatbot-widget .session-expired-banner button {
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.easy-ai-chatbot-widget .session-expired-banner button:hover {
  opacity: 0.9;
}

/* Consent bar (replaces chat input until user agrees) */
.easy-ai-chatbot-widget .consent-bar {
  padding: 12px 16px;
  background: var(--chat--color-background);
  border-top: 1px solid rgba(133, 79, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}
.easy-ai-chatbot-widget .consent-bar .consent-bar-message {
  font-size: 12px;
  line-height: 1.5;
  color: var(--chat--color-font);
  opacity: 0.75;
  margin: 0;
}
.easy-ai-chatbot-widget .consent-bar .consent-bar-message a {
  color: var(--chat--color-primary);
  text-decoration: underline;
}
.easy-ai-chatbot-widget .consent-bar .consent-bar-btn {
  background: linear-gradient(135deg, var(--chat--color-primary) 0%, var(--chat--color-secondary) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 100%;
}
.easy-ai-chatbot-widget .consent-bar .consent-bar-btn:hover { opacity: 0.9; }