/* ============================================
   AI Bot Widget CSS
   Plan-aware styling
   ============================================ */

/* CSS Variables */
:root {
  --aibot-primary: #6d5efc;
  --aibot-secondary: #9a7bff;
  --aibot-primary-grad: linear-gradient(135deg, #6d5efc, #9a7bff);
  --aibot-radius: 16px;
  --aibot-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Root container */
#aibot-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  left: auto !important;
  top: auto !important;
  z-index: 2147483647 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#aibot-root * {
  box-sizing: border-box !important;
}

/* Plan-specific root adjustments */
#aibot-root.aibot-plan-starter {}
#aibot-root.aibot-plan-professional {}
#aibot-root.aibot-plan-enterprise {}

/* Launcher Button */
#aibot-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--aibot-primary-grad);
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--aibot-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
#aibot-send {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #000;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#aibot-send svg {
  width: 16px;
  height: 16px;
}

#aibot-send:hover {
  background: #333;
  transform: scale(1.05);
}

#aibot-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#aibot-send svg {
  width: 16px;
  height: 16px;
}

#aibot-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

#aibot-btn[data-shape="circle"] {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

#aibot-btn[data-shape="circle"] .aibot-launcher-text {
  display: none;
}

#aibot-btn[data-shape="pill"] .aibot-launcher-icon {
  display: flex;
}

.aibot-launcher-ico {
  width: 20px;
  height: 20px;
}

/* Chat Panel */
/* Chat Panel */
#aibot-panel {
  position: fixed !important;
  bottom: 90px !important;
  right: 20px !important;
  left: auto !important;
  top: auto !important;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: var(--aibot-radius);
  box-shadow: var(--aibot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

#aibot-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
#aibot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--aibot-primary-grad);
  color: #fff;
}

#aibot-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

#aibot-title img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#aibot-title .t1 {
  font-size: 16px;
  font-weight: 600;
}

#aibot-title .t2 {
  font-size: 12px;
  opacity: 0.8;
}

#aibot-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#aibot-close:hover {
  background: rgba(255, 255, 255, 0.3);
}


/* Body / Messages */
#aibot-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f9fa;
  min-height: 0;
}

#aibot-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Message Bubbles */
.aibot-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  animation: aibot-fadeIn 0.3s ease;
}

@keyframes aibot-fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aibot-user {
  align-self: flex-end;
  background: var(--aibot-primary-grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.aibot-bot {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
#aibot-typing {
  display: none;
  padding: 12px 16px;
  background: #fff;
  color: #666;
  border-radius: 16px;
  font-style: italic;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  align-self: flex-start;
}

#aibot-typing.show {
  display: block;
  animation: aibot-pulse 1.5s infinite;
}

@keyframes aibot-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Footer / Input Area */
#aibot-footer {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #eee;
}



#aibot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-height: 120px;
}

#aibot-input:focus {
  border-color: var(--aibot-primary);
  box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.1);
}

#aibot-input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}


/* === Mic button FINAL override === */
#aibot-form {
  align-items: center;
}
/* === FINAL INPUT + ACTIONS LAYOUT === */
#aibot-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

#aibot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  resize: none;
}

/* Actions wrapper (mic + send) */
#aibot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Mic + Send */
#aibot-mic,
#aibot-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#aibot-mic {
  background: #000;
  color: #fff;
  cursor: pointer;
}

#aibot-mic svg {
  width: 14px;
  height: 14px;
}

#aibot-mic.listening {
  background: #ef4444;
}


#aibot-mic {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
  }

#aibot-mic svg {
  width: 16px !important;
  height: 16px !important;
  fill: currentColor !important;
}

#aibot-mic:hover {
  background: #222 !important;
}

#aibot-mic.listening {
  background: #ef4444 !important;
}

/* Voice Button */


@keyframes aibot-recording {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Voice Playback Button */
.aibot-play-voice {
  margin-left: 8px;
  padding: 4px 8px;
  border: none;
  background: rgba(109, 94, 252, 0.1);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.aibot-play-voice:hover {
  background: rgba(109, 94, 252, 0.2);
}


/* Lead Capture Form */
#aibot-lead {
  display: none;
  flex-direction: column;
  gap: 10px;
}

#aibot-lead.show {
  display: flex;
}

#aibot-lead input,
#aibot-lead textarea {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#aibot-lead input:focus,
#aibot-lead textarea:focus {
  border-color: var(--aibot-primary);
}

#aibot-lead textarea {
  resize: none;
  min-height: 80px;
}

#aibot-lead button.primary {
  padding: 12px 20px;
  background: var(--aibot-primary-grad);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

#aibot-lead button.primary:hover {
  transform: translateY(-1px);
}

/* Powered By Branding - ONLY SHOWN FOR STARTER PLAN */
#aibot-powered {
  padding: 10px 16px;
  background: #f8f9fa;
  border-top: 1px solid #eee;
  text-align: center;
}

.aibot-powered-link {
  display: inline-flex;
  align-items: center;
  color: #888;
  text-decoration: none;
  font-size: 11px;
  transition: color 0.2s;
}

.aibot-powered-link:hover {
  color: #666;
}

.aibot-powered-link img {
  height: 16px;
  margin-right: 6px;
}

/* Plan-specific: Hide powered by for pro/enterprise via JS (not needed in CSS anymore) */

/* Mobile Responsive */
@media (max-width: 480px) {
  #aibot-root {
    bottom: 10px;
    right: 10px;
  }
  
  #aibot-panel {
    bottom: 80px;
    right: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    max-height: none;
    border-radius: 12px;
  }
  
  #aibot-btn {
    padding: 10px 16px;
  }
  
  #aibot-btn[data-shape="circle"] {
    width: 50px;
    height: 50px;
  }
  
  .aibot-bubble {
    max-width: 85%;
  }
}
#aibot-root.aibot-plan-starter #aibot-mic{
  display:none !important;
}

/* Scrollbar Styling */
#aibot-body::-webkit-scrollbar {
  width: 6px;
}

#aibot-body::-webkit-scrollbar-track {
  background: transparent;
}

#aibot-body::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

#aibot-body::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles if needed */
}

/* Print - Hide widget */
@media print {
  #aibot-root {
    display: none !important;
  }
}
/* ===== FORCE MIC TO SHOW (NO EXCUSES) ===== */
#aibot-mic {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  background: #000 !important;
  color: #fff !important;
  border-radius: 50% !important;
  border: none !important;
  position: relative !important;
  z-index: 999999 !important;
}

#aibot-mic svg {
  fill: #fff !important;
  width: 14px !important;
  height: 14px !important;
}

#aibot-mic svg {
  display: block !important;
  width: 14px !important;
  height: 14px !important;
  fill: #fff !important;
}
/* Force mic to show on all devices */
#aibot-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

#aibot-mic {
  display: flex !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  background: #000 !important;
  border: none !important;
  border-radius: 50% !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}
/* WhatsApp button */
#aibot-wa-footer{
  width:36px;
  height:36px;
  min-width:36px;
  padding:0;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;

  /* design only (no fixed color theme) */
  background: var(--aibot-primary);   /* uses your dashboard primary color */
  border: none;
  color: #fff;                        /* keeps icon visible */
}

#aibot-wa-footer svg{
  width:18px;
  height:18px;
  display:block;
}
/* WhatsApp — soft green */
#aibot-wa-footer{
  background: #25D366 !important;   /* soft WhatsApp green */
  border: none !important;
  color: #fff !important;
}

#aibot-wa-footer:hover{
  filter: brightness(0.95);
}

#aibot-wa-footer svg{
  width: 18px;
  height: 18px;
  display: block;
}
/* ===== Play Voice button (soft black) ===== */
.aibot-play-btn,
.aibot-play-voice {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  width: auto !important;
  max-width: 220px;
  padding: 8px 12px;

  border-radius: 9999px !important;
  border: 1px solid rgba(0,0,0,.10) !important;

  background: rgba(0,0,0,.08) !important;   /* soft black */
  color: rgba(0,0,0,.78) !important;        /* soft black text */

  font-size: 13px;
  font-weight: 600;
  line-height: 1;

  box-shadow: none !important;
  cursor: pointer;
}

.aibot-play-btn::before,
.aibot-play-voice::before{
  content: "🔊";
  margin-right: 8px;
  font-size: 14px;
  line-height: 1;
  opacity: .85;
}

.aibot-play-btn:hover,
.aibot-play-voice:hover{
  background: rgba(0,0,0,.12) !important;
  border-color: rgba(0,0,0,.14) !important;
}

.aibot-play-btn:active,
.aibot-play-voice:active{
  background: rgba(0,0,0,.16) !important;
}
#aibot-input {
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
  white-space: pre-wrap;
}