/* ==========================================================================
   NEXBOT — OFFICIAL AI VIRTUAL ASSISTANT & CHATBOT WIDGET
   NexBrivo Solutions Private Limited
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ADJUST FLOATING BUTTON STACKING
   Coordinate existing WhatsApp and Back-To-Top buttons so they stack gracefully
   above the NexBot launcher at bottom-right.
   -------------------------------------------------------------------------- */
.floating-whatsapp-btn {
  bottom: 96px !important;
  right: 24px !important;
  z-index: 9998 !important;
}

.back-to-top-btn,
#backToTopBtn {
  bottom: 160px !important;
  right: 26px !important;
  z-index: 9997 !important;
}

@media (max-width: 768px) {
  .floating-whatsapp-btn {
    bottom: 136px !important;
    right: 16px !important;
    width: 46px !important;
    height: 46px !important;
  }
  .back-to-top-btn,
  #backToTopBtn {
    bottom: 190px !important;
    right: 18px !important;
    width: 38px !important;
    height: 38px !important;
  }
}

/* --------------------------------------------------------------------------
   2. NEXBOT LAUNCHER (FLOATING BUTTON & TEASER)
   -------------------------------------------------------------------------- */
#nexbotWidget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  font-family: var(--font-sans, 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif);
  color: var(--main-text, #172B3A);
}

@media (max-width: 768px) {
  #nexbotWidget {
    bottom: 74px;
    right: 16px;
  }
}

/* Launcher Trigger Button */
.nexbot-launcher-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0878E8 0%, #031B2E 100%);
  color: #FFFFFF;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 30px rgba(8, 120, 232, 0.45), 0 0 0 1px rgba(20, 149, 255, 0.3);
  cursor: pointer;
  outline: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, background 0.3s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .nexbot-launcher-btn {
    width: 52px;
    height: 52px;
  }
}

.nexbot-launcher-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 36px rgba(8, 120, 232, 0.6), 0 0 20px rgba(20, 149, 255, 0.5);
}

.nexbot-launcher-btn:active {
  transform: scale(0.95);
}

/* Pulsing Outer Glow Ring */
.nexbot-pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #1495FF;
  opacity: 0.6;
  animation: nexbotPulse 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
  pointer-events: none;
}

@keyframes nexbotPulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.22);
    opacity: 0;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}

/* Launcher Icons */
.nexbot-launcher-icon,
.nexbot-close-icon {
  width: 28px;
  height: 28px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 768px) {
  .nexbot-launcher-icon,
  .nexbot-close-icon {
    width: 24px;
    height: 24px;
  }
}

.nexbot-launcher-icon svg,
.nexbot-close-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.nexbot-close-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.6);
  pointer-events: none;
}

#nexbotWidget.open .nexbot-launcher-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.6);
  pointer-events: none;
}

#nexbotWidget.open .nexbot-close-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  pointer-events: auto;
}

/* Online Status Pill Badge on Launcher */
.nexbot-online-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #10B981;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.nexbot-online-dot {
  width: 6px;
  height: 6px;
  background: #FFFFFF;
  border-radius: 50%;
  animation: nexbotDotBlink 2s infinite ease-in-out;
}

@keyframes nexbotDotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Notification Unread Bubble */
.nexbot-unread-pill {
  position: absolute;
  top: -6px;
  left: -6px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 12px;
  border: 2px solid #FFFFFF;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
  line-height: 1;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nexbot-unread-pill.hidden {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

/* Teaser / Greeting Popup Bubble */
.nexbot-teaser-bubble {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 280px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border, #DCE7F0);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(6, 43, 73, 0.18), 0 0 0 1px rgba(8, 120, 232, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transform-origin: bottom right;
  animation: nexbotTeaserPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 9999;
}

@keyframes nexbotTeaserPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nexbot-teaser-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(6, 43, 73, 0.24);
}

.nexbot-teaser-bubble.hidden {
  display: none !important;
}

.nexbot-teaser-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0878E8, #031B2E);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
}

.nexbot-teaser-avatar svg {
  width: 20px;
  height: 20px;
}

.nexbot-teaser-content {
  flex: 1;
}

.nexbot-teaser-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-navy, #062B49);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.nexbot-teaser-text {
  font-size: 0.78rem;
  color: var(--secondary-text, #64748B);
  line-height: 1.35;
  margin: 0;
}

.nexbot-teaser-close {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s ease;
}

.nexbot-teaser-close:hover {
  color: #062B49;
}

/* --------------------------------------------------------------------------
   3. NEXBOT MAIN CHAT WINDOW
   -------------------------------------------------------------------------- */
.nexbot-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 390px;
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border-radius: 20px;
  border: 1px solid var(--border, #DCE7F0);
  box-shadow: 0 20px 50px rgba(3, 27, 46, 0.22), 0 0 0 1px rgba(8, 120, 232, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.92) translateY(20px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
  z-index: 10002;
}

#nexbotWidget.open .nexbot-window {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

@media (max-width: 480px) {
  .nexbot-window {
    position: fixed;
    bottom: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    height: calc(100vh - 84px);
    max-height: 640px;
    border-radius: 16px;
  }
}

/* --------------------------------------------------------------------------
   4. CHAT HEADER
   -------------------------------------------------------------------------- */
.nexbot-header {
  background: linear-gradient(135deg, #031B2E 0%, #062B49 55%, #0878E8 100%);
  color: #FFFFFF;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  flex-shrink: 0;
}

.nexbot-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #1495FF, #10B981, #0878E8);
}

.nexbot-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nexbot-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.nexbot-avatar-wrap svg {
  width: 22px;
  height: 22px;
}

.nexbot-avatar-wrap .online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: #10B981;
  border: 2px solid #062B49;
  border-radius: 50%;
}

.nexbot-meta {
  display: flex;
  flex-direction: column;
}

.nexbot-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nexbot-name {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.2;
}

.nexbot-badge {
  background: rgba(20, 149, 255, 0.25);
  border: 1px solid rgba(20, 149, 255, 0.5);
  color: #60A5FA;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}

.nexbot-status {
  font-size: 0.75rem;
  color: #93C5FD;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.nexbot-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  display: inline-block;
  box-shadow: 0 0 6px #10B981;
}

/* Header Action Controls */
.nexbot-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nexbot-icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #E2E8F0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nexbot-icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.nexbot-icon-btn svg {
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------------------
   5. CHAT MESSAGES BODY
   -------------------------------------------------------------------------- */
.nexbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.nexbot-body::-webkit-scrollbar {
  width: 6px;
}

.nexbot-body::-webkit-scrollbar-track {
  background: transparent;
}

.nexbot-body::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 6px;
}

.nexbot-body::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Welcome Card inside Chat */
.nexbot-welcome-card {
  background: #FFFFFF;
  border: 1px solid var(--border, #DCE7F0);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(6, 43, 73, 0.06));
  text-align: center;
  animation: nexbotFadeIn 0.35s ease;
}

@keyframes nexbotFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.nwc-icon-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(8, 120, 232, 0.12), rgba(20, 149, 255, 0.22));
  color: var(--primary-blue, #0878E8);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.nwc-icon-ring svg {
  width: 26px;
  height: 26px;
}

.nwc-title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-navy, #062B49);
  margin-bottom: 4px;
}

.nwc-desc {
  font-size: 0.82rem;
  color: var(--secondary-text, #64748B);
  line-height: 1.45;
  margin-bottom: 12px;
}

.nwc-chips-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94A3B8;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* Suggestion Quick Chips in Welcome & Footer */
.nexbot-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.nexbot-chip-btn {
  background: #F1F7FC;
  border: 1px solid #DCE7F0;
  color: var(--primary-navy, #062B49);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.nexbot-chip-btn:hover {
  background: var(--primary-blue, #0878E8);
  color: #FFFFFF;
  border-color: var(--primary-blue, #0878E8);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(8, 120, 232, 0.25);
}

/* Message Rows */
.nexbot-msg-row {
  display: flex;
  gap: 9px;
  animation: nexbotFadeIn 0.25s ease;
}

.nexbot-msg-row.bot {
  align-items: flex-start;
}

.nexbot-msg-row.user {
  justify-content: flex-end;
}

.nexbot-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0878E8, #031B2E);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.nexbot-msg-avatar svg {
  width: 17px;
  height: 17px;
}

.nexbot-msg-bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}

.nexbot-msg-row.bot .nexbot-msg-bubble {
  background: #FFFFFF;
  color: #1E293B;
  border: 1px solid #E2E8F0;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(6, 43, 73, 0.05);
}

.nexbot-msg-row.user .nexbot-msg-bubble {
  background: linear-gradient(135deg, #0878E8 0%, #0264C7 100%);
  color: #FFFFFF;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(8, 120, 232, 0.25);
}

.nexbot-msg-time {
  font-size: 0.65rem;
  color: #94A3B8;
  margin-top: 4px;
  display: block;
}

.nexbot-msg-row.user .nexbot-msg-time {
  color: rgba(255, 255, 255, 0.75);
  text-align: right;
}

/* Rich Formatted Elements inside Bot Bubble */
.nexbot-msg-bubble strong {
  color: #062B49;
  font-weight: 700;
}

.nexbot-msg-bubble ul {
  margin: 6px 0 6px 16px;
  padding: 0;
}

.nexbot-msg-bubble li {
  margin-bottom: 4px;
  font-size: 0.83rem;
}

.nexbot-msg-bubble a {
  color: var(--primary-blue, #0878E8);
  text-decoration: underline;
  font-weight: 600;
}

/* Interactive Action Buttons inside Bot Message */
.nexbot-action-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #E2E8F0;
}

.nexbot-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #F1F7FC;
  color: #0878E8;
  border: 1px solid #DCE7F0;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.nexbot-action-btn:hover {
  background: #0878E8;
  color: #FFFFFF;
  border-color: #0878E8;
  transform: translateY(-1px);
}

.nexbot-action-btn.primary {
  background: #0878E8;
  color: #FFFFFF;
  border-color: #0878E8;
}

.nexbot-action-btn.primary:hover {
  background: #0264C7;
}

.nexbot-action-btn.whatsapp {
  background: rgba(37, 211, 102, 0.12);
  color: #128C7E;
  border-color: rgba(37, 211, 102, 0.3);
}

.nexbot-action-btn.whatsapp:hover {
  background: #25D366;
  color: #FFFFFF;
  border-color: #25D366;
}

/* Typing Indicator */
.nexbot-typing-row {
  display: flex;
  gap: 9px;
  align-items: center;
  animation: nexbotFadeIn 0.2s ease;
}

.nexbot-typing-bubble {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(6, 43, 73, 0.05);
}

.nexbot-typing-bubble .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0878E8;
  display: inline-block;
  animation: nexbotBounce 1.2s infinite ease-in-out;
}

.nexbot-typing-bubble .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.nexbot-typing-bubble .dot:nth-child(3) {
  animation-delay: 0.4s;
}

.nexbot-typing-text {
  font-size: 0.72rem;
  color: #94A3B8;
  margin-left: 6px;
  font-style: italic;
}

@keyframes nexbotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   6. QUICK SUGGESTIONS SCROLL STRIP (Above input)
   -------------------------------------------------------------------------- */
.nexbot-suggestions-strip {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  overflow-x: auto;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-behavior: smooth;
}

.nexbot-suggestions-strip::-webkit-scrollbar {
  height: 4px;
}

.nexbot-suggestions-strip::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.nexbot-mini-chip {
  background: #FFFFFF;
  border: 1px solid #DCE7F0;
  color: #062B49;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.nexbot-mini-chip:hover {
  background: #0878E8;
  color: #FFFFFF;
  border-color: #0878E8;
}

/* --------------------------------------------------------------------------
   7. INPUT BAR & FOOTER
   -------------------------------------------------------------------------- */
.nexbot-footer {
  padding: 10px 14px 12px;
  background: #FFFFFF;
  border-top: 1px solid var(--border, #DCE7F0);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.nexbot-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.nexbot-input-field {
  flex: 1;
  height: 44px;
  background: #F8FAFC;
  border: 1.5px solid #DCE7F0;
  border-radius: 22px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--main-text, #172B3A);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.nexbot-input-field:focus {
  background: #FFFFFF;
  border-color: var(--primary-blue, #0878E8);
  box-shadow: 0 0 0 3px rgba(8, 120, 232, 0.15);
}

.nexbot-input-field::placeholder {
  color: #94A3B8;
  font-size: 0.82rem;
}

.nexbot-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0878E8, #0264C7);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.nexbot-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(8, 120, 232, 0.4);
}

.nexbot-send-btn:active {
  transform: scale(0.94);
}

.nexbot-send-btn svg {
  width: 18px;
  height: 18px;
  transform: translateX(1px);
}

.nexbot-caption {
  font-size: 0.68rem;
  color: #94A3B8;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nexbot-caption span {
  color: var(--primary-blue, #0878E8);
  font-weight: 600;
}
