/* PawMatix Chatbot Widget Styles - Dark Theme */
.pawmatix-chat-widget {
  --pm-primary: #7265e3;
  --pm-primary-hover: #8a7ff0;
  --pm-bg: #0a0a0a;
  --pm-bg-light: #1a1a1a;
  --pm-text: #ffffff;
  --pm-text-light: #7b7b7b;
  --pm-border: rgba(255, 255, 255, 0.1);
  --pm-user-bg: #7265e3;
  --pm-user-text: #ffffff;
  --pm-bot-bg: #1a1a1a;
  --pm-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --pm-radius: 16px;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  line-height: 20px;
  box-sizing: border-box;
}

.pawmatix-chat-widget *,
.pawmatix-chat-widget *::before,
.pawmatix-chat-widget *::after {
  box-sizing: inherit;
}

/* Chat Button - 48px like Voiceflow */
.pawmatix-chat-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--pm-primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--pm-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  z-index: 9998;
}

.pawmatix-chat-button:hover {
  background: var(--pm-primary-hover);
  transform: scale(1.05);
}

.pawmatix-chat-button svg {
  width: 24px;
  height: 24px;
  fill: white;
}

/* Icon visibility - show only one at a time */
.pawmatix-chat-button .chat-icon {
  display: block;
}

.pawmatix-chat-button .close-icon {
  display: none;
}

.pawmatix-chat-button.open .chat-icon {
  display: none;
}

.pawmatix-chat-button.open .close-icon {
  display: block;
}

/* Chat Modal - 400px width like Voiceflow */
.pawmatix-chat-modal {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--pm-bg);
  border-radius: var(--pm-radius);
  box-shadow: var(--pm-shadow);
  border: 1px solid var(--pm-border);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 9999;
  overflow: hidden;
}

.pawmatix-chat-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.pawmatix-chat-header {
  background: var(--pm-primary);
  color: white;
  padding: 12px 16px 12px 20px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pawmatix-chat-header-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.pawmatix-chat-header-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.pawmatix-chat-header-close svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.pawmatix-chat-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pawmatix-chat-header-avatar svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.pawmatix-chat-header-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.pawmatix-chat-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.pawmatix-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--pm-bg);
}

.pawmatix-message {
  max-width: 80%;
  padding: 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 20px;
  width: fit-content;
}

.pawmatix-message.user {
  align-self: flex-end;
  background: var(--pm-user-bg);
  color: var(--pm-user-text);
}

.pawmatix-message.bot {
  align-self: flex-start;
  background: var(--pm-bot-bg);
  color: var(--pm-text);
  border: 1px solid var(--pm-border);
}

/* Formatted content in bot messages */
.pawmatix-message.bot p {
  margin: 0 0 8px 0;
}

.pawmatix-message.bot p:last-child {
  margin-bottom: 0;
}

.pawmatix-message.bot ul,
.pawmatix-message.bot ol {
  margin: 8px 0;
  padding-left: 20px;
}

.pawmatix-message.bot ul:first-child,
.pawmatix-message.bot ol:first-child {
  margin-top: 0;
}

.pawmatix-message.bot ul:last-child,
.pawmatix-message.bot ol:last-child {
  margin-bottom: 0;
}

.pawmatix-message.bot li {
  margin: 4px 0;
  line-height: 1.5;
}

.pawmatix-message.bot a {
  color: var(--pm-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.pawmatix-message.bot a:hover {
  border-bottom-color: var(--pm-primary);
}

.pawmatix-message.bot strong {
  font-weight: 600;
  color: #fff;
}

.pawmatix-message.bot em {
  font-style: italic;
}

.pawmatix-message.bot.typing {
  display: flex;
  gap: 4px;
  padding: 11px 16px;
}

.pawmatix-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--pm-primary);
  border-radius: 50%;
  animation: pawmatix-typing 1.4s infinite ease-in-out both;
}

.pawmatix-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.pawmatix-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.pawmatix-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes pawmatix-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.pawmatix-chat-input-area {
  padding: 10px 20px 20px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--pm-bg);
}

.pawmatix-chat-input {
  flex: 1;
  align-content: center;
  border: 1px solid var(--pm-border);
  border-radius: 25px;
  padding: 7px 20px;
  height: 48px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  background: var(--pm-bg-light);
  color: var(--pm-text);
}

.pawmatix-chat-input:focus {
  border-color: var(--pm-primary);
}

.pawmatix-chat-input::placeholder {
  color: var(--pm-text-light);
}

.pawmatix-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pm-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

.pawmatix-chat-send:hover {
  background: var(--pm-primary-hover);
}

.pawmatix-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pawmatix-chat-send svg {
  width: 16px;
  height: 16px;
  fill: white;
}

/* Powered By */
.pawmatix-powered-by {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--pm-text-light);
  border-top: 1px solid var(--pm-border);
  background: var(--pm-bg);
}

.pawmatix-powered-by a {
  color: var(--pm-primary);
  text-decoration: none;
}

/* Scrollbar styling */
.pawmatix-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.pawmatix-chat-messages::-webkit-scrollbar-track {
  background: var(--pm-bg);
}

.pawmatix-chat-messages::-webkit-scrollbar-thumb {
  background: var(--pm-border);
  border-radius: 3px;
}

.pawmatix-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--pm-text-light);
}

/* Mobile Styles */
@media (max-width: 480px) {
  .pawmatix-chat-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .pawmatix-chat-button {
    bottom: 16px;
    right: 16px;
  }

  .pawmatix-chat-modal.open ~ .pawmatix-chat-button {
    display: none;
  }
}
