/* ABMTAX Chat Widget Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/*
* {
  box-sizing: border-box;
}*/

.ai-chatbot-abmtax-chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #02B3C5;
  border: none;
  box-shadow: 0 8px 32px rgba(34, 231, 245, 0.4);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: pulse 2s infinite;
}

.ai-chatbot-abmtax-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(35, 240, 255, 0.5);
}

.ai-chatbot-abmtax-chat-toggle.open {
  animation: none;
}

.ai-chatbot-abmtax-chat-toggle svg {
  width: 24px;
  height: 24px;
}

.ai-chatbot-abmtax-chat-toggle .ai-chatbot-tooltip {
  position: absolute;
  bottom: 80px;
  right: 0;
  background: #264244;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.ai-chatbot-abmtax-chat-toggle:hover .ai-chatbot-tooltip {
  opacity: 1;
}

@keyframes pulse {
  0% { box-shadow: 0 8px 32px rgba(16, 228, 243, 0.4); }
  50% { box-shadow: 0 8px 32px rgba(16, 228, 243, 0.4); }
  100% { box-shadow: 0 8px 32px rgba(16, 228, 243, 0.4); }
}

#ai-chatbot-abmtax-chat-window {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 570px;
  max-width: 90vw;
  height: 650px;
  max-height: 70vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(100%) scale(0.8);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001;
  font-family: 'Inter', sans-serif;
  overflow: hidden;

  display: flex;
  flex-direction: column;
}

#ai-chatbot-abmtax-chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.ai-chatbot-chat-header {
  background: #02B3C5;
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.ai-chatbot-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.ai-chatbot-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chatbot-language-dropdown {
  position: relative;
  display: inline-block;
}

.ai-chatbot-lang-toggle {
  width: 40px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.ai-chatbot-lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 36px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 150px;
  z-index: 10002;
}

.ai-chatbot-lang-menu.open { display: block; }

.ai-chatbot-lang-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #008888
}

.ai-chatbot-lang-item:hover { background: #9d9e9e; }


.ai-chatbot-chat-title svg {
  width: 20px;
  height: 20px;
}

.ai-chatbot-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.ai-chatbot-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ai-chatbot-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-chatbot-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-chatbot-chat-messages::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 2px;
}

.ai-chatbot-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.ai-chatbot-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.ai-chatbot-message {
  display: flex;
  gap: 12px;
  max-width: 100%;
}

.ai-chatbot-message.ai-chatbot-user {
  flex-direction: row-reverse;
}

.ai-chatbot-message .ai-chatbot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.ai-chatbot-message.ai-chatbot-bot .ai-chatbot-avatar {
  background: #02B3C5;
  color: white;
}

.ai-chatbot-message.ai-chatbot-user .ai-chatbot-message-bubble {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 18px 18px 6px 18px;
  padding: 12px 16px;
  max-width: 80%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  white-space: pre-wrap;
  line-height: 1.5;
}

.ai-chatbot-message.ai-chatbot-bot .ai-chatbot-message-bubble {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 18px 18px 18px 6px;
  padding: 12px 16px;
  max-width: 80%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Add this new rule for bot responses */
.ai-chatbot-message.ai-chatbot-bot .ai-chatbot-message-bubble pre.ai-chatbot-bot-response {
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  font-family: 'Inter', sans-serif !important;
  line-height: 1.6 !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  font-size: 14px !important;
}

.ai-chatbot-message.ai-chatbot-typing .ai-chatbot-message-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chatbot-typing-dots {
  display: flex;
  gap: 2px;
}

.ai-chatbot-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typing 1.4s infinite;
}

.ai-chatbot-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-chatbot-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

.ai-chatbot-sources-toggle {
  margin-top: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-chatbot-sources-toggle:hover {
  background: #e2e8f0;
}

details.ai-chatbot-sources {
  margin-top: 8px;
  font-size: 12px;
}

details.ai-chatbot-sources summary {
  cursor: pointer;
  padding: 4px 0;
  font-weight: 500;
}

details.ai-chatbot-sources pre {
  background: #f8fafc;
  padding: 8px;
  border-radius: 4px;
  margin: 4px 0 0 0;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 11px;
}

.ai-chatbot-chat-input-container {
  padding: 20px;
  border-top: 1px solid #e2e8f0;
  background: white;
  display: flex;
  gap: 12px;
}

#ai-chatbot-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 12px 20px;
  font-size: 14px;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}

#ai-chatbot-chat-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#ai-chatbot-chat-send {
  width: 56px;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: #02B3C5;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#ai-chatbot-chat-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

#ai-chatbot-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-chatbot-chat-input-error {
  display: none;
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  margin-top: -4px;
}

.ai-chatbot-chat-footer {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  gap: 0;
}

.ai-chatbot-chat-footer small {
  color: #64748b;
  font-size: 12px;
}

.ai-chatbot-footer-right {
  flex: 1;
  padding: 20px 20px 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 0;
  text-align: left;
}

/* privacy caption/id-specific override to avoid host stylesheet conflicts */
#ai-chatbot-privacy-caption,
#ai-chatbot-privacy-caption a {
  color: #64748b !important;
}
#ai-chatbot-privacy-link {
  text-decoration: underline !important;
}

.ai-chatbot-chat-footer .ai-chatbot-terms-caption {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
}

.ai-chatbot-chat-footer .ai-chatbot-terms-caption a {
  color: #64748b;
  text-decoration: underline;
}

.ai-chatbot-chat-footer .ai-chatbot-terms-caption a:hover {
  color: #02B3C5;
}

.ai-chatbot-chat-footer .ai-chatbot-powered-by {
  display: block;
  margin-top: 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}



.ai-chatbot-assistant-icon {
  width: 107px;      /* Fits perfectly in chat-title div */
  height: 30px;     /* Same height as SVG */
  border-radius: 4px;
  object-fit: cover; /* Maintains aspect ratio */
  flex-shrink: 0;   /* Prevents squishing */
}

.ai-chatbot-promo-btn span {                           /* Text takes remaining space */
  flex: 1;                       /* Grow to fill space */
  white-space: nowrap;           /* Prevent text wrap */
}

/* Promotional buttons styling */
.ai-chatbot-promo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.ai-chatbot-abmtax-btn {
  background: linear-gradient(135deg, #02B3C5 0%, #028090 100%);
  color: white;
}

.ai-chatbot-abmbooks-btn {
  background: linear-gradient(135deg, #6366f1 0%, #46b8e5 100%);
  color: white;
}

.ai-chatbot-contact-btn{
  background: linear-gradient(135deg, #00aca3 0%, #00adad 100%);
  color: white;
}

.ai-chatbot-promo-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  color: white !important;
  text-decoration: none;
}

.ai-chatbot-promo-buttons {
  animation: ai-chatbot-slideInUp 0.3s ease-out;
}

/* File Upload Form Styles - Enhanced */
.ai-chatbot-file-upload-form {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0 20px;
  /*margin: 16px 0;*/
}

.ai-chatbot-file-upload-form label {
  display: block;
  font-weight: 500;
  /*margin-bottom: 8px;*/
  color: #374151;
  font-size: 14px;
}

.ai-chatbot-file-upload-form input[type="email"],
.ai-chatbot-file-upload-form input[type="file"] {
  width: 100%;
  padding: 12px;
  /*border: 1px solid #d1d5db;*/
  border: 1px solid #5a5a5a;
  border-radius: 8px;
  font-size: 14px;
  /*margin-bottom: 12px;*/
  box-sizing: border-box;
}

.ai-chatbot-file-upload-form input[type="email"]:focus {
  outline: none;
  border-color: #02B3C5;
  box-shadow: 0 0 0 3px rgba(2, 179, 197, 0.1);
}


#ai-chatbot-file-list {
  max-height: 140px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  /*margin-bottom: 16px;*/
  font-size: 13px;
}

.ai-chatbot-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.ai-chatbot-file-item:last-child {
  border-bottom: none;
}

.ai-chatbot-file-item span {
  flex: 1;
  word-break: break-all;
}

.ai-chatbot-remove-file-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
  min-width: 60px;
}

.ai-chatbot-remove-file-btn:hover {
  background: #dc2626;
}

.ai-chatbot-clear-all-btn {
  background: #6b7280;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  /*margin-bottom: 12px;*/
  width: 100%;
}

.ai-chatbot-clear-all-btn:hover {
  background: #4b5563;
}

.ai-chatbot-file-limit-error {
  display: none;
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  margin: 4px 0;
  line-height: 1.4;
}

.ai-chatbot-form-send-btn {
  background: linear-gradient(135deg, #02B3C5 0%, #028090 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
}

.ai-chatbot-form-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 179, 197, 0.4);
}

.ai-chatbot-form-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* File Taxes Button */
.ai-chatbot-file-taxes-btn {
  background: linear-gradient(135deg, #02B3C5 0%, #028090 100%);
  color: white;
  border: none;
  padding: 20px 32px 24px 20px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin: 0 0 20px 20px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-chatbot-file-taxes-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(2, 179, 197, 0.4);
}

/* User submission summary */
.ai-chatbot-user-submission {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  margin: 8px 0;
}

.ai-chatbot-user-submission strong {
  color: #166534;
}


.ai-chatbot-file-comment-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  /*margin-bottom: 16px;*/
  box-sizing: border-box;
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
}


.ai-chatbot-file-comment-input:focus {
  outline: none;
  border-color: #02B3C5;
  box-shadow: 0 0 0 3px rgba(2, 179, 197, 0.1);
}

.ai-chatbot-file-comment-input::placeholder {
  color: #4c4d4e;
}

.ai-chatbot-file-comment-input:disabled {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
  border-color: #464545;
}


.ai-chatbot-file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.ai-chatbot-custom-file-label {
  flex: 1;
  padding: 12px 16px;
  background: white;
  border: 1px solid #6b7280;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s;
  white-space: nowrap;
}

.ai-chatbot-custom-file-label:hover {
  border-color: #02B3C5;
  background: #f8fafc;
  transform: translateY(-1px);
}

.ai-chatbot-file-display {
  font-size: 13px;
  color: #6b7280;
  flex: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


@keyframes ai-chatbot-slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Tablet (768px and below) */
@media (max-width: 768px) {
  #ai-chatbot-abmtax-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 90px;
    height: 72vh;
    max-height: 72vh;
    border-radius: 12px;
  }

  .ai-chatbot-promo-btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .ai-chatbot-assistant-icon {
    width: 107px !important;
    height: 30px !important;
    flex-shrink: 0 !important;
    object-fit: cover;
    border-radius: 4px;
  }
}

/* Phone (480px and below) — full-screen chat */
@media (max-width: 480px) {
  /* Full-screen chat window */
  #ai-chatbot-abmtax-chat-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* dynamic viewport height (avoids mobile browser chrome overlap) */
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    transform: translateY(100%); /* slide-in only, no scale */
  }

  #ai-chatbot-abmtax-chat-window.open {
    transform: translateY(0);
  }

  /* Hide the toggle button while the chat is open */
  .ai-chatbot-abmtax-chat-toggle.open {
    opacity: 0;
    pointer-events: none;
  }

  /* Header */
  .ai-chatbot-chat-header {
    padding: 12px 16px;
  }

  .ai-chatbot-chat-title {
    font-size: 14px;
    gap: 6px;
  }

  /* Restore logo to its natural size; hide the text label to give it room */
  .ai-chatbot-assistant-icon {
    width: 107px !important;
    height: 30px !important;
    flex-shrink: 0 !important;
    object-fit: cover;
    border-radius: 4px;
  }

  .ai-chatbot-chat-title-text {
    display: none;
  }

  /* Bigger touch targets for header buttons */
  .ai-chatbot-close-btn {
    font-size: 28px;
    padding: 6px 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ai-chatbot-lang-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  /* Messages */
  .ai-chatbot-chat-messages {
    padding: 12px;
    gap: 10px;
  }

  .ai-chatbot-message.ai-chatbot-user .ai-chatbot-message-bubble,
  .ai-chatbot-message.ai-chatbot-bot .ai-chatbot-message-bubble {
    max-width: 88%;
    font-size: 14px;
    padding: 10px 14px;
  }

  /* Input area */
  .ai-chatbot-chat-input-container {
    padding: 10px 12px;
    gap: 8px;
  }

  /* font-size: 16px prevents iOS Safari from auto-zooming on focus */
  #ai-chatbot-chat-input {
    font-size: 16px;
    padding: 10px 16px;
  }

  #ai-chatbot-chat-send {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
  }

  /* Footer */
  .ai-chatbot-chat-footer {
    flex-direction: row;
    padding: 0;
    gap: 0;
    align-items: stretch;
  }

  .ai-chatbot-chat-footer small {
    font-size: 10px;
  }

  .ai-chatbot-footer-right {
    flex: 1;
    padding: 12px 12px 12px 9px;
  }

  .ai-chatbot-file-taxes-btn {
    font-size: 15px;
    padding: 12px 20px 12px 12px;
    margin: 0 0 6px 12px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  /* Promo buttons: full width, allow text wrapping */
  .ai-chatbot-promo-btn {
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
    padding: 12px 16px;
    font-size: 13px;
    box-sizing: border-box;
  }

  /* ensure container doesn’t overflow its bubble */
  .ai-chatbot-promo-buttons {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* File upload form */
  .ai-chatbot-file-upload-form {
    padding: 0 12px;
  }

  .ai-chatbot-file-input-wrapper {
    flex-direction: column;
    gap: 8px;
  }

  .ai-chatbot-custom-file-label {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    white-space: normal;
  }

  .ai-chatbot-file-display {
    flex: none;
    width: 100%;
    text-align: center;
    white-space: normal;
  }
}

/* Very narrow phones (≤380px) — logo can't fit without crowding header-right,
   so swap: hide the logo image and show the text label instead */
@media (max-width: 380px) {
  .ai-chatbot-assistant-icon {
    display: none !important;
  }

  .ai-chatbot-chat-title-text {
    display: inline;
  }
}

/* Prevent background scroll when chat is open on mobile */
body.ai-chatbot-chat-open-mobile {
  overflow: hidden;
  touch-action: none;
}